Changeset 657 for trunk/hal/tsar_mips32/drivers/soclib_fbf.c
- Timestamp:
- Mar 18, 2020, 11:16:59 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_fbf.c
r654 r657 2 2 * soclib_fbf.c - soclib frame-buffer driver implementation. 3 3 * 4 * Author Alain greiner (2016,2017,2018,2019 )4 * Author Alain greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 59 59 void __attribute__((noinline)) soclib_fbf_cmd( xptr_t thread_xp ) 60 60 { 61 uint32_t cmd_type; // READ / WRITE / SYNC_READ / SYNC_WRITE 62 uint32_t offset; 63 uint32_t length; 64 void * buffer; // pointer on memory buffer in user space 65 xptr_t fbf_xp; 61 uint32_t type; // USER_WRITE / USER_READ / KERNEL_WRITE / KERNEL_READ 62 uint32_t offset; // offset in FBF (in pixels) 63 uint32_t npixels; // number of pixels to move 64 xptr_t fbf_xp; // extended pointer on FBF chdev descriptor 66 65 uint32_t status; // I/0 operation status (from BDV) 66 void * buffer; // pointer on kernel or user buffer 67 67 68 68 // get client thread cluster and local pointer … … 78 78 79 79 // get command arguments 80 cmd_type = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.type) );81 offset = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.offset) );82 length = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.length) );83 buffer = hal_remote_lpt( XPTR( th_cxy , &th_ptr->fbf_cmd.buffer) );84 fbf_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->fbf_cmd.dev_xp) );80 type = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.type ) ); 81 offset = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.offset ) ); 82 npixels = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.npixels ) ); 83 fbf_xp = hal_remote_l64( XPTR( th_cxy , &th_ptr->fbf_cmd.dev_xp ) ); 84 buffer = hal_remote_lpt( XPTR( th_cxy , &th_ptr->fbf_cmd.buffer ) ); 85 85 86 86 // get cluster and local pointer on FBF chdev … … 92 92 93 93 // execute command 94 if( cmd_type == FBF_READ ) // use a (kernel -> user) memcpy94 if( type == FBF_DRIVER_USER_WRITE ) // user_buffer => FBF 95 95 { 96 96 97 97 #if DEBUG_HAL_FBF 98 98 if( DEBUG_HAL_FBF < cycle ) 99 printk("\n[%s] client thread[%x,%x] / READ / offset %d / length %d / buffer %x / fbf (%x,%x)\n", 100 __FUNCTION__ , client_pid, client_trdid, 101 offset, length, buffer, GET_CXY(base_xp), GET_PTR(base_xp) ); 99 printk("\n[%s] client thread[%x,%x] / USER_WRITE / offset %d / npixels %d / buf %x\n", 100 __FUNCTION__ , client_pid, client_trdid, offset, npixels, buffer ); 102 101 #endif 103 hal_copy_to_uspace( buffer, 104 base_xp + offset, 105 length ); 106 #if DEBUG_HAL_FBF 107 if( DEBUG_HAL_FBF < cycle ) 108 printk("\n[%s] client thread[%x,%x] / READ successful / cycle %d\n", 109 __FUNCTION__ , client_pid, client_trdid , cycle ); 110 #endif 111 102 hal_copy_from_uspace( base_xp + offset, 103 buffer, 104 npixels ); 112 105 } 113 else // cmd_type == FBF_WRITE => use a (user -> kernel) memcpy106 else if( type == FBF_DRIVER_USER_READ ) // FBF => user_buffer 114 107 { 115 108 116 109 #if DEBUG_HAL_FBF 117 110 if( DEBUG_HAL_FBF < cycle ) 118 printk("\n[%s] client thread[%x,%x] / WRITE / offset %d / length %d / buffer %x / fbf (%x,%x)\n", 119 __FUNCTION__ , client_pid, client_trdid, 120 offset, length, buffer, GET_CXY(base_xp), GET_PTR(base_xp) ); 111 printk("\n[%s] client thread[%x,%x] / USER_READ / offset %d / npixels %d / buf %x\n", 112 __FUNCTION__ , client_pid, client_trdid, offset, npixels, buffer ); 121 113 #endif 122 hal_copy_from_uspace( base_xp + offset, 123 buffer, 124 length ); 114 hal_copy_to_uspace( buffer, 115 base_xp + offset, 116 npixels ); 117 } 118 else if( type == FBF_DRIVER_KERNEL_WRITE ) // kernel_buffer => FBF 119 { 120 125 121 #if DEBUG_HAL_FBF 126 122 if( DEBUG_HAL_FBF < cycle ) 127 printk("\n[%s] client thread[%x,%x] / WRITE successful / cycle %d\n",128 __FUNCTION__ , client_pid, client_trdid , cycle);123 printk("\n[%s] client thread[%x,%x] / KERNEL_WRITE / offset %d / npixels %d / buf %x\n", 124 __FUNCTION__ , client_pid, client_trdid, offset, npixels, buffer ); 129 125 #endif 126 hal_remote_memcpy( base_xp + offset, 127 XPTR( local_cxy , buffer ), 128 npixels ); 129 } 130 else if( type == FBF_DRIVER_KERNEL_READ ) // FBF => kernel_buffer 131 { 130 132 133 #if DEBUG_HAL_FBF 134 if( DEBUG_HAL_FBF < cycle ) 135 printk("\n[%s] client thread[%x,%x] / KERNEL_READ / offset %d / npixels %d / buf %x\n", 136 __FUNCTION__ , client_pid, client_trdid, offset, npixels, buffer ); 137 #endif 138 hal_remote_memcpy( XPTR( local_cxy , buffer ), 139 base_xp + offset, 140 npixels ); 131 141 } 132 142 133 143 // set success in command 134 144 hal_remote_s32( XPTR( th_cxy , &th_ptr->fbf_cmd.error ) , 0 ); 145 146 #if DEBUG_HAL_FBF 147 if( DEBUG_HAL_FBF < cycle ) 148 printk("\n[%s] client thread[%x,%x] / successful move / cycle %d\n", 149 __FUNCTION__ , client_pid, client_trdid , cycle ); 150 #endif 135 151 136 152 } // end soclib_fbf_cmd()
Note: See TracChangeset
for help on using the changeset viewer.