Changeset 4 for trunk/kernel/drivers/soclib/soclib_bdv.c
- Timestamp:
- Apr 26, 2017, 2:10:21 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/drivers/soclib/soclib_bdv.c
r1 r4 22 22 */ 23 23 24 #include < device.h>24 #include <chdev.h> 25 25 #include <dev_ioc.h> 26 26 #include <soclib_bdv.h> … … 29 29 30 30 31 ///////////////////////////////////// 32 void soclib_bdv_init( xptr_t dev_xp)31 /////////////////////////////////////// 32 void soclib_bdv_init( chdev_t * chdev ) 33 33 { 34 // get IOC device descriptor cluster and local pointer35 cxy_t dev_cxy = GET_CXY( dev_xp );36 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );37 38 34 // get extended pointer on SOCLIB_BDV peripheral base address 39 xptr_t bdv_xp = hal_remote_lwd( XPTR( dev_cxy , &dev_ptr->base ) );35 xptr_t bdv_xp = chdev->base; 40 36 41 37 // get hardware device cluster and local pointer … … 48 44 49 45 // set IOC device descriptor extension 50 hal_remote_sw( XPTR( dev_cxy , &dev_ptr->ext.ioc.size ) , block_size );51 hal_remote_sw( XPTR( dev_cxy , &dev_ptr->ext.ioc.count ) , block_count );46 chdev->ext.ioc.size = block_size; 47 chdev->ext.ioc.count = block_count; 52 48 53 49 } // end soclib_bdv_init() 54 50 55 51 56 ////////////////////////////////////////////////////////////// ////57 void __attribute__ ((noinline)) soclib_bdv_c ommand( xptr_t th_xp )52 ////////////////////////////////////////////////////////////// 53 void __attribute__ ((noinline)) soclib_bdv_cmd( xptr_t th_xp ) 58 54 { 59 55 uint32_t to_mem; // command argument … … 68 64 69 65 // get command arguments and extended pointer on IOC device 70 to_mem = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> dev.ioc.to_mem ) );71 lba = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> dev.ioc.lba ) );72 count = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> dev.ioc.count ) );73 buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr-> dev.ioc.buf_xp ) );74 dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr-> dev.ioc.dev_xp ) );66 to_mem = hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.to_mem ) ); 67 lba = hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.lba ) ); 68 count = hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.count ) ); 69 buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.ioc.buf_xp ) ); 70 dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.ioc.dev_xp ) ); 75 71 76 72 // get IOC device cluster and local pointer 77 73 cxy_t dev_cxy = GET_CXY( dev_xp ); 78 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );74 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 79 75 80 76 // get extended pointer on SOCLIB-BDV peripheral … … 107 103 108 104 109 //////////////////////////////////////////////////////////////// 110 void __attribute__ ((noinline)) soclib_bdv_isr( device_t *dev )105 ///////////////////////////////////////////////////////////////// 106 void __attribute__ ((noinline)) soclib_bdv_isr( chdev_t * chdev ) 111 107 { 112 108 // get extended pointer on client thread 113 xptr_t root = XPTR( local_cxy , & dev->wait_root );109 xptr_t root = XPTR( local_cxy , &chdev->wait_root ); 114 110 xptr_t client_xp = XLIST_FIRST_ELEMENT( root , thread_t , wait_list ); 115 111 116 112 // get extended pointer on server thread 117 xptr_t server_xp = XPTR( local_cxy , & dev->server );113 xptr_t server_xp = XPTR( local_cxy , &chdev->server ); 118 114 119 115 // get client thread cluster and local pointer … … 122 118 123 119 // get SOCLIB_BDV device cluster and local pointer 124 cxy_t bdv_cxy = GET_CXY( dev->base );125 uint32_t * bdv_ptr = (uint32_t *)GET_PTR( dev->base );120 cxy_t bdv_cxy = GET_CXY( chdev->base ); 121 uint32_t * bdv_ptr = (uint32_t *)GET_PTR( chdev->base ); 126 122 127 123 // get BDV status register and acknowledge IRQ … … 131 127 if((status != BDV_READ_SUCCESS) && (status != BDV_WRITE_SUCCESS)) 132 128 { 133 hal_remote_sw( XPTR( client_cxy , &client_ptr-> dev.ioc.error ) , 1 );129 hal_remote_sw( XPTR( client_cxy , &client_ptr->command.ioc.error ) , 1 ); 134 130 } 135 131 else 136 132 { 137 hal_remote_sw( XPTR( client_cxy , &client_ptr-> dev.ioc.error ) , 0 );133 hal_remote_sw( XPTR( client_cxy , &client_ptr->command.ioc.error ) , 0 ); 138 134 } 139 135
Note: See TracChangeset
for help on using the changeset viewer.