libspe2
0.9a
Main Page
Data Structures
Files
File List
Globals
spebase
accessors.c
Go to the documentation of this file.
1
/*
2
* libspe2 - A wrapper library to adapt the JSRE SPU usage model to SPUFS
3
* Copyright (C) 2005 IBM Corp.
4
*
5
* This library is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU Lesser General Public License as published by
7
* the Free Software Foundation; either version 2.1 of the License,
8
* or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13
* License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this library; if not, write to the Free Software Foundation,
17
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*/
19
#include "
spebase.h
"
20
#include "
create.h
"
21
22
#include <fcntl.h>
23
#include <errno.h>
24
#include <sys/mman.h>
25
26
/*
27
* accessor functions for private members
28
*/
29
30
void
*
_base_spe_ps_area_get
(
spe_context_ptr_t
spe,
enum
ps_area
area)
31
{
32
void
*ptr;
33
34
switch
(area) {
35
case
SPE_MSSYNC_AREA
:
36
ptr = spe->
base_private
->
mssync_mmap_base
;
37
break
;
38
case
SPE_MFC_COMMAND_AREA
:
39
ptr = spe->
base_private
->
mfc_mmap_base
;
40
break
;
41
case
SPE_CONTROL_AREA
:
42
ptr = spe->
base_private
->
cntl_mmap_base
;
43
break
;
44
case
SPE_SIG_NOTIFY_1_AREA
:
45
ptr = spe->
base_private
->
signal1_mmap_base
;
46
break
;
47
case
SPE_SIG_NOTIFY_2_AREA
:
48
ptr = spe->
base_private
->
signal2_mmap_base
;
49
break
;
50
default
:
51
errno = EINVAL;
52
return
NULL;
53
break
;
54
}
55
56
if
(ptr == MAP_FAILED) {
57
errno = EACCES;
58
return
NULL;
59
}
60
61
return
ptr;
62
}
63
64
void
*
_base_spe_ls_area_get
(
spe_context_ptr_t
spe)
65
{
66
return
spe->
base_private
->
mem_mmap_base
;
67
}
68
69
__attribute__
((noinline)) void
__spe_context_update_event
(
void
)
70
{
71
return
;
72
}
73
74
int
__base_spe_event_source_acquire
(
spe_context_ptr_t
spe,
enum
fd_name
fdesc)
75
{
76
return
_base_spe_open_if_closed
(spe, fdesc, 0);
77
}
78
79
void
__base_spe_event_source_release
(
struct
spe_context
*spe,
enum
fd_name
fdesc)
80
{
81
_base_spe_close_if_open
(spe, fdesc);
82
}
83
84
int
__base_spe_spe_dir_get
(
spe_context_ptr_t
spe)
85
{
86
return
spe->
base_private
->
fd_spe_dir
;
87
}
88
92
int
__base_spe_stop_event_source_get
(
spe_context_ptr_t
spe)
93
{
94
return
spe->
base_private
->
ev_pipe
[1];
95
}
96
100
int
__base_spe_stop_event_target_get
(
spe_context_ptr_t
spe)
101
{
102
return
spe->
base_private
->
ev_pipe
[0];
103
}
104
105
int
_base_spe_ls_size_get
(
spe_context_ptr_t
spe)
106
{
107
return
LS_SIZE
;
108
}
Generated on Thu Oct 10 2013 02:03:40 for libspe2 by
1.8.4