Пример #1
0
/****************************************************************************************************
 * @fn      ASFTimerExpiry
 *          Handles the timer expiry by sending message to the task that created the timer
 *
 * @param   info  pseudo pointer to timer control block of the timer that expired.
 *
 * @return  none
 *
 * @see     ASFKillTimer()
 ***************************************************************************************************/
void _ASFTimerExpiry ( uint16_t info, char *_file, int _line )
{
    AsfTimer *pTimer;
    int wasMasked = __disable_irq();
    pTimer = (AsfTimer *)(RAM_START + info);
    //Look for our magic number to be sure we got the right pointer
    ASF_assert_var( pTimer->sysUse == TIMER_SYS_ID,  pTimer->ticks, pTimer->userValue, pTimer->owner);
    SendTimerExpiry( pTimer );
    pTimer->sysUse = (uint32_t)-1; //Timer no longer in use
    if (!wasMasked) __enable_irq();
}
Пример #2
0
/****************************************************************************************************
 * @fn      ASFTimerExpiry
 *          Handles the timer expiry by sending message to the task that created the timer
 *
 * @param   info  pseudo pointer to timer control block of the timer that expired.
 *
 * @return  none
 *
 * @see     ASFKillTimer()
 ***************************************************************************************************/
void _ASFTimerExpiry ( uint32_t info, char *_file, int _line )
{
    AsfTimer *pTimer;
    int wasMasked = __disable_irq();
    pTimer = AsfTimerGetTimerFromList(info);
    AsfTimerRemoveTimerFromList(info);

    //Look for our magic number to be sure we got the right pointer
    ASF_assert_var( pTimer->sysUse == TIMER_SYS_ID,  pTimer->ticks, pTimer->userValue, pTimer->owner);
    /* Reset timer before starting to process it.
     *  This is to prevent a race condition, where the processing task restarts a timer before we reset here.
     * Timer thread runs on a lower priority then, the processing task
     */
    pTimer->sysUse = (uint32_t)-1; //Timer no longer in use
    SendTimerExpiry( pTimer );
    if (!wasMasked) __enable_irq();
}