Changeset 563 for trunk/kernel/libk/remote_fifo.c
- Timestamp:
- Oct 4, 2018, 11:16:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/remote_fifo.c
r457 r563 34 34 #include <remote_fifo.h> 35 35 36 //////////////////////////////////////////// 37 void local_fifo_init( remote_fifo_t * fifo )36 ///////////////////////////////////////////// 37 void remote_fifo_init( remote_fifo_t * fifo ) 38 38 { 39 39 uint32_t slot; … … 59 59 60 60 // get remote cluster identifier and pointer on FIFO 61 cxy_t fifo_cxy = (cxy_t)GET_CXY( fifo_xp );62 remote_fifo_t * fifo_ptr = (remote_fifo_t *)GET_PTR( fifo_xp );61 cxy_t fifo_cxy = GET_CXY( fifo_xp ); 62 remote_fifo_t * fifo_ptr = GET_PTR( fifo_xp ); 63 63 64 64 // initialise watchdog for contention detection … … 77 77 78 78 // read remote rd_id value 79 rd_id = hal_remote_l w( XPTR( fifo_cxy , &fifo_ptr->rd_id ) );79 rd_id = hal_remote_l32( XPTR( fifo_cxy , &fifo_ptr->rd_id ) ); 80 80 81 81 // compute number of full slots … … 89 89 // - deschedule without blocking if possible 90 90 // - wait ~1000 cycles otherwise 91 if( thread_can_yield()) sched_yield( "wait RPC fifo" );92 else hal_fixed_delay( 1000 );91 if( CURRENT_THREAD->busylocks == 0 ) sched_yield( "wait RPC fifo" ); 92 else hal_fixed_delay( 1000 ); 93 93 94 94 // increment watchdog … … 100 100 101 101 // copy item to fifo 102 hal_remote_s wd( XPTR( fifo_cxy , &fifo_ptr->data[ptw] ), item );102 hal_remote_s64( XPTR( fifo_cxy , &fifo_ptr->data[ptw] ), item ); 103 103 hal_fence(); 104 104 105 105 // set the slot valid flag 106 hal_remote_s w( XPTR( fifo_cxy , &fifo_ptr->valid[ptw] ) , 1 );106 hal_remote_s32( XPTR( fifo_cxy , &fifo_ptr->valid[ptw] ) , 1 ); 107 107 hal_fence(); 108 108 … … 111 111 } // end remote_fifo_put_item() 112 112 113 ////////////////////////////////////////////////// 114 error_t local_fifo_get_item( remote_fifo_t * fifo,115 uint64_t * item )113 /////////////////////////////////////////////////// 114 error_t remote_fifo_get_item( remote_fifo_t * fifo, 115 uint64_t * item ) 116 116 { 117 117 // get fifo state … … 138 138 139 139 return 0; 140 } // end local_fifo_get_item() 140 141 } // end remote_fifo_get_item() 141 142 142 143 ///////////////////////////////////////// … … 146 147 147 148 // get remote cluster identifier and pointer on FIFO 148 cxy_t cxy = (cxy_t)GET_CXY( fifo );149 remote_fifo_t * ptr = (remote_fifo_t *)GET_PTR( fifo );149 cxy_t cxy = GET_CXY( fifo ); 150 remote_fifo_t * ptr = GET_PTR( fifo ); 150 151 151 152 // get read and write pointers 152 uint32_t wr_id = hal_remote_l w( XPTR( cxy , &ptr->wr_id ) );153 uint32_t rd_id = hal_remote_l w( XPTR( cxy , &ptr->rd_id ) );153 uint32_t wr_id = hal_remote_l32( XPTR( cxy , &ptr->wr_id ) ); 154 uint32_t rd_id = hal_remote_l32( XPTR( cxy , &ptr->rd_id ) ); 154 155 155 156 // compute number of full slots … … 160 161 } 161 162 162 ////////////////////////////////////////////////// 163 bool_t local_fifo_is_empty( remote_fifo_t * fifo )163 /////////////////////////////////////////////////// 164 bool_t remote_fifo_is_empty( remote_fifo_t * fifo ) 164 165 { 165 166 return ( fifo->wr_id == fifo->rd_id ); … … 172 173 173 174 // get remote cluster identifier and pointer on FIFO 174 cxy_t cxy = (cxy_t)GET_CXY( fifo );175 remote_fifo_t * ptr = (remote_fifo_t *)GET_PTR( fifo );175 cxy_t cxy = GET_CXY( fifo ); 176 remote_fifo_t * ptr = GET_PTR( fifo ); 176 177 177 178 // get read and write pointers 178 uint32_t wr_id = hal_remote_l w( XPTR( cxy , &ptr->wr_id ) );179 uint32_t rd_id = hal_remote_l w( XPTR( cxy , &ptr->rd_id ) );179 uint32_t wr_id = hal_remote_l32( XPTR( cxy , &ptr->wr_id ) ); 180 uint32_t rd_id = hal_remote_l32( XPTR( cxy , &ptr->rd_id ) ); 180 181 181 182 // compute number of full slots
Note: See TracChangeset
for help on using the changeset viewer.