示例#1
0
// **********************************************************************
// **********************************************************************
// simulate asynchronous interrupts by polling events during idle loop
//
void pollInterrupts(void)
{
	// check for task monopoly
	pollClock = clock();
	assert("Timeout" && ((pollClock - lastPollClock) < MAX_CYCLES));
	lastPollClock = pollClock;

	// check for keyboard interrupt
	if ((inChar = GET_CHAR) > 0)
	{
	  keyboard_isr();
	}

	// timer interrupt
	timer_isr();

	return;
} // end pollInterrupts
示例#2
0
文件: us_ticker.c 项目: AsamQi/mbed
uint32_t us_ticker_read() {
    if (!us_ticker_inited)
        us_ticker_init();
        
    uint32_t retval;
    __disable_irq(); 
    retval = (timer_ldval - PIT_TIMER.CVAL) / clk_mhz; //Hardware bits
    retval |= msb_counter << __CLZ(clk_mhz);           //Software bits
    
    if (PIT_TIMER.TFLG == 1) {                         //If overflow bit is set, force it to be handled
        timer_isr();                                   //Handle IRQ, read again to make sure software/hardware bits are synced
        NVIC_ClearPendingIRQ(PIT_TIMER_IRQ);
        return us_ticker_read();
    }

    __enable_irq();
    return retval;
}
示例#3
0
文件: os345.c 项目: jrasm91/cs345
// **********************************************************************
// **********************************************************************
// simulate asynchronous interrupts by polling events during idle loop
//
static void pollInterrupts(void)
{
	// check for task monopoly
	pollClock = clock();
	assert("Timeout" && ((pollClock - lastPollClock) < MAX_CYCLES));
	lastPollClock = pollClock;

	// check for keyboard interrupt
	int inCharInt = 0;
	if ((inCharInt = GET_CHAR) > 0)
	{
		if(inCharInt == 224){
			arrowKey = TRUE;
			inChar = GET_CHAR;
		}
		else
			inChar = (char)inCharInt;
		keyboard_isr();
	}
	// timer interrupt
	timer_isr();

	return;
} // end pollInterrupts
示例#4
0
void low_priority_isr(void)
{
    adc_isr();
    timer_isr();
}
示例#5
0
文件: main.c 项目: xawirq/rpds-fw
void interrupts(void) {
    if (is_timer_isr()) timer_isr();
    if (is_adc_isr()) adc_isr();
    if (is_usart_isr()) usart_isr();
}