Ejemplo n.º 1
0
void DelayMs(WORD delay) {
    unsigned int int_status;
    while (delay--) {
        int_status = INTDisableInterrupts();
        OpenCoreTimer(500000 / 2000);
        INTRestoreInterrupts(int_status);
        mCTClearIntFlag();
        while (!mCTGetIntFlag());
    }
    mCTClearIntFlag();
}
void delayMs(WORD delay)
{
    unsigned int int_status;
    while (delay--)
    {
        //int_status = INTDisableInterrupts();
        OpenCoreTimer(GetSystemClock() / 2000);
        //INTRestoreInterrupts(int_status);
        mCTClearIntFlag();
        while (!mCTGetIntFlag());
    }
    mCTClearIntFlag();
}
Ejemplo n.º 3
0
//************************************************************************
void __ISR(_CORE_TIMER_VECTOR, ipl2) CoreTimerHandler(void)
{
unsigned int cur_timer_val;
	

	cur_timer_val	=	ReadCoreTimer();
	// clear the interrupt flag
	mCTClearIntFlag();

	// update the period
	UpdateCoreTimer(CORE_TICK_RATE);

	// .. things to do
	
	// Check for CoreTimer overflows, record for micros() function
	// If micros() is not called more often than every 107 seconds (the
	// period of overflow for CoreTimer) then overflows to CoreTimer
	// will be lost. So we put code here to check for this condition
	// and record it so that the next call to micros() will be accurate.
	if (!gMicros_calculating)
	{
		if (cur_timer_val < gCore_timer_last_val)
		{
			// We have an overflow
			gCore_timer_micros		+=	((0xFFFFFFFF - gCore_timer_last_val) + cur_timer_val) / CORETIMER_TICKS_PER_MICROSECOND;
			gCore_timer_first_val	=	cur_timer_val;
			gMicros_overflows	=	gCore_timer_micros;
		}
		gCore_timer_last_val	=	cur_timer_val;
	}
	
	// Count this millisecond
	gTimer0_millis++;
}
void DelayMs(WORD time)
{
    while(time--)
    {
        unsigned int    int_status;

        int_status = INTDisableInterrupts();
        OpenCoreTimer(GetSystemClock() / 2000); // core timer is at 1/2 system clock
        INTRestoreInterrupts(int_status);

        mCTClearIntFlag();

        while(!mCTGetIntFlag());
    }

    mCTClearIntFlag();
}
Ejemplo n.º 5
0
Archivo: timing.c Proyecto: ipeet/ubw32
//! Keep 1ms resolution system time
void __ISR(_CORE_TIMER_VECTOR, ipl2) CoreTimerHandler(void)
{
    // clear the interrupt flag
    mCTClearIntFlag();

    // update the period
    UpdateCoreTimer(CORE_TICK_RATE);

    ++_sys_time;
}
Ejemplo n.º 6
0
void __ISR(_CORE_TIMER_VECTOR, ipl6) CoreTimerHandler(void)
{
	/* update the period */
	UpdateCoreTimer(CORE_TICK_RATE);

	/* do repetitive tasks here */
	stepgen();

	/* clear the interrupt flag */
	mCTClearIntFlag();
}
Ejemplo n.º 7
0
/*********************************************************************
 * Function:  		void T1Handler(void)     
 *
 * PreCondition:    
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    
 *
 * Overview:        FatFs requires a 1ms tick timer to aid
 *					with low level function timinng
 *
 * Note:           
 ********************************************************************/
void __attribute__((interrupt(ipl1), vector(_CORE_TIMER_VECTOR))) T1Handler(void)
{
	//static const BYTE dom[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	//static int div1k;
	//BYTE n;
	
	// clear the interrupt flag
	mCTClearIntFlag();
	OpenCoreTimer(FOSC/2000);
	//Timer++;

	disk_timerproc();	// call the low level disk IO timer functions
}
Ejemplo n.º 8
0
void  BSP_TickISR_Handler (void)
{
    mCTClearIntFlag();                                                        // Clear the core timer interrupt             
    UpdateCoreTimer(BSP_TMR_RELOAD);                                          // Prepare for the next core timer interrupt  
}
Ejemplo n.º 9
0
// this runs on a separate stack (interrupts stack)->original Task stack already saved
void handleSysTimerINT() {
    /*if()*/
    HAL::GetAlarmHandler()->HandleAlarm();

    mCTClearIntFlag();
}
Ejemplo n.º 10
0
void __ISR(_CORE_TIMER_VECTOR, IPL2) CTHandle(){
	mCTClearIntFlag();
	dflag=1;
}
Ejemplo n.º 11
0
void __ISR(_CORE_TIMER_VECTOR, ipl2) CoreTimerHandler(void)
{
	++_nu__Timer__carry;
	//UpdateCoreTimer(CORE_TICK_RATE);
	mCTClearIntFlag();
}