//***************************************************************************** // // The interrupt handler for the Timer0B interrupt. // //***************************************************************************** void Timer0BIntHandler(void) { // // Clear the timer interrupt flag. // TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT); // // Update the periodic interrupt counter. // g_ulCounter++; // // Once NUMBER_OF_INTS interrupts have been received, turn off the // TIMER0B interrupt. // if(g_ulCounter == NUMBER_OF_INTS) { // // Disable the Timer0B interrupt. // IntDisable(INT_TIMER0B); // // Turn off Timer0B interrupt. // TimerIntDisable(TIMER0_BASE, TIMER_TIMB_TIMEOUT); // // Clear any pending interrupt flag. // TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT); } }
//***************************************************************************** // //! Sets the duty cycle of the generated PWM waveforms. //! //! \param ulDutyCycleA is the duty cycle of the waveform for the U phase of //! the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. //! \param ulDutyCycleB is the duty cycle of the waveform for the V phase of //! the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. //! \param ulDutyCycleC is the duty cycle of the waveform for the W phase of //! the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. //! //! This function configures the duty cycle of the generated PWM waveforms. //! The duty cycle update will not occur immediately; the change will be //! registered for synchronous application to the output waveforms to avoid //! discontinuities. //! //! \return None. // //***************************************************************************** void PWMSetDutyCycle(unsigned long ulDutyCycleA, unsigned long ulDutyCycleB, unsigned long ulDutyCycleC) { // // Disable the PWM interrupt temporarily. // IntDisable(INT_PWM0_0); // // Save the duty cycles for the three phases. // g_ulPWMDutyCycleA = ulDutyCycleA; g_ulPWMDutyCycleB = ulDutyCycleB; g_ulPWMDutyCycleC = ulDutyCycleC; // // Set the flag indicating that the duty cycles need to be updated. // HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_DUTY_CYCLE) = 1; // // Re-enable the PWM interrupt. // IntEnable(INT_PWM0_0); }
//***************************************************************************** // //! Unregisters an interrupt handler for the I2C module. //! //! \param ulBase is the base address of the I2C Master module. //! //! This function will clear the handler to be called when an I2C interrupt //! occurs. This will also mask off the interrupt in the interrupt controller //! so that the interrupt handler no longer is called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void I2CIntUnregister(unsigned long ulBase) { unsigned long ulInt; // // Check the arguments. // ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE)); // // Determine the interrupt number based on the I2C port. // ulInt = (ulBase == I2C0_MASTER_BASE) ? INT_I2C0 : INT_I2C1; // // Disable the interrupt. // IntDisable(ulInt); // // Unregister the interrupt handler. // IntUnregister(ulInt); }
//***************************************************************************** // //! Stops playback of the current sound stream. //! //! This function immediately stops playback of the current sound stream. As //! a result, the output is changed directly to the mid-point, possibly //! resulting in a pop or click. It is then ramped down to no output, //! eliminating the current draw through the amplifier and speaker. //! //! \return None. // //***************************************************************************** void SoundStop(void) { // // See if playback is in progress. // if((g_sSoundState.ui32Flags != 0) && (HWREGBITW(&g_sSoundState.ui32Flags, SOUND_FLAG_SHUTDOWN) == 0)) { // // Temporarily disable the timer interrupt. // IntDisable(INT_TIMER5A); // // Clear the sound flags and set the shutdown flag (to try to avoid a // pop, though one may still occur based on the current position of the // output waveform). // g_sSoundState.ui32Flags = 0; HWREGBITW(&g_sSoundState.ui32Flags, SOUND_FLAG_SHUTDOWN) = 1; // // Set the shutdown step to the first. // g_sSoundState.i32Step = g_sSoundState.ui32Period / 2; // // Reenable the timer interrupt. // IntEnable(INT_TIMER5A); } }
//***************************************************************************** // //! Unregisters an interrupt handler for the synchronous serial interface. //! //! \param ui32Base specifies the SSI module base address. //! //! This function clears the handler to be called when an SSI interrupt //! occurs. This function also masks off the interrupt in the interrupt //! controller so that the interrupt handler no longer is called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void SSIIntUnregister(uint32_t ui32Base) { uint32_t ui32Int; // // Check the arguments. // ASSERT(_SSIBaseValid(ui32Base)); // // Determine the interrupt number based on the SSI module. // ui32Int = _SSIIntNumberGet(ui32Base); ASSERT(ui32Int != 0); // // Disable the interrupt. // IntDisable(ui32Int); // // Unregister the interrupt handler. // IntUnregister(ui32Int); }
//***************************************************************************** // //! This is the Pulse Per Second (PPS) interrupt handler. //! The updateCounter is incremented on each Pulse per second call, if equal to //! the update rate, the GPS data is parsed and logged. // //***************************************************************************** void PortKIntHandler(void) { uint32_t intStatus = 0; // // Get the current interrupt status for Port K // intStatus = GPIOIntStatus(GPIO_PORTK_BASE,true); // // Clear the set interrupts for Port K // GPIOIntClear(GPIO_PORTK_BASE,intStatus); // // Execute code for PK2 interrupt // if((intStatus & GPIO_INT_PIN_2) == GPIO_INT_PIN_2){ if (updateRate == updateCounter++) { GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x02); gpsData(); GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x00); updateCounter = 0; // // Disable PPS interrupt after one read if in low power mode // if (lowPowerOn == 1) { IntDisable(INT_GPIOK); logComplete = 1; } } } } // End function PortKIntHandler
//***************************************************************************** // //! Unregisters an interrupt handler for the quadrature encoder interrupt. //! //! \param ui32Base is the base address of the quadrature encoder module. //! //! This function unregisters the handler to be called when a quadrature //! encoder interrupt occurs. This function also masks off the interrupt in //! the interrupt controller so that the interrupt handler no longer is called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void QEIIntUnregister(uint32_t ui32Base) { uint32_t ui32Int; // // Check the arguments. // ASSERT((ui32Base == QEI0_BASE) || (ui32Base == QEI1_BASE)); // // Determine the interrupt number based on the QEI module. // ui32Int = QEIIntNumberGet(ui32Base); ASSERT(ui32Int != 0); // // Disable the interrupt. // IntDisable(ui32Int); // // Unregister the interrupt handler. // IntUnregister(ui32Int); }
//***************************************************************************** // //! Check the result of an AES ECB operation // //***************************************************************************** uint32_t CRYPTOAesEcbStatus(void) { uint32_t ui32Status; // // Get the current DMA status. // ui32Status = HWREG(CRYPTO_BASE + CRYPTO_O_DMASTAT); // // Check if DMA is still busy. // if(ui32Status & CRYPTO_DMA_BSY) { return (AES_DMA_BSY); } // // Check the status of the DMA operation - return error if not success. // if(ui32Status & CRYPTO_DMA_BUS_ERROR) { g_ui32CurrentAesOp = CRYPTO_AES_NONE; return (AES_DMA_BUS_ERROR); } // // Operation successfull - disable interrupt and return success. // g_ui32CurrentAesOp = CRYPTO_AES_NONE; IntDisable(INT_CRYPTO); return (AES_SUCCESS); }
int NwpRegisterInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue) //do not know what to do with pValue { if(InterruptHdl == NULL) { //De-register Interprocessor communication interrupt between App and NWP #ifdef SL_PLATFORM_MULTI_THREADED osi_InterruptDeRegister(INT_NWPIC); #else IntDisable(INT_NWPIC); IntUnregister(INT_NWPIC); IntPendClear(INT_NWPIC); #endif g_pHostIntHdl = NULL; } else { g_pHostIntHdl = InterruptHdl; #if 0 //Setting the 14th and 13th bit to '01' to make the HOST_IRQ edge triggered HWREG(0x4402E168) |= 0x2000; #endif #ifdef SL_PLATFORM_MULTI_THREADED IntPendClear(INT_NWPIC); osi_InterruptRegister(INT_NWPIC, (P_OSI_INTR_ENTRY)HostIntHanlder,INT_PRIORITY_LVL_1); #else IntRegister(INT_NWPIC, HostIntHanlder); IntPrioritySet(INT_NWPIC, INT_PRIORITY_LVL_1); IntPendClear(INT_NWPIC); IntEnable(INT_NWPIC); #endif } return 0; }
//***************************************************************************** // //! Unregisters an interrupt handler for the quadrature encoder interrupt. //! //! \param ulBase is the base address of the quadrature encoder module. //! //! This function will clear the handler to be called when a quadrature encoder //! interrupt occurs. This will also mask off the interrupt in the interrupt //! controller so that the interrupt handler no longer is called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void QEIIntUnregister(unsigned long ulBase) { unsigned long ulInt; // // Check the arguments. // ASSERT((ulBase == QEI0_BASE) || (ulBase == QEI1_BASE)); // // Determine the interrupt number based on the QEI module. // ulInt = (ulBase == QEI0_BASE) ? INT_QEI0 : INT_QEI1; // // Disable the interrupt. // IntDisable(ulInt); // // Unregister the interrupt handler. // IntUnregister(ulInt); }
//***************************************************************************** // //! Unregisters an interrupt handler for the synchronous serial interface //! //! \param ui32Base specifies the SSI module base address. //! //! This function will clear the handler to be called when a SSI //! interrupt occurs. This will also mask off the interrupt in the interrupt //! controller so that the interrupt handler no longer is called. //! //! \sa See IntRegister() for important information about registering interrupt //! handlers. //! //! \return None // //***************************************************************************** void SSIIntUnregister(uint32_t ui32Base) { uint32_t ui32Int; // // Check the arguments. // ASSERT((ui32Base == SSI0_BASE) || (ui32Base == SSI1_BASE)); // // Determine the interrupt number based on the SSI port. // ui32Int = (ui32Base == SSI0_BASE) ? INT_SSI0 : INT_SSI1; // // Disable the interrupt. // IntDisable(ui32Int); // // Unregister the interrupt handler. // IntUnregister(ui32Int); }
//***************************************************************************** // //! Unregisters an interrupt handler for the I2C module. //! //! \param ulBase is the base address of the I2C Master module. //! //! This function will clear the handler to be called when an I2C interrupt //! occurs. This will also mask off the interrupt in the interrupt controller //! so that the interrupt handler no longer is called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void I2CIntUnregister(unsigned long ulBase) { unsigned long ulInt; // // Check the arguments. // ASSERT(I2CMasterBaseValid(ulBase)); // // Determine the interrupt number based on the I2C port. // ulInt = I2CIntNumberGet(ulBase); // // Disable the interrupt. // IntDisable(ulInt); // // Unregister the interrupt handler. // IntUnregister(ulInt); }
//***************************************************************************** // //! Unregisters an interrupt handler for a UART interrupt. //! //! \param ulBase is the base address of the UART port. //! //! This function does the actual unregistering of the interrupt handler. It //! will clear the handler to be called when a UART interrupt occurs. This //! will also mask off the interrupt in the interrupt controller so that the //! interrupt handler no longer is called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void UARTIntUnregister(unsigned long ulBase) { unsigned long ulInt; // // Check the arguments. // ASSERT(UARTBaseValid(ulBase)); // // Determine the interrupt number based on the UART port. // ulInt = ((ulBase == UART0_BASE) ? INT_UART0 : ((ulBase == UART1_BASE) ? INT_UART1 : INT_UART2)); // // Disable the interrupt. // IntDisable(ulInt); // // Unregister the interrupt handler. // IntUnregister(ulInt); }
/**************************************************************************//** * @brief Connect interrupt service routine to 32 kHz timer interrupt. * * @param pFnHandle Void function pointer to interrupt service routine * * @return None ******************************************************************************/ void halTimer32kIntConnect(void (*pFnHandle)(void)) { tBoolean intDisabled = IntMasterDisable(); SleepModeIntRegister(&halTimer32kIsr); // Register function and IntDisable(INT_SMTIM); // disable SMTIM interrupts pFptr = pFnHandle; // Set custom ISR if(!intDisabled) IntMasterEnable(); }
void Spi::disableInterrupts(void) { // Disable the SPI interrupt SSIIntDisable(config_.base, (SSI_TXFF | SSI_RXFF | SSI_RXTO | SSI_RXOR)); // Disable the SPI interrupt IntDisable(config_.interrupt); }
//******** OS_AddPeriodicThread *************** // add a background periodic task // typically this function receives the highest priority // Inputs: pointer to a void/void background function // period given in system time units // priority 0 is highest, 5 is lowest // Outputs: 1 if successful, 0 if this thread can not be added // It is assumed that the user task will run to completion and return // This task can not spin, block, loop, sleep, or kill // This task can call OS_Signal OS_bSignal OS_AddThread // You are free to select the time resolution for this function // This task does not have a Thread ID // In lab 2, this command will be called 0 or 1 times // In lab 2, the priority field can be ignored // In lab 3, this command will be called 0 1 or 2 times // In lab 3, there will be up to four background threads, and this priority field // determines the relative priority of these four threads int OS_AddPeriodicThread(void(*task)(void), unsigned long period, unsigned long priority){ if (periodic[0] == NULL){ // Set function pointer periodic[0] = task; // Startup timer IntDisable(INT_TIMER1A); TimerLoadSet(TIMER1_BASE, TIMER_A, period); TimerEnable(TIMER1_BASE, TIMER_A); IntEnable(INT_TIMER1A); }else if (periodic[1] == NULL){ // Set function pointer periodic[1] = task; // Startup timer IntDisable(INT_TIMER1B); TimerLoadSet(TIMER1_BASE, TIMER_B, period); TimerEnable(TIMER1_BASE, TIMER_B); IntEnable(INT_TIMER1B); }else if (periodic[2] == NULL){ // Set function pointer periodic[2] = task; // Startup timer IntDisable(INT_TIMER2A); TimerLoadSet(TIMER2_BASE, TIMER_A, period); TimerEnable(TIMER2_BASE, TIMER_A); IntEnable(INT_TIMER2A); }else if (periodic[3] == NULL){ // Set function pointer periodic[3] = task; // Startup timer IntDisable(INT_TIMER2B); TimerLoadSet(TIMER2_BASE, TIMER_B, period); TimerEnable(TIMER2_BASE, TIMER_B); IntEnable(INT_TIMER2B); }else{ // Apparenty all periodic threads are in use return 0; } return 1; // For now }
void Spi::disableInterrupts(void) { // Disable the SPI interrupt SSIIntDisable(base_, (SSI_TXFF | SSI_RXFF | SSI_RXTO | SSI_RXOR)); // Disable the SPI interrupt IntDisable(interrupt_); }
void Uart::disableInterrupts(void) { // Disable the UART RX, TX and RX timeout interrupts UARTIntDisable(config_.base, UART_INT_RX | UART_INT_TX | UART_INT_RT); // Disable the UART interrupt IntDisable(config_.interrupt); }
/******************************************************************************* ** Name: SdcDevDeInit ** Input:HDC dev ** Return: rk_err_t ** Owner:Aaron.sun ** Date: 2014.2.19 ** Time: 15:59:49 *******************************************************************************/ _DRIVER_SDMMC_SDMMCDEVICE_INIT_ rk_err_t SdcDevDeInit(SDC_DEVICE_CLASS * pstSdcDev) { if (pstSdcDev->enSdMmcPort == SDC0) { IntDisable(INT_ID_EMMC); IntPendingClear(INT_ID_EMMC); IntUnregister(INT_ID_EMMC); } else if (pstSdcDev->enSdMmcPort == SDC1) { IntDisable(INT_ID_SDMMC); IntPendingClear(INT_ID_SDMMC); IntUnregister(INT_ID_SDMMC); } //ScuClockGateCtr(CLOCK_GATE_SDMMC,0); return RK_SUCCESS; }
/****************************************************************************** * * * \brief Generic event handler for the composite device.\n * * * * \param pvCBData : Is the event callback pointer provided during * * USBDCompositeInit * * * * \param ulEvent : Identifies the event we are being called back for. * * * * \param ulMsgValue : Is an event-specific value. * * * * \param pvMsgData : Is an event-specific pointer. * * * * \return The return value is event-specific. * * * ******************************************************************************/ unsigned int EventHandler(void *pvCBData, unsigned int ulEvent, unsigned int ulMsgValue, void *pvMsgData) { unsigned char ulIntsOff; /* Which event are we being asked to process? */ switch(ulEvent) { /* We are connected to a host and communication is now possible. */ case USB_EVENT_CONNECTED: /* Flush our buffers. */ USBBufferFlush(&g_sTxBuffer); USBBufferFlush(&g_sRxBuffer); ulIntsOff = IntDisable(); g_pcStatus = "Host connected."; g_ulFlags |= COMMAND_STATUS_UPDATE; IntEnable(ulIntsOff); break; /* The host has disconnected. */ case USB_EVENT_DISCONNECTED: ulIntsOff = IntDisable(); g_pcStatus = "Host disconnected."; g_ulFlags |= COMMAND_STATUS_UPDATE; IntEnable(ulIntsOff); break; default: break; } return(0); }
void SCCBStop(void){ // // Enable the timer interrupt. // TODO: change this to whichever timer interrupt you are using. // GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sdaGpio,SCCBMaster.sdaGpio); SCCBMaster.state=SCCB_DONE; IntDisable(INT_TIMER0A); TimerIntDisable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); }
/*---------------------------------------------------------------------------- Ethernet Device Uninitialize *----------------------------------------------------------------------------*/ static int EthDev_UnInit (void) { pEMAC->IEN = 0; /* Disable all Ethernet Interrupts */ pEMAC->ISR = INT_ALL; IntDisable (INT_ETH); /* Disable ENET Interrupt */ /* Power Down PHY */ phy_Wr (PHY_REG_CTRL, 0x0800); return (0); }
unsigned long systime_get(void) { unsigned long state, ret; state = IntDisable(); // iprintf("state 0x%08lx\n", state); ret = systime_value; IntRestore(state); return ret; }
/**************************************************************************//** * @brief Set up sleep mode timer to generate interrupt every \c cycles * 32768 Hz. Use halTimer32kIntConnect() to connect an ISR to the * interrupt and halTimer32kIntEnable() to enable timer interrupts. * * @param cycles Number of cycles between every timer interrupt. * * @return None ******************************************************************************/ void halTimer32kInit(uint16 cycles) { // Store cycle count ulHalTimer32kInterval = cycles; // Disable sleep mode timer interrupts IntDisable(INT_SMTIM); // Set compare value SleepModeTimerCompareSet((SleepModeTimerCountGet() + cycles)); }
//****************************************************************************** // //! Un-Register camera interrupt handler //! //! \param ulBase is the base address of the camera module. //! //! This function unregisters and disables global camera interrupt from the //! interrupt controller. //! //! \return None. // //****************************************************************************** void CameraIntUnregister(unsigned long ulBase) { // // Disable the interrupt. // IntDisable(INT_CAMERA); // // Unregister the interrupt handler. // IntUnregister(INT_CAMERA); }
void UART_IntDisable(tUART* uart, tUART_IRQ_Flag flag) { // Disable Interrupt UARTIntDisable(uart -> base, uart_int_flags[flag]); // Bookkeeping uart -> irq_flags &= ~uart_int_flags[flag]; // No more UART Ints enabled if (uart -> irq_flags == 0) IntDisable(uart -> nvic_ndx); }
//***************************************************************************** // //! Unregisters the system exception interrupt handler. //! //! This function removes the system exception interrupt handler from the //! vector table in SRAM. This function also masks off the system exception //! interrupt in the interrupt controller so that the interrupt handler is no //! longer called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void SysExcIntUnregister(void) { // // Disable the system exception interrupt. // IntDisable(INT_SYSEXC); // // Unregister the system exception interrupt handler. // IntUnregister(INT_SYSEXC); }
//***************************************************************************** // //! Unregisters an interrupt handler for the Hibernation module interrupt. //! //! Unregisters the interrupt handler in the system interrupt controller. The //! interrupt is disabled at the global level, and the interrupt handler will //! no longer be called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void HibernateIntUnregister(void) { // // Disable the hibernate interrupt. // IntDisable(INT_HIBERNATE); // // Unregister the interrupt handler. // IntUnregister(INT_HIBERNATE); }
//***************************************************************************** // //! Unregisters an interrupt handler for the uDMA controller. //! //! \param ulIntChannel identifies which uDMA interrupt to unregister. //! //! This function will disable and clear the handler to be called for the //! specified uDMA interrupt. The \e ulIntChannel parameter should be one of //! \b UDMA_INT_SW or \b UDMA_INT_ERR as documented for the function //! uDMAIntRegister(). //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void uDMAIntUnregister(unsigned long ulIntChannel) { // // Disable the interrupt. // IntDisable(ulIntChannel); // // Unregister the interrupt handler. // IntUnregister(ulIntChannel); }
//***************************************************************************** // //! Unregisters the interrupt handler for SDHost interrupt //! //! \param ulBase is the base address of SDHost module //! //! This function does the actual unregistering of the interrupt handler. It //! clears the handler to be called when a SDHost interrupt occurs. This //! function also masks off the interrupt in the interrupt controller so that //! the interrupt handler no longer is called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //***************************************************************************** void SDHostIntUnregister(unsigned long ulBase) { // // Disable the SDHost interrupt. // IntDisable(INT_MMCHS); // // Unregister the interrupt handler. // IntUnregister(INT_MMCHS); }