Changeset 570 for trunk/hal/tsar_mips32/drivers/soclib_bdv.c
- Timestamp:
- Oct 5, 2018, 12:08:35 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_bdv.c
r492 r570 28 28 #include <printk.h> 29 29 #include <thread.h> 30 #include <spinlock.h>31 30 32 31 /////////////////////////////////////// … … 45 44 46 45 // get block_size and block_count 47 uint32_t block_size = hal_remote_l w( XPTR( bdv_cxy , bdv_ptr + BDV_BLOCK_SIZE_REG ) );48 uint32_t block_count = hal_remote_l w( XPTR( bdv_cxy , bdv_ptr + BDV_SIZE_REG ) );46 uint32_t block_size = hal_remote_l32( XPTR( bdv_cxy , bdv_ptr + BDV_BLOCK_SIZE_REG ) ); 47 uint32_t block_count = hal_remote_l32( XPTR( bdv_cxy , bdv_ptr + BDV_SIZE_REG ) ); 49 48 50 49 // set IOC device descriptor extension … … 69 68 70 69 // get command arguments and extended pointer on IOC device 71 cmd_type = hal_remote_l w( XPTR( th_cxy , &th_ptr->ioc_cmd.type ) );72 lba = hal_remote_l w( XPTR( th_cxy , &th_ptr->ioc_cmd.lba ) );73 count = hal_remote_l w( XPTR( th_cxy , &th_ptr->ioc_cmd.count ) );74 buf_xp = (xptr_t)hal_remote_l wd( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) );75 ioc_xp = (xptr_t)hal_remote_l wd( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) );70 cmd_type = hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.type ) ); 71 lba = hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.lba ) ); 72 count = hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.count ) ); 73 buf_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) ); 74 ioc_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) ); 76 75 77 76 #if DEBUG_HAL_IOC_RX … … 94 93 95 94 // get cluster and pointers for SOCLIB-BDV peripheral segment base 96 xptr_t seg_xp = (xptr_t)hal_remote_l wd( XPTR( ioc_cxy , &ioc_ptr->base ) );95 xptr_t seg_xp = (xptr_t)hal_remote_l64( XPTR( ioc_cxy , &ioc_ptr->base ) ); 97 96 cxy_t seg_cxy = GET_CXY( seg_xp ); 98 97 uint32_t * seg_ptr = GET_PTR( seg_xp ); … … 108 107 109 108 // set SOCLIB_BDV registers to start one I/O operation 110 hal_remote_s w( XPTR( seg_cxy , seg_ptr + BDV_IRQ_ENABLE_REG ) , 1 );111 hal_remote_s w( XPTR( seg_cxy , seg_ptr + BDV_BUFFER_REG ) , buf_lsb );112 hal_remote_s w( XPTR( seg_cxy , seg_ptr + BDV_BUFFER_EXT_REG ) , buf_msb );113 hal_remote_s w( XPTR( seg_cxy , seg_ptr + BDV_LBA_REG ) , lba );114 hal_remote_s w( XPTR( seg_cxy , seg_ptr + BDV_COUNT_REG ) , count );115 hal_remote_s w( XPTR( seg_cxy , seg_ptr + BDV_OP_REG ) , op );109 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_IRQ_ENABLE_REG ) , 1 ); 110 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_BUFFER_REG ) , buf_lsb ); 111 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_BUFFER_EXT_REG ) , buf_msb ); 112 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_LBA_REG ) , lba ); 113 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_COUNT_REG ) , count ); 114 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_OP_REG ) , op ); 116 115 117 116 // waiting policy depends on the command type … … 124 123 while (1) 125 124 { 126 status = hal_remote_l w( XPTR( seg_cxy , seg_ptr + BDV_STATUS_REG ) );125 status = hal_remote_l32( XPTR( seg_cxy , seg_ptr + BDV_STATUS_REG ) ); 127 126 128 127 if( status == BDV_READ_SUCCESS ) // successfully completed 129 128 { 130 hal_remote_s w( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 );129 hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 ); 131 130 break; 132 131 } … … 137 136 else // error reported 138 137 { 139 hal_remote_s w( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 );138 hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 ); 140 139 break; 141 140 } … … 174 173 // get extended pointer on client thread 175 174 xptr_t root = XPTR( local_cxy , &chdev->wait_root ); 176 xptr_t client_xp = XLIST_FIRST _ELEMENT( root , thread_t , wait_list );175 xptr_t client_xp = XLIST_FIRST( root , thread_t , wait_list ); 177 176 178 177 // get extended pointer on server thread … … 184 183 185 184 // get command type 186 uint32_t cmd_type = hal_remote_l w( XPTR( client_cxy , &client_ptr->ioc_cmd.type ) );185 uint32_t cmd_type = hal_remote_l32( XPTR( client_cxy , &client_ptr->ioc_cmd.type ) ); 187 186 188 187 // get SOCLIB_BDV device cluster and local pointer … … 191 190 192 191 // get BDV status register and acknowledge IRQ 193 uint32_t status = hal_remote_l w( XPTR( bdv_cxy , bdv_ptr + BDV_STATUS_REG ) );192 uint32_t status = hal_remote_l32( XPTR( bdv_cxy , bdv_ptr + BDV_STATUS_REG ) ); 194 193 195 194 if( cmd_type == IOC_READ ) … … 223 222 224 223 // set operation status in command 225 hal_remote_s w( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , error );224 hal_remote_s32( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , error ); 226 225 227 226 // unblock server thread
Note: See TracChangeset
for help on using the changeset viewer.