Example #1
0
IOReturn WLCard::
handleInterrupt()
{
    disableInterrupts();
    UInt16 evStat = getRegister(wlEvStat);
    setRegister(wlEvAck, ~_interrupts);

    /*
     * Check for "phantom interrupt"
     */
    if (!evStat)
	return kIOReturnSuccess;

    if (evStat & wleRx) {
	_handleRx();
        setRegister(wlEvAck, wleRx);
    }
    if (evStat & wleTx) {
	_handleTx();
        setRegister(wlEvAck, wleTx);
    }
    if (evStat & wleTxExc) {
	_handleTxExc();
        setRegister(wlEvAck, wleTxExc);
    }
    if (evStat & wleAlloc) {
	_handleAlloc();
        setRegister(wlEvAck, wleAlloc);
    }
    if (evStat & wleCmd) {
	_handleCmd();
        setRegister(wlEvAck, wleCmd);
    }
    if (evStat & wleInfo) {
	_handleInfo();
        setRegister(wlEvAck, wleInfo);
    }
    if (evStat & wleInfDrop) {
	_handleInfDrop();
        setRegister(wlEvAck, wleInfDrop);
    }
    if (evStat & wleWTErr) {
	_handleWTErr();
        setRegister(wlEvAck, wleWTErr);
    }
    if (evStat & wleTick) {
	_handleTick();
        setRegister(wlEvAck, wleTick);
    }

    enableInterrupts();

    return kIOReturnSuccess;
}
void executeTest(Test_Case * tc)
{
    Telegram * tel = tc->telegram;
    unsigned int tn = 1;
    void * refState  = tc->refState;
    void * stepState = tc->stepState;

    IAP_Init_Flash(0xFF);
    if(tc->eepromSetup) tc->eepromSetup();
    memcpy(FLASH_BASE_ADDRESS + iapFlashSize() - FLASH_SECTOR_SIZE, userEepromData, 0x100);
    bcu.begin(tc->manufacturer, tc->deviceType, tc->version);
    sndStartIdx = 0;
    systemTime  = 0;
    wfiSystemTimeInc = 1;
    setup();
    wfiSystemTimeInc = 0;
    if (tc->powerOnDelay)
    {
        REQUIRE(tc->powerOnDelay == systemTime);
    }
    if (tc->setup) tc->setup();
    if (tc->gatherState) tc->gatherState(refState, NULL);
    while (tel->type != END)
    {
        // clear the "interrupts" to allow sending of a new telegram
        LPC_TMR16B1->IR = 0x00;
        userEepromModified = 0;
        INFO("Step " << tn << " of test case " << tc->name);
        if (BREAK == tel->type)
                tn = _handleBreak (tc, tel, tn);
        else         if (TEL_RX == tel->type)
                _handleRx(tc, tel, tn);
        else if (TEL_TX == tel->type)
                _handleTx(tc, tel, tn);
        else if (CHECK_TX_BUFFER == tel->type)
                _handleCheckTx(tc, tel, tn);
        else if (TIMER_TICK == tel->type)
                _handleTime(tc, tel, tn);

        if (tel->stepFunction) tel->stepFunction(refState);
        if (tc->gatherState) tc->gatherState(stepState, refState);
        tn++;
        tel++;
    }
}