Ignore:
Timestamp:
Jul 15, 2015, 6:15:52 PM (9 years ago)
Author:
bellefin
Message:

Change the syscalls related to the NIC and the CMA
1) In a CHBUF, every buffer is linked to a variable called “status” which is equal to 1 if the buffer is full or 0 if it is empty. The status occupies 64 bytes to simplify cache coherence
2) The CHBUF descriptor now contains the physical addresses of the buffer and its status. It only occupies 64 bits.

File:
1 edited

Legend:

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

    r556 r614  
    2424
    2525///////////////////////////////////////////////////////////////////////////////
    26 // This structure is used by the nic_chbuf_t and fbf_chbuf_t structures.
    27 // It describes a single buffer descriptor. The useful information is
    28 // contained in one single 64 bits word (desc field):
    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
     26// This structure is used by the CMA component to store the status of the
     27// frame buffer (full or empty). The useful information is contained in the
     28// "status" integer (1 for full and 0 for empty).
     29// This structure must be aligned on a cache line (64 bytes) to simplify
    3230// the software L2/L3 cache coherence when the IO bridge is used.
    3331///////////////////////////////////////////////////////////////////////////////
    3432
    35 typedef struct buffer_descriptor_s
     33typedef struct buffer_status_s
    3634{
    37     unsigned long long  desc;
    38     unsigned int        padding[14];
    39 } buffer_descriptor_t;
    40  
     35    unsigned int status;
     36    unsigned int padding[15];
     37} buffer_status_t;
     38
    4139///////////////////////////////////////////////////////////////////////////////
    4240// This structure is used by the CMA component to move a stream
     
    4543// - The SRC chbuf contains two buffers (buf0 & buf1), in user space.
    4644// - The DST cbuf contains one single buffer (fbf), that is the frame buffer.
    47 // - The length field define the buffer size (bytes)
     45// Each buffer is described with a 64 bits buffer descriptor:
     46// - the 26 LSB bits contain bits[6:31] of the buffer physical address
     47// - the 26 following bits contain bits[6:31] of the physical address where the
     48//   buffer status is located
     49// - the 12 MSB bits contain the common address extension of the buffer and its
     50//   status
     51// The length field define the buffer size (bytes)
    4852// This structure must be 64 bytes aligned.
    4953///////////////////////////////////////////////////////////////////////////////
     
    5155typedef struct fbf_chbuf_s
    5256{
    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
     57    unsigned long long  buf0_desc;     // first user buffer descriptor
     58    unsigned long long  buf1_desc;     // second user buffer descriptor
     59    unsigned long long  fbf_desc;      // frame buffer descriptor
     60    unsigned int        length;        // buffer length (bytes)
     61    unsigned int        padding[9];    // padding for 64 bytes alignment
    5862} fbf_chbuf_t;   
    5963
     
    6569// The number of distributed containers can be smaller than (X_SIZE * YSIZE).
    6670// The actual number of buffers used in the chbuf is defined by (xmax * ymax).
     71// Each buffer is described with a 64 bits buffer descriptor:
     72// - the 26 LSB bits contain bits[6:31] of the buffer physical address
     73// - the 26 following bits contain bits[6:31] of the physical address where the
     74//   buffer status is located
     75// - the 12 MSB bits contain the common address extension of the buffer and its
     76//   status
    6777// This structure must be 64 bytes aligned.
    6878///////////////////////////////////////////////////////////////////////////////
    6979
    70 typedef struct nic_chbuf_s
     80typedef struct ker_chbuf_s
    7181{
    72     buffer_descriptor_t  buffer[X_SIZE*Y_SIZE];  // kernel chbuf
    73     unsigned int         xmax;                   // nb clusters in a row
    74     unsigned int         ymax;                   // nb clusters in a column
    75 } nic_chbuf_t;
     82    unsigned long long   buf_desc[X_SIZE*Y_SIZE]; // kernel chbuf descriptor
     83    unsigned int         xmax;                        // nb clusters in a row
     84    unsigned int         ymax;                        // nb clusters in a column
     85} ker_chbuf_t;
    7686
    7787
     
    171181int _sys_fbf_cma_alloc();
    172182
    173 int _sys_fbf_cma_start( void*        vbase0,
    174                         void*        vbase1, 
    175                         unsigned int length );
     183int _sys_fbf_cma_init_buf(void*        buf0_vbase,
     184                          void*        buf1_vbase,
     185                          void*        sts0_vaddr,
     186                          void*        sts1_vaddr );
     187
     188int _sys_fbf_cma_start( unsigned int length );
    176189
    177190int _sys_fbf_cma_display( unsigned int buffer_index );
Note: See TracChangeset for help on using the changeset viewer.