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 <mapping_info.h> |
---|
16 | #include <giet_config.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 vci_chbuf_dma component to transfer a stream |
---|
26 | // of images from two buffers in user space to the frame buffer in kernel space. |
---|
27 | // It contains two chbuf descriptors |
---|
28 | // - The SRC chbuf contains two buffers (buf0 & buf1), that can be in user space. |
---|
29 | // - The DST cbuf contains one single buffer (fbf), that is the frame buffer. |
---|
30 | /////////////////////////////////////////////////////////////////////////////////// |
---|
31 | |
---|
32 | typedef struct fbf_chbuf_s |
---|
33 | { |
---|
34 | unsigned long long buf0; // physical address + status for user buffer 0 |
---|
35 | unsigned long long buf1; // physical address + status for user buffer 1 |
---|
36 | unsigned long long fbf; // physical address + status for user buffer 0 |
---|
37 | unsigned int length; // buffer length (bytes) |
---|
38 | unsigned int padding; // 8 bytes alignment |
---|
39 | } fbf_chbuf_t; |
---|
40 | |
---|
41 | ////////////////////////////////////////////////////////////////////////////////// |
---|
42 | // This structure define the generic chained buffer used by the vci_chbuf_dma |
---|
43 | // component to move a stream of containers to or from the vci_multi_nic component. |
---|
44 | // The same structure is used for both TX or RX transfers. |
---|
45 | // The single buffer size and the number of buffers must be defined by the |
---|
46 | // GIET_NIC_CHBUF_SIZE and GIET_NIC_CHBUF_NBUFS parameters in giet_config.h. |
---|
47 | // - The buffer array is the chbuf descriptor, shared by the vci_chbuf_dma, |
---|
48 | // and by the kernel. |
---|
49 | // - The index field is only used by the kernel. It define the currently pointed |
---|
50 | // buffer for read (RX transfer) or write (TX transfer). |
---|
51 | ////////////////////////////////////////////////////////////////////////////////// |
---|
52 | |
---|
53 | typedef struct nic_chbuf_s |
---|
54 | { |
---|
55 | unsigned long long buffer[GIET_NIC_CHBUF_NBUFS]; // chbuf descriptor |
---|
56 | unsigned int index; // current buffer index |
---|
57 | unsigned int padding; // 8 bytes alignment |
---|
58 | } nic_chbuf_t; |
---|
59 | |
---|
60 | |
---|
61 | ////////////////////////////////////////////////////////////////////////////////// |
---|
62 | // TTY related syscall handlers |
---|
63 | ////////////////////////////////////////////////////////////////////////////////// |
---|
64 | |
---|
65 | int _sys_tty_alloc(); |
---|
66 | |
---|
67 | int _sys_tty_write( const char* buffer, |
---|
68 | unsigned int length, |
---|
69 | unsigned int channel ); |
---|
70 | |
---|
71 | int _sys_tty_read( char* buffer, |
---|
72 | unsigned int length, |
---|
73 | unsigned int channel ); |
---|
74 | |
---|
75 | int _sys_tty_get_lock( unsigned int channel, |
---|
76 | unsigned int * save_sr_ptr ); |
---|
77 | |
---|
78 | int _sys_tty_release_lock( unsigned int channel, |
---|
79 | unsigned int * save_sr_ptr ); |
---|
80 | |
---|
81 | ////////////////////////////////////////////////////////////////////////////// |
---|
82 | // TIM related syscall handlers |
---|
83 | ////////////////////////////////////////////////////////////////////////////// |
---|
84 | |
---|
85 | int _sys_tim_alloc(); |
---|
86 | |
---|
87 | int _sys_tim_start( unsigned int period ); |
---|
88 | |
---|
89 | int _sys_tim_stop(); |
---|
90 | |
---|
91 | ////////////////////////////////////////////////////////////////////////////// |
---|
92 | // NIC related syscall handlers |
---|
93 | ////////////////////////////////////////////////////////////////////////////// |
---|
94 | |
---|
95 | int _sys_nic_alloc( unsigned int is_rx ); |
---|
96 | |
---|
97 | int _sys_nic_start( unsigned int is_rx, |
---|
98 | unsigned int mac4, |
---|
99 | unsigned int mac2 ); |
---|
100 | |
---|
101 | int _sys_nic_move( unsigned int is_rx, |
---|
102 | void* buffer ); |
---|
103 | |
---|
104 | int _sys_nic_stop( unsigned int is_rx ); |
---|
105 | |
---|
106 | ////////////////////////////////////////////////////////////////////////////// |
---|
107 | // FBF related syscall handlers |
---|
108 | ////////////////////////////////////////////////////////////////////////////// |
---|
109 | |
---|
110 | int _sys_fbf_sync_write( unsigned int offset, |
---|
111 | void* buffer, |
---|
112 | unsigned int length ); |
---|
113 | |
---|
114 | int _sys_fbf_sync_read( unsigned int offset, |
---|
115 | void* buffer, |
---|
116 | unsigned int length ); |
---|
117 | |
---|
118 | int _sys_fbf_cma_alloc(); |
---|
119 | |
---|
120 | int _sys_fbf_cma_start( void* vbase0, |
---|
121 | void* vbase1, |
---|
122 | unsigned int length ); |
---|
123 | |
---|
124 | int _sys_fbf_cma_display( unsigned int buffer_index ); |
---|
125 | |
---|
126 | int _sys_fbf_cma_stop(); |
---|
127 | |
---|
128 | ////////////////////////////////////////////////////////////////////////////// |
---|
129 | // Miscelaneous syscall handlers |
---|
130 | ////////////////////////////////////////////////////////////////////////////// |
---|
131 | |
---|
132 | int _sys_ukn(); |
---|
133 | |
---|
134 | int _sys_proc_xyp( unsigned int* x, |
---|
135 | unsigned int* y, |
---|
136 | unsigned int* p ); |
---|
137 | |
---|
138 | int _sys_task_exit( char* string ); |
---|
139 | |
---|
140 | int _context_switch(); |
---|
141 | |
---|
142 | int _sys_local_task_id(); |
---|
143 | |
---|
144 | int _sys_global_task_id(); |
---|
145 | |
---|
146 | int _sys_thread_id(); |
---|
147 | |
---|
148 | int _sys_procs_number( unsigned int x, |
---|
149 | unsigned int y, |
---|
150 | unsigned int* number ); |
---|
151 | |
---|
152 | int _sys_vobj_get_vbase( char* vspace_name, |
---|
153 | char* vobj_name, |
---|
154 | unsigned int* vbase ); |
---|
155 | |
---|
156 | int _sys_vobj_get_length( char* vspace_name, |
---|
157 | char* vobj_name, |
---|
158 | unsigned int* length ); |
---|
159 | |
---|
160 | int _sys_xy_from_ptr( void* ptr, |
---|
161 | unsigned int* x, |
---|
162 | unsigned int* y ); |
---|
163 | |
---|
164 | int _sys_heap_info( unsigned int* vaddr, |
---|
165 | unsigned int* length, |
---|
166 | unsigned int x, |
---|
167 | unsigned int y ); |
---|
168 | |
---|
169 | #endif |
---|
170 | |
---|
171 | // Local Variables: |
---|
172 | // tab-width: 4 |
---|
173 | // c-basic-offset: 4 |
---|
174 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
175 | // indent-tabs-mode: nil |
---|
176 | // End: |
---|
177 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
178 | |
---|