SDK4.0
This document shows Ameba SDK 4.0 APIs
|
i2s functions More...
Ameba Common | |
enum | { SR_8KHZ = I2S_SR_8KHZ, SR_16KHZ = I2S_SR_16KHZ, SR_24KHZ = I2S_SR_24KHZ, SR_32KHZ = I2S_SR_32KHZ, SR_48KHZ = I2S_SR_48KHZ, SR_96KHZ = I2S_SR_96KHZ, SR_7p35KHZ = I2S_SR_7p35KHZ, SR_14p7KHZ = I2S_SR_14p7KHZ, SR_22p05KHZ = I2S_SR_22p05KHZ, SR_29p4KHZ = I2S_SR_29p4KHZ, SR_44p1KHZ = I2S_SR_44p1KHZ, SR_88p2KHZ = I2S_SR_88p2KHZ } |
enum | { CH_STEREO = I2S_CH_STEREO, CH_MONO = I2S_CH_MONO } |
enum | { WL_16b = I2S_WL_16, WL_24b = I2S_WL_24 } |
enum | { I2S_DIR_RX = I2S_ONLY_RX, I2S_DIR_TX = I2S_ONLY_TX, I2S_DIR_TXRX = I2S_TXRX } |
typedef void(* | i2s_irq_handler) (uint32_t id, char *pbuf) |
typedef struct i2s_s | i2s_t |
void | i2s_deinit (i2s_t *obj) |
Deinitializes the I2S device, include function/interrupt/I2S registers. More... | |
void | i2s_set_dma_buffer (i2s_t *obj, char *tx_buf, char *rx_buf, uint32_t page_num, uint32_t page_size) |
Sets page number, page size, page address. More... | |
void | i2s_tx_irq_handler (i2s_t *obj, i2s_irq_handler handler, uint32_t id) |
Sets TX interrupt handler. More... | |
void | i2s_rx_irq_handler (i2s_t *obj, i2s_irq_handler handler, uint32_t id) |
Sets RX interrupt handler. More... | |
void | i2s_set_direction (i2s_t *obj, int trx_type) |
Sets i2s data transfer direction. More... | |
void | i2s_set_param (i2s_t *obj, int channel_num, int rate, int word_len) |
Sets i2s channel number, sample rate, word length. More... | |
int * | i2s_get_tx_page (i2s_t *obj) |
Gets current tx page address. More... | |
void | i2s_send_page (i2s_t *obj, uint32_t *pbuf) |
Sets current tx page own by i2s. More... | |
void | i2s_recv_page (i2s_t *obj) |
Sets current rx page own by i2s. More... | |
void | i2s_enable (i2s_t *obj) |
Enable i2s interrupt and function. More... | |
void | i2s_disable (i2s_t *obj) |
Disable i2s interrupt and function. More... | |
Ameba1 Only | |
void | i2s_init (i2s_t *obj, PinName sck, PinName ws, PinName sd) |
Initializes the I2S device, include clock/function/interrupt/I2S registers. More... | |
AmebaZ Only | |
void | i2s_init (i2s_t *obj, PinName sck, PinName ws, PinName sd_tx, PinName sd_rx, PinName mck) |
Initializes the I2S device, include clock/function/interrupt/I2S registers. More... | |
i2s functions
void i2s_deinit | ( | i2s_t * | obj | ) |
Deinitializes the I2S device, include function/interrupt/I2S registers.
obj | i2s object define in application software. |
none |
void i2s_disable | ( | i2s_t * | obj | ) |
Disable i2s interrupt and function.
obj | i2s object define in application software. |
none |
void i2s_enable | ( | i2s_t * | obj | ) |
Enable i2s interrupt and function.
obj | i2s object define in application software. |
none |
int* i2s_get_tx_page | ( | i2s_t * | obj | ) |
Gets current tx page address.
obj | i2s object define in application software. |
address of current tx page or NULL |
void i2s_init | ( | i2s_t * | obj, |
PinName | sck, | ||
PinName | ws, | ||
PinName | sd | ||
) |
Initializes the I2S device, include clock/function/interrupt/I2S registers.
obj | i2s object define in application software. |
sck | Serial clock PinName according to pinmux spec. |
ws | Word select PinName according to pinmux spec. |
sd | PinName according to pinmux spec. |
none |
void i2s_init | ( | i2s_t * | obj, |
PinName | sck, | ||
PinName | ws, | ||
PinName | sd_tx, | ||
PinName | sd_rx, | ||
PinName | mck | ||
) |
Initializes the I2S device, include clock/function/interrupt/I2S registers.
obj | i2s object define in application software. |
sck | Serial clock PinName according to pinmux spec. |
ws | Word select PinName according to pinmux spec. |
sd_tx | Tx PinName according to pinmux spec. |
sd_rx | Rx PinName according to pinmux spec. |
mck | Master clock PinName according to pinmux spec. |
none |
void i2s_recv_page | ( | i2s_t * | obj | ) |
Sets current rx page own by i2s.
obj | i2s object define in application software. |
none |
void i2s_rx_irq_handler | ( | i2s_t * | obj, |
i2s_irq_handler | handler, | ||
uint32_t | id | ||
) |
Sets RX interrupt handler.
obj | i2s object define in application software. |
handler | RX interrupt callback function. |
id | RX interrupt callback function parameter. |
none |
void i2s_send_page | ( | i2s_t * | obj, |
uint32_t * | pbuf | ||
) |
Sets current tx page own by i2s.
obj | i2s object define in application software. |
pbuf | tx buffer adderss. |
none |
void i2s_set_direction | ( | i2s_t * | obj, |
int | trx_type | ||
) |
Sets i2s data transfer direction.
obj | i2s object define in application software. |
trx_type | transfer direction. This parameter can be one of the following values:
|
none |
void i2s_set_dma_buffer | ( | i2s_t * | obj, |
char * | tx_buf, | ||
char * | rx_buf, | ||
uint32_t | page_num, | ||
uint32_t | page_size | ||
) |
Sets page number, page size, page address.
obj | i2s object define in application software. |
tx_buf | pointer to the start address of Tx page. |
rx_buf | pointer to the start address of Rx page. |
page_num | page number. This parameter must be set to a value in the 2~4 range |
page_size | page size. This parameter must be set to a value in the 4~16384 bytes range |
none |
void i2s_set_param | ( | i2s_t * | obj, |
int | channel_num, | ||
int | rate, | ||
int | word_len | ||
) |
Sets i2s channel number, sample rate, word length.
obj | i2s object define in application software. |
channel_num | this parameter can be one of the following values:
|
rate | this parameter can be one of the following values:
|
word_len | this parameter can be one of the following values:
|
none |
void i2s_tx_irq_handler | ( | i2s_t * | obj, |
i2s_irq_handler | handler, | ||
uint32_t | id | ||
) |
Sets TX interrupt handler.
obj | i2s object define in application software. |
handler | TX interrupt callback function. |
id | TX interrupt callback function parameter. |
none |