コード例 #1
0
ファイル: InterruptArp32.c プロジェクト: andreimironenko/ipc
/*!
 *  ======== InterruptArp32_intRegister ========
 */
Void InterruptArp32_intRegister(UInt16 remoteProcId,
                                 IInterrupt_IntInfo *intInfo,
                                 Fxn func, UArg arg)
{
    UInt        key;
    Hwi_Params  hwiAttrs;
    Error_Block eb;
    InterruptArp32_FxnTable *table;

    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors, 
            ti_sdo_ipc_Ipc_A_internal);

    /* Assert that our MultiProc id is set correctly */
    Assert_isTrue((InterruptArp32_arp32ProcId == MultiProc_self()), 
                   ti_sdo_ipc_Ipc_A_internal);

    /* init error block */
    Error_init(&eb);
    
    /* Disable global interrupts */
    key = Hwi_disable();

    table = &(InterruptArp32_module->fxnTable);
    table->func = func;
    table->arg  = arg;

    InterruptArp32_intClear(remoteProcId, intInfo);
    
    /* Make sure the interrupt only gets plugged once */
    InterruptArp32_module->numPlugged++;
    if (InterruptArp32_module->numPlugged == 1) { 
        /* Register interrupt to remote processor */
        Hwi_Params_init(&hwiAttrs);
        hwiAttrs.arg = arg;
        hwiAttrs.vectorNum = intInfo->intVectorId;

        Hwi_create(ARP32INT,
                  (Hwi_FuncPtr)InterruptArp32_intShmStub,
                   &hwiAttrs,
                   &eb);
    }

    /* enable the mailbox and Hwi */
    InterruptArp32_intEnable(remoteProcId, intInfo);
    
    /* Restore global interrupts */
    Hwi_restore(key);
}
コード例 #2
0
ファイル: InterruptArp32.c プロジェクト: skitlab/ti-ipc
/*!
 *  ======== InterruptArp32_intRegister ========
 */
Void InterruptArp32_intRegister(UInt16 remoteProcId,
                                 IInterrupt_IntInfo *intInfo,
                                 Fxn func, UArg arg)
{
    UInt        key;
    UInt16      index;
    UInt        mbxIdx;
    Hwi_Params  hwiAttrs;
    Error_Block eb;
    InterruptArp32_FxnTable *table;

    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors, 
           ti_sdo_ipc_Ipc_A_internal);

    /* Assert that our MultiProc id is set correctly */
    Assert_isTrue((InterruptArp32_eve0ProcId == MultiProc_self()) ||
                  (InterruptArp32_eve1ProcId == MultiProc_self()) ||
                  (InterruptArp32_eve2ProcId == MultiProc_self()) ||
                  (InterruptArp32_eve3ProcId == MultiProc_self()), 
                   ti_sdo_ipc_Ipc_A_internal);

    /* init error block */
    Error_init(&eb);

    index = PROCID(remoteProcId);

    /* Disable global interrupts */
    key = Hwi_disable();

    table = &(InterruptArp32_module->fxnTable[index]);
    table->func = func;
    table->arg  = arg;

    InterruptArp32_intClear(remoteProcId, intInfo);

    if ((index == DSP0_ID) || (index == BENELLI_CORE0_ID)) {
        mbxIdx = 0;
    }
    else if ((index == DSP1_ID) || (index == BENELLI_CORE1_ID)) {
        mbxIdx = 1;
    }
    else if (index < InterruptArp32_NUM_EVES) {
        mbxIdx = 2;
    }
 
    /* Make sure the interrupt only gets plugged once */
    InterruptArp32_module->numPlugged[mbxIdx]++;
    if (InterruptArp32_module->numPlugged[mbxIdx] == 1) { 
        /* Register interrupt to remote processor */
        Hwi_Params_init(&hwiAttrs);
        hwiAttrs.arg = arg;
        hwiAttrs.vectorNum = intInfo->intVectorId;

        Hwi_create(InterruptArp32_eveInterruptTable[index],
                  (Hwi_FuncPtr)InterruptArp32_intShmStub,
                   &hwiAttrs,
                   &eb);
        Hwi_enableInterrupt(InterruptArp32_eveInterruptTable[index]);
    }

    /* enable the mailbox and Hwi */
    InterruptArp32_intEnable(remoteProcId, intInfo);
    
    /* Restore global interrupts */
    Hwi_restore(key);
}