64 #include <inc/hw_types.h>
65 #include <inc/hw_memmap.h>
66 #include <inc/hw_ints.h>
67 #include <inc/hw_i2s.h>
85 #define I2SEnable NOROM_I2SEnable
86 #define I2SAudioFormatConfigure NOROM_I2SAudioFormatConfigure
87 #define I2SChannelConfigure NOROM_I2SChannelConfigure
88 #define I2SBufferConfig NOROM_I2SBufferConfig
89 #define I2SPointerUpdate NOROM_I2SPointerUpdate
90 #define I2SPointerSet NOROM_I2SPointerSet
91 #define I2SSampleStampConfigure NOROM_I2SSampleStampConfigure
92 #define I2SSampleStampGet NOROM_I2SSampleStampGet
147 #define I2S_DMA_BUF_SIZE_64 0x00000040
148 #define I2S_DMA_BUF_SIZE_128 0x00000080
149 #define I2S_DMA_BUF_SIZE_256 0x00000100
156 #define I2S_EXT_WCLK 0x00000001
157 #define I2S_INT_WCLK 0x00000002
158 #define I2S_INVERT_WCLK 0x00000004
159 #define I2S_NORMAL_WCLK 0x00000000
166 #define I2S_LINE_UNUSED 0x00000000
167 #define I2S_LINE_INPUT 0x00000001
168 #define I2S_LINE_OUTPUT 0x00000002
169 #define I2S_LINE_MASK 0x00000003
176 #define I2S_CHAN0_ACT 0x00000100
177 #define I2S_CHAN1_ACT 0x00000200
178 #define I2S_CHAN2_ACT 0x00000400
179 #define I2S_CHAN3_ACT 0x00000800
180 #define I2S_CHAN4_ACT 0x00001000
181 #define I2S_CHAN5_ACT 0x00002000
182 #define I2S_CHAN6_ACT 0x00004000
183 #define I2S_CHAN7_ACT 0x00008000
184 #define I2S_MONO_MODE 0x00000100
185 #define I2S_STEREO_MODE 0x00000300
186 #define I2S_CHAN_CFG_MASK 0x0000FF00
193 #define I2S_MEM_LENGTH_16 0x00000000 // 16 bit size of word in memory
194 #define I2S_MEM_LENGTH_24 0x00000080 // 24 bit size of word in memory
195 #define I2S_POS_EDGE 0x00000040 // Sample on positive edge
196 #define I2S_NEG_EDGE 0x00000000 // Sample on negative edge
197 #define I2S_DUAL_PHASE_FMT 0x00000020 // Dual Phased audio format
198 #define I2S_SINGLE_PHASE_FMT 0x00000000 // Single Phased audio format
199 #define I2S_WORD_LENGTH_8 0x00000008 // Word length is 8 bits
200 #define I2S_WORD_LENGTH_16 0x00000010 // Word length is 16 bits
201 #define I2S_WORD_LENGTH_24 0x00000018 // Word length is 24 bits
208 #define I2S_STMP0 0x00000001 // Sample stamp counter channel 0
209 #define I2S_STMP1 0x00000002 // Sample stamp counter channel 1
210 #define I2S_STMP_SATURATION 0x0000FFFF // The saturation value used when
218 #define I2S_INT_DMA_IN 0x00000020 // DMA output buffer full interrupt
219 #define I2S_INT_DMA_OUT 0x00000010 // DMA input buffer empty interrupt
220 #define I2S_INT_TIMEOUT 0x00000008 // Word Clock Timeout
221 #define I2S_INT_BUS_ERR 0x00000004 // DMA Bus error
222 #define I2S_INT_WCLK_ERR 0x00000002 // Word Clock error
223 #define I2S_INT_PTR_ERR 0x00000001 // Data pointer error (DMA data was not updated in time).
224 #define I2S_INT_ALL 0x0000003F // All interrupts
232 #ifdef DRIVERLIB_DEBUG
248 I2SBaseValid(uint32_t ui32Base)
271 extern void I2SEnable(uint32_t ui32Base);
297 ASSERT(I2SBaseValid(ui32Base));
345 uint32_t ui32BitClkDelay);
389 uint32_t ui32Chan1Cfg, uint32_t ui32Chan2Cfg);
421 ASSERT(I2SBaseValid(ui32Base));
452 uint32_t ui32OutBufBase, uint16_t ui16DMABufSize,
453 uint16_t ui16ChanBufSize);
506 extern void I2SPointerSet(uint32_t ui32Base,
bool bInput,
void * pNextPointer);
533 ASSERT(I2SBaseValid(ui32Base));
569 ASSERT(I2SBaseValid(ui32Base));
610 ASSERT(I2SBaseValid(ui32Base));
646 ASSERT(I2SBaseValid(ui32Base));
676 __STATIC_INLINE uint32_t
684 ASSERT(I2SBaseValid(ui32Base));
744 ASSERT(I2SBaseValid(ui32Base));
829 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
833 #define I2SEnable ROM_I2SEnable
835 #ifdef ROM_I2SAudioFormatConfigure
836 #undef I2SAudioFormatConfigure
837 #define I2SAudioFormatConfigure ROM_I2SAudioFormatConfigure
839 #ifdef ROM_I2SChannelConfigure
840 #undef I2SChannelConfigure
841 #define I2SChannelConfigure ROM_I2SChannelConfigure
843 #ifdef ROM_I2SBufferConfig
844 #undef I2SBufferConfig
845 #define I2SBufferConfig ROM_I2SBufferConfig
847 #ifdef ROM_I2SPointerUpdate
848 #undef I2SPointerUpdate
849 #define I2SPointerUpdate ROM_I2SPointerUpdate
851 #ifdef ROM_I2SPointerSet
853 #define I2SPointerSet ROM_I2SPointerSet
855 #ifdef ROM_I2SSampleStampConfigure
856 #undef I2SSampleStampConfigure
857 #define I2SSampleStampConfigure ROM_I2SSampleStampConfigure
859 #ifdef ROM_I2SSampleStampGet
860 #undef I2SSampleStampGet
861 #define I2SSampleStampGet ROM_I2SSampleStampGet
void I2SSampleStampConfigure(uint32_t ui32Base, bool bInput, bool bOutput)
Configure the sample stamp generator.
static void I2SIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
Registers an interrupt handler for an I2S interrupt.
static void I2SIntUnregister(uint32_t ui32Base)
Unregisters an interrupt handler for a I2S interrupt.
void I2SPointerSet(uint32_t ui32Base, bool bInput, void *pNextPointer)
Set a buffer pointer (input or output) directly.
void I2SBufferConfig(uint32_t ui32Base, uint32_t ui32InBufBase, uint32_t ui32OutBufBase, uint16_t ui16DMABufSize, uint16_t ui16ChanBufSize)
Set the input buffer pointers.
static void I2SDisable(uint32_t ui32Base)
Disables the I2S module for operation.
uint16_t ui16DMABufSize
Size of DMA buffer in number of samples.
uint32_t ui32InOffset
Value of the current input pointer offset.
uint32_t I2SSampleStampGet(uint32_t ui32Base, uint32_t ui32Channel)
Get the current value of a sample stamp counter.
uint32_t ui32OutOffset
Value of the current output pointer offset.
static void I2SIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Disables individual I2S interrupt sources.
static void I2SSampleStampEnable(uint32_t ui32Base)
Enable the Sample Stamp generator.
uint32_t ui32OutBase
Base address of the output buffer.
void I2SPointerUpdate(uint32_t ui32Base, bool bInput)
Update the buffer pointers.
uint16_t ui16MemLen
Length of the audio words stored in memory.
A structure that defines an audio control table. Note: Memory for this structure must be initialized ...
uint8_t ui8InChan
Input Channel.
void I2SEnable(uint32_t ui32Base)
Enables the I2S module for operation.
uint32_t ui32InBase
Base address of the input buffer.
static void I2SIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Clears I2S interrupt sources.
void I2SAudioFormatConfigure(uint32_t ui32Base, uint32_t ui32FmtCfg, uint32_t ui32BitClkDelay)
Configures the I2S module.
uint8_t ui8OutChan
Output Channel.
static uint32_t I2SIntStatus(uint32_t ui32Base, bool bMasked)
Gets the current interrupt status.
void IntUnregister(uint32_t ui32Interrupt)
Unregisters the function to be called when an interrupt occurs.
static void I2SIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Enables individual I2S interrupt sources.
void I2SChannelConfigure(uint32_t ui32Base, uint32_t ui32Chan0Cfg, uint32_t ui32Chan1Cfg, uint32_t ui32Chan2Cfg)
Setup the audio channel configuration.
I2SControlTable * g_pControlTable
static void I2SSampleStampDisable(uint32_t ui32Base)
Disable the Sample Stamp generator.
uint16_t ui16ChBufSize
Size of Channel buffer.
static void I2SClockConfigure(uint32_t ui32Base, uint32_t ui32ClkConfig)
Configure the I2S frame clock.
void IntDisable(uint32_t ui32Interrupt)
Disables an interrupt.
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Registers a function to be called when an interrupt occurs.
void IntEnable(uint32_t ui32Interrupt)
Enables an interrupt.