예제 #1
0
/*..........................................................................*/
void QK_onIdle(void) {

    /* toggle the User LED on and then off, see NOTE02 */
    QF_INT_LOCK(dummy);
    GPIOC->DATA_Bits[USER_LED] = USER_LED;         /* turn the User LED on  */
    GPIOC->DATA_Bits[USER_LED] = 0;                /* turn the User LED off */
    QF_INT_UNLOCK(dummy);

#ifdef Q_SPY
    if ((UART0->FR & UART_FR_TXFE) != 0) {                      /* TX done? */
        uint16_t fifo = UART_TXFIFO_DEPTH;       /* max bytes we can accept */
        uint8_t const *block;
        QF_INT_LOCK(dummy);
        block = QS_getBlock(&fifo);    /* try to get next block to transmit */
        QF_INT_UNLOCK(dummy);
        while (fifo-- != 0) {                    /* any bytes in the block? */
            UART0->DR = *block++;                      /* put into the FIFO */
        }
    }
#elif defined NDEBUG
    /* Put the CPU and peripherals to the low-power mode.
    * you might need to customize the clock management for your application,
    * see the datasheet for your particular Cortex-M3 MCU.
    */
    __WFI();                                          /* Wait-For-Interrupt */
#endif
}
/*..........................................................................*/
void QK_onIdle(void) {
    QF_INT_KEY_TYPE key;

                     /* toggle the LED number 7 on and then off, see NOTE01 */
    QF_INT_LOCK(key);
    LED_ON(7);
    LED_OFF(7);
    QF_INT_UNLOCK(key);

#ifdef Q_SPY                     /* use the idle cycles for QS transmission */

    if ((UCSR0A & (1 << UDRE0)) != 0) {

        uint16_t b = QS_getByte();
        QF_INT_UNLOCK(key);                            /* unlock interrupts */
        if (b != QS_EOD) {
            UDR0 = (uint8_t)b;              /* stick the byte to the TX UDR */
        }
    }

#elif defined NDEBUG

    SMCR = (0 << SM0) | (1 << SE);/*idle sleep mode, adjust to your project */

    __sleep();             /* execute before entering any pending interrupt */
                                                 /* see Atmel AVR Datasheet */
    SMCR = 0;                                           /* clear the SE bit */

#endif                                                             /* Q_SPY */
}
예제 #3
0
파일: bsp.cpp 프로젝트: dizel3d/qpcpp
//............................................................................
void QK::onIdle(void) {
    // toggle the User LED on and then off, see NOTE01
    QF_INT_LOCK(dummy);
    GPIOC->DATA_Bits[USER_LED] = USER_LED;            // turn the User LED on
    GPIOC->DATA_Bits[USER_LED] = 0;                   // turn the User LED off
    QF_INT_UNLOCK(dummy);

#ifdef Q_SPY
    if ((UART0->FR & UART_FR_TXFE) != 0) {                         // TX done?
        uint16_t fifo = UART_TXFIFO_DEPTH;          // max bytes we can accept
        uint8_t const *block;
        QF_INT_LOCK(dummy);
        block = QS::getBlock(&fifo);      // try to get next block to transmit
        QF_INT_UNLOCK(dummy);
        while (fifo-- != 0) {                       // any bytes in the block?
            UART0->DR = *block++;                         // put into the FIFO
        }
    }
#elif defined NDEBUG
    // put the CPU and peripherals to the low-power mode
    // you might need to customize the clock management for your application,
    // see the datasheet for your particular Cortex-M3 MCU.
    __WFI();                                             // Wait-For-Interrupt
#endif
}
예제 #4
0
//------------------------------------------------------------------------------
/// Handler for PIT interrupt. Increments the timestamp counter.
//------------------------------------------------------------------------------
void ISR_Pit(void)
{
    unsigned int status;

    // Read the PIT status register
    status = PIT_GetStatus() & AT91C_PITC_PITS;



    if (status != 0) {

        // Read the PIVR to acknowledge interrupt and get number of ticks
        timestamp += (PIT_GetPIVR() >> 20);
		#ifdef QF_TICK
#ifdef QK
 	__disable_irq(); 
  	  ++QK_intNest_; 
#endif  

	QF_INT_UNLOCK();
	QF_tick();

	QF_INT_LOCK(); 
#ifdef QK 
	   --QK_intNest_;
	   if (   QK_intNest_ ==0) 
	   		QK_schedule_();
#endif
		 
#endif 
    }
예제 #5
0
파일: bsp.c 프로젝트: westlicht/camcontrol
/*..........................................................................*/
void QF_onStartup(void) {
                                      /* save the origingal DOS vectors ... */
    l_dosTmrISR   = getvect(TMR_VECTOR);

    QF_INT_LOCK();
    setvect(TMR_VECTOR, &tmrISR);
    QF_INT_UNLOCK();
}
예제 #6
0
/* case 1: Interrupt Controller available,
* "unconditional interrupt unlocking" critical section policy
* (nesting of critical sections _not_ allowed)
*/
interrupt void ISR_timer() {  /* entered with interrupts locked in hardware */
    QF_INT_UNLOCK(ignore);                             /* unlock interrupts */

    QF_tick();                            /*<-- call the QF tick processing */

    QF_INT_LOCK(ignore);                           /* lock interrupts again */
    /* send the EOI instruction to the Interrupt Controller */
}
예제 #7
0
파일: bsp.c 프로젝트: westlicht/camcontrol
/*..........................................................................*/
void QF_stop(void) {
                                    /* restore the original DOS vectors ... */
    if (l_dosTmrISR != (void interrupt (*)(void))0) { /* DOS vectors saved? */
        QF_INT_LOCK();
        setvect(TMR_VECTOR, l_dosTmrISR);
        QF_INT_UNLOCK();
    }
    _exit(0);                                                /* exit to DOS */
}
예제 #8
0
파일: bsp.cpp 프로젝트: dizel3d/qpcpp
//............................................................................
void QF::onCleanup(void) {             // restore the original DOS vectors ...
    QF_INT_LOCK(dummy);
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    QF_INT_UNLOCK(dummy);

    QS_EXIT();                                                      // exit QS
    _exit(0);                                                   // exit to DOS
}
예제 #9
0
파일: bsp.cpp 프로젝트: dizel3d/qpcpp
//............................................................................
void QF::onStartup(void) {
                                         // save the origingal DOS vectors ...
    l_dosTmrISR = _dos_getvect(TMR_VECTOR);
    l_dosKbdISR = _dos_getvect(KBD_VECTOR);

    QF_INT_LOCK(dummy);
    _dos_setvect(TMR_VECTOR, &ISR_tmr);
    _dos_setvect(KBD_VECTOR, &ISR_kbd);
    QF_INT_UNLOCK(dummy);
}
/*..........................................................................*/
void QF_onIdle(void) {
#ifdef Q_SPY
    if (ti_u0c1 != 0) {
        uint16_t b = QS_getByte();
        QF_INT_UNLOCK(dummy);                          /* unlock interrupts */
        if (b != QS_EOD) {
            u0tb = b;                    /* stick the byte to the TX buffer */
        }
    }
    else {
        QF_INT_UNLOCK(dummy);                          /* unlock interrupts */
    }
#elif (defined NDEBUG)          /* low-power mode interferes with debugging */
    /* stop all peripheral clocks that you can in your applicaiton ... */
    _asm("FSET I");            /* NOTE: the following WAIT instruction will */
    _asm("WAIT");          /* execute before entering any pending interrupt */
#else
    QF_INT_UNLOCK(dummy);                         /* just unlock interrupts */
#endif
}
예제 #11
0
파일: bsp.cpp 프로젝트: dizel3d/qpcpp
//............................................................................
void QF::onStartup(void) {
                 // set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate
    SysTick_Config(SystemFrequency / BSP_TICKS_PER_SEC);

                          // set priorities of all interrupts in the system...
    NVIC_SetPriority(SysTick_IRQn,   SYSTICK_PRIO);
    NVIC_SetPriority(GPIOPortA_IRQn, GPIOPORTA_PRIO);

    NVIC_EnableIRQ(GPIOPortA_IRQn);

    QF_INT_UNLOCK(dummy);                 // set the interrupt flag in PRIMASK
}
예제 #12
0
파일: bsp.c 프로젝트: westlicht/camcontrol
/*..........................................................................*/
void QF_stop(void) {
                                    /* restore the original DOS vectors ... */
    if (l_dosTmrISR != (void interrupt (*)(void))0) { /* DOS vectors saved? */
        QF_INT_LOCK();
        setvect(TMR_VECTOR, l_dosTmrISR);
        setvect(KBD_VECTOR, l_dosKbdISR);
        QF_INT_UNLOCK();
    }
                                                       /* clear the display */
    //Video_clearScreen(VIDEO_BGND_BLACK | VIDEO_FGND_LIGHT_GRAY);
    _exit(0);                                                /* exit to DOS */
}
/*..........................................................................*/
#pragma INTERRUPT ta0_isr (vect = 12)              /* system clock tick ISR */
void ta0_isr(void) {
    QF_INT_UNLOCK(dummy);                                     /* see NOTE01 */

#ifdef Q_SPY
    if (ir_ta1ic != 0) {                          /* interrupt request set? */
        ++l_nTimerA1Underflows; /* account for 16-bit underflow (0->0xFFFF) */
        ir_ta1ic = 0;                            /* clear the overflow flag */
    }
#endif

    QF_tick();                             /* process all armed time events */

    QF_INT_LOCK(dummy);                                       /* see NOTE01 */
}
예제 #14
0
파일: bsp.cpp 프로젝트: dizel3d/qpcpp
   //.........................................................................
void QK::onIdle(void) {
#ifdef Q_SPY
    if ((inp(l_uart_base + 5) & (1 << 5)) != 0) {            // Tx FIFO empty?
        uint16_t fifo = UART_16550_TXFIFO_DEPTH;        // 16550 Tx FIFO depth
        uint8_t const *block;
        QF_INT_LOCK(dummy);
        block = QS::getBlock(&fifo);      // try to get next block to transmit
        QF_INT_UNLOCK(dummy);
        while (fifo-- != 0) {                       // any bytes in the block?
            outp(l_uart_base + 0, *block++);
        }
    }
#endif
}
예제 #15
0
/*..........................................................................*/
void QF_onIdle(void) {        /* entered with interrupts LOCKED, see NOTE01 */

    /* toggle the blue LED on and then off, see NOTE02 */
    STM_EVAL_LEDOn (LED4);                                  /* blue LED on  */
    STM_EVAL_LEDOff(LED4);                                  /* blue LED off */

#ifdef Q_SPY
    if ((USART2->SR & USART_FLAG_TXE) != 0) {              /* is TXE empty? */
        uint16_t b = QS_getByte();
        if (b != QS_EOD) {                              /* not End-Of-Data? */
           USART2->DR = (b & 0xFF);             /* put into the DR register */
        }
    }
#elif defined NDEBUG
    __WFI();                                          /* wait for interrupt */
#endif
    QF_INT_UNLOCK(dummy);                   /* always unlock the interrupts */
}
예제 #16
0
파일: bsp.c 프로젝트: linuxbest/lsa_raid
static int idleThread(void *arg)
{
	complete(&idle_done);
	while (idle_running) {
		QF_INT_KEY_TYPE dummy;
		uint8_t const *block;
		uint16_t nBytes = QS_SPY_BLOCK;
		QF_INT_LOCK(dummy);
		block = QS_getBlock(&nBytes);
		QF_INT_UNLOCK(dummy);

		QS_send(block, nBytes);
		schedule_timeout(HZ);
	}
	complete(&idle_done);

	return 0;
}
예제 #17
0
파일: bsp.c 프로젝트: westlicht/camcontrol
/*..........................................................................*/
void QF_onIdle(void) {                                        /* see NOTE02 */
    QF_INT_UNLOCK();
}
예제 #18
0
void poll_phydev(void )  {

	QF_INT_LOCK(); 			// does this have any effect
        phy_dev_read();
   	QF_INT_UNLOCK(); 
}
예제 #19
0
/*..........................................................................*/
void QF_onIdle(void) {              /* NOTE: entered with interrupts LOCKED */
    QF_INT_UNLOCK(dummy);                /* must at least unlock interrupts */
}