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
RevLine 
[519]1///////////////////////////////////////////////////////////////////////////////
[258]2// File     : sys_handler.h
3// Date     : 01/04/2012
[519]4// Author   : alain greiner
[258]5// Copyright (c) UPMC-LIP6
[519]6///////////////////////////////////////////////////////////////////////////////
7// The sys_handler.c and sys_handler.h files are part of the GIET-VM kernel.
[440]8// It define the syscall_vector[] (at the end of this file), as well as the
9// associated syscall handlers.
[519]10///////////////////////////////////////////////////////////////////////////////
[258]11
12#ifndef _SYS_HANDLER_H
13#define _SYS_HANDLER_H
14
[459]15#include "giet_config.h"
[494]16#include "kernel_locks.h"
[519]17#include "stdio.h"
[440]18
[505]19///////////////////////////////////////////////////////////////////////////////
[258]20//     Syscall Vector Table (indexed by syscall index)
[505]21///////////////////////////////////////////////////////////////////////////////
[258]22
23extern const void * _syscall_vector[64];
24
[505]25///////////////////////////////////////////////////////////////////////////////
[478]26// This structure is used by the nic_chbuf_t and fbf_chbuf_t structures.
[505]27// It describes a single buffer descriptor. The useful information is
28// contained in one single 64 bits word (desc field):
[478]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.
[505]33///////////////////////////////////////////////////////////////////////////////
[478]34
35typedef struct buffer_descriptor_s
36{
37    unsigned long long  desc;
38    unsigned int        padding[14];
39} buffer_descriptor_t;
40 
[505]41///////////////////////////////////////////////////////////////////////////////
[459]42// This structure is used by the CMA component to move a stream
[478]43// of images from two user buffers to the frame buffer in kernel space.
[459]44// It contains two chbuf arrays:
[478]45// - The SRC chbuf contains two buffers (buf0 & buf1), in user space.
[440]46// - The DST cbuf contains one single buffer (fbf), that is the frame buffer.
[459]47// - The length field define the buffer size (bytes)
[494]48// This structure must be 64 bytes aligned.
[505]49///////////////////////////////////////////////////////////////////////////////
[440]50
51typedef struct fbf_chbuf_s
52{
[478]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
[440]58} fbf_chbuf_t;   
59
[505]60///////////////////////////////////////////////////////////////////////////////
[478]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
[494]63// containing up to (X_SIZE * Y_SIZE) buffers (one buffer per cluster).
[449]64// The same structure is used for both TX or RX transfers.
[494]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.
[505]68///////////////////////////////////////////////////////////////////////////////
[449]69
70typedef struct nic_chbuf_s
71{
[478]72    buffer_descriptor_t  buffer[X_SIZE*Y_SIZE];  // kernel chbuf
[494]73    unsigned int         xmax;                   // nb clusters in a row
74    unsigned int         ymax;                   // nb clusters in a column
[449]75} nic_chbuf_t;
76
[519]77
78
79
[505]80///////////////////////////////////////////////////////////////////////////////
[519]81//    Coprocessors related syscall handlers
82///////////////////////////////////////////////////////////////////////////////
83
84int _sys_coproc_alloc( unsigned int   coproc_type,
[556]85                       unsigned int*  coproc_info );
[519]86
[556]87int _sys_coproc_release( unsigned int coproc_reg_index );
[519]88
[556]89int _sys_coproc_channel_init( unsigned int            channel,
[519]90                              giet_coproc_channel_t*  desc );
91
[556]92int _sys_coproc_run( unsigned int coproc_reg_index );
[519]93
[556]94int _sys_coproc_completed();
[519]95
96///////////////////////////////////////////////////////////////////////////////
[440]97//    TTY related syscall handlers
[505]98///////////////////////////////////////////////////////////////////////////////
[258]99
[440]100int _sys_tty_alloc();
[294]101
[440]102int _sys_tty_write( const char*  buffer,
103                    unsigned int length,
104                    unsigned int channel );
[428]105
[440]106int _sys_tty_read(  char*        buffer,
107                    unsigned int length,
108                    unsigned int channel );
[294]109
[440]110int _sys_tty_get_lock( unsigned int   channel,
111                       unsigned int * save_sr_ptr );
[294]112
[440]113int _sys_tty_release_lock( unsigned int   channel,
114                           unsigned int * save_sr_ptr );
[294]115
[519]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
[440]124//////////////////////////////////////////////////////////////////////////////
125//    TIM related syscall handlers
126//////////////////////////////////////////////////////////////////////////////
[294]127
[440]128int _sys_tim_alloc();
[258]129
[440]130int _sys_tim_start( unsigned int period );
[258]131
[440]132int _sys_tim_stop();
[258]133
[440]134//////////////////////////////////////////////////////////////////////////////
135//    NIC related syscall handlers
136//////////////////////////////////////////////////////////////////////////////
[294]137
[494]138int _sys_nic_alloc( unsigned int is_rx,
139                    unsigned int xmax,
140                    unsigned int ymax );
[396]141
[494]142
[489]143int _sys_nic_start( unsigned int is_rx,
144                    unsigned int channel );
[396]145
[449]146int _sys_nic_move( unsigned int is_rx,
[489]147                   unsigned int channel,
[449]148                   void*        buffer );
[440]149
[489]150int _sys_nic_stop( unsigned int is_rx,
151                   unsigned int channel );
[449]152
[489]153int _sys_nic_clear( unsigned int is_rx,
154                    unsigned int channel );
[459]155
[489]156int _sys_nic_stats( unsigned int is_rx,
157                    unsigned int channel );
[459]158
[440]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
[528]193int _sys_context_switch();
[440]194
195int _sys_local_task_id();
196
197int _sys_global_task_id();
198
199int _sys_thread_id();
200
[494]201int _sys_procs_number( unsigned int* x_size,
202                       unsigned int* y_size, 
203                       unsigned int* nprocs );
[440]204
[516]205int _sys_vseg_get_vbase( char*         vspace_name,
206                         char*         vseg_name,
[440]207                         unsigned int* vbase );
208
[516]209int _sys_vseg_get_length( char*         vspace_name, 
210                          char*         vseg_name,
[440]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
[258]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.