SDK4.0
This document shows Ameba SDK 4.0 APIs
i2s_api.h File Reference

This file provides following mbed I2S API. More...

#include "device.h"
#include "ameba_soc.h"

Functions

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...
 

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...
 

Detailed Description

This file provides following mbed I2S API.

mbed Microcontroller Library

Author
Version
V1.0.0
Attention

Copyright (c) 2006-2013 ARM Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.