10.02_devices/2_src/rx211.cpp
// thread
// no background activity for bus interface
thread
no background activity for bus interface
thread no background activity for bus interface
void RX211_c::worker(unsigned instance) {
    UNUSED(instance); 
    while (!workers_terminate) {
        int res = pthread_cond_wait(&on_after_register_access_cond,
                                    &on_after_register_access_mutex);
        if (res != 0) {
            ERROR("RX211_c::worker() pthread_cond_wait = %d = %s>", res, strerror(res));
            continue;
        }
        if (state != state_dma_busy)
            continue ;
        switch (function_select) {
        case RX11_CMD_EMPTY_BUFFER:
            if (uCPU->rx2wc_overflow_error(function_select, function_density, rx2wc))
                break ; 
            worker_transfer_uCPU2DMA() ;
            break ;
        case RX11_CMD_FILL_BUFFER:
            if (uCPU->rx2wc_overflow_error(function_select, function_density, rx2wc))
                break ; 
            worker_transfer_DMA2uCPU() ;
            break ;
        case RX11_CMD_READ_ERROR_CODE:
            worker_transfer_uCPU2DMA() ;
            break ;
        default:
            assert(false) ; 
        }
        state = state_base ;
        done = true ;
        update_status(__func__) ;
    }
}
void RX211_c :: worker ( unsigned instance ) { UNUSED ( instance ) ; while ( ! workers_terminate ) { int res = pthread_cond_wait ( & on_after_register_access_cond , & on_after_register_access_mutex ) ; if ( res != 0 ) { ERROR ( " " , res , strerror ( res ) ) ; continue ; } if ( state != state_dma_busy ) continue ; switch ( function_select ) { case RX11_CMD_EMPTY_BUFFER : if ( uCPU -> rx2wc_overflow_error ( function_select , function_density , rx2wc ) ) break ; worker_transfer_uCPU2DMA ( ) ; break ; case RX11_CMD_FILL_BUFFER : if ( uCPU -> rx2wc_overflow_error ( function_select , function_density , rx2wc ) ) break ; worker_transfer_DMA2uCPU ( ) ; break ; case RX11_CMD_READ_ERROR_CODE : worker_transfer_uCPU2DMA ( ) ; break ; default : assert ( false ) ; } state = state_base ; done = true ; update_status ( __func__ ) ; } }
thread
no background activity for bus interface
thread no background activity for bus interface
// only one // write into RXDB starts DMA // only worker operation is DMA. // RX2WC and RX2BA set via RXDB access // update_status() already called by uCPU // update_status() already called by uCPU // fix 4 word transfer, no rx2wc overflow possible // unexpected state