src/lib/occlib/ipc_core.c
///////////////////////////////////////////////////////////////////////////////
/// Disable recieving new IPC commands for a processor.
///
Disable recieving new IPC commands for a processor.
Disable recieving new IPC commands for a processor .
int ipc_disable(uint32_t target_id)
{
    int i;
    int rc = IPC_RC_SUCCESS;
    ipc_target_t* target_cbufs;
    KERN_MACHINE_CONTEXT    ctx;
    do
    {
        if(target_id > OCCHW_INST_ID_MAX)
        {
            rc = IPC_RC_INVALID_TARGET_ID;
            break;
        }
        if(target_id == OCCHW_INST_ID_SELF)
        {
            G_ipc_enabled = 0;
        }
        KERN_CRITICAL_SECTION_ENTER(KERN_CRITICAL, &ctx);
        KERN_IRQ_DISABLE(IPC_GET_IRQ(target_id));
        target_cbufs = &OSD_PTR->ipc_data.targets[target_id];
        for(i = 0; i <= OCCHW_INST_ID_MAX; i++)
        {
            target_cbufs->counts.reads.counts8[i] =
                target_cbufs->counts.writes.counts8[i] - (IPC_CBUF_SIZE * 2);
        }
        KERN_CRITICAL_SECTION_EXIT(&ctx);
    }
    while(0);
    return rc;
}
int ipc_disable ( uint32_t target_id ) { int i ; int rc = IPC_RC_SUCCESS ; ipc_target_t * target_cbufs ; KERN_MACHINE_CONTEXT ctx ; do { if ( target_id > OCCHW_INST_ID_MAX ) { rc = IPC_RC_INVALID_TARGET_ID ; break ; } if ( target_id == OCCHW_INST_ID_SELF ) { G_ipc_enabled = 0 ; } KERN_CRITICAL_SECTION_ENTER ( KERN_CRITICAL , & ctx ) ; KERN_IRQ_DISABLE ( IPC_GET_IRQ ( target_id ) ) ; target_cbufs = & OSD_PTR -> ipc_data . targets [ target_id ] ; for ( i = 0 ; i <= OCCHW_INST_ID_MAX ; i ++ ) { target_cbufs -> counts . reads . counts8 [ i ] = target_cbufs -> counts . writes . counts8 [ i ] - ( IPC_CBUF_SIZE * 2 ) ; } KERN_CRITICAL_SECTION_EXIT ( & ctx ) ; } while ( 0 ) ; return rc ; }
Disable recieving new IPC commands for a processor.
Disable recieving new IPC commands for a processor .
// Check for invalid target ID // Prevent us from sending out new commands //disable interrupts to prevent the IPC interrupt handler or other threads //on this instance from interrupting us and changing the read count or //interrupt mask bits under our feet. //mask off the IPC interrupt for the target (this is mostly for the case //where we are diabling IPC for ourselves). // Make each cbuf appear to be more than full. This signals to // senders that the buffer is not just full, but blocked.  When // the sender sees this it knows not to place more messages on the cbuf. // NOTE: we are updating the read register, which is allowed if the cbuf // is owned by the instance this code is running on OR if the instance // is known to be halted.