I2S driver for SAM.
This file defines a useful set of functions for the I2S on SAM devices.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
static enum status_code | _i2s_set_config (struct i2s_dev_inst *const dev_inst) |
void | i2s_clear_status (struct i2s_dev_inst *dev_inst, i2s_interrupt_source_t source) |
Clear the I2S status value. More... | |
void | i2s_disable (struct i2s_dev_inst *const dev_inst) |
Disable the I2S module. More... | |
void | i2s_disable_interrupt (struct i2s_dev_inst *const dev_inst, i2s_interrupt_source_t source) |
Disable the specified interrput sources. More... | |
void | i2s_enable (struct i2s_dev_inst *const dev_inst) |
Enable the I2S module. More... | |
void | i2s_enable_interrupt (struct i2s_dev_inst *const dev_inst, i2s_interrupt_source_t source) |
Enable the specified interrput sources. More... | |
enum status_code | i2s_init (struct i2s_dev_inst *const dev_inst, I2sc *i2sc, struct i2s_config *const cfg) |
Initialize and configure the I2S module. More... | |
static void | i2s_interrupt_handler (I2sc *i2sc) |
Internal interrupt handler for I2S. More... | |
enum status_code | i2s_read (struct i2s_dev_inst *const dev_inst, uint32_t *data) |
Read a single message of data. More... | |
void | i2s_set_callback (struct i2s_dev_inst *const dev_inst, i2s_interrupt_source_t source, i2s_callback_t callback, uint8_t irq_level) |
Set callback for I2S. More... | |
enum status_code | i2s_write (struct i2s_dev_inst *const dev_inst, uint32_t data) |
Write a single message of data. More... | |
Variables | |
i2s_callback_t | i2s_callback_pointer [I2SC_NUM][_I2S_INTERRUPT_SOURCE_NUM] |
I2S callback function pointer array. More... | |
|
static |
Set configurations to module.
dev_inst | Pointer to device instance structure. |
References Assert, i2s_dev_inst::cfg, i2s_config::data_format, i2s_config::fs_ratio, i2s_dev_inst::hw_dev, I2S_CHANNEL_MONO, I2S_ONE_DMA_CHANNEL_FOR_ONE_CHANNEL, i2s_config::loopback, i2s_config::master_clock_divide, i2s_config::master_clock_enable, i2s_config::master_mode, i2s_config::rx_channels, i2s_config::rx_dma, i2s_config::slot_length_24, STATUS_OK, i2s_config::transmit_mode_underrun, i2s_config::tx_channels, and i2s_config::tx_dma.
Referenced by i2s_init().
|
static |
Internal interrupt handler for I2S.
References i2s_dev_inst::hw_dev, i2s_callback_pointer, i2s_get_interrupt_mask(), i2s_get_status(), I2S_INTERRUPT_ENDRX, I2S_INTERRUPT_ENDTX, I2S_INTERRUPT_RXBUFF, I2S_INTERRUPT_RXOR, I2S_INTERRUPT_RXRDY, I2S_INTERRUPT_TXBUFE, I2S_INTERRUPT_TXRDY, and I2S_INTERRUPT_TXUR.
i2s_callback_t i2s_callback_pointer[I2SC_NUM][_I2S_INTERRUPT_SOURCE_NUM] |
I2S callback function pointer array.
Referenced by i2s_interrupt_handler(), and i2s_set_callback().