Changes between Version 46 and Version 47 of kernel_syscalls


Ignore:
Timestamp:
Nov 1, 2015, 12:00:50 AM (9 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kernel_syscalls

    v46 v47  
    178178== FBF related syscall handlers ==
    179179
    180 There exist two methods to access the ''vci_framebuffer'':
    181  * The _sys_fbf_sync_write() and _sys_fbf_sync_read() functions use a memcpy strategy to implement the transfer between a data buffer (user space) and the frame buffer (kernel space). They are blocking until completion of the transfer.
    182  * The _sys_fbf_cma_alloc(), _sys_fbf_cma_start(),  _sys_fbf_cma_display(), and _sys_fbf_cma_stop() functions use the ''vci_chbuf_dma'' component to transfer a stream of images from an user space chained buffer (two buffers) to the frame buffer.
    183  
    184  === 1) int '''_sys_fbf_cma_alloc'''() ===
    185 This function allocates a private CMA channel to the calling task, and register the channel index in the task context.
    186 Return -1 if no CMA channel available.
    187  
    188  === 2) int '''_sys_fbf_cma_start'''( void* vbase0,  void* vbase1,  unsigned int length ) ===
    189 This function initializes the CMA channel to start the transfer of a stream of images from an user chbuf (two buffers) to the frame buffer chbuf (one single buffer). The user buffers must be aligned on a word boundary. The CMA component is configured in IN_ORDER transfer mode (blocking when the expected source or destination buffer is not available).
    190  * '''vbase0''' : virtual base address of the first user buffer.
    191  * '''vbase1''' : virtual base address of the second user buffer.
    192  * '''length''' : buffer length (bytes)
    193 It uses the _fbf_chbuf[] and _fbf_chbuf_paddr[] arrays, that are both indexed by the channel index, and makes the following actions:
    194 1. it computes the physical addresses for the two source user buffers, for the destination frame buffer, and initializes the channel descriptor _fbf_chbuf[i].
    195 2. it computes the physical address for the chbuf descriptor and register it in the _fbf_chbuf_paddr[i].
    196 3. it makes a SYNC request to L2 cache for channel descriptor if the IOB is used, because the channel descriptor is directly accessed in XRAM by the CMA component.
    197 4. it Starts the CMA hardware channel, that will poll the channel descriptor to fransfer an user buffer to the frame buffer as soon as the source user buffer is marked valid.
    198 Return 0 in case of success.
    199 Return -1 if no CMA channel allocated to the calling task, or if user buffers not aligned on a word boundary.
    200 
    201  === 3) int '''_sys_fbf_cma_display'''( unsigned int buffer_index ) ===
    202 This function is used in conjunction with the _fbf_cma_start() function, and must be called each time a new user buffer is available for display, to set the user buffer status in the chbuf descriptor.
    203 The '''buffer_index'''  argument define the user buffer index (0 => buf0 / not 0 => buf1).
    204 It makes the following actions if the IO Bridge component is used:
    205 1. it makes an INVAL request for the channel descriptor, before testing the source buffer status, because it is modified in XRAM by the CMA component.
    206 2. it makes a SYNC request for the source user buffer before activating the CMA  transfer, because the data will be read from XRAM by the CMA component.
    207 3. it makes a SYNC request for the channel descriptor after modification of the SRC and DST status, because these descriptors will be read from XRAM by the CMA component.
    208 Return 0 in case of success. Return -1 if no CMA channel allocated to the calling task.
    209 
    210  === 4) int '''_sys_fbf_cma_stop'''() ===
     180 === 1) int '''_sys_fbf_size'''( unsigned int* width , unsigned int* height ) ===
     181This function returns in the <width> and <height> buffers the Frame Buffer size.
     182It returns always SYSCALL_OK.
     183
     184 === 2) int '''_sys_fbf_alloc'''() ===
     185This function takes the exclusive ownership of the frame buffer for the calling thread application.
     186It must be called by a single thread. It register the number of potential users : all threads in the same space as the calling thread.
     187It returns  SYSCALL_OK in case of success.
     188It returns SYSCALL_SHARED_PERIPHERAL_BUSY if the frame buffer is already allocated.
     189
     190 === 3) int '''_sys_fbf_release'''() ===
     191This function decrement the number of registered users for the frame buffer. It must be called by all the threads of a given application to completely release the frame buffer.
     192It returns SYSCALL_OK  in case of success.
     193It returns SYCALL_CHANNEL_NON_ALLOCATED if the frame buffer was not allocated.
     194
     195
     196 === 4) int '''_sys_fbf_cma_alloc'''( unsigned int nbufs ) ===
     197This function allocates a private CMA channel, that can be used by all threads in the same space as the calling thread. It must be called by a single thread, but the channel index is registered in all threads contexts in the same vspace.
     198The <nbufs> argument define the CMA length (number of chained buffers).
     199Ir returns SYSCALL_OK in case of success.
     200It returns SYSCALL_NO_CHANNEL_AVAILABLE if no CMA channel available.
     201It returns SYSCALL_CHANNEL_ALREADY_ALLOCATED if CMA already allocated.
     202It returns SYSCALL_ILLEGAL_ARGUMENT if <nbufs> is larger than 256.
     203
     204 === 5) int '''_sys_fbf_cma_release'''() ===
     205This function decrement the number of registered users for the allocated CMA channel. It must be called by all the threads of a given application to completely release the CMA channel. It stops the CMA transfer, when the last thread in the space releases the CMA channel.
     206It returns SYSCALL_OK  in case of success.
     207It returns SYCALL_CHANNEL_NON_ALLOCATED if the CMA channel was not allocated.
     208
     209 === 6) int _sys_fbf_cma_init_buf'''( unsigned int index , void* buf_vaddr , void* sts_vaddr ) ===
     210This function register an user buffer and a  buffer status in the the CHBUF descriptor associated to the
     211frame buffer. The <index> argument is the buffer index in the CHBUF. The <buf_vaddr> and <sts_vaddr> arguments are the pointers on the user buffer and status. Both the user buffer and the user status must be 64 bytes aligned.
     212It returns SYSCALL_OK  in case of success.
     213It returns SYCALL_CHANNEL_NON_ALLOCATED if the CMA channel was not allocated.
     214It returns SYSCALL_ADDRESS_NON_ALIGNED if the buffer or status are not 64 bytes aligned.
     215It returns SYSCALL_ADDRESS_NON_USER_ACCESSIBLE if addresses are protected.
     216
     217 === 7) int '''_sys_fbf_cma_start'''( ) ===
     218This function activates the CMA channel to transfer of a stream of images from the user buffers to the frame buffer. The user buffers musThe CMA component is configured in IN_ORDER transfer mode (blocking when the expected source buffer is not available).
     219It returns SYSCALL_OK  in case of success.
     220It returns SYCALL_CHANNEL_NON_ALLOCATED if the CMA channel was not allocated.
     221It returns SYSCALL_MISSING_INITIALISATION if the CHBUF was not initialized.
     222
     223 === 8) int '''_sys_fbf_cma_check'''( unsigned int index ) ===
     224This blocking function checks that the user buffer identified by the <index> argument is empty, and can be reused by the application. It makes an INVAL request to the L2 cache, before testing the source buffer status, because it is modified in XRAM by the CMA component.
     225It returns SYSCALL_OK  when the buffer is empty.
     226It returns SYCALL_CHANNEL_NON_ALLOCATED if the CMA channel was not allocated.
     227
     228 === 9) int '''_sys_fbf_cma_display'''( unsigned int index ) ===
     229This function must be used to signal that the user buffer identified by the <index> argument is full and can be transferred to the frame buffer.
     230It makes a SYNC request  to the L2 cache, for both the source user buffer the status, because these data will be read from XRAM by the CMA component.
     231It returns SYSCALL_OK  in case of success.
     232It returns SYCALL_CHANNEL_NON_ALLOCATED if the CMA channel was not allocated.
     233
     234 === 10) int '''_sys_fbf_cma_stop'''() ===
    211235This function  desactivares the CMA channel  allocated to the calling task.
    212 Return 0 in case of success.
    213 Return -1 if no CMA channel allocated to the calling task.
    214 
    215  === 5) int '''_sys_fbf_sync_write'''( unsigned int offset,  void* buffer,   unsigned int length ) ===
     236It returns SYSCALL_OK in case of success.
     237It returns SYCALL_CHANNEL_NON_ALLOCATED if the CMA channel was not allocated.
     238
     239 === 11) int '''_sys_fbf_sync_write'''( unsigned int offset,  void* buffer,   unsigned int length ) ===
    216240This function transfer data from an user buffer to the frame_buffer device using a memcpy.
    217241 * '''offset''' : offset (in bytes) in the frame buffer.
     
    219243 * '''length''' : number of bytes to be transfered.
    220244
    221  === 6) int '''_sys_fbf_sync_read'''( unsigned int offset,  void* buffer,   unsigned int length ) ===
     245 === 12) int '''_sys_fbf_sync_read'''( unsigned int offset,  void* buffer,   unsigned int length ) ===
    222246This function transfer data from the frame_buffer device to anuser buffer using a memcpy.
    223247 * '''offset''' : offset (in bytes) in the frame buffer.