1 | /////////////////////////////////////////////////////////////////////////////////// |
---|
2 | // File : sys_handler.h |
---|
3 | // Date : 01/04/2012 |
---|
4 | // Author : alain greiner and joel porquet |
---|
5 | // Copyright (c) UPMC-LIP6 |
---|
6 | /////////////////////////////////////////////////////////////////////////////////// |
---|
7 | // The sys_handler.c and sys_handler.h files are part of the GIET-VM nano-kernel. |
---|
8 | // It define the syscall_vector[] (at the end of this file), as well as the |
---|
9 | // associated syscall handlers. |
---|
10 | /////////////////////////////////////////////////////////////////////////////////// |
---|
11 | |
---|
12 | #ifndef _SYS_HANDLER_H |
---|
13 | #define _SYS_HANDLER_H |
---|
14 | |
---|
15 | #include "giet_config.h" |
---|
16 | #include "locks.h" |
---|
17 | |
---|
18 | /////////////////////////////////////////////////////////////////////////////////// |
---|
19 | // Syscall Vector Table (indexed by syscall index) |
---|
20 | /////////////////////////////////////////////////////////////////////////////////// |
---|
21 | |
---|
22 | extern const void * _syscall_vector[64]; |
---|
23 | |
---|
24 | /////////////////////////////////////////////////////////////////////////////////// |
---|
25 | // This structure is used by the nic_chbuf_t and fbf_chbuf_t structures. |
---|
26 | // It describes a single buffer descriptor. The useful information is contained |
---|
27 | // in one single 64 bits word (desc field): |
---|
28 | // - the 48 LSB bits contain the buffer physical address |
---|
29 | // - the MSB bit 63 indicates the buffer state (empty if 0) |
---|
30 | // This descriptor must be aligned on a cache line (64 bytes) to simplify |
---|
31 | // the software L2/L3 cache coherence when the IO bridge is used. |
---|
32 | /////////////////////////////////////////////////////////////////////////////////// |
---|
33 | |
---|
34 | typedef struct buffer_descriptor_s |
---|
35 | { |
---|
36 | unsigned long long desc; |
---|
37 | unsigned int padding[14]; |
---|
38 | } buffer_descriptor_t; |
---|
39 | |
---|
40 | /////////////////////////////////////////////////////////////////////////////////// |
---|
41 | // This structure is used by the CMA component to move a stream |
---|
42 | // of images from two user buffers to the frame buffer in kernel space. |
---|
43 | // it must be 64 bytes aligned. |
---|
44 | // It contains two chbuf arrays: |
---|
45 | // - The SRC chbuf contains two buffers (buf0 & buf1), in user space. |
---|
46 | // - The DST cbuf contains one single buffer (fbf), that is the frame buffer. |
---|
47 | // - The length field define the buffer size (bytes) |
---|
48 | /////////////////////////////////////////////////////////////////////////////////// |
---|
49 | |
---|
50 | typedef struct fbf_chbuf_s |
---|
51 | { |
---|
52 | buffer_descriptor_t buf0; // first user buffer descriptor |
---|
53 | buffer_descriptor_t buf1; // second user buffer descriptor |
---|
54 | buffer_descriptor_t fbf; // frame buffer descriptor |
---|
55 | unsigned int length; // buffer length (bytes) |
---|
56 | unsigned int padding[15]; // padding for 64 bytes alignment |
---|
57 | } fbf_chbuf_t; |
---|
58 | |
---|
59 | ////////////////////////////////////////////////////////////////////////////////// |
---|
60 | // This structure is used by the CMA component to move a stream of containers |
---|
61 | // between the NIC chbuf containing 2 buffers, and a kernel chbuf |
---|
62 | // containing (X_SIZE * Y_SIZE) buffers (one buffer per cluster). |
---|
63 | // The same structure is used for both TX or RX transfers. |
---|
64 | // It must be 64 bytes aligned. |
---|
65 | ////////////////////////////////////////////////////////////////////////////////// |
---|
66 | |
---|
67 | typedef struct nic_chbuf_s |
---|
68 | { |
---|
69 | buffer_descriptor_t buffer[X_SIZE*Y_SIZE]; // kernel chbuf |
---|
70 | } nic_chbuf_t; |
---|
71 | |
---|
72 | ////////////////////////////////////////////////////////////////////////////////// |
---|
73 | // TTY related syscall handlers |
---|
74 | ////////////////////////////////////////////////////////////////////////////////// |
---|
75 | |
---|
76 | int _sys_tty_alloc(); |
---|
77 | |
---|
78 | int _sys_tty_write( const char* buffer, |
---|
79 | unsigned int length, |
---|
80 | unsigned int channel ); |
---|
81 | |
---|
82 | int _sys_tty_read( char* buffer, |
---|
83 | unsigned int length, |
---|
84 | unsigned int channel ); |
---|
85 | |
---|
86 | int _sys_tty_get_lock( unsigned int channel, |
---|
87 | unsigned int * save_sr_ptr ); |
---|
88 | |
---|
89 | int _sys_tty_release_lock( unsigned int channel, |
---|
90 | unsigned int * save_sr_ptr ); |
---|
91 | |
---|
92 | ////////////////////////////////////////////////////////////////////////////// |
---|
93 | // TIM related syscall handlers |
---|
94 | ////////////////////////////////////////////////////////////////////////////// |
---|
95 | |
---|
96 | int _sys_tim_alloc(); |
---|
97 | |
---|
98 | int _sys_tim_start( unsigned int period ); |
---|
99 | |
---|
100 | int _sys_tim_stop(); |
---|
101 | |
---|
102 | ////////////////////////////////////////////////////////////////////////////// |
---|
103 | // NIC related syscall handlers |
---|
104 | ////////////////////////////////////////////////////////////////////////////// |
---|
105 | |
---|
106 | int _sys_nic_alloc( unsigned int is_rx ); |
---|
107 | |
---|
108 | int _sys_nic_start( unsigned int is_rx ); |
---|
109 | |
---|
110 | int _sys_nic_move( unsigned int is_rx, |
---|
111 | unsigned int nic_channel, |
---|
112 | void* buffer ); |
---|
113 | |
---|
114 | int _sys_nic_stop( unsigned int is_rx ); |
---|
115 | |
---|
116 | int _sys_nic_clear( unsigned int is_rx ); |
---|
117 | |
---|
118 | int _sys_nic_stats( unsigned int is_rx ); |
---|
119 | |
---|
120 | ////////////////////////////////////////////////////////////////////////////// |
---|
121 | // FBF related syscall handlers |
---|
122 | ////////////////////////////////////////////////////////////////////////////// |
---|
123 | |
---|
124 | int _sys_fbf_sync_write( unsigned int offset, |
---|
125 | void* buffer, |
---|
126 | unsigned int length ); |
---|
127 | |
---|
128 | int _sys_fbf_sync_read( unsigned int offset, |
---|
129 | void* buffer, |
---|
130 | unsigned int length ); |
---|
131 | |
---|
132 | int _sys_fbf_cma_alloc(); |
---|
133 | |
---|
134 | int _sys_fbf_cma_start( void* vbase0, |
---|
135 | void* vbase1, |
---|
136 | unsigned int length ); |
---|
137 | |
---|
138 | int _sys_fbf_cma_display( unsigned int buffer_index ); |
---|
139 | |
---|
140 | int _sys_fbf_cma_stop(); |
---|
141 | |
---|
142 | ////////////////////////////////////////////////////////////////////////////// |
---|
143 | // Miscelaneous syscall handlers |
---|
144 | ////////////////////////////////////////////////////////////////////////////// |
---|
145 | |
---|
146 | int _sys_ukn(); |
---|
147 | |
---|
148 | int _sys_proc_xyp( unsigned int* x, |
---|
149 | unsigned int* y, |
---|
150 | unsigned int* p ); |
---|
151 | |
---|
152 | int _sys_task_exit( char* string ); |
---|
153 | |
---|
154 | int _context_switch(); |
---|
155 | |
---|
156 | int _sys_local_task_id(); |
---|
157 | |
---|
158 | int _sys_global_task_id(); |
---|
159 | |
---|
160 | int _sys_thread_id(); |
---|
161 | |
---|
162 | int _sys_procs_number( unsigned int x, |
---|
163 | unsigned int y, |
---|
164 | unsigned int* number ); |
---|
165 | |
---|
166 | int _sys_vobj_get_vbase( char* vspace_name, |
---|
167 | char* vobj_name, |
---|
168 | unsigned int* vbase ); |
---|
169 | |
---|
170 | int _sys_vobj_get_length( char* vspace_name, |
---|
171 | char* vobj_name, |
---|
172 | unsigned int* length ); |
---|
173 | |
---|
174 | int _sys_xy_from_ptr( void* ptr, |
---|
175 | unsigned int* x, |
---|
176 | unsigned int* y ); |
---|
177 | |
---|
178 | int _sys_heap_info( unsigned int* vaddr, |
---|
179 | unsigned int* length, |
---|
180 | unsigned int x, |
---|
181 | unsigned int y ); |
---|
182 | |
---|
183 | #endif |
---|
184 | |
---|
185 | // Local Variables: |
---|
186 | // tab-width: 4 |
---|
187 | // c-basic-offset: 4 |
---|
188 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
189 | // indent-tabs-mode: nil |
---|
190 | // End: |
---|
191 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
192 | |
---|