MG32F10x Standard Peripherals Firmware Library
mg32f10x_i2s.h
Go to the documentation of this file.
1 
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MG32F10x_I2S_H
12 #define __MG32F10x_I2S_H
13 
14 #ifdef __cplusplus
15  extern "C" {
16 #endif
17 
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32f10x.h"
20 
29 /* Exported types ------------------------------------------------------------*/
30 /* Exported constants --------------------------------------------------------*/
31 
36 #define I2S_WordSelectSize_16 I2S_CCR_WSS_16
37 #define I2S_WordSelectSize_24 I2S_CCR_WSS_24
38 #define I2S_WordSelectSize_32 I2S_CCR_WSS_32
39 
40 #define I2S_SclkGate_None I2S_CCR_SCLKG_NONE
41 #define I2S_SclkGate_12 I2S_CCR_SCLKG_12
42 #define I2S_SclkGate_16 I2S_CCR_SCLKG_16
43 #define I2S_SclkGate_20 I2S_CCR_SCLKG_20
44 #define I2S_SclkGate_24 I2S_CCR_SCLKG_24
45 
46 
47 
48 
49 #define I2S_IT_RXDA (0x01)
50 #define I2S_IT_RXFO (0x02)
51 #define I2S_IT_TXFE (0x10)
52 #define I2S_IT_TXFO (0x20)
53 
54 
55 #define I2S_DataFormat_Ignore ((uint32_t)0x00000000)
56 #define I2S_DataFormat_12b ((uint32_t)0x00000001)
57 #define I2S_DataFormat_16b ((uint32_t)0x00000002)
58 #define I2S_DataFormat_20b ((uint32_t)0x00000003)
59 #define I2S_DataFormat_24b ((uint32_t)0x00000004)
60 #define I2S_DataFormat_32b ((uint32_t)0x00000005)
61 
66 /* Exported macro ------------------------------------------------------------*/
67 /* Exported functions --------------------------------------------------------*/
68 
69 void I2S_DeInit(void);
70 void I2S_Cmd(FunctionalState NewState);
71 
72 void I2S_ReceiverCmd(FunctionalState NewState);
73 void I2S_TransmitterCmd(FunctionalState NewState);
74 
75 void I2S_ClockConfig(uint32_t I2S_WordSelectSize, uint32_t I2S_SclkGate);
76 void I2S_ClockCmd(FunctionalState NewState);
77 
78 void I2S_ReceiverFIFOFlush(void);
79 void I2S_TransmitterFIFOFlush(void);
80 
81 
82 uint32_t I2S_Channel_ReadLeftData(uint32_t I2S_Channel);
83 uint32_t I2S_Channel_ReadRightData(uint32_t I2S_Channel);
84 
85 void I2S_Channel_WriteLeftData(uint32_t I2S_Channel, uint32_t LeftData);
86 void I2S_Channel_WriteRightData(uint32_t I2S_Channel, uint32_t RightData);
87 
88 void I2S_Channel_ReceiveCmd(uint32_t I2S_Channel, FunctionalState NewState);
89 void I2S_Channel_TransmitCmd(uint32_t I2S_Channel, FunctionalState NewState);
90 
91 void I2S_Channel_ReceiveConfig(uint32_t I2S_Channel, uint32_t I2S_DataFormat);
92 void I2S_Channel_TransmitConfig(uint32_t I2S_Channel, uint32_t I2S_DataFormat);
93 
94 void I2S_Channel_ITConfig(uint32_t I2S_Channel, uint8_t I2S_IT, FunctionalState NewState);
95 ITStatus I2S_Channel_GetITStatus(uint32_t I2S_Channel, uint8_t I2S_IT);
96 void I2S_Channel_ClearITPendingBit(uint32_t I2S_Channel, uint8_t I2S_IT);
97 
98 void I2S_Channel_ReceiveFIFOConfig(uint32_t I2S_Channel, uint8_t Threshold);
99 void I2S_Channel_TransmitFIFOConfig(uint32_t I2S_Channel, uint8_t Threshold);
100 
101 void I2S_Channel_ReceiveFIFOFlush(uint32_t I2S_Channel);
102 void I2S_Channel_TransmitFIFOFlush(uint32_t I2S_Channel);
103 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* __MG32F10x_I2S_H */
void I2S_DeInit(void)
Deinitializes the I2S peripheral registers to their default reset values.
Definition: mg32f10x_i2s.c:37
void I2S_Channel_ReceiveCmd(uint32_t I2S_Channel, FunctionalState NewState)
Enables or disables the receive channel.
Definition: mg32f10x_i2s.c:196
void I2S_TransmitterFIFOFlush(void)
Flushes all the TX FIFOs.
Definition: mg32f10x_i2s.c:142
void I2S_Channel_ReceiveConfig(uint32_t I2S_Channel, uint32_t I2S_DataFormat)
Configures the desired data resolution of the receiver.
Definition: mg32f10x_i2s.c:236
void I2S_Channel_TransmitConfig(uint32_t I2S_Channel, uint32_t I2S_DataFormat)
Configures the data resolution of the transmitter.
Definition: mg32f10x_i2s.c:254
void I2S_Channel_TransmitFIFOFlush(uint32_t I2S_Channel)
Flushes the corresponding TX FIFO.
Definition: mg32f10x_i2s.c:365
ITStatus I2S_Channel_GetITStatus(uint32_t I2S_Channel, uint8_t I2S_IT)
Checks whether the specified I2S interrupt has occurred or not.
Definition: mg32f10x_i2s.c:293
void I2S_Channel_TransmitCmd(uint32_t I2S_Channel, FunctionalState NewState)
Enables or disables the transmit channel.
Definition: mg32f10x_i2s.c:213
uint32_t I2S_Channel_ReadLeftData(uint32_t I2S_Channel)
Read the left stereo data from Rx FIFO.
Definition: mg32f10x_i2s.c:152
void I2S_Channel_WriteLeftData(uint32_t I2S_Channel, uint32_t LeftData)
Write the left stereo data to Tx FIFO.
Definition: mg32f10x_i2s.c:173
void I2S_Channel_TransmitFIFOConfig(uint32_t I2S_Channel, uint8_t Threshold)
Configures the Tx FIFO threshold.
Definition: mg32f10x_i2s.c:345
void I2S_TransmitterCmd(FunctionalState NewState)
Enables or disables the I2S transmitter block.
Definition: mg32f10x_i2s.c:81
void I2S_ClockConfig(uint32_t I2S_WordSelectSize, uint32_t I2S_SclkGate)
Configures I2S Clock Generation block.
Definition: mg32f10x_i2s.c:108
void I2S_ReceiverFIFOFlush(void)
Flushes all the RX FIFOs.
Definition: mg32f10x_i2s.c:133
uint32_t I2S_Channel_ReadRightData(uint32_t I2S_Channel)
Read the right stereo data from Rx FIFO.
Definition: mg32f10x_i2s.c:162
void I2S_Channel_ReceiveFIFOConfig(uint32_t I2S_Channel, uint8_t Threshold)
Configures the Rx FIFO threshold.
Definition: mg32f10x_i2s.c:333
void I2S_ClockCmd(FunctionalState NewState)
Enables or disables the I2S clock generation block.
Definition: mg32f10x_i2s.c:119
void I2S_Channel_ClearITPendingBit(uint32_t I2S_Channel, uint8_t I2S_IT)
Clears the I2S interrupt pending bits.
Definition: mg32f10x_i2s.c:315
void I2S_ReceiverCmd(FunctionalState NewState)
Enables or disables the I2S receiver block.
Definition: mg32f10x_i2s.c:65
void I2S_Channel_ReceiveFIFOFlush(uint32_t I2S_Channel)
Flushes the corresponding RX FIFO.
Definition: mg32f10x_i2s.c:355
void I2S_Channel_ITConfig(uint32_t I2S_Channel, uint8_t I2S_IT, FunctionalState NewState)
Enables or disables the specified I2S interrupts.
Definition: mg32f10x_i2s.c:272
void I2S_Cmd(FunctionalState NewState)
Enables or disables the specified I2S peripheral.
Definition: mg32f10x_i2s.c:49
void I2S_Channel_WriteRightData(uint32_t I2S_Channel, uint32_t RightData)
Write the right stereo data to Tx FIFO.
Definition: mg32f10x_i2s.c:184