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

Last change on this file since 508 was 505, checked in by alain, 10 years ago

Fixing a bug in _sys_fbf_cma_start() function.

  • Property svn:executable set to *
File size: 7.3 KB
RevLine 
[258]1///////////////////////////////////////////////////////////////////////////////////
2// File     : sys_handler.h
3// Date     : 01/04/2012
4// Author   : alain greiner and joel porquet
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
[440]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///////////////////////////////////////////////////////////////////////////////////
[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"
[440]17
[505]18///////////////////////////////////////////////////////////////////////////////
[258]19//     Syscall Vector Table (indexed by syscall index)
[505]20///////////////////////////////////////////////////////////////////////////////
[258]21
22extern const void * _syscall_vector[64];
23
[505]24///////////////////////////////////////////////////////////////////////////////
[478]25// This structure is used by the nic_chbuf_t and fbf_chbuf_t structures.
[505]26// It describes a single buffer descriptor. The useful information is
27// contained in one single 64 bits word (desc field):
[478]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.
[505]32///////////////////////////////////////////////////////////////////////////////
[478]33
34typedef struct buffer_descriptor_s
35{
36    unsigned long long  desc;
37    unsigned int        padding[14];
38} buffer_descriptor_t;
39 
[505]40///////////////////////////////////////////////////////////////////////////////
[459]41// This structure is used by the CMA component to move a stream
[478]42// of images from two user buffers to the frame buffer in kernel space.
[459]43// It contains two chbuf arrays:
[478]44// - The SRC chbuf contains two buffers (buf0 & buf1), in user space.
[440]45// - The DST cbuf contains one single buffer (fbf), that is the frame buffer.
[459]46// - The length field define the buffer size (bytes)
[494]47// This structure must be 64 bytes aligned.
[505]48///////////////////////////////////////////////////////////////////////////////
[440]49
50typedef struct fbf_chbuf_s
51{
[478]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
[440]57} fbf_chbuf_t;   
58
[505]59///////////////////////////////////////////////////////////////////////////////
[478]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
[494]62// containing up to (X_SIZE * Y_SIZE) buffers (one buffer per cluster).
[449]63// The same structure is used for both TX or RX transfers.
[494]64// The number of distributed containers can be smaller than (X_SIZE * YSIZE).
65// The actual number of buffers used in the chbuf is defined by (xmax * ymax).
66// This structure must be 64 bytes aligned.
[505]67///////////////////////////////////////////////////////////////////////////////
[449]68
69typedef struct nic_chbuf_s
70{
[478]71    buffer_descriptor_t  buffer[X_SIZE*Y_SIZE];  // kernel chbuf
[494]72    unsigned int         xmax;                   // nb clusters in a row
73    unsigned int         ymax;                   // nb clusters in a column
[449]74} nic_chbuf_t;
75
[505]76///////////////////////////////////////////////////////////////////////////////
[440]77//    TTY related syscall handlers
[505]78///////////////////////////////////////////////////////////////////////////////
[258]79
[440]80int _sys_tty_alloc();
[294]81
[440]82int _sys_tty_write( const char*  buffer,
83                    unsigned int length,
84                    unsigned int channel );
[428]85
[440]86int _sys_tty_read(  char*        buffer,
87                    unsigned int length,
88                    unsigned int channel );
[294]89
[440]90int _sys_tty_get_lock( unsigned int   channel,
91                       unsigned int * save_sr_ptr );
[294]92
[440]93int _sys_tty_release_lock( unsigned int   channel,
94                           unsigned int * save_sr_ptr );
[294]95
[440]96//////////////////////////////////////////////////////////////////////////////
97//    TIM related syscall handlers
98//////////////////////////////////////////////////////////////////////////////
[294]99
[440]100int _sys_tim_alloc();
[258]101
[440]102int _sys_tim_start( unsigned int period );
[258]103
[440]104int _sys_tim_stop();
[258]105
[440]106//////////////////////////////////////////////////////////////////////////////
107//    NIC related syscall handlers
108//////////////////////////////////////////////////////////////////////////////
[294]109
[494]110int _sys_nic_alloc( unsigned int is_rx,
111                    unsigned int xmax,
112                    unsigned int ymax );
[396]113
[494]114
[489]115int _sys_nic_start( unsigned int is_rx,
116                    unsigned int channel );
[396]117
[449]118int _sys_nic_move( unsigned int is_rx,
[489]119                   unsigned int channel,
[449]120                   void*        buffer );
[440]121
[489]122int _sys_nic_stop( unsigned int is_rx,
123                   unsigned int channel );
[449]124
[489]125int _sys_nic_clear( unsigned int is_rx,
126                    unsigned int channel );
[459]127
[489]128int _sys_nic_stats( unsigned int is_rx,
129                    unsigned int channel );
[459]130
[440]131//////////////////////////////////////////////////////////////////////////////
132//    FBF related syscall handlers
133//////////////////////////////////////////////////////////////////////////////
134
135int _sys_fbf_sync_write( unsigned int offset,
136                         void*        buffer,
137                         unsigned int length );
138
139int _sys_fbf_sync_read(  unsigned int offset,
140                         void*        buffer,
141                         unsigned int length );
142
143int _sys_fbf_cma_alloc();
144
145int _sys_fbf_cma_start( void*        vbase0, 
146                        void*        vbase1, 
147                        unsigned int length );
148
149int _sys_fbf_cma_display( unsigned int buffer_index );
150
151int _sys_fbf_cma_stop();
152
153//////////////////////////////////////////////////////////////////////////////
154//    Miscelaneous syscall handlers
155//////////////////////////////////////////////////////////////////////////////
156
157int _sys_ukn();
158
159int _sys_proc_xyp( unsigned int* x,
160                   unsigned int* y,
161                   unsigned int* p );
162
163int _sys_task_exit( char* string );
164
165int _context_switch();
166
167int _sys_local_task_id();
168
169int _sys_global_task_id();
170
171int _sys_thread_id();
172
[494]173int _sys_procs_number( unsigned int* x_size,
174                       unsigned int* y_size, 
175                       unsigned int* nprocs );
[440]176
177int _sys_vobj_get_vbase( char*         vspace_name,
178                         char*         vobj_name,
179                         unsigned int* vbase );
180
181int _sys_vobj_get_length( char*         vspace_name, 
182                          char*         vobj_name,
183                          unsigned int* length );
184
185int _sys_xy_from_ptr( void*          ptr,
186                      unsigned int*  x,
187                      unsigned int*  y );
188
189int _sys_heap_info( unsigned int* vaddr, 
190                    unsigned int* length,
191                    unsigned int  x,
192                    unsigned int  y ); 
193
[258]194#endif
195
196// Local Variables:
197// tab-width: 4
198// c-basic-offset: 4
199// c-file-offsets:((innamespace . 0)(inline-open . 0))
200// indent-tabs-mode: nil
201// End:
202// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
203
Note: See TracBrowser for help on using the repository browser.