User guide
CIF Peripheral Model - SimpleTimer
104 CoMET Version 5.9 – Tutorial
if (IP->regMTR[MTR_ix] > Count)
MatchTicks = IP->regMTR[MTR_ix] - Count;
else
MatchTicks = (tWord32)(ULL(0x100000000)
+ IP->regMTR[MTR_ix]
- Count);
/*
** Setup the timeout.
*/
AmpiTaskScheduleCallbackTicksAfterSync
(
IP->MatchEvent[MTR_ix],
MatchTicks,
0
);
}
}
}
/**
** void ClearMatchInterrupts(const tInstanceData *IP, const tWord32 Mask)
**
** Clears match interrupts corresponding to the given bit mask.
**
** Parameters
** IP
** A pointer to the instance data.
**
** Mask
** A bit mask of the match interrupts to be cleared.
*/
static void ClearMatchInterrupts(const tInstanceData *IP, const tWord32
Mask)
{
size_t j;
/*
** Do nothing if in reset.
*/
if (IP->InReset)
return;
/*
** Clear the match interrupts as per the Mask.
*/
for (j = 0; j < lengthof(IP->MatchInterrupt); j++)
{
if ((Mask & (1 << j)) != 0)
AmpiLogicWrite(IP->MatchInterrupt[j], StdLogicL);
}
}
/**
** void Match(void *p)
**
** Called as a scheduled callback when a timer match occurs and the
** interrupt is enabled. This function drives the appropriate match
** interrupt output high, sets the corresponding bit in the status
** register and schedules a callback one tick later to schedule the
** next match interrupt.
**