Download DSTni User Guide
Transcript
*/
static void interrupt vTmrInt(void)
{
/* Clear the Max Count bit */
outport(DST_REG_T1CON, 0x2009);
/* Bump the system clock */
mu32SysTime++;
}
/* Clear the interrupt */
outport(DST_REG_EOI, DST_IVECT_TMR1);
/*
**************************************************************
* FUNCTION:
void vDstTimerHalt( void )
*
* ARGUMENTS:
0
*
* RETURNS:
void
*
* DESCRIPTION:
*
Halts operation of the timer
*
**************************************************************
*/
void vDstTimerHalt(void)
{
/* Make sure timers are stopped by clearing the EN bit */
outport(DST_REG_T1CON, 0x4000);
outport(DST_REG_T2CON, 0x4000);
/* Mask the timer interrupt */
outport(DST_REG_IMASK, inport(DST_REG_IMASK) | DST_IMASK_TMR);
}
/* Clear any timer interrupts that may be pending */
outport(DST_REG_EOI, DST_IVECT_TMR1);
/*
**************************************************************
* FUNCTION:
U32 u32DstGetTime( void )
*
* ARGUMENTS:
0
*
* RETURNS:
U32 Number of elapsed ticks
*
* DESCRIPTION:
*
Returns number of clock ticks since the last reset.
*
**************************************************************
*/
U32 u32DstGetTime(void)
{
U32
u32Time;
** Since this is a 16 bit CPU, we need to protect against the long word SysTime being
** changed in the middle of a copy. That's why we disable interrupts during the copy.
asm pushf
asm cli
u32Time = mu32SysTime;
asm popf
return u32Time;
}
106