source: soft/giet_vm/giet_kernel/sys_handler.h @ 556

Last change on this file since 556 was 556, checked in by alain, 9 years ago

Introducing support for the coprocessor related system calls.

  • Property svn:executable set to *
File size: 8.1 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2// File     : sys_handler.h
3// Date     : 01/04/2012
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////
7// The sys_handler.c and sys_handler.h files are part of the GIET-VM 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 "kernel_locks.h"
17#include "stdio.h"
18
19///////////////////////////////////////////////////////////////////////////////
20//     Syscall Vector Table (indexed by syscall index)
21///////////////////////////////////////////////////////////////////////////////
22
23extern const void * _syscall_vector[64];
24
25///////////////////////////////////////////////////////////////////////////////
26// This structure is used by the nic_chbuf_t and fbf_chbuf_t structures.
27// It describes a single buffer descriptor. The useful information is
28// contained in one single 64 bits word (desc field):
29// - the 48 LSB bits contain the buffer physical address
30// - the MSB bit 63 indicates the buffer state (empty if 0)
31// This descriptor must be aligned on a cache line (64 bytes) to simplify
32// the software L2/L3 cache coherence when the IO bridge is used.
33///////////////////////////////////////////////////////////////////////////////
34
35typedef struct buffer_descriptor_s
36{
37    unsigned long long  desc;
38    unsigned int        padding[14];
39} buffer_descriptor_t;
40 
41///////////////////////////////////////////////////////////////////////////////
42// This structure is used by the CMA component to move a stream
43// of images from two user buffers to the frame buffer in kernel space.
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// This structure must be 64 bytes aligned.
49///////////////////////////////////////////////////////////////////////////////
50
51typedef struct fbf_chbuf_s
52{
53    buffer_descriptor_t  buf0;         // first user buffer descriptor
54    buffer_descriptor_t  buf1;         // second user buffer descriptor
55    buffer_descriptor_t  fbf;          // frame buffer descriptor
56    unsigned int         length;       // buffer length (bytes)
57    unsigned int         padding[15];  // padding for 64 bytes alignment
58} fbf_chbuf_t;   
59
60///////////////////////////////////////////////////////////////////////////////
61// This structure is used by the CMA component to move a stream of containers
62// between the NIC chbuf containing 2 buffers, and a kernel chbuf
63// containing up to (X_SIZE * Y_SIZE) buffers (one buffer per cluster).
64// The same structure is used for both TX or RX transfers.
65// The number of distributed containers can be smaller than (X_SIZE * YSIZE).
66// The actual number of buffers used in the chbuf is defined by (xmax * ymax).
67// This structure must be 64 bytes aligned.
68///////////////////////////////////////////////////////////////////////////////
69
70typedef struct nic_chbuf_s
71{
72    buffer_descriptor_t  buffer[X_SIZE*Y_SIZE];  // kernel chbuf
73    unsigned int         xmax;                   // nb clusters in a row
74    unsigned int         ymax;                   // nb clusters in a column
75} nic_chbuf_t;
76
77
78
79
80///////////////////////////////////////////////////////////////////////////////
81//    Coprocessors related syscall handlers
82///////////////////////////////////////////////////////////////////////////////
83
84int _sys_coproc_alloc( unsigned int   coproc_type,
85                       unsigned int*  coproc_info );
86
87int _sys_coproc_release( unsigned int coproc_reg_index );
88
89int _sys_coproc_channel_init( unsigned int            channel,
90                              giet_coproc_channel_t*  desc );
91
92int _sys_coproc_run( unsigned int coproc_reg_index );
93
94int _sys_coproc_completed();
95
96///////////////////////////////////////////////////////////////////////////////
97//    TTY related syscall handlers
98///////////////////////////////////////////////////////////////////////////////
99
100int _sys_tty_alloc();
101
102int _sys_tty_write( const char*  buffer,
103                    unsigned int length,
104                    unsigned int channel );
105
106int _sys_tty_read(  char*        buffer,
107                    unsigned int length,
108                    unsigned int channel );
109
110int _sys_tty_get_lock( unsigned int   channel,
111                       unsigned int * save_sr_ptr );
112
113int _sys_tty_release_lock( unsigned int   channel,
114                           unsigned int * save_sr_ptr );
115
116int _sys_coproc_register_set( unsigned int cluster_xy,
117                              unsigned int reg_index,
118                              unsigned int value );
119
120int _sys_coproc_register_get( unsigned int  cluster_xy,
121                              unsigned int  reg_index,
122                              unsigned int* buffer );
123
124//////////////////////////////////////////////////////////////////////////////
125//    TIM related syscall handlers
126//////////////////////////////////////////////////////////////////////////////
127
128int _sys_tim_alloc();
129
130int _sys_tim_start( unsigned int period );
131
132int _sys_tim_stop();
133
134//////////////////////////////////////////////////////////////////////////////
135//    NIC related syscall handlers
136//////////////////////////////////////////////////////////////////////////////
137
138int _sys_nic_alloc( unsigned int is_rx,
139                    unsigned int xmax,
140                    unsigned int ymax );
141
142
143int _sys_nic_start( unsigned int is_rx,
144                    unsigned int channel );
145
146int _sys_nic_move( unsigned int is_rx,
147                   unsigned int channel,
148                   void*        buffer );
149
150int _sys_nic_stop( unsigned int is_rx,
151                   unsigned int channel );
152
153int _sys_nic_clear( unsigned int is_rx,
154                    unsigned int channel );
155
156int _sys_nic_stats( unsigned int is_rx,
157                    unsigned int channel );
158
159//////////////////////////////////////////////////////////////////////////////
160//    FBF related syscall handlers
161//////////////////////////////////////////////////////////////////////////////
162
163int _sys_fbf_sync_write( unsigned int offset,
164                         void*        buffer,
165                         unsigned int length );
166
167int _sys_fbf_sync_read(  unsigned int offset,
168                         void*        buffer,
169                         unsigned int length );
170
171int _sys_fbf_cma_alloc();
172
173int _sys_fbf_cma_start( void*        vbase0, 
174                        void*        vbase1, 
175                        unsigned int length );
176
177int _sys_fbf_cma_display( unsigned int buffer_index );
178
179int _sys_fbf_cma_stop();
180
181//////////////////////////////////////////////////////////////////////////////
182//    Miscelaneous syscall handlers
183//////////////////////////////////////////////////////////////////////////////
184
185int _sys_ukn();
186
187int _sys_proc_xyp( unsigned int* x,
188                   unsigned int* y,
189                   unsigned int* p );
190
191int _sys_task_exit( char* string );
192
193int _sys_context_switch();
194
195int _sys_local_task_id();
196
197int _sys_global_task_id();
198
199int _sys_thread_id();
200
201int _sys_procs_number( unsigned int* x_size,
202                       unsigned int* y_size, 
203                       unsigned int* nprocs );
204
205int _sys_vseg_get_vbase( char*         vspace_name,
206                         char*         vseg_name,
207                         unsigned int* vbase );
208
209int _sys_vseg_get_length( char*         vspace_name, 
210                          char*         vseg_name,
211                          unsigned int* length );
212
213int _sys_xy_from_ptr( void*          ptr,
214                      unsigned int*  x,
215                      unsigned int*  y );
216
217int _sys_heap_info( unsigned int* vaddr, 
218                    unsigned int* length,
219                    unsigned int  x,
220                    unsigned int  y ); 
221
222#endif
223
224// Local Variables:
225// tab-width: 4
226// c-basic-offset: 4
227// c-file-offsets:((innamespace . 0)(inline-open . 0))
228// indent-tabs-mode: nil
229// End:
230// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
231
Note: See TracBrowser for help on using the repository browser.