Exemple #1
0
/*
 *  ======== Hwi_Module_startup ========
 *  must initialize IRQ (and SWI?) SPs (R13s)
 */
Int Hwi_Module_startup (Int startupPhase)
{
    int i;
    Hwi_Object *hwi;

    /* must wait for these modules to initialize first */
    if (!Startup_rtsDone()) {
        return Startup_NOTDONE;
    }

    /* okay to proceed with initialization */

#ifndef ti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS
    for (i = 0; i < Hwi_hooks.length; i++) {
        if (Hwi_hooks.elem[i].registerFxn != NULL) {
            Hwi_hooks.elem[i].registerFxn(i);
        }
    }
#endif
    Hwi_initIntController();

    /*
     * Initialize the pointer to the isrStack.
     *
     * The dispatcher's SP is decremented to accomodate its local variables
     * BEFORE switching to the ISR stack. Consequently, the intial value of
     * the ISR stack SP must leave room for these variables.
     *
     * Leave room for up to 32 32 bit local variables.
     */
    Hwi_module->isrStack =
        (Char *) (((UInt32) (Hwi_module->isrStackBase) & 0xfffffff8) +
                   (UInt32) (Hwi_module->isrStackSize) - (32 * sizeof(Int)));

    /*
     * Signal that we're executing on the ISR stack.
     */
    Hwi_module->taskSP = (Char *)-1;

    /*
     * Initialize the dispatchTable with default entries pointing
     * to nonPluggedHwi() handler.
     *
     * This will catch any triggered Interrupts that were not created
     * using the Hwi module.
     */
    for (i = 0; i < Hwi_NUM_INTERRUPTS; i++) {
        hwi = Hwi_module->dispatchTable[i];
        if (hwi !=  ti_sysbios_family_arm_gic_Hwi_Module_State_nonPluggedHwi()) {
            Hwi_postInit(hwi, NULL);
        }
    }
    return (Startup_DONE);
}
Exemple #2
0
/*
 *  ======== Hwi_Instance_init ========
 */
Int Hwi_Instance_init(Hwi_Object *hwi, Int intNum,
                      Hwi_FuncPtr fxn, const Hwi_Params *params,
                      Error_Block *eb)
{
    Int status;

    /* only Hwi 4-15 can be created to use Hwi dispatcher */
    if (intNum < 4 || intNum > 15) {
        Error_raise(eb, Hwi_E_invalidIntNum, intNum, 0);
        return (1);
    }

    if (Hwi_module->dispatchTable[intNum] != NULL) {
        Error_raise(eb, Hwi_E_alreadyDefined, intNum, 0);
        return (1);
    }

    Hwi_module->dispatchTable[intNum] = hwi;
    Hwi_plug(intNum, Hwi_dispatchAlways);
    Hwi_reconfig(hwi, fxn, params);

#ifndef ti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS
    if (Hwi_hooks.length > 0) {
        /* Allocate environment space for each hook instance. */
        hwi->hookEnv = Memory_calloc(Hwi_Object_heap(),
                Hwi_hooks.length * sizeof(Ptr), 0, eb);

        if (hwi->hookEnv == NULL) {
            return (2);
        }
    }
#endif

    hwi->irp = 0;

    status = Hwi_postInit(hwi, eb);

    if (Error_check(eb)) {
        return (3 + status);
    }

    return (0);
}
Exemple #3
0
/*
 *  ======== Hwi_Instance_init  ========
 */
Int Hwi_Instance_init(Hwi_Object *hwi, Int intNum, Hwi_FuncPtr fxn,
        const Hwi_Params *params, Error_Block *eb)
{
    Int status;

    if (intNum >= Hwi_NUM_INTERRUPTS) {
        Error_raise(eb, Hwi_E_badIntNum, intNum, 0);
        return (1);
    }

    if (Hwi_module->dispatchTable[intNum] !=
        ti_sysbios_family_arm_gic_Hwi_Module_State_nonPluggedHwi()) {
        Error_raise(eb, Hwi_E_alreadyDefined, intNum, 0);
        return (1);
    }

    Hwi_module->dispatchTable[intNum] = hwi;
    Hwi_reconfig(hwi, fxn, params);

#ifndef ti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS
    if (Hwi_hooks.length > 0) {
        /* Allocate environment space for each hook instance. */
        hwi->hookEnv = Memory_calloc(Hwi_Object_heap(),
                Hwi_hooks.length * sizeof(Ptr), 0, eb);

        if (hwi->hookEnv == NULL) {
            return (1);
        }
    }
#endif

    hwi->irp = 0;

    status = Hwi_postInit(hwi, eb);

    if (Error_check(eb)) {
        return (2 + status);
    }

    return (0);
}
Exemple #4
0
/*
 *  ======== Hwi_Module_startup ========
 */
Int Hwi_Module_startup(Int phase)
{
    Int i;
    Hwi_Object *hwi;
#ifdef ti_sysbios_BIOS_useSK__D
    UInt32* fxnPtr = &ti_sysbios_family_c64p_Hwi_int2;
#endif

    /* Task and Swi APIs used not called until BIOS_start() */
    /* okay to proceed with initialization */

#ifndef ti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS
    for (i = 0; i < Hwi_hooks.length; i++) {
        if (Hwi_hooks.elem[i].registerFxn != NULL) {
            Hwi_hooks.elem[i].registerFxn(i);
        }
    }
#endif

#ifdef ti_sysbios_BIOS_useSK__D
    /* register interrupts 2-15 with SK */
    for (i = 2; i < 16; i++) {
        SK_registerOSIntr(i, fxnPtr);
        fxnPtr = fxnPtr + 8;
    }

    /* NMI vector */
    fxnPtr = &ti_sysbios_family_c64p_Hwi_int1;

    /* Register NMI vector with SK for exceptions */
    SK_registerOSHWE(fxnPtr);

    /* Register NMI vector with SK for SWE processing */
    SK_registerOSSWE(fxnPtr);

#else
    /* Initialize the vector table pointer, ISTP */
    ISTP = (UInt) Hwi_module->vectorTableBase;

#endif

    /*
     * Initialize the pointer to the isrStack. These symbols are part of the
     * Hwi_module (instead of floating) in order to support ROM.
     * Leave room for one 32-bit value pushed by xdc_runtime_Startup_reset()
     * (for cases where intentionally reset as resume from power down),
     * and maintain double word alignment.
     */
    Hwi_module->isrStack = Hwi_getIsrStackAddress() - 8;

    Hwi_module->taskSP = (Char *)-1;/* signal that we're executing on the */
                                        /* ISR stack */
    /* initialize INTMUX */
    for (i = 4; i < Hwi_NUM_INTERRUPTS; i++) {
        if (Hwi_module->intEvents[i] != -1) {
            Hwi_eventMap(i, Hwi_module->intEvents[i]);
        }
        else {
            /* keep intEvents[] current for ROV */
            Hwi_module->intEvents[i] = Hwi_getEventId(i);
        }
    }

    /* start with a clean slate after initializing INTMUX */
    ICR = 0xffff;

    Hwi_enableIER(Hwi_module->ierMask); /* IER per static Hwi settings */

    for (i = 0; i < Hwi_NUM_INTERRUPTS; i++) {
        hwi = Hwi_module->dispatchTable[i];
        if (hwi !=  NULL) {
            Hwi_postInit(hwi, NULL);
        }
    }

    return (Startup_DONE);
}