示例#1
0
/*
 *  ======== Timer_periodicNestStub ========
 */
Void Timer_periodicNestStub(UArg arg)
{
    Timer_Object *obj;
    ti_catalog_msp430_peripherals_timers_TimerRegs *timer;

    obj = Timer_module->handles[(UInt)arg];

    timer = (ti_catalog_msp430_peripherals_timers_TimerRegs *)
        Timer_module->device[obj->id].baseAddr;

    /* save previous threshold value */
    obj->prevThreshold = timer->cc_compare_0;

    /* set compare threshold for next periodic interrupt */
    timer->cc_compare_0 += obj->period;

    /* allow nesting of other interrupts ... */
    timer->cctl_0 &= ~TIMER_COMPARE_INTR_ENABLE;
    Hwi_enable();

    /* call the tick function */
    obj->tickFxn(obj->arg);

    /* disable interrupts as unwind the ISR */
    Hwi_disable();
    timer->cctl_0 |= TIMER_COMPARE_INTR_ENABLE;
}
示例#2
0
/*
 *  ======== Timer_isrStub ========
 */
Void Timer_isrStub(UArg arg)
{
    ti_catalog_arm_peripherals_timers_TimerRegsM4 *timer;
    Timer_Object *obj = (Timer_Object *)arg;

    timer = (ti_catalog_arm_peripherals_timers_TimerRegsM4 *)
        Timer_module->device[obj->id].baseAddr;

    /* clear all timer interrupt status bits */
    Timer_write(obj->altclk, &timer->GPTMICR, 0xFFFFFFFF);

    /* for DYNAMIC, mode latch prevThreshold and detect rollovers */
    if (obj->runMode == Timer_RunMode_DYNAMIC) {
        /* 
         * if the current threshold is greater than the prevThreshold
         * then a rollover has occurred.
         */
        if (obj->prevThreshold < timer->GPTMTAMATCHR) {
            obj->rollovers += 1;
        }
        obj->prevThreshold = timer->GPTMTAMATCHR;
    }

    obj->tickFxn(obj->arg);
}
示例#3
0
/*
 *  ======== Timer_periodicStub ========
 */
Void Timer_periodicStub(UArg arg)
{
    Timer_Object *obj = (Timer_Object *)arg;
    volatile UInt32 dummy;

    dummy = Hwi_nvic.STCSR; /* read to ack the interrupt */
    Hwi_nvic.ICSR = 0x02000000; /* clear SysTick pending */

    obj->tickFxn(obj->arg);
}
示例#4
0
/*
 *  ======== Timer_oneShotStub ========
 */
Void Timer_oneShotStub(UArg arg)
{
    Timer_Object *obj;
    obj = Timer_module->handles[(UInt)arg];

    /* stop the timer (and disable this interrupt source) */
    Timer_stop(obj);

    /* call the tick function */
    obj->tickFxn(obj->arg);
}
/*
 *  ======== Timer_stub ========
 */
Void Timer_stub(UArg arg)
{
    Timer_Object *obj = (Timer_Object *)arg;
    TimerRegs *timer;

    timer = (TimerRegs *)Timer_module->device[obj->id].baseAddr;

    /* acknowledge the interrupt */
    timer->tisr = obj->tier;

    /* call the user's ISR */
    obj->tickFxn(obj->arg);
}
示例#6
0
/*
 *  ======== Timer_oneShotNestStub ========
 */
Void Timer_oneShotNestStub(UArg arg)
{
    Timer_Object *obj;
    obj = Timer_module->handles[(UInt)arg];

    /* stop the timer (and disable this interrupt source) */
    Timer_stop(obj);

    /* enable interrupts to allow nesting */ 
    Hwi_enable();            

    /* call the tick function */
    obj->tickFxn(obj->arg);

    /* disable interrupts as unwind the ISR */
    Hwi_disable();           
}
示例#7
0
/*
 *  ======== Timer_periodicStub ========
 */
Void Timer_periodicStub(UArg arg)
{
    Timer_Object *obj;
    ti_catalog_msp430_peripherals_timers_TimerRegs *timer;

    obj = Timer_module->handles[(UInt)arg];

    timer = (ti_catalog_msp430_peripherals_timers_TimerRegs *)
        Timer_module->device[obj->id].baseAddr;

    /* save previous threshold value */
    obj->prevThreshold = timer->cc_compare_0;

    /* set compare threshold for next periodic interrupt */
    timer->cc_compare_0 += obj->period;

    /* call the tick function */
    obj->tickFxn(obj->arg);
}
示例#8
0
/*
 *  ======== Timer_dynStub ========
 */
Void Timer_dynStub(UArg arg)
{
    Timer_Object *obj = (Timer_Object *)arg;
    TimerRegs *timer;
    UInt irqStatus;

    timer = (TimerRegs *)Timer_module->device[obj->id].baseAddr;

    /* get interrupt status flags */
    irqStatus = timer->tisr;

    /* if this is a rollover (overflow) interrupt ... */
    if (irqStatus & TIMER_IRQSTATUS_OVF_IT_FLAG) {

        /* acknowledge the interrupt */
        timer->tisr |= TIMER_IRQSTATUS_OVF_IT_FLAG;

        obj->rollovers++;
    }

    /* if this is a threshold match interrupt ... */
    if (irqStatus & TIMER_IRQSTATUS_MAT_IT_FLAG) {

        /* acknowledge the interrupt */
        timer->tisr |= TIMER_IRQSTATUS_MAT_IT_FLAG;

        /* save previous threshold value */
        obj->prevThreshold = timer->tmar;

        /* set compare threshold for next periodic interrupt */
        timer->tmar += obj->period;

        /* call the user's ISR */
        obj->tickFxn(obj->arg);
    }
}