Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
i2s.h File Reference

Public APIs for the I2S (Inter-IC Sound) bus drivers. More...

#include <zephyr/types.h>
#include <device.h>
#include <syscalls/i2s.h>

Go to the source code of this file.

Data Structures

struct  i2s_config
 Interface configuration options. More...
 

Macros

#define I2S_FMT_DATA_FORMAT_SHIFT   0
 
#define I2S_FMT_DATA_FORMAT_MASK   (0x7 << I2S_FMT_DATA_FORMAT_SHIFT)
 
#define I2S_FMT_DATA_FORMAT_I2S   (0 << I2S_FMT_DATA_FORMAT_SHIFT)
 Standard I2S Data Format. More...
 
#define I2S_FMT_DATA_FORMAT_PCM_SHORT   (1 << I2S_FMT_DATA_FORMAT_SHIFT)
 PCM Short Frame Sync Data Format. More...
 
#define I2S_FMT_DATA_FORMAT_PCM_LONG   (2 << I2S_FMT_DATA_FORMAT_SHIFT)
 PCM Long Frame Sync Data Format. More...
 
#define I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED   (3 << I2S_FMT_DATA_FORMAT_SHIFT)
 Left Justified Data Format. More...
 
#define I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED   (4 << I2S_FMT_DATA_FORMAT_SHIFT)
 Right Justified Data Format. More...
 
#define I2S_FMT_DATA_ORDER_MSB   (0 << 3)
 
#define I2S_FMT_DATA_ORDER_LSB   BIT(3)
 
#define I2S_FMT_DATA_ORDER_INV   I2S_FMT_DATA_ORDER_LSB
 
#define I2S_FMT_CLK_FORMAT_SHIFT   4
 
#define I2S_FMT_CLK_FORMAT_MASK   (0x3 << I2S_FMT_CLK_FORMAT_SHIFT)
 
#define I2S_FMT_BIT_CLK_INV   BIT(4)
 
#define I2S_FMT_FRAME_CLK_INV   BIT(5)
 
#define I2S_FMT_CLK_NF_NB   (0 << I2S_FMT_CLK_FORMAT_SHIFT)
 
#define I2S_FMT_CLK_NF_IB   (1 << I2S_FMT_CLK_FORMAT_SHIFT)
 
#define I2S_FMT_CLK_IF_NB   (2 << I2S_FMT_CLK_FORMAT_SHIFT)
 
#define I2S_FMT_CLK_IF_IB   (3 << I2S_FMT_CLK_FORMAT_SHIFT)
 
#define I2S_OPT_BIT_CLK_CONT   (0 << 0)
 
#define I2S_OPT_BIT_CLK_GATED   BIT(0)
 
#define I2S_OPT_BIT_CLK_MASTER   (0 << 1)
 
#define I2S_OPT_BIT_CLK_SLAVE   BIT(1)
 
#define I2S_OPT_FRAME_CLK_MASTER   (0 << 2)
 
#define I2S_OPT_FRAME_CLK_SLAVE   BIT(2)
 
#define I2S_OPT_LOOPBACK   BIT(7)
 Loop back mode. More...
 
#define I2S_OPT_PINGPONG   BIT(6)
 Ping pong mode. More...
 

Typedefs

typedef uint8_t i2s_fmt_t
 
typedef uint8_t i2s_opt_t
 

Enumerations

enum  i2s_dir { I2S_DIR_RX , I2S_DIR_TX , I2S_DIR_BOTH }
 I2C Direction. More...
 
enum  i2s_state {
  I2S_STATE_NOT_READY , I2S_STATE_READY , I2S_STATE_RUNNING , I2S_STATE_STOPPING ,
  I2S_STATE_ERROR
}
 
enum  i2s_trigger_cmd {
  I2S_TRIGGER_START , I2S_TRIGGER_STOP , I2S_TRIGGER_DRAIN , I2S_TRIGGER_DROP ,
  I2S_TRIGGER_PREPARE
}
 

Functions

int i2s_configure (const struct device *dev, enum i2s_dir dir, const struct i2s_config *cfg)
 Configure operation of a host I2S controller. More...
 
static const struct i2s_configi2s_config_get (const struct device *dev, enum i2s_dir dir)
 Fetch configuration information of a host I2S controller. More...
 
static int i2s_read (const struct device *dev, void **mem_block, size_t *size)
 Read data from the RX queue. More...
 
int i2s_buf_read (const struct device *dev, void *buf, size_t *size)
 Read data from the RX queue into a provided buffer. More...
 
static int i2s_write (const struct device *dev, void *mem_block, size_t size)
 Write data to the TX queue. More...
 
int i2s_buf_write (const struct device *dev, void *buf, size_t size)
 Write data to the TX queue from a provided buffer. More...
 
int i2s_trigger (const struct device *dev, enum i2s_dir dir, enum i2s_trigger_cmd cmd)
 Send a trigger command. More...
 

Detailed Description

Public APIs for the I2S (Inter-IC Sound) bus drivers.