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

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

1) Introducing support for external IRQs dynamic routing.
2) Simplifying the _v2p_translate() function.
3) Removing the generic IOC driver (integrated in the FAT library).

  • Property svn:executable set to *
File size: 8.4 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,
85                       unsigned int*  coproc_info,
86                       unsigned int*  cluster_xy );
87
88int _sys_coproc_release( unsigned int cluster_xy );
89
90int _sys_coproc_channel_init( unsigned int            cluster_xy,
91                              unsigned int            channel,
92                              giet_coproc_channel_t*  desc );
93
94int _sys_coproc_channel_start( unsigned int  cluster_xy,
95                               unsigned int  channel );
96
97int _sys_coproc_channel_stop( unsigned int  cluster_xy,
98                              unsigned int  channel );
99
100int _sys_coproc_completed( unsigned int cluster_xy );
101
102///////////////////////////////////////////////////////////////////////////////
[440]103//    TTY related syscall handlers
[505]104///////////////////////////////////////////////////////////////////////////////
[258]105
[440]106int _sys_tty_alloc();
[294]107
[440]108int _sys_tty_write( const char*  buffer,
109                    unsigned int length,
110                    unsigned int channel );
[428]111
[440]112int _sys_tty_read(  char*        buffer,
113                    unsigned int length,
114                    unsigned int channel );
[294]115
[440]116int _sys_tty_get_lock( unsigned int   channel,
117                       unsigned int * save_sr_ptr );
[294]118
[440]119int _sys_tty_release_lock( unsigned int   channel,
120                           unsigned int * save_sr_ptr );
[294]121
[519]122int _sys_coproc_register_set( unsigned int cluster_xy,
123                              unsigned int reg_index,
124                              unsigned int value );
125
126int _sys_coproc_register_get( unsigned int  cluster_xy,
127                              unsigned int  reg_index,
128                              unsigned int* buffer );
129
[440]130//////////////////////////////////////////////////////////////////////////////
131//    TIM related syscall handlers
132//////////////////////////////////////////////////////////////////////////////
[294]133
[440]134int _sys_tim_alloc();
[258]135
[440]136int _sys_tim_start( unsigned int period );
[258]137
[440]138int _sys_tim_stop();
[258]139
[440]140//////////////////////////////////////////////////////////////////////////////
141//    NIC related syscall handlers
142//////////////////////////////////////////////////////////////////////////////
[294]143
[494]144int _sys_nic_alloc( unsigned int is_rx,
145                    unsigned int xmax,
146                    unsigned int ymax );
[396]147
[494]148
[489]149int _sys_nic_start( unsigned int is_rx,
150                    unsigned int channel );
[396]151
[449]152int _sys_nic_move( unsigned int is_rx,
[489]153                   unsigned int channel,
[449]154                   void*        buffer );
[440]155
[489]156int _sys_nic_stop( unsigned int is_rx,
157                   unsigned int channel );
[449]158
[489]159int _sys_nic_clear( unsigned int is_rx,
160                    unsigned int channel );
[459]161
[489]162int _sys_nic_stats( unsigned int is_rx,
163                    unsigned int channel );
[459]164
[440]165//////////////////////////////////////////////////////////////////////////////
166//    FBF related syscall handlers
167//////////////////////////////////////////////////////////////////////////////
168
169int _sys_fbf_sync_write( unsigned int offset,
170                         void*        buffer,
171                         unsigned int length );
172
173int _sys_fbf_sync_read(  unsigned int offset,
174                         void*        buffer,
175                         unsigned int length );
176
177int _sys_fbf_cma_alloc();
178
179int _sys_fbf_cma_start( void*        vbase0, 
180                        void*        vbase1, 
181                        unsigned int length );
182
183int _sys_fbf_cma_display( unsigned int buffer_index );
184
185int _sys_fbf_cma_stop();
186
187//////////////////////////////////////////////////////////////////////////////
188//    Miscelaneous syscall handlers
189//////////////////////////////////////////////////////////////////////////////
190
191int _sys_ukn();
192
193int _sys_proc_xyp( unsigned int* x,
194                   unsigned int* y,
195                   unsigned int* p );
196
197int _sys_task_exit( char* string );
198
[528]199int _sys_context_switch();
[440]200
201int _sys_local_task_id();
202
203int _sys_global_task_id();
204
205int _sys_thread_id();
206
[494]207int _sys_procs_number( unsigned int* x_size,
208                       unsigned int* y_size, 
209                       unsigned int* nprocs );
[440]210
[516]211int _sys_vseg_get_vbase( char*         vspace_name,
212                         char*         vseg_name,
[440]213                         unsigned int* vbase );
214
[516]215int _sys_vseg_get_length( char*         vspace_name, 
216                          char*         vseg_name,
[440]217                          unsigned int* length );
218
219int _sys_xy_from_ptr( void*          ptr,
220                      unsigned int*  x,
221                      unsigned int*  y );
222
223int _sys_heap_info( unsigned int* vaddr, 
224                    unsigned int* length,
225                    unsigned int  x,
226                    unsigned int  y ); 
227
[258]228#endif
229
230// Local Variables:
231// tab-width: 4
232// c-basic-offset: 4
233// c-file-offsets:((innamespace . 0)(inline-open . 0))
234// indent-tabs-mode: nil
235// End:
236// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
237
Note: See TracBrowser for help on using the repository browser.