/*..........................................................................*/ void BSP_init(void) { if (QS_INIT(l_cmdLine) == (uint8_t)0) { /* QS initialization failed? */ MessageBox(l_hWnd, "Cannot connect to QSPY via TCP/IP\n" "Please make sure that 'qspy -t' is running", "QS_INIT() Error", MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL); } QS_OBJ_DICTIONARY(&l_clock_tick); QS_USR_DICTIONARY(PLAYER_TRIGGER); QS_USR_DICTIONARY(COMMAND_STAT); }
//............................................................................ void BSP_init(void) { // set the system clock as specified in lm3s_config.h (20MHz from PLL) SystemInit(); // enable clock to the peripherals used by the application SYSCTL->RCGC2 |= 1U | (1U << 2); // enable clock to GPIOA & C __NOP(); // wait after enabling clocks __NOP(); __NOP(); // configure the LED and push button GPIOC->DIR |= USER_LED; // set direction: output GPIOC->DEN |= USER_LED; // digital enable GPIOC->DATA_Bits[USER_LED] = 0U; // turn the User LED off GPIOC->DIR &= ~PUSH_BUTTON; // set direction: input GPIOC->DEN |= PUSH_BUTTON; // digital enable Display96x16x1Init(1U); // initialize the OLED display Display96x16x1StringDraw(&"Dining Philos"[0], 0U, 0U); Display96x16x1StringDraw(&"0 ,1 ,2 ,3 ,4"[0], 0U, 1U); Q_ALLEGE(QS_INIT(static_cast<void *>(0))); QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_OBJ_DICTIONARY(&l_GPIOPortA_IRQHandler); QS_USR_DICTIONARY(PHILO_STAT); }
/* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* turn the GPIO clock on */ LPC_SC->PCONP |= (1U << 15); /* setup the GPIO pin functions for the LEDs... */ LPC_PINCON->PINSEL3 &= ~(3U << 4); /* LED_1: function P1.18 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 8); /* LED_2: function P1.20 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 10); /* LED_3: function P1.21 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 14); /* LED_4: function P1.23 to GPIO */ /* Set GPIO-P1 LED pins to output */ LPC_GPIO1->FIODIR |= (LED_1 | LED_2 | LED_3 | LED_4); /* setup the GPIO pin function for the Button... */ LPC_PINCON->PINSEL0 &= ~(3U << 12); /* function P0.6 to GPIO, pull-up */ /* Set GPIO-P0 Button pin as input */ LPC_GPIO0->FIODIR &= ~BTN_EXT; BSP_randomSeed(1234U); if (QS_INIT((void *)0) == 0U) { /* initialize the QS software tracing */ Q_ERROR(); } QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_OBJ_DICTIONARY(&l_EINT0_IRQHandler); QS_USR_DICTIONARY(PHILO_STAT); }
//............................................................................ void BSP_init(void) { Q_ALLEGE(QS_INIT((void *)0)); QS_RESET(); QS_OBJ_DICTIONARY(&l_clock_tick); // must be called *after* QF_init() QS_USR_DICTIONARY(PHILO_STAT); }
//............................................................................ void BSP_init(void) { Q_ALLEGE(QS_INIT((char *)0)); QS_RESET(); QS_OBJ_DICTIONARY(&l_time_tick); QS_USR_DICTIONARY(PHILO_STAT); BSP_randomSeed(1234U); }
//............................................................................ void BSP_init(void) { Q_ALLEGE(QS_INIT((char *)0)); QS_RESET(); QS_OBJ_DICTIONARY(&l_time_tick); QS_USR_DICTIONARY(PHILO_STAT); l_stdOutStream << "DPP-Qt console example" << endl << "QP " << QP::QF::getVersion() << endl; BSP_randomSeed(1234U); }
/* BSP functions ===========================================================*/ void BSP_init(void) { /* setup the port for the LED (PORTB.5) */ DDRB = 0xFFU; /* set all pins on PORTB as output */ PORTB &= ~LED_L; /* drive LED_L pin low */ /* setup the port for the Button (PORTD.2) */ DDRD &= ~BTN_EXT; /* set PORTD pin BTN_EXT as input */ if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ Q_ERROR(); } QS_OBJ_DICTIONARY(&l_ISR_TIMER2_COMPA); QS_USR_DICTIONARY(PHILO_STAT); }
/*..........................................................................*/ void BSP_init(void) { printf("Dining Philosopher Problem example" "\nQEP %s\nQF %s\n" "Press 'p' to pause/un-pause\n" "Press ESC to quit...\n", QEP_getVersion(), QF_getVersion()); BSP_randomSeed(1234U); Q_ALLEGE(QS_INIT((void *)0)); QS_OBJ_DICTIONARY(&l_clock_tick); /* must be called *after* QF_init() */ QS_USR_DICTIONARY(PHILO_STAT); }
/*..........................................................................*/ void BSP_init(int argc, char *argv[]) { printf("Dining Philosophers Problem example" "\nQP %s\n" "Press 'p' to pause\n" "Press 's' to serve\n" "Press ESC to quit...\n", QP_versionStr); BSP_randomSeed(1234U); Q_ALLEGE(QS_INIT((void *)0)); QS_OBJ_DICTIONARY(&l_clock_tick); /* must be called *after* QF_init() */ QS_USR_DICTIONARY(PHILO_STAT); }
// BSP functions ============================================================= void BSP::init(void) { // NOTE: SystemInit() has been already called from the startup code // but SystemCoreClock needs to be updated SystemCoreClockUpdate(); // NOTE: The VFP (hardware Floating Point) unit is configured by FreeRTOS */ SCB_EnableICache(); // Enable I-Cache SCB_EnableDCache(); // Enable D-Cache // Configure Flash prefetch and Instr. cache through ART accelerator #if (ART_ACCLERATOR_ENABLE != 0) __HAL_FLASH_ART_ENABLE(); #endif // ART_ACCLERATOR_ENABLE /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); // Configure the User Button in GPIO Mode BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); //... BSP::randomSeed(1234U); // initialize the QS software tracing... if (!QS_INIT((void *)0)) { Q_ERROR(); } QS_OBJ_DICTIONARY(&l_TickHook); QS_OBJ_DICTIONARY(&l_EXTI0_IRQHandler); QS_USR_DICTIONARY(PHILO_STAT); QS_USR_DICTIONARY(PAUSED_STAT); QS_USR_DICTIONARY(COMMAND_STAT); }
//............................................................................ void BSP_init(void) { // Enable the floating-point unit SCB->CPACR |= (0xFU << 20); // Enable lazy stacking for interrupt handlers. This allows FPU // instructions to be used within interrupt handlers, but at the // expense of extra stack and CPU usage. // FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); // Set the clocking to run directly from the crystal ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // enable clock to the peripherals used by the application SYSCTL->RCGC2 |= (1U << 5); // enable clock to GPIOF __NOP(); // wait after enabling clocks __NOP(); __NOP(); // configure the LEDs and push buttons GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE); // set direction: output GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); // digital enable GPIOF->DATA_Bits[LED_RED] = 0; // turn the LED off GPIOF->DATA_Bits[LED_GREEN] = 0; // turn the LED off GPIOF->DATA_Bits[LED_BLUE] = 0; // turn the LED off // configure the User Switches GPIOF->DIR &= ~(USR_SW1 | USR_SW2); // set direction: input ROM_GPIOPadConfigSet(GPIO_PORTF_BASE, (USR_SW1 | USR_SW2), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); BSP_randomSeed(1234U); Q_ALLEGE(QS_INIT(static_cast<void *>(0))); QS_RESET(); QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_OBJ_DICTIONARY(&l_GPIOPortA_IRQHandler); QS_USR_DICTIONARY(PHILO_STAT); }
/* BSP functions ===========================================================*/ void BSP_init(void) { WDTCTL = WDTPW | WDTHOLD; /* stop watchdog timer */ /* configure the Basic Clock Module */ DCOCTL = 0; /* Select lowest DCOx and MODx settings */ BCSCTL1 = CALBC1_8MHZ; /* Set DCO */ DCOCTL = CALDCO_8MHZ; /* configure pins for LEDs */ P1DIR |= (LED1 | LED2); /* set LED1 and LED2 pins to output */ /* configure pin for Button */ P1DIR &= ~BTN1; /* set BTN1 pin as input */ P1OUT |= BTN1; /* drive output to hi */ P1REN |= BTN1; /* enable internal pull up register */ if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ Q_ERROR(); } QS_OBJ_DICTIONARY(&l_timerA_ISR); QS_USR_DICTIONARY(PHILO_STAT); }
int main(void) { Ble_ctor(); Array_ctor(); QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ void BSP_init(); BSP_init(); /* initialize the Board Support Package */ /* dictionaries... */ QS_USR_DICTIONARY(TRACE_SDK_EVT); QS_USR_DICTIONARY(TRACE_PEER_EVT); QS_USR_DICTIONARY(TRACE_ADV_EVT); QS_USR_DICTIONARY(TRACE_BLE_EVT); QS_USR_DICTIONARY(TRACE_DM_EVT); QS_USR_DICTIONARY(TRACE_ANCS_EVT); return QF_run(); /* run the QF application */ }
//............................................................................ void BSP_init(void) { Q_ALLEGE(QS_INIT(l_cmdLine)); QS_RESET(); QS_OBJ_DICTIONARY(&l_clock_tick); QS_USR_DICTIONARY(PLAYER_TRIGGER); }
// BSP functions ============================================================= void BSP::init(void) { // NOTE: SystemInit() has been already called from the startup code // but SystemCoreClock needs to be updated // SystemCoreClockUpdate(); SCB_EnableICache(); // Enable I-Cache SCB_EnableDCache(); // Enable D-Cache // Configure Flash prefetch and Instr. cache through ART accelerator #if (ART_ACCLERATOR_ENABLE != 0) __HAL_FLASH_ART_ENABLE(); #endif // ART_ACCLERATOR_ENABLE // configure the FPU usage by choosing one of the options... #if 1 // OPTION 1: // Use the automatic FPU state preservation and the FPU lazy stacking. // // NOTE: // Use the following setting when FPU is used in more than one task or // in any ISRs. This setting is the safest and recommended, but requires // extra stack space and CPU cycles. // FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); #else // OPTION 2: // Do NOT to use the automatic FPU state preservation and // do NOT to use the FPU lazy stacking. // // NOTE: // Use the following setting when FPU is used in ONE task only and not // in any ISR. This setting is very efficient, but if more than one task // (or ISR) start using the FPU, this can lead to corruption of the // FPU registers. This option should be used with CAUTION. // FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); #endif /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); // Configure the User Button in GPIO Mode BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); //... BSP::randomSeed(1234U); // initialize the QS software tracing... if (!QS_INIT((void *)0)) { Q_ERROR(); } QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_OBJ_DICTIONARY(&l_EXTI0_IRQHandler); QS_USR_DICTIONARY(PHILO_STAT); QS_USR_DICTIONARY(PAUSED_STAT); QS_USR_DICTIONARY(COMMAND_STAT); QS_USR_DICTIONARY(ON_CONTEXT_SW); }