Ignore:
Timestamp:
Oct 4, 2018, 11:16:13 PM (6 years ago)
Author:
alain
Message:

Complete restructuration of kernel spinlocks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/remote_fifo.c

    r457 r563  
    3434#include <remote_fifo.h>
    3535
    36 ////////////////////////////////////////////
    37 void local_fifo_init( remote_fifo_t * fifo )
     36/////////////////////////////////////////////
     37void remote_fifo_init( remote_fifo_t * fifo )
    3838{
    3939    uint32_t  slot;
     
    5959
    6060    // 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 );
    6363
    6464    // initialise watchdog for contention detection
     
    7777
    7878        // read remote rd_id value
    79         rd_id = hal_remote_lw( XPTR( fifo_cxy , &fifo_ptr->rd_id ) );
     79        rd_id = hal_remote_l32( XPTR( fifo_cxy , &fifo_ptr->rd_id ) );
    8080
    8181        // compute number of full slots
     
    8989        // - deschedule without blocking if possible
    9090        // - 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 );
    9393
    9494        // increment watchdog
     
    100100
    101101    // copy item to fifo
    102         hal_remote_swd( XPTR( fifo_cxy , &fifo_ptr->data[ptw] ), item );
     102        hal_remote_s64( XPTR( fifo_cxy , &fifo_ptr->data[ptw] ), item );
    103103        hal_fence();
    104104
    105105    // set the slot valid flag
    106         hal_remote_sw( XPTR( fifo_cxy , &fifo_ptr->valid[ptw] ) , 1 );
     106        hal_remote_s32( XPTR( fifo_cxy , &fifo_ptr->valid[ptw] ) , 1 );
    107107        hal_fence();
    108108
     
    111111} // end remote_fifo_put_item()
    112112
    113 //////////////////////////////////////////////////
    114 error_t local_fifo_get_item( remote_fifo_t * fifo,
    115                              uint64_t      * item )
     113///////////////////////////////////////////////////
     114error_t remote_fifo_get_item( remote_fifo_t * fifo,
     115                              uint64_t      * item )
    116116{
    117117    // get fifo state
     
    138138
    139139        return 0;
    140 } // end local_fifo_get_item()
     140
     141} // end remote_fifo_get_item()
    141142
    142143/////////////////////////////////////////
     
    146147
    147148    // 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 );
    150151   
    151152    // get read and write pointers
    152         uint32_t wr_id = hal_remote_lw( XPTR( cxy , &ptr->wr_id ) );
    153         uint32_t rd_id = hal_remote_lw( 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 ) );
    154155
    155156    // compute number of full slots
     
    160161}
    161162
    162 //////////////////////////////////////////////////
    163 bool_t local_fifo_is_empty( remote_fifo_t * fifo )
     163///////////////////////////////////////////////////
     164bool_t remote_fifo_is_empty( remote_fifo_t * fifo )
    164165{
    165166    return ( fifo->wr_id == fifo->rd_id );
     
    172173
    173174    // 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 );
    176177   
    177178    // get read and write pointers
    178         uint32_t wr_id = hal_remote_lw( XPTR( cxy , &ptr->wr_id ) );
    179         uint32_t rd_id = hal_remote_lw( 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 ) );
    180181
    181182    // compute number of full slots
Note: See TracChangeset for help on using the changeset viewer.