/* to this function. */ int BTPSAPI HCITR_COMWrite(unsigned int HCITransportID, unsigned int Length, unsigned char *Buffer) { int ret_val; int Count; /* Check to make sure that the specified Transport ID is valid and */ /* the output buffer appears to be valid as well. */ if((HCITransportID == TRANSPORT_ID) && (HCITransportOpen) && (Length) && (Buffer)) { /* Delay and poll until there is enough room in the Tx Buffer (in */ /* the UartContext structure) to hold the data we are trying to */ /* transmit. */ while(UartContext.TxBytesFree < Length) BTPS_Delay(10); /* Process all of the data. */ while(Length) { /* The data may have to be copied in 2 phases. Calculate the */ /* number of character that can be placed in the buffer before */ /* the buffer must be wrapped. */ Count = (UartContext.TxBufferSize-UartContext.TxInIndex); Count = (Count > Length)?Length:Count; BTPS_MemCopy(&(UartContext.TxBuffer[UartContext.TxInIndex]), Buffer, Count); /* Update the number of free bytes in the buffer. Since this */ /* count can also be updated in the interrupt routine, we will */ /* have have to update this with interrupts disabled. */ MAP_IntDisable(UartContext.IntBase); UartContext.TxBytesFree -= Count; MAP_IntEnable(UartContext.IntBase); /* Adjust the count and index values. */ Buffer += Count; Length -= Count; UartContext.TxInIndex += Count; if(UartContext.TxInIndex >= UartContext.TxBufferSize) UartContext.TxInIndex = 0; } /* Check to see if we need to prime the transmitter. */ if(!(HWREG(UartContext.Base + UART_O_IM) & UART_IM_TXIM)) { /* Now that the data is in the input buffer, check to see if we*/ /* need to enable the interrupt to start the TX Transfer. */ HWREG(UartContext.Base + UART_O_IM) |= UART_IM_TXIM; /* Start sending data to the Uart Transmit. */ MAP_IntDisable(UartContext.IntBase); TxInterrupt(); MAP_IntEnable(UartContext.IntBase); } ret_val = 0; } else ret_val = HCITR_ERROR_WRITING_TO_PORT; return(ret_val); }
//***************************************************************************** // // This function is called to stop an acquisition running. It disables the // ADC sequencers and the RTC match interrupt. // //***************************************************************************** void AcquireStop(void) { // // Disable RTC interrupts // MAP_IntDisable(INT_HIBERNATE); // // Disable ADC interrupts // MAP_IntDisable(INT_ADC0SS0); MAP_IntDisable(INT_ADC1SS0); // // Disable ADC sequencers // MAP_ADCSequenceDisable(ADC0_BASE, 0); MAP_ADCSequenceDisable(ADC1_BASE, 0); // // If USB stick is being used, then close the file so it will flush // the buffers to the USB stick. // if(g_psConfigState->ui8Storage == CONFIG_STORAGE_USB) { USBStickCloseFile(); } // // Disable the configuration pointer, which acts as a flag to indicate // if we are properly configured for data acquisition. // g_psConfigState = 0; }
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 MAP_IntDisable(INT_NWPIC); MAP_IntUnregister(INT_NWPIC); MAP_IntPendClear(INT_NWPIC); #endif } else { #ifdef SL_PLATFORM_MULTI_THREADED MAP_IntPendClear(INT_NWPIC); osi_InterruptRegister(INT_NWPIC, (P_OSI_INTR_ENTRY)InterruptHdl, INT_PRIORITY_LVL_1); #else MAP_IntRegister(INT_NWPIC, InterruptHdl); MAP_IntPrioritySet(INT_NWPIC, INT_PRIORITY_LVL_1); MAP_IntPendClear(INT_NWPIC); MAP_IntEnable(INT_NWPIC); #endif } return 0; }
// //! \brief Application defined idle task hook //! //! \param none //! //! \return none //! //***************************************************************************** void vApplicationIdleHook( void) { int iRetVal; // // Enter SLEEP...WaitForInterrupt ARM intrinsic // DBG_PRINT("DEEPSLEEP: Entering DeepSleep\n\r"); //MAP_UtilsDelay(80000); for(iRetVal = 0; iRetVal < 80000; iRetVal++); // // Disable the SYSTICK interrupt // MAP_IntDisable(FAULT_SYSTICK); MAP_PRCMDeepSleepEnter(); // // Enable the SYSTICK interrupt // MAP_IntEnable(FAULT_SYSTICK);
void Button_IF_DisableInterrupt(unsigned char ucSwitch) { if(ucSwitch & SW2) { //Clear and Disable GPIO Interrupt MAP_GPIOIntDisable(GPIOA2_BASE,GPIO_PIN_6); MAP_GPIOIntClear(GPIOA2_BASE,GPIO_PIN_6); MAP_IntDisable(INT_GPIOA2); } if(ucSwitch & SW3) { //Clear and Disable GPIO Interrupt MAP_GPIOIntDisable(GPIOA1_BASE,GPIO_PIN_5); MAP_GPIOIntClear(GPIOA1_BASE,GPIO_PIN_5); MAP_IntDisable(INT_GPIOA1); } }
void DataReadyIntHandler(void) { uint8_t p = ROM_GPIOPinIntStatus(ADS_DRY_PORT, true) & 0xFF; MAP_IntDisable(INT_GPIOC); MAP_GPIOPinIntDisable(ADS_DRY_PORT, ADS_DRY_PIN); GPIOPinIntClear(ADS_DRY_PORT, p); HWREGBITW(&g_ulFlags, FLAG_ADS_INT) = 1; }
//-------------------------------- void esp8266::OnTransmit() { if (m_nTxHead != m_nTxFill) { MAP_IntDisable(UART_INT); while (MAP_UARTSpaceAvail(UART_BASE) && (m_nTxHead != m_nTxFill)) { m_nTxHead = ((m_nTxHead + 1) % OutputBufferSize); MAP_UARTCharPutNonBlocking(UART_BASE, m_cOutput[m_nTxHead]); } MAP_IntEnable(UART_INT); } if (m_nTxHead == m_nTxFill) { MAP_UARTIntDisable(UART_BASE, UART_INT_TX); } }
/* for the data length and data buffer (respectively). */ void BTPSAPI HCITR_COMClose(unsigned int HCITransportID) { HCITR_COMDataCallback_t COMDataCallback; unsigned long CallbackParameter; /* Check to make sure that the specified Transport ID is valid. */ if((HCITransportID == TRANSPORT_ID) && (HCITransportOpen)) { /* Disable the UART Interrupts. */ MAP_UARTIntDisable(UartContext.Base, UART_INT_RX | UART_INT_RT); MAP_IntDisable(UartContext.IntBase); /* Place the Bluetooth Device in Reset. */ MAP_GPIOPinWrite(HCI_RESET_BASE, HCI_RESET_PIN, 0); /* Note the Callback information. */ COMDataCallback = _COMDataCallback; CallbackParameter = _COMCallbackParameter; /* Flag that the HCI Transport is no longer open. */ HCITransportOpen = 0; /* Flag that there is no callback information present. */ _COMDataCallback = NULL; _COMCallbackParameter = 0; /* Flag that the RxThread is deleted. */ Handle = NULL; /* Flag that the Rx Thread should delete itself. */ RxThreadDeleted = TRUE; BTPS_SetEvent(RxDataEvent); /* Flag that the RxThread is deleted. */ Handle = NULL; /* Delay while the RxThread exits. */ BTPS_Delay(5); /* All finished, perform the callback to let the upper layer know */ /* that this module will no longer issue data callbacks and is */ /* completely cleaned up. */ if(COMDataCallback) (*COMDataCallback)(HCITransportID, 0, NULL, CallbackParameter); /* Close the RxData event. */ BTPS_CloseEvent(RxDataEvent); } }
//***************************************************************************** // //! GPIO Interrupt Handler for S2 button //! //! \param None //! //! \return None // //***************************************************************************** static void SpeakerButtonHandler() { unsigned long ulPinState = GPIOIntStatus(GPIOA2_BASE,1); if(ulPinState & GPIO_PIN_6) { //Clear and Disable GPIO Interrupt MAP_GPIOIntDisable(GPIOA2_BASE,GPIO_PIN_6); MAP_GPIOIntClear(GPIOA2_BASE,GPIO_PIN_6); MAP_IntDisable(INT_GPIOA2); //Call Speaker Handler if(g_pAudioOutControlHdl) { g_pAudioOutControlHdl(); } } }
//-------------------------------- void ssi_peripheral::Terminate() { switch (m_nDevice) { case ssi_peripheral::SSI0: g_pTheSSI0 = 0; break; case ssi_peripheral::SSI1: g_pTheSSI1 = 0; break; case ssi_peripheral::SSI2: g_pTheSSI2 = 0; break; case ssi_peripheral::SSI3: g_pTheSSI3 = 0; break; default: break; } SSIIntDisable(m_rSpecification.m_nSSIBase, SSI_TXFF); /* SSI_TXFF | SSI_RXFF | SSI_RXTO | SSI_RXOR */ MAP_IntDisable(m_rSpecification.m_nInterrupt); MAP_SSIDisable(m_rSpecification.m_nSSIBase); }
void HardwareSerial::primeTransmit(unsigned long ulBase) { /* Do we have any data to transmit? */ if(!TX_BUFFER_EMPTY) { /* Disable the UART interrupt. If we don't do this there is a race * condition which can cause the read index to be corrupted. */ MAP_IntDisable(g_ulUARTInt[uartModule]); /* Yes - take some characters out of the transmit buffer and feed * them to the UART transmit FIFO. */ while(!TX_BUFFER_EMPTY){ while(MAP_UARTSpaceAvail(ulBase) && !TX_BUFFER_EMPTY){ MAP_UARTCharPutNonBlocking(ulBase, txBuffer[txReadIndex]); txReadIndex = (txReadIndex + 1) % txBufferSize; } } /* Reenable the UART interrupt */ MAP_IntEnable(g_ulUARTInt[uartModule]); } }
void osi_InterruptDeRegister(int iIntrNum) { MAP_IntDisable(iIntrNum); MAP_IntUnregister(iIntrNum); }
/* received from the UART and placed in the receive buffer. */ static void *RxThread(void *Param) { int MaxWrite; int Count; /* This thread will loop forever. */ while(!RxThreadDeleted) { /* Check to see if there are any characters in the receive buffer.*/ Count = (UartContext.RxBufferSize - UartContext.RxBytesFree); if(!Count) { /* Wait for a Recevied Character event; */ BTPS_WaitEvent(RxDataEvent, BTPS_INFINITE_WAIT); if(!RxThreadDeleted) BTPS_ResetEvent(RxDataEvent); else break; Count = (UartContext.RxBufferSize - UartContext.RxBytesFree); } if(Count) { /* Determine the maximum number of characters that we can send */ /* before we reach the end of the buffer. We need to process */ /* the smaller of the max characters of the number of */ /* characters that are in the buffer. */ MaxWrite = (UartContext.RxBufferSize-UartContext.RxOutIndex); Count = (MaxWrite < Count)?MaxWrite:Count; /* Call the upper layer back with the data. */ if(_COMDataCallback) (*_COMDataCallback)(TRANSPORT_ID, Count, &UartContext.RxBuffer[UartContext.RxOutIndex], _COMCallbackParameter); /* Adjust the Out Index and handle any looping. */ UartContext.RxOutIndex += Count; if(UartContext.RxOutIndex >= UartContext.RxBufferSize) UartContext.RxOutIndex = 0; /* Enter a critical section by disabling the UART interrupt */ /* since the UART interrupts access and change the UartContext */ /* structure (which we are about to change). */ MAP_IntDisable(UartContext.IntBase); /* Credit the amount that was sent. */ UartContext.RxBytesFree += Count; /* Check to see if we need to recover from a Buffer Overflow. */ if(UartContext.Flags & UART_CONTEXT_FLAG_RX_OVERRUN) { /* Clear the Overrun Flag and re-enabled the interrupt. */ UartContext.Flags &= ~UART_CONTEXT_FLAG_RX_OVERRUN; MAP_UARTIntEnable(UartContext.Base, UART_INT_RX | UART_INT_RT); } /* Check to se if we need to re-enable Flow Control. */ if(!(UartContext.FlowInfo & UART_CONTEXT_FLAG_RX_FLOW_ENABLED) && (UartContext.RxBytesFree > UartContext.XOnLimit)) { HWREG(BT_RTS_BASE) = FLOW_ON; UartContext.FlowInfo |= UART_CONTEXT_FLAG_RX_FLOW_ENABLED; } /* Re-enable UART interrupts to exit from the critical section.*/ MAP_IntEnable(UartContext.IntBase); } } return(NULL); }