Ignore:
Timestamp:
Dec 5, 2014, 3:51:22 PM (10 years ago)
Author:
alain
Message:

Removing the kernel_utils.c/kernel_utils.h file.
Introducing new functions in sys_handler.c/sys_handler.h to handle NIC related system calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/sys_handler.h

    r449 r459  
    1313#define _SYS_HANDLER_H
    1414
    15 #include <mapping_info.h>
    16 #include <giet_config.h>
     15#include "giet_config.h"
     16#include "locks.h"
     17
     18#if !defined ( GIET_NIC_NBUFS )
     19# error: You must define GIET_NIC_NBUFS in the giet_config.h file
     20#endif
     21
     22#if !defined ( GIET_NIC_NFAKE )
     23# error: You must define GIET_NIC_NFAKE in the giet_config.h file
     24#endif
     25
     26#if !defined ( GIET_NIC_BUFSIZE )
     27# error: You must define GIET_NIC_BUFSIZE in the giet_config.h file
     28#endif
     29
     30#if !defined ( GIET_NIC_TIMEOUT )
     31# error: You must define GIET_NIC_TIMEOUT in the giet_config.h file
     32#endif
     33
     34#if !defined ( GIET_NIC_MAC4 )
     35# error: You must define GIET_NIC_MAC4 in the giet_config.h file
     36#endif
     37
     38#if !defined ( GIET_NIC_MAC2 )
     39# error: You must define GIET_NIC_MAC2 in the giet_config.h file
     40#endif
     41
     42#if ( (GIET_NIC_NBUFS + GIET_NIC_NFAKE) % 8 )
     43#error: GIET_NIC_NBUFS + GIET_NIC_NFAKE must be multiple of 8 for alignment
     44#endif
    1745
    1846///////////////////////////////////////////////////////////////////////////////////
     
    2351
    2452///////////////////////////////////////////////////////////////////////////////////
    25 // This structure is used by the vci_chbuf_dma component to transfer a stream
     53// This structure is used by the CMA component to move a stream
    2654// of images from two buffers in user space to the frame buffer in kernel space.
    27 // It contains two chbuf descriptors
     55// it must be 64 bytes aligned.
     56// It contains two chbuf arrays:
    2857// - The SRC chbuf contains two buffers (buf0 & buf1), that can be in user space.
    2958// - The DST cbuf contains one single buffer (fbf), that is the frame buffer.
     59// - The length field define the buffer size (bytes)
    3060///////////////////////////////////////////////////////////////////////////////////
    3161
    3262typedef struct fbf_chbuf_s
    3363{
    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
     64    unsigned long long  buf0;        // physical address + status for user buffer 0
     65    unsigned long long  buf1;        // physical address + status for user buffer 1
     66    unsigned long long  fbf;         // physical address + status for user buffer 0
     67    unsigned int        length;      // buffer length (bytes)
     68    unsigned int        padding[9];  // 64 bytes alignment
    3969} fbf_chbuf_t;   
    4070
    4171//////////////////////////////////////////////////////////////////////////////////
    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.
     72// This structure is used by the CMA component to move a stream
     73// of packet containers between the NIC component an a chbuf containing
     74// a variable number of buffers in kernel space.
    4475// The same structure is used for both TX or RX transfers.
     76// It must be 64 bytes aligned.
    4577// 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
     78// GIET_NIC_BUFSIZE and GIET_NIC_NBUFS parameters in giet_config.h.
     79// - The buffer array implements the chbuf, and is concurently accessed
     80//   by the CMA component and by the kernel code.
     81// - The lock must be taken by the kernel code, because several user tasks
     82//   can concurently try to consume buffers in the chbuf.
     83// - The index is only used by the kernel, and define the currently pointed
    5084//   buffer for read (RX transfer) or write (TX transfer).
    5185//////////////////////////////////////////////////////////////////////////////////
     
    5387typedef struct nic_chbuf_s
    5488{
    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
     89    unsigned long long  buffer[GIET_NIC_NBUFS];  // Kernel CHBUF
     90    unsigned long long  unused[GIET_NIC_NFAKE];  // padding for 64 bytes alignment
     91    unsigned int        index;                   // current buffer index
     92    unsigned int        padding[15];             // padding for 64 bytes alignment
    5893} nic_chbuf_t;
    5994
     
    95130int _sys_nic_alloc( unsigned int is_rx );
    96131
    97 int _sys_nic_start( unsigned int is_rx,
    98                     unsigned int mac4,
    99                     unsigned int mac2 );
     132int _sys_nic_start( unsigned int is_rx );
    100133
    101134int _sys_nic_move( unsigned int is_rx,
     135                   unsigned int nic_channel,
    102136                   void*        buffer );
    103137
    104138int _sys_nic_stop( unsigned int is_rx );
     139
     140int _sys_nic_clear( unsigned int is_rx );
     141
     142int _sys_nic_stats( unsigned int is_rx );
    105143
    106144//////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.