/** * Turn off interrupt sources that may interrupt us (SysTick and Ethernet) and then switch control * to the Boot Loader. This will never return! */ void halSwitchToBootloader() { while(UARTCharsAvail(UART0_BASE)) { UARTCharGet(UART0_BASE); } EthernetIntDisable(ETH_BASE, 0xFFFF); SysTickIntDisable(); IntDisable(INT_UART0); UARTIntDisable(UART0_BASE, UART_INT_RX | UART_INT_RT); UARTIntClear(UART0_BASE, UART_INT_RX | UART_INT_RT); delayMs(100); // Call the boot loader so that it will listen for an update on the UART. (*((void (*)(void))(*(unsigned long *)0x2c)))(); // // The boot loader should take control, so this should never be reached. // Just in case, loop forever. // while(1) { } }
/********************************************************************* * @fn osalAdjustTimer * * @brief Updates the OSAL Clock and Timer with elapsed milliseconds. * * @param MSec - elapsed milliseconds * * @return none */ void osalAdjustTimer(uint32 Msec ) { /* Disable SysTick interrupts */ SysTickIntDisable(); osalClockUpdate(Msec); osalTimerUpdate(Msec); /* Enable SysTick interrupts */ SysTickIntEnable(); }
//***************************************************************************** // //! Update the firmware using the bootloader. //! //! This function is called by the serial user interface when the firmware //! update command is received. //! //! \return None. // //***************************************************************************** void UIUpgrade(void) { // // Emergency stop the motor drive. // StepperEmergencyStop(); // // Disable all processor interrupts. Instead of disabling them one at a // time (and possibly missing an interrupt if new sources are added), a // direct write to NVIC is done to disable all peripheral interrupts. // HWREG(NVIC_DIS0) = 0xffffffff; // // Also disable the SysTick interrupt. // SysTickIntDisable(); // // Turn off all the on-board LEDs. // BlinkStart(STATUS_LED, 0, 1, 1); BlinkStart(MODE_LED, 0, 1, 1); BlinkHandler(); // // Stop running from the PLL. // SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ); // // Reconfigure the UART for 115,200, 8-N-1 operation with new clock. // UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE)); // // Return control to the boot loader. This is a call to the SVC handler in // the boot loader. // (*((void (*)(void))(*(unsigned long *)0x2c)))(); // // Control should never return here, but just in case it does. // while(1) { } }
/*Function to handle Systick interrupts*/ void SysTickHandler(void) { SysTickIntDisable(); a1++; if(a1==100) { a1=1; disk_timerproc(); } SysTickIntEnable(); }
/* This function is to initialize the SysTick relate configurations */ void BSP_SysTickInit() { #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */ OS_CPU_SR cpu_sr; #endif OS_ENTER_CRITICAL(); SysTickIntDisable(); SysTickIntRegister(OSTimeTickIsr); SysTickPeriodSet(80000); SysTickIntEnable(); SysTickEnable(); OS_EXIT_CRITICAL(); SysTickOut = 0x01; SysTickLedOut = GPIO_LED_PIN1; }
// ***************************************************************************** // UpdateFirmware // Do not call from an interrupt! - Jumps to the bootloader for flash update // ***************************************************************************** static void UpdateFirmware ( void ) { // // Disable all processor interrupts. Instead of disabling them // one at a time (and possibly missing an interrupt if new sources // are added), a direct write to NVIC is done to disable all // peripheral interrupts. // HWREG(NVIC_DIS0) = 0xffffffff; HWREG(NVIC_DIS1) = 0xffffffff; // // Also disable the SysTick interrupt. // SysTickIntDisable(); // // Return control to the boot loader. This is a call to the SVC // handler in the boot loader, or to the ROM if available. // (*((void (*)(void))(*(unsigned long *)0x2c)))(); }
/************************************************************************************//** ** \brief Stops and disables the timer. ** \return none. ** ****************************************************************************************/ void TimeDeinit(void) { SysTickIntDisable(); SysTickDisable(); } /*** end of TimeDeinit ***/
void SysTick::disableInterrupts(void) { SysTickIntDisable(); }
void GPIOEIntHandler(void) { // Clear the GPIO interrupt GPIOPinIntClear(GPIO_PORTE_BASE, GPIO_PIN_2 | GPIO_PIN_3); // Disable Interrupts GPIOPinIntDisable(GPIO_PORTE_BASE, GPIO_PIN_2 | GPIO_PIN_3); GPIOPinIntDisable(GPIO_PORTF_BASE, GPIO_PIN_0); // If the clock has been set before, we need to disable SysTickInt if (start==1){ SysTickIntDisable(); } // Clear the OLED RIT128x96x4Clear(); // If the left button got us here, display that we are in set clock mode // If the right button got us here, display that we are in set alarm mode if (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_2)==0){ RIT128x96x4StringDraw("Set Clock", 40, 0, 15); DisplayTime(); } else if (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_3)==0){ RIT128x96x4StringDraw("Set Alarm", 40, 0, 15); DisplayTimeA(); } // If the left button is held down enable the time to be set while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_2)==0){ // While the up button is being pressed, the clock will increment if (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0)==0){ // In order to slow the incrementing we count to 10000 first x++; if (x>9999){ // Show the increment DisplayIncrementedTime(); x = 0; } } // While the down button is being pressed, the clock will decrement if (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1)==0){ // In order to slow the decrementing we count to 10000 first x++; if (x>9999){ // Show the decrement DisplayDecrementedTime(); x = 0; } } } // If the right button is held down enable the alarm to be set while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_3)==0){ // While the up button is being pressed, the clock will increment if (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0)==0){ // In order to slow the decrementing we count to 10000 first x++; if (x>9999){ // Show the increment DisplayIncrementedAlarm(); x = 0; } } // While the down button is being pressed, the clock will decrement if (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1)==0){ // In order to slow the decrementing we count to 10000 first x++; if (x>9999){ // Show the decrement DisplayDecrementedAlarm(); x = 0; } } alarmSet = 1; } RIT128x96x4Clear(); // Enable the interrupts GPIOPinIntEnable(GPIO_PORTE_BASE, GPIO_PIN_2 | GPIO_PIN_3); GPIOPinIntEnable(GPIO_PORTF_BASE, GPIO_PIN_0); // If the start variable is not set, we set it and start SysTick if (!start){ start++; t = 0; SysTickIntEnable(); SysTickEnable(); } else { SysTickIntEnable(); } }