--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 75x_ssp.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 03/10/2006 \r
+* Description : This file provides all the SSP software functions.\r
+********************************************************************************\r
+* History:\r
+* 07/17/2006 : V1.0\r
+* 03/10/2006 : V0.1\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, \r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING \r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "75x_ssp.h"\r
+#include "75x_mrcc.h"\r
+\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+\r
+/* SSP peripheral Enable */\r
+#define SSP_Enable 0x0002\r
+#define SSP_Disable 0xFFFD\r
+\r
+/* SSP Loop Back Mode Enable */\r
+#define SSP_LoopBackMode_Enable 0x0001\r
+#define SSP_LoopBackMode_Disable 0xFFFE\r
+\r
+/* SSP Flag Mask */\r
+#define SSP_Flag_Mask 0x001F\r
+\r
+/* SSP DMA transmit/ receive enable/disable Masks */\r
+#define SSP0_DMA_TransmitEnable 0x0002\r
+#define SSP0_DMA_TransmitDisable 0xFFFD\r
+#define SSP0_DMA_ReceiveEnable 0x0001\r
+#define SSP0_DMA_ReceiveDisable 0xFFFE\r
+\r
+/* SSP Masks */\r
+#define SSP_FrameFormat_Mask 0xFFCF\r
+#define SSP_DataSize_Mask 0xFFF0\r
+#define SSP_ClockRate_Mask 0x00FF\r
+#define SSP_ClockPrescaler_Mask 0xFF00\r
+#define SSP_SSI_Set_Mask 0x0020\r
+#define SSP_SSI_Reset_Mask 0xFFDF\r
+\r
+\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_DeInit\r
+* Description : Deinitializes the SSPx peripheral registers to their default\r
+* reset values.\r
+* Input : SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_DeInit(SSP_TypeDef* SSPx)\r
+{\r
+ if(SSPx == SSP0)\r
+ {\r
+ /* Reset the SSP0 registers values*/\r
+ MRCC_PeripheralSWResetConfig(MRCC_Peripheral_SSP0,ENABLE);\r
+ MRCC_PeripheralSWResetConfig(MRCC_Peripheral_SSP0,DISABLE); \r
+ }\r
+ else if (SSPx == SSP1)\r
+ {\r
+ /* Reset the SSP1 registers values*/\r
+ MRCC_PeripheralSWResetConfig(MRCC_Peripheral_SSP1,ENABLE);\r
+ MRCC_PeripheralSWResetConfig(MRCC_Peripheral_SSP1,DISABLE); \r
+ } \r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_Init\r
+* Description : Initializes the SSPx peripheral according to the specified\r
+* parameters in the SSP_InitTypeDef structure.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - SSP_InitStruct: pointer to a SSP_InitTypeDef structure that\r
+* contains the configuration information for the specified SSP\r
+* peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct)\r
+{ \r
+ /* Configure the Frame format */\r
+ if(SSP_InitStruct->SSP_FrameFormat == SSP_FrameFormat_TI)\r
+ { \r
+ /* Clear the FRF[1:0] bits */\r
+ SSPx->CR0 &= SSP_FrameFormat_Mask;\r
+ /* Set the TI frame format */\r
+ SSPx->CR0 |= SSP_FrameFormat_TI;\r
+ }\r
+ else\r
+ {\r
+ /* Set the Motorola frame format */\r
+ SSPx->CR0 &= SSP_FrameFormat_Motorola;\r
+ /* Configure the Clock polarity */\r
+ if(SSP_InitStruct->SSP_CPOL == SSP_CPOL_High)\r
+ { \r
+ /* SCK is held high when no data is being transfered */ \r
+ SSPx->CR0 |= SSP_CPOL_High;\r
+ }\r
+ else\r
+ {\r
+ /* SCK is held low when no data is being transfered */ \r
+ SSPx->CR0 &= SSP_CPOL_Low;\r
+ }\r
+ /* Configure the Clock Phase */\r
+ if(SSP_InitStruct->SSP_CPHA == SSP_CPHA_2Edge)\r
+ { \r
+ /* Data captured on second clock edge */ \r
+ SSPx->CR0 |= SSP_CPHA_2Edge;\r
+ }\r
+ else\r
+ {\r
+ /* Data captured on first clock edge */\r
+ SSPx->CR0 &= SSP_CPHA_1Edge;\r
+ }\r
+ }\r
+ \r
+ /* Configure the Mode */\r
+ if(SSP_InitStruct->SSP_Mode == SSP_Mode_Slave)\r
+ { \r
+ /* Set the slave mode */ \r
+ SSPx->CR1 |= SSP_Mode_Slave;\r
+ /* Configure the Slave output */\r
+ if(SSP_InitStruct->SSP_SlaveOutput == SSP_SlaveOutput_Disable)\r
+ { \r
+ /* Slave output disabled */ \r
+ SSPx->CR1 |= SSP_SlaveOutput_Disable;\r
+ }\r
+ else\r
+ {\r
+ /* Slave output enabled */ \r
+ SSPx->CR1 &= SSP_SlaveOutput_Enable;\r
+ }\r
+ /* Configure the NSS pin */\r
+ if(SSP_InitStruct->SSP_NSS == SSP_NSS_Soft)\r
+ { \r
+ /* Slave selected by software through SSI bit */ \r
+ SSPx->CR1 |= SSP_NSS_Soft;\r
+ SSPx->CR1 &= SSP_SSI_Reset_Mask;\r
+ }\r
+ else\r
+ {\r
+ /* Slave selected by hardware through external SSpin */\r
+ SSPx->CR1 &= SSP_NSS_Hard;\r
+ }\r
+ /* Configure the Clock rate and prescaler in TI slave mode */\r
+ if(SSP_InitStruct->SSP_FrameFormat == SSP_FrameFormat_TI)\r
+ { \r
+ /* Clear clock rate SCR[7:0] bits */\r
+ SSPx->CR0 &= SSP_ClockRate_Mask; \r
+ /* Set the serial clock rate */\r
+ SSPx->CR0 |= (SSP_InitStruct->SSP_ClockRate<<8);\r
+ /* Clear clock prescaler CPSDVSR[7:0] bits */\r
+ SSPx->PR &= SSP_ClockPrescaler_Mask;\r
+ /* Set the serial clock prescaler */\r
+ SSPx->PR |= SSP_InitStruct->SSP_ClockPrescaler;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* Set the master mode */\r
+ SSPx->CR1 &= SSP_Mode_Master;\r
+ /* Configure the NSS pin */\r
+ if(SSP_InitStruct->SSP_NSS == SSP_NSS_Soft)\r
+ { \r
+ /* Master selected by software through SSI bit */ \r
+ SSPx->CR1 |= SSP_NSS_Soft;\r
+ SSPx->CR1 |= SSP_SSI_Set_Mask;\r
+ }\r
+ else\r
+ {\r
+ /* Master selected by hardware through external SSpin */\r
+ SSPx->CR1 &= SSP_NSS_Hard;\r
+ }\r
+ /* Clear clock rate SCR[7:0] bits */\r
+ SSPx->CR0 &= SSP_ClockRate_Mask; \r
+ /* Set the serial clock rate */\r
+ SSPx->CR0 |= (SSP_InitStruct->SSP_ClockRate<<8);\r
+ /* Clear clock prescaler CPSDVSR[7:0] bits */\r
+ SSPx->PR &= SSP_ClockPrescaler_Mask;\r
+ /* Set the serial clock prescaler */\r
+ SSPx->PR |= SSP_InitStruct->SSP_ClockPrescaler;\r
+ }\r
+ \r
+ /* Clear data size DSS[3:0] bits */\r
+ SSPx->CR0 &= SSP_DataSize_Mask;\r
+ /* Set the data size */\r
+ SSPx->CR0 |= SSP_InitStruct->SSP_DataSize;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_StructInit\r
+* Description : Fills each SSP_InitStruct member with its default value.\r
+* Input : SSP_InitStruct : pointer to a SSP_InitTypeDef structure\r
+ which will be initialized.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct)\r
+{\r
+ /* Initialize the SSP_FrameFormat member */\r
+ SSP_InitStruct->SSP_FrameFormat = SSP_FrameFormat_Motorola;\r
+\r
+ /* Initialize the SSP_Mode member */\r
+ SSP_InitStruct->SSP_Mode = SSP_Mode_Master;\r
+\r
+ /* Initialize the SSP_CPOL member */\r
+ SSP_InitStruct->SSP_CPOL = SSP_CPOL_Low;\r
+\r
+ /* Initialize the SSP_CPHA member */\r
+ SSP_InitStruct->SSP_CPHA = SSP_CPHA_1Edge;\r
+\r
+ /* Initialize the SSP_DataSize member */\r
+ SSP_InitStruct->SSP_DataSize = SSP_DataSize_8b;\r
+ \r
+ /* Initialize the SSP_NSS member */\r
+ SSP_InitStruct->SSP_NSS = SSP_NSS_Hard;\r
+ \r
+ /* Initialize the SSP_SlaveOutput member */\r
+ SSP_InitStruct->SSP_SlaveOutput = SSP_SlaveOutput_Enable;\r
+ \r
+ /* Initialize the SSP_ClockRate member */\r
+ SSP_InitStruct->SSP_ClockRate = 0;\r
+ \r
+ /* Initialize the SSP_ClockPrescaler member */\r
+ SSP_InitStruct->SSP_ClockPrescaler = 0;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_Cmd\r
+* Description : Enables or disables the specified SSP peripheral.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - NewState: new state of the SSPx peripheral. \r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState)\r
+{\r
+ if(NewState == ENABLE)\r
+ {\r
+ /* Enable the SSP peripheral */\r
+ SSPx->CR1 |= SSP_Enable;\r
+ }\r
+ else\r
+ {\r
+ /* Disable the SSP peripheral */\r
+ SSPx->CR1 &= SSP_Disable;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_ITConfig\r
+* Description : Enables or disables the specified SSP interrupts.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - SSP_IT: specifies the SSP interrupts sources to be enabled\r
+* or disabled. This parameter can be any combination of the\r
+* following values:\r
+* - SSP_IT_TxFifo: Transmit FIFO half empty or less interrupt \r
+* - SSP_IT_RxFifo: Receive FIFO half full or less interrupt \r
+* - SSP_IT_RxTimeOut: Receive timeout interrupt \r
+* - SSP_IT_RxOverrun: Receive overrun interrupt \r
+* - NewState: new state of the specified SSP interrupts.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState)\r
+{\r
+ if(NewState == ENABLE)\r
+ {\r
+ /* Enable the selected SSP interrupts */\r
+ SSPx->IMSCR |= SSP_IT;\r
+ }\r
+ else\r
+ {\r
+ /* Disable the selected SSP interrupts */\r
+ SSPx->IMSCR &= ~SSP_IT;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_DMACmd\r
+* Description : Configures the SSP0 DMA interface.\r
+* Input : - SSP0_DMAtransfer : specifies the DMA transfer to be \r
+* enabled or disabled. This parameter can be one of the\r
+* following values:\r
+* - SSP0_DMA_Transmit: transmit Fifo DMA transfer\r
+* - SSP0_DMA_Receive: receive Fifo DMA transfer \r
+* - NewState: new state of SSP0 DMA transfer.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_DMACmd(u16 SSP0_DMAtransfer, FunctionalState NewState)\r
+{\r
+ if(NewState == ENABLE) \r
+ {\r
+ if(SSP0_DMAtransfer == SSP0_DMA_Transmit) \r
+ {\r
+ /* Enable DMA for the transmit FIFO */\r
+ SSP0->DMACR |= SSP0_DMA_TransmitEnable;\r
+ }\r
+ else \r
+ {\r
+ /* Enable DMA for the receive FIFO */\r
+ SSP0->DMACR |= SSP0_DMA_ReceiveEnable;\r
+ }\r
+ }\r
+ else \r
+ {\r
+ if(SSP0_DMAtransfer == SSP0_DMA_Transmit) \r
+ {\r
+ /* Disable DMA for the transmit FIFO */\r
+ SSP0->DMACR &= SSP0_DMA_TransmitDisable;\r
+ }\r
+ else \r
+ {\r
+ /* Disable DMA for the receive FIFO */\r
+ SSP0->DMACR &= SSP0_DMA_ReceiveDisable;\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_DMATxConfig\r
+* Description : Configures the SSP0 DMA transmit transfer.\r
+* Input : - SSP0_DMATxReq : specifies the SSP0 DMA transmit request to \r
+* be enabled. This parameter can be one of the following\r
+* values:\r
+* - SSP0_DMATxReq_Single: Transmit FIFO DMA single \r
+* request enabled\r
+* - SSP0_DMATxReq_Burst: Transmit FIFO DMA burst request\r
+* enabled\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_DMATxConfig(u16 SSP0_DMATxReq)\r
+{\r
+ if(SSP0_DMATxReq == SSP0_DMATxReq_Burst) \r
+ {\r
+ /* Enable DMA transmit burst request */\r
+ SSP0->DMACR |= SSP0_DMATxReq_Burst;\r
+ }\r
+ else \r
+ {\r
+ /* Enable DMA transmit single request */\r
+ SSP0->DMACR &= SSP0_DMATxReq_Single;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_DMARxConfig\r
+* Description : Configures the SSP0 DMA receive transfer.\r
+* Input : - SSP0_DMARxReq : specifies the SSP0 DMA receive request to \r
+* be enabled. This parameter can be one of the following\r
+* values:\r
+* - SSP0_DMARxReq_Single: Receive FIFO DMA burst request\r
+* enabled\r
+* - SSP0_DMARxReq_Burst: Receive FIFO DMA single request\r
+* enabled\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_DMARxConfig(u16 SSP0_DMARxReq)\r
+{\r
+ if(SSP0_DMARxReq == SSP0_DMARxReq_Burst) \r
+ {\r
+ /* Enable DMA receive burst request */\r
+ SSP0->DMACR |= SSP0_DMARxReq_Burst;\r
+ }\r
+ else \r
+ {\r
+ /* Enable DMA receive single request */\r
+ SSP0->DMACR &= SSP0_DMARxReq_Single;\r
+ } \r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_SendData\r
+* Description : Transmits a Data through the SSP peripheral.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - Data : Data to be transmitted.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_SendData(SSP_TypeDef* SSPx, u16 Data)\r
+{\r
+ /* Write in the DR register the data to be sent */\r
+ SSPx->DR = Data;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_ReceiveData\r
+* Description : Returns the most recent received data by the SSP peripheral.\r
+* Input : SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* Output : None\r
+* Return : The value of the received data.\r
+*******************************************************************************/\r
+u16 SSP_ReceiveData(SSP_TypeDef* SSPx)\r
+{\r
+ /* Return the data in the DR register */ \r
+ return SSPx->DR;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_LoopBackConfig\r
+* Description : Enables or disables the Loop back mode for the selected SSP\r
+* peripheral.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - NewState: new state of the Loop Back mode.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_LoopBackConfig(SSP_TypeDef* SSPx, FunctionalState NewState)\r
+{\r
+ if(NewState == ENABLE)\r
+ {\r
+ /* Enable loop back mode */\r
+ SSPx->CR1 |= SSP_LoopBackMode_Enable;\r
+ }\r
+ else\r
+ {\r
+ /* Disable loop back mode */\r
+ SSPx->CR1 &= SSP_LoopBackMode_Disable;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_NSSInternalConfig\r
+* Description : Configures by software the NSS pin.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - SSP_NSSState: NSS internal state.This parameter can be one\r
+* of the following values:\r
+* - SSP_NSSInternal_Set: Set NSS pin internally\r
+* - SSP_NSSInternal_Reset: Reset NSS pin internally\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_NSSInternalConfig(SSP_TypeDef* SSPx, u16 SSP_NSSState)\r
+{\r
+ if(SSP_NSSState == SSP_NSSInternal_Set)\r
+ {\r
+ /* Set NSS pin internally */\r
+ SSPx->CR1 |= SSP_NSSInternal_Set;\r
+ }\r
+ else\r
+ {\r
+ /* Reset NSS pin internally */\r
+ SSPx->CR1 &= SSP_NSSInternal_Reset;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_GetFlagStatus\r
+* Description : Checks whether the specified SSP flag is set or not.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - SSP_FLAG: specifies the flag to check. This parameter can \r
+* be one of the following values:\r
+* - SSP_FLAG_Busy: busy flag\r
+* - SSP_FLAG_RxFifoFull: Receive FIFO full flag\r
+* - SSP_FLAG_RxFifoNotEmpty: Receive FIFO not empty flag \r
+* - SSP_FLAG_TxFifoNotFull: Transmit FIFO not full flag \r
+* - SSP_FLAG_TxFifoEmpty: Transmit FIFO empty flag \r
+* - SSP_FLAG_TxFifo: Transmit FIFO half empty or less flag\r
+* - SSP_FLAG_RxFifo: Receive FIFO half full or less flag\r
+* - SSP_FLAG_RxTimeOut: Receive timeout flag\r
+* - SSP_FLAG_RxOverrun: Receive overrun flag\r
+* Output : None\r
+* Return : The new state of SSP_FLAG(SET or RESET).\r
+*******************************************************************************/\r
+FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG)\r
+{\r
+ u32 SSPReg = 0, FlagPos = 0;\r
+ u32 StatusReg = 0;\r
+\r
+ /* Get the SSP register index */\r
+ SSPReg = SSP_FLAG >> 5;\r
+\r
+ /* Get the flag position */\r
+ FlagPos = SSP_FLAG & SSP_Flag_Mask;\r
+\r
+ /* Find the register of the flag to check */\r
+ if(SSPReg == 1) \r
+ {\r
+ /* The flag to check is in SR register */\r
+ StatusReg = SSPx->SR; \r
+ }\r
+ else if (SSPReg == 2) \r
+ {\r
+ /* The flag to check is in RISR register */\r
+ StatusReg = SSPx->RISR;\r
+ }\r
+ \r
+ /* Check the status of the specified SSP flag */\r
+ if((StatusReg & (1 << FlagPos)) != RESET)\r
+ {\r
+ /* Return SET if the SSP flag is set */\r
+ return SET;\r
+ }\r
+ else\r
+ {\r
+ /* Return RESET if the SSP flag is reset */\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_ClearFlag\r
+* Description : Clears the SSPx\92s pending flags.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - SSP_FLAG: specifies the flag to clear. This parameter can \r
+* be one of the following values:\r
+* - SSP_FLAG_RxTimeOut: Receive timeout flag \r
+* - SSP_FLAG_RxOverrun: Receive overrun flag \r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG)\r
+{ \r
+ u8 FlagPos = 0;\r
+\r
+ /* Get the flag position */\r
+ FlagPos = SSP_FLAG & SSP_Flag_Mask;\r
+ \r
+ /* Clear the selected SSP flag */ \r
+ SSPx->ICR = (1 << FlagPos); \r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_GetITStatus\r
+* Description : Checks whether the specified SSP interrupt has occurred or not.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - SSP_IT: specifies the interrupt source to check. \r
+* This parameter can be one of the following values:\r
+* - SSP_IT_TxFifo: Transmit FIFO half empty or less interrupt \r
+* - SSP_IT_RxFifo: Receive FIFO half full or less interrupt \r
+* - SSP_IT_RxTimeOut: Receive timeout interrupt \r
+* - SSP_IT_RxOverrun: Receive overrun interrupt \r
+* Output : None\r
+* Return : The new state of SSP_IT(SET or RESET).\r
+*******************************************************************************/\r
+ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT)\r
+{\r
+ /* Check the status of the specified interrupt flag */\r
+ if((SSPx->MISR & SSP_IT) != RESET)\r
+ {\r
+ /* Return SET if the SSP interrupt flag is set */\r
+ return SET;\r
+ }\r
+ else\r
+ {\r
+ /* Return RESET if SSP interrupt flag is reset */\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SSP_ClearITPendingBit\r
+* Description : Clears the SSPx\92s interrupt pending bits.\r
+* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.\r
+* - SSP_IT: specifies the interrupt pending bit to clear. \r
+* This parameter can be any combination of the following values:\r
+* - SSP_IT_RxTimeOut: Receive timeout interrupt \r
+* - SSP_IT_RxOverrun: Receive overrun interrupt \r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT)\r
+{\r
+ /* Clear the selected SSP interrupts pending bits */\r
+ SSPx->ICR = SSP_IT;\r
+}\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r