| 65 | == __ FBF related syscall handlers__== |
| 66 | |
| 67 | There exist two methods to access the ''vci_framebuffer'': |
| 68 | * 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. |
| 69 | * 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. |
| 70 | |
| 71 | === int '''_sys_fbf_sync_write'''( unsigned int offset, void* buffer, unsigned int length ) === |
| 72 | This function transfer data from an user buffer to the frame_buffer device using a memcpy. |
| 73 | * '''offset''' : offset (in bytes) in the frame buffer. |
| 74 | * '''buffer''' : base address of the memory buffer. |
| 75 | * '''length''' : number of bytes to be transfered. |
| 76 | |
| 77 | === int '''_sys_fbf_sync_read'''( unsigned int offset, void* buffer, unsigned int length ) === |
| 78 | This function transfer data from the frame_buffer device to anuser buffer using a memcpy. |
| 79 | * '''offset''' : offset (in bytes) in the frame buffer. |
| 80 | * '''buffer''' : base address of the memory buffer. |
| 81 | * '''length''' : number of bytes to be transfered. |
| 82 | |
| 83 | === int '''_sys_fbf_cma_alloc'''() === |
| 84 | This function allocates a private CMA channel to the calling task, and register the channel index in the task context. |
| 85 | Return -1 if no CMA channel available. |
| 86 | |
| 87 | === int '''_sys_fbf_cma_start'''( void* vbase0, void* vbase1, unsigned int length ) === |
| 88 | 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. |
| 89 | * '''vbase0''' : virtual base address of the first user buffer. |
| 90 | * '''vbase1''' : virtual base address of the second user buffer. |
| 91 | * '''length''' : buffer length (bytes) |
| 92 | It uses the _fbf_chbuf[] and _fbf_chbuf_paddr[] arrays, that are both indexed by the channel index, and makes the following actions: |
| 93 | 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]. |
| 94 | 2. it computes the physical address for the chbuf descriptor and register it in the _fbf_chbuf_paddr[i]. |
| 95 | 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. |
| 96 | 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. |
| 97 | Return 0 in case of success. |
| 98 | Return -1 if no CMA channel allocated to the calling task, or if user buffers not aligned on a word boundary. |
| 99 | |
| 100 | === int '''_sys_fbf_cma_display'''( unsigned int index ) === |
| 101 | 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. |
| 102 | The '''buffer''' argument define the user buffer index (0 => buf0 / not 0 => buf1). |
| 103 | It makes the following actions if the IO Bridge component is used: |
| 104 | 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. |
| 105 | 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. |
| 106 | 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. |
| 107 | Return 0 in case of success. |
| 108 | Return -1 if no CMA channel allocated to the calling task. |
| 109 | |
| 110 | === int '''_sys_fbf_cma_stop'''() === |
| 111 | This function desactivares the CMA channel allocated to the calling task. |
| 112 | Return 0 in case of success. |
| 113 | Return -1 if no CMA channel allocated to the calling task. |
| 114 | |
| 115 | |
| 116 | |
| 117 | |