Ignore:
Timestamp:
Nov 21, 2015, 2:28:31 PM (9 years ago)
Author:
alain
Message:

Modify FBF_CMA syscall handlers to support chbufs containing more than two buffers.

File:
1 edited

Legend:

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

    r714 r725  
    5151#define SYSCALL_NO_CHANNEL_AVAILABLE             (-18)
    5252#define SYSCALL_CHANNEL_NON_ALLOCATED            (-19)
    53 #define SYSCALL_ILLEGAL_XY_ARGUMENTS             (-20)
     53#define SYSCALL_ILLEGAL_ARGUMENT                 (-20)
    5454#define SYSCALL_OUT_OF_KERNEL_HEAP_MEMORY        (-21)
    5555#define SYSCALL_ADDRESS_NON_ALIGNED              (-22)
     
    6464
    6565///////////////////////////////////////////////////////////////////////////////
    66 // This structure is used by the CMA component to store the status of the
    67 // frame buffer (full or empty). The useful information is contained in the
    68 // "status" integer (1 for full and 0 for empty).
    69 // This structure must be aligned on a cache line (64 bytes) to simplify
    70 // the software L2/L3 cache coherence when the IO bridge is used.
    71 ///////////////////////////////////////////////////////////////////////////////
    72 
    73 typedef struct buffer_status_s
    74 {
    75     unsigned int status;
    76     unsigned int padding[15];
    77 } buffer_status_t;
    78 
    79 ///////////////////////////////////////////////////////////////////////////////
    80 // This structure is used by the CMA component to move a stream
    81 // of images from two user buffers to the frame buffer in kernel space.
     66// This structure is used by the CMA component to move a stream of images
     67// from a set of user buffers to the frame buffer in kernel space.
    8268// It contains two chbuf arrays:
    83 // - The SRC chbuf contains two buffers (buf0 & buf1), in user space.
    84 // - The DST cbuf contains one single buffer (fbf), that is the frame buffer.
     69// - The SRC chbuf contains <nbufs> buffer descriptors, in user space,
     70//   that can be distributed (one buffer per cluster) or not.
     71// - The DST cbuf contains one single buffer, that is the frame buffer.
    8572// Each buffer is described with a 64 bits buffer descriptor:
    86 // - the 26 LSB bits contain bits[6:31] of the buffer physical address
    87 // - the 26 following bits contain bits[6:31] of the physical address where the
    88 //   buffer status is located
    89 // - the 12 MSB bits contain the common address extension of the buffer and its
    90 //   status
    91 // The length field define the buffer size (bytes)
     73// - the 26 LSB bits contain bits[31:6] of the status physical address.
     74// - the 26 following bits contain bits[31:6] of the buffer physical address.
     75// - the 12 MSB bits contain the common address extension.
     76// The actual number of user buffers cannot be larger than 256 (at most
     77// one user buffer per cluster for a 16*16 mesh).
     78// NB: The user buffers are mapped in user space, but the chbuf descriptor
     79// contained in this structure is a protected kernel variable.
    9280// This structure must be 64 bytes aligned.
    9381///////////////////////////////////////////////////////////////////////////////
     
    9583typedef struct fbf_chbuf_s
    9684{
    97     unsigned long long  buf0_desc;     // first user buffer descriptor
    98     unsigned long long  buf1_desc;     // second user buffer descriptor
    99     unsigned long long  fbf_desc;      // frame buffer descriptor
    100     unsigned int        length;        // buffer length (bytes)
    101     unsigned int        padding[9];    // padding for 64 bytes alignment
     85    unsigned long long  fbf_desc;                    // frame buffer descriptor
     86    unsigned long long  usr_desc[256];               // user chbuf descriptor
     87    unsigned int        nbufs;                       // number of user buffers
    10288} fbf_chbuf_t;   
    10389
     
    11096// The actual number of buffers used in the chbuf is defined by (xmax * ymax).
    11197// Each buffer is described with a 64 bits buffer descriptor:
    112 // - the 26 LSB bits contain bits[6:31] of the buffer physical address
    113 // - the 26 following bits contain bits[6:31] of the physical address where the
    114 //   buffer status is located
    115 // - the 12 MSB bits contain the common address extension of the buffer and its
    116 //   status
     98// - the 26 LSB bits contain bits[31:6] of the status physical address.
     99// - the 26 following bits contain bits[31:6] of the buffer physical address.
     100// - the 12 MSB bits contain the common address extension.
     101// The <xmax> and <ymax> fields define the actual mesh size.
    117102// This structure must be 64 bytes aligned.
    118103///////////////////////////////////////////////////////////////////////////////
    119104
    120 typedef struct ker_chbuf_s
     105typedef struct nic_chbuf_s
    121106{
    122     unsigned long long   buf_desc[X_SIZE*Y_SIZE]; // kernel chbuf descriptor
     107    unsigned long long   buf_desc[X_SIZE*Y_SIZE];     // kernel chbuf descriptor
    123108    unsigned int         xmax;                        // nb clusters in a row
    124109    unsigned int         ymax;                        // nb clusters in a column
    125 } ker_chbuf_t;
     110} nic_chbuf_t;
    126111
    127112
     
    236221
    237222extern int _sys_fbf_sync_write( unsigned int offset,
    238                          void*        buffer,
    239                          unsigned int length );
     223                                void*        buffer,
     224                                unsigned int length );
    240225
    241226extern int _sys_fbf_sync_read(  unsigned int offset,
    242                          void*        buffer,
    243                          unsigned int length );
    244 
    245 extern int _sys_fbf_cma_alloc();
     227                                void*        buffer,
     228                                unsigned int length );
     229
     230extern int _sys_fbf_cma_alloc( unsigned int nbufs );
    246231
    247232extern int _sys_fbf_cma_release();
    248233
    249 extern int _sys_fbf_cma_init_buf(void*        buf0_vbase,
    250                                  void*        buf1_vbase,
    251                                  void*        sts0_vaddr,
    252                                  void*        sts1_vaddr );
    253 
    254 extern int _sys_fbf_cma_start( unsigned int length );
    255 
    256 extern int _sys_fbf_cma_display( unsigned int buffer_index );
     234extern int _sys_fbf_cma_init_buf( unsigned int index,
     235                                  void*        buf_vaddr,
     236                                  void*        sts_vaddr );
     237
     238extern int _sys_fbf_cma_start();
     239
     240extern int _sys_fbf_cma_display( unsigned int index );
     241
     242extern int _sys_fbf_cma_check( unsigned int index );
    257243
    258244extern int _sys_fbf_cma_stop();
     
    265251
    266252extern int _sys_proc_xyp( unsigned int* x,
    267                    unsigned int* y,
    268                    unsigned int* p );
     253                          unsigned int* y,
     254                          unsigned int* p );
    269255
    270256extern int _sys_procs_number( unsigned int* x_size,
    271                        unsigned int* y_size,
    272                        unsigned int* nprocs );
     257                              unsigned int* y_size,
     258                              unsigned int* nprocs );
    273259
    274260extern int _sys_vseg_get_vbase( char*         vspace_name,
    275                          char*         vseg_name,
    276                          unsigned int* vbase );
     261                                char*         vseg_name,
     262                                unsigned int* vbase );
    277263
    278264extern int _sys_vseg_get_length( char*         vspace_name,
    279                           char*         vseg_name,
    280                           unsigned int* length );
     265                                 char*         vseg_name,
     266                                 unsigned int* length );
    281267
    282268extern int _sys_xy_from_ptr( void*          ptr,
    283                       unsigned int*  x,
    284                       unsigned int*  y );
     269                             unsigned int*  x,
     270                             unsigned int*  y );
    285271
    286272extern int _sys_heap_info( unsigned int* vaddr,
    287                     unsigned int* length,
    288                     unsigned int  x,
    289                     unsigned int  y );
     273                           unsigned int* length,
     274                           unsigned int  x,
     275                           unsigned int  y );
    290276
    291277#endif
Note: See TracChangeset for help on using the changeset viewer.