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

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

Introducing the CMA_RX, CMA_TX, NIC_RX, NIC_TX slots in the task context.
This allows an user task to have a private NIC channel and a private CMA channel.

  • Property svn:executable set to *
File size: 6.4 KB
Line 
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
22extern 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
32typedef 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
53typedef 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
65int _sys_tty_alloc();
66
67int _sys_tty_write( const char*  buffer,
68                    unsigned int length,
69                    unsigned int channel );
70
71int _sys_tty_read(  char*        buffer,
72                    unsigned int length,
73                    unsigned int channel );
74
75int _sys_tty_get_lock( unsigned int   channel,
76                       unsigned int * save_sr_ptr );
77
78int _sys_tty_release_lock( unsigned int   channel,
79                           unsigned int * save_sr_ptr );
80
81//////////////////////////////////////////////////////////////////////////////
82//    TIM related syscall handlers
83//////////////////////////////////////////////////////////////////////////////
84
85int _sys_tim_alloc();
86
87int _sys_tim_start( unsigned int period );
88
89int _sys_tim_stop();
90
91//////////////////////////////////////////////////////////////////////////////
92//    NIC related syscall handlers
93//////////////////////////////////////////////////////////////////////////////
94
95int _sys_nic_alloc( unsigned int is_rx );
96
97int _sys_nic_start( unsigned int is_rx,
98                    unsigned int mac4,
99                    unsigned int mac2 );
100
101int _sys_nic_move( unsigned int is_rx,
102                   void*        buffer );
103
104int _sys_nic_stop( unsigned int is_rx );
105
106//////////////////////////////////////////////////////////////////////////////
107//    FBF related syscall handlers
108//////////////////////////////////////////////////////////////////////////////
109
110int _sys_fbf_sync_write( unsigned int offset,
111                         void*        buffer,
112                         unsigned int length );
113
114int _sys_fbf_sync_read(  unsigned int offset,
115                         void*        buffer,
116                         unsigned int length );
117
118int _sys_fbf_cma_alloc();
119
120int _sys_fbf_cma_start( void*        vbase0, 
121                        void*        vbase1, 
122                        unsigned int length );
123
124int _sys_fbf_cma_display( unsigned int buffer_index );
125
126int _sys_fbf_cma_stop();
127
128//////////////////////////////////////////////////////////////////////////////
129//    Miscelaneous syscall handlers
130//////////////////////////////////////////////////////////////////////////////
131
132int _sys_ukn();
133
134int _sys_proc_xyp( unsigned int* x,
135                   unsigned int* y,
136                   unsigned int* p );
137
138int _sys_task_exit( char* string );
139
140int _context_switch();
141
142int _sys_local_task_id();
143
144int _sys_global_task_id();
145
146int _sys_thread_id();
147
148int _sys_procs_number( unsigned int  x,
149                       unsigned int  y, 
150                       unsigned int* number );
151
152int _sys_vobj_get_vbase( char*         vspace_name,
153                         char*         vobj_name,
154                         unsigned int* vbase );
155
156int _sys_vobj_get_length( char*         vspace_name, 
157                          char*         vobj_name,
158                          unsigned int* length );
159
160int _sys_xy_from_ptr( void*          ptr,
161                      unsigned int*  x,
162                      unsigned int*  y );
163
164int _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
Note: See TracBrowser for help on using the repository browser.