![]() |
MAX32672 Peripheral Driver API
Peripheral Driver API for the MAX32672
|
Modules | |
| I2S_Registers | |
Data Structures | |
| struct | mxc_i2s_req_t |
Enumerations | |
| enum | mxc_i2s_stereo_t |
| enum | mxc_i2s_polarity_t |
| enum | mxc_i2s_bitorder_t |
| enum | mxc_i2s_justify_t |
| enum | mxc_i2s_wsize_t |
| enum | mxc_i2s_adjust_t |
| enum | mxc_i2s_ch_mode_t |
Functions | |
| int | MXC_I2S_Init (mxc_i2s_req_t *req) |
| int | MXC_I2S_Shutdown (void) |
| int | MXC_I2S_ConfigData (mxc_i2s_req_t *req) |
| void | MXC_I2S_TXEnable (void) |
| void | MXC_I2S_TXDisable (void) |
| void | MXC_I2S_RXEnable (void) |
| void | MXC_I2S_RXDisable (void) |
| int | MXC_I2S_SetRXThreshold (uint8_t threshold) |
| int | MXC_I2S_SetFrequency (mxc_i2s_ch_mode_t mode, uint16_t clkdiv) |
| int | MXC_I2S_SetSampleRate (uint32_t smpl_rate, mxc_i2s_wsize_t smpl_sz) |
| int | MXC_I2S_GetSampleRate (void) |
| int | MXC_I2S_CalculateClockDiv (uint32_t smpl_rate, mxc_i2s_wsize_t smpl_sz) |
| void | MXC_I2S_Flush (void) |
| int | MXC_I2S_FillTXFIFO (void *txData, mxc_i2s_wsize_t wordSize, int len, int smpl_cnt) |
| int | MXC_I2S_ReadRXFIFO (void *rxData, mxc_i2s_wsize_t wordSize, int len, int smpl_cnt) |
| void | MXC_I2S_EnableInt (uint32_t flags) |
| void | MXC_I2S_DisableInt (uint32_t flags) |
| int | MXC_I2S_GetFlags (void) |
| void | MXC_I2S_ClearFlags (uint32_t flags) |
| int | MXC_I2S_Transaction (mxc_i2s_req_t *i2s_req) |
| int | MXC_I2S_TransactionAsync (mxc_i2s_req_t *i2s_req) |
| int | MXC_I2S_TXDMAConfig (void *src_addr, int len) |
| int | MXC_I2S_RXDMAConfig (void *dest_addr, int len) |
| void | MXC_I2S_Handler (void) |
| void | MXC_I2S_RegisterDMACallback (void(*callback)(int, int)) |
| void | MXC_I2S_RegisterAsyncCallback (void(*callback)(int)) |
Variables | |
| mxc_i2s_samplesize_t | sampleSize |
| uint8_t | bitsWord |
| struct mxc_i2s_req_t |
I2S Configuration Struct.
Most common audio configurations.
| Audio Sample | bitsWord | sampleSize | wordSize | | Width / Samples | | | mxc_i2s_wsize_t | |---------------------------------------------------------------—| | 8 bits / 16 | 8 | 8 | MXC_I2S_WSIZE_BYTE | | 16 bits / 32 | 16 | 16 | MXC_I2S_WSIZE_HALFWORD | | 20 bits / 40 | 20 | 20 | MXC_I2S_WSIZE_WORD | | 24 bits / 48 | 24 | 24 | MXC_I2S_WSIZE_WORD | | 24 bits / 64 | 32 | 24 | MXC_I2S_WSIZE_WORD | | 32 bits / 64 | 32 | 32 | MXC_I2S_WSIZE_WORD | |_________________|__________|____________|________________________|
Data Fields | |
| mxc_i2s_samplesize_t | sampleSize |
| uint8_t | bitsWord |
| enum mxc_i2s_adjust_t |
I2S transaction adjust position.
This field is used to determine which bits are used if the sample size is less than the bits per word.
| enum mxc_i2s_wsize_t |
I2S transaction word size.
Set this field to the desired width for data writes and reads from the FIFO.
| int MXC_I2S_CalculateClockDiv | ( | uint32_t | smpl_rate, |
| mxc_i2s_wsize_t | smpl_sz | ||
| ) |
Calculates the value of the clock divider that should be used in order to get the desired sampling frequency.
| smpl_rate | Desired sampling rate. |
| smple_sz | The size of each I2S word. |
| void MXC_I2S_ClearFlags | ( | uint32_t | flags | ) |
Clears Interrupt Flags.
| flags | Interrupt flags to be cleared |
| int MXC_I2S_ConfigData | ( | mxc_i2s_req_t * | req | ) |
Configure data to be transmitted based on word and sample size.
| req | see mxc_i2s_req_t I2S Request Struct |
| void MXC_I2S_DisableInt | ( | uint32_t | flags | ) |
Disable Interrupt.
| flags | Interrupt mask |
| void MXC_I2S_EnableInt | ( | uint32_t | flags | ) |
Enable Interrupts.
| flags | Interrupt mask |
| int MXC_I2S_FillTXFIFO | ( | void * | txData, |
| mxc_i2s_wsize_t | wordSize, | ||
| int | len, | ||
| int | smpl_cnt | ||
| ) |
Fill I2S FIFO with data to transmit.
| txData | Pointer to base address of the data buffer |
| wordSize | Size of the data samples |
| len | Number of samples in the data buffer |
| smpl_cnt | Number of samples already sent from the data buffer |
| int MXC_I2S_GetFlags | ( | void | ) |
Get the set interrupt flags.
| int MXC_I2S_GetSampleRate | ( | void | ) |
Returns the current sampling rate.
| int MXC_I2S_Init | ( | mxc_i2s_req_t * | req | ) |
Initialize I2S resources.
| req | see mxc_i2s_req_t I2S Request Struct |
| int MXC_I2S_ReadRXFIFO | ( | void * | rxData, |
| mxc_i2s_wsize_t | wordSize, | ||
| int | len, | ||
| int | smpl_cnt | ||
| ) |
Read audio samples from I2S receive buffer.
| rxData | Pointer to data buffer that will store the audio samples |
| wordSize | Size of the samples in the FIFO |
| len | Number of samples to read |
| smpl_cnt | Number of samples already received in the data buffer |
| void MXC_I2S_RegisterAsyncCallback | ( | void(*)(int) | callback | ) |
Sets the callback function for asynchronous I2S transactions.
| callback | Function pointer to the asynchronous transaction callback |
| void MXC_I2S_RegisterDMACallback | ( | void(*)(int, int) | callback | ) |
Set the callback function pointer for I2S DMA transactions.
| callback | Function pointer to the DMA callback function |
| int MXC_I2S_RXDMAConfig | ( | void * | dest_addr, |
| int | len | ||
| ) |
Configure RX DMA transaction.
| dest_addr | destination address |
| len | length of the data to be received |
| int MXC_I2S_SetFrequency | ( | mxc_i2s_ch_mode_t | mode, |
| uint16_t | clkdiv | ||
| ) |
Set I2S Frequency, automatically called by I2S_Init.
| mode | Channel mode to select clock |
| clkdiv | clock divider to set baudrate |
| int MXC_I2S_SetRXThreshold | ( | uint8_t | threshold | ) |
Set threshold for RX FIFO
| threshold |
| int MXC_I2S_SetSampleRate | ( | uint32_t | smpl_rate, |
| mxc_i2s_wsize_t | smpl_sz | ||
| ) |
Sets the clock divider to provide the desired sampling rate.
| smpl_rate | The desired sampling rate. |
| smpl_sz | The size of each sample. |
| int MXC_I2S_Shutdown | ( | void | ) |
Release I2S, clear configuration and flush FIFOs.
| int MXC_I2S_Transaction | ( | mxc_i2s_req_t * | i2s_req | ) |
Performs a blocking I2S transaction.
| Pointer | to transaction request structure |
| int MXC_I2S_TransactionAsync | ( | mxc_i2s_req_t * | i2s_req | ) |
Sets up an asynchronous I2S transaction.
| Pointer | to transaction request structure |
| int MXC_I2S_TXDMAConfig | ( | void * | src_addr, |
| int | len | ||
| ) |
Configure TX DMA transaction.
| src_addr | source address of data |
| len | length od the data to be transmitted |