/*..........................................................................*/ void QK_onIdle(void) { QF_INT_DISABLE(); SLED_ON(); /* switch the System LED on and off */ asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop"); SLED_OFF(); QF_INT_ENABLE(); #ifdef Q_SPY if (CSL_FEXT(l_uartObj.uartRegs->LSR, UART_LSR_THRE)) { uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { /* not End-Of-Data? */ CSL_FSET(l_uartObj.uartRegs->THR, 7U, 0U, b); } } #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 TMS320C5500 device. */ asm(" IDLE"); #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 */ }
/*..........................................................................*/ void QK_onIdle(void) { /* toggle the LED on and then off, see NOTE01 */ QF_INT_DISABLE(); omxEval_led_on(LED_1); omxEval_led_off(LED_1); QF_INT_ENABLE(); #ifdef Q_SPY if ((USART3->SR & USART_FLAG_TXE) != 0) { /* is TXE empty? */ uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { /* not End-Of-Data? */ USART3->DR = (b & 0xFF); /* put into the DR register */ } } #elif defined NDEBUG __WFI(); /* wait for interrupt */ #endif }
/*..........................................................................*/ void QV_onIdle(void) { /* NOTE: called with interrutps DISABLED, see NOTE1 */ /* toggle LED2 on and then off, see NOTE2 */ P1OUT |= LED2; /* turn LED2 on */ P1OUT &= ~LED2; /* turn LED2 off */ #ifdef Q_SPY QF_INT_ENABLE(); if (((IFG2 & UCA0TXIFG)) != 0U) { /* UART not transmitting? */ uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { UCA0TXBUF = (uint8_t)b; /* stick the byte to the TX BUF */ } } #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 MSP430 MCU. */ __low_power_mode_1(); /* Enter LPM1; also ENABLES interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif }
/*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts DISABLED, see NOTE1 */ /* toggle the User LED, see NOTE2 , not enough LEDs to implement! */ //PORTB |= LED_L; //PORTB &= ~LED_L; #ifdef Q_SPY QF_INT_ENABLE(); if ((UCSR0A & (1U << UDRE0)) != 0U) { uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { UDR0 = (uint8_t)b; /* stick the byte to the TX UDR0 */ } } #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 AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif }
/*..........................................................................*/ void QF_onIdle(void) { /* called with interrupts disabled, see NOTE01 */ //QF_INT_DISABLE(); //GPIOSetValue(LED_PORT, LED_BIT, LED_ON); /* LED on */ //GPIOSetValue(LED_PORT, LED_BIT, LED_OFF); /* LED off */ //QF_INT_ENABLE(); #ifdef Q_SPY QF_INT_ENABLE(); if ((LPC_UART->LSR & LSR_THRE) != 0) { /* is THR empty? */ uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { /* not End-Of-Data? */ LPC_UART->THR = (b & 0xFF); /* put into the THR register */ } } #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 */ QF_INT_ENABLE(); #else QF_INT_ENABLE(); #endif }
/*..........................................................................*/ void QF_onIdle(void) { /* entered with interrupts disabled, NOTE01 */ LED_ON (IDLE_LED); /* blink the IDLE LED, see NOTE02 */ LED_OFF(IDLE_LED); #ifdef Q_SPY QF_INT_ENABLE(); /* enable interrupts, see NOTE01 */ while (U2STAbits.UTXBF == 0U) { /* TX Buffer not full? */ uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b == QS_EOD) { /* End-Of-Data reached? */ break; /* break out of the loop */ } U2TXREG = (uint8_t)b; /* stick the byte to TXREG for transmission */ } #elif defined NDEBUG __asm__ volatile("disi #0x0001"); Idle(); /* transition to Idle mode, see NOTE03 */ #else QF_INT_ENABLE(); /* enable interrupts, see NOTE01 */ #endif }
/*..........................................................................*/ void QS_onFlush(void) { uint16_t b; while ((b = QS_getByte()) != QS_EOD) { /* while not End-Of-Data... */ while ((USART3->SR & USART_FLAG_TXE) == 0) { /* while TXE not empty */ } USART3->DR = (b & 0xFF); /* put into the DR register */ } }
/*..........................................................................*/ void QS_onFlush(void) { uint16_t b; while ((b = QS_getByte()) != QS_EOD) { /* while not End-Of-Data... */ while ((LPC_UART->LSR & LSR_THRE) == 0) { /* while TXE not empty */ } LPC_UART->THR = (b & 0xFF); /* put into the THR register */ } }
/*..........................................................................*/ void QS_onFlush(void) { uint16_t b; while ((b = QS_getByte()) != QS_EOD) { /* next QS trace byte available? */ while ((inp(l_uart_base + 5) & (1 << 5)) == 0) { /* not empty? */ } outp(l_uart_base + 0, (uint8_t)b); /* put the byte to TX FIFO */ } }
static void uart_tx1() { static uint16_t b; QF_INT_DISABLE(); { b = QS_getByte(); } QF_INT_ENABLE(); if (b != QS_EOD) { /* Have a byte to TX? */ nrf_drv_uart_tx((const uint8_t*)&b //This cast works only on LE , 1); } }
/*..........................................................................*/ void QS_onFlush(void) { uint16_t b; QF_INT_DISABLE(); while ((b = QS_getByte()) != QS_EOD) { /* next QS trace byte available? */ QF_INT_ENABLE(); while ((UCSR0A & (1U << UDRE0)) == 0U) { /* TX UDR not empty? */ } UDR0 = (uint8_t)b; /* stick the byte to the TX UDR */ } QF_INT_ENABLE(); }
/*..........................................................................*/ void QS_onFlush(void) { uint16_t b; QF_INT_DISABLE(); while ((b = QS_getByte()) != QS_EOD) { /* while not End-Of-Data... */ QF_INT_ENABLE(); while ((LPC_UART0->LSR & 0x20U) == 0U) { /* while THR empty... */ } LPC_UART0->THR = (b & 0xFFU); /* put into the DR register */ } QF_INT_ENABLE(); }
/*..........................................................................*/ void QS_onFlush(void) { uint16_t b; QF_INT_DISABLE(); while ((b = QS_getByte()) != QS_EOD) { /* next QS byte available? */ QF_INT_ENABLE(); while ((IFG2 & UCA0TXIFG) == 0U) { /* TX not ready? */ } UCA0TXBUF = (uint8_t)b; /* stick the byte to the TX BUF */ QF_INT_DISABLE(); } QF_INT_ENABLE(); }
/*..........................................................................*/ void QS_onFlush(void) { uint16_t b; QF_INT_DISABLE(); while ((b = QS_getByte()) != QS_EOD) { /* while not End-Of-Data... */ QF_INT_ENABLE(); while ((USART2->SR & 0x0080U) == 0U) { /* while TXE not empty */ } USART2->DR = (b & 0xFFU); /* put into the DR register */ } QF_INT_ENABLE(); }
void QS_onFlush(void) { static uint16_t b; QF_INT_DISABLE(); while ((b = QS_getByte()) != QS_EOD) { /* while not End-Of-Data... */ QF_INT_ENABLE(); while (nrf_drv_uart_tx_in_progress()) { /* while TXE not empty */ } //static uint8_t byte; //byte = b & 0xFF; nrf_drv_uart_tx((const uint8_t*)&b, 1); } QF_INT_ENABLE(); }
/*..........................................................................*/ void QS_onFlush(void) { uint16_t b; #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */ OS_CPU_SR cpu_sr = 0u; #endif OS_ENTER_CRITICAL(); while ((b = QS_getByte()) != QS_EOD) { /* while not End-Of-Data... */ OS_EXIT_CRITICAL(); while ((USART2->SR & 0x0080U) == 0U) { /* while TXE not empty */ } USART2->DR = (b & 0xFFU); /* put into the DR register */ } OS_EXIT_CRITICAL(); }
/*..........................................................................*/ void QK_onIdle(void) { #ifdef Q_SPY if ((SCI3_2.SSR.BYTE & 0x80) != 0) { /* TDRE not ready? */ uint16_t b; QF_INT_DISABLE(); /* disable interrupts */ b = QS_getByte(); QF_INT_ENABLE(); /* enable interrupts */ if (b != QS_EOD) { SCI3_2.TDR = (uint8_t)b; /* put the byte to TX data register */ } } #elif (defined NDEBUG) /* low-power mode interferes with debugging */ /* stop all peripheral clocks that you can in your applicaiton ... */ sleep(); /* before entering any pending interrupt */ #endif }
/*..........................................................................*/ void QK_onIdle(void) { #ifdef Q_SPY if (((IFG2 & UCA0TXIFG)) != 0) { uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { UCA0TXBUF = (uint8_t)b; /* stick the byte to the TX BUF */ } } #elif defined NDEBUG __low_power_mode_1(); /* Enter LPM1; also UNLOCKS interrupts */ #endif }
/*..........................................................................*/ 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 */ }
/*..........................................................................*/ 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 }
/*..........................................................................*/ void App_TaskIdleHook(void) { #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */ OS_CPU_SR cpu_sr = 0u; #endif /* toggle LED[0] on and then off, see NOTE01 */ OS_ENTER_CRITICAL(); //GPIOA->BSRRL |= LED_LD2; /* turn LED on */ //GPIOA->BSRRH |= LED_LD2; /* turn LED off */ OS_EXIT_CRITICAL(); #ifdef Q_SPY if ((USART2->SR & 0x0080U) != 0) { /* is TXE empty? */ uint16_t b; OS_ENTER_CRITICAL(); b = QS_getByte(); OS_EXIT_CRITICAL(); if (b != QS_EOD) { /* not End-Of-Data? */ USART2->DR = (b & 0xFFU); /* put into the DR register */ } } #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. */ /* !!!CAUTION!!! * The WFI instruction stops the CPU clock, which unfortunately disables * the JTAG port, so the ST-Link debugger can no longer connect to the * board. For that reason, the call to __WFI() has to be used with caution. * * NOTE: If you find your board "frozen" like this, strap BOOT0 to VDD and * reset the board, then connect with ST-Link Utilities and erase the part. * The trick with BOOT(0) is it gets the part to run the System Loader instead * of your broken code. When done disconnect BOOT0, and start over. */ //__WFI(); /* Wait-For-Interrupt */ #endif }
/*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts disabled, see NOTE01 */ #ifdef Q_SPY # if 0 QS_rxParse(); /* parse all the received bytes */ // Push out QS buffer to UART if (!nrf_drv_uart_tx_in_progress()) { /* is TXE empty? */ static uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { /* not End-Of-Data? */ nrf_drv_uart_tx((const uint8_t*)&b, 1); } } # else QF_INT_ENABLE(); //sd_app_evt_wait(); __WFE(); //__SEV(); __WFE(); # endif #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-M MCU. */ /* !!!CAUTION!!! * The QF_CPU_SLEEP() contains the WFI instruction, which stops the CPU * clock, which unfortunately disables the JTAG port, so the ST-Link * debugger can no longer connect to the board. For that reason, the call * to QF_CPU_SLEEP() has to be used with CAUTION. */ //QV_CPU_SLEEP(); //atomically go to SHALLOW sleep and enable interrupts __WFE(); QF_INT_ENABLE(); /* for now, just enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif }
/*..........................................................................*/ void QK_onIdle(void) { /* called with interrupts enabled */ /* toggle an LED on and then off (not enough LEDs, see NOTE01) */ QF_INT_DISABLE(); //GPIOA->BSRR |= (LED_LD2); /* turn LED[n] on */ //GPIOA->BSRR |= (LED_LD2 << 16); /* turn LED[n] off */ QF_INT_ENABLE(); #ifdef Q_SPY if ((USART2->SR & 0x0080U) != 0) { /* is TXE empty? */ uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { /* not End-Of-Data? */ USART2->DR = (b & 0xFFU); /* put into the DR register */ } } #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. */ /* !!!CAUTION!!! * The WFI instruction stops the CPU clock, which unfortunately disables * the JTAG port, so the ST-Link debugger can no longer connect to the * board. For that reason, the call to __WFI() has to be used with CAUTION. * * NOTE: If you find your board "frozen" like this, strap BOOT0 to VDD and * reset the board, then connect with ST-Link Utilities and erase the part. * The trick with BOOT(0) is it gets the part to run the System Loader * instead of your broken code. When done disconnect BOOT0, and start over. */ //__WFI(); /* Wait-For-Interrupt */ #endif }
/*..........................................................................*/ void QK_onIdle(void) { QF_INT_DISABLE(); LED_ON (IDLE_LED); /* blink the IDLE LED, see NOTE01 */ LED_OFF(IDLE_LED); QF_INT_ENABLE(); #ifdef Q_SPY while (U2STAbits.UTXBF == 0U) { /* TX Buffer not full? */ uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b == QS_EOD) { /* End-Of-Data reached? */ break; /* break out of the loop */ } U2TXREG = (uint8_t)b; /* stick the byte to TXREG for transmission */ } #elif defined NDEBUG Idle(); /* transition to Idle mode */ #endif }
/*..........................................................................*/ void QF_onIdle(void) { /* invoked with interrupts DISABLED */ LED1_on(); /* switch LED1 on and off */ LED1_off(); #ifdef Q_SPY if (((IFG2 & UCA0TXIFG)) != 0) { uint16_t b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { UCA0TXBUF = (uint8_t)b; /* stick the byte to the TX BUF */ } } else { QF_INT_ENABLE(); } #elif defined NDEBUG __low_power_mode_1(); /* Enter LPM1 and ENABLE interrupts atomically */ #else QF_INT_ENABLE(); #endif }