12#ifndef ZEPHYR_INCLUDE_DRIVERS_I2S_H_
13#define ZEPHYR_INCLUDE_DRIVERS_I2S_H_
41#define I2S_FMT_DATA_FORMAT_SHIFT 0
43#define I2S_FMT_DATA_FORMAT_MASK (0x7 << I2S_FMT_DATA_FORMAT_SHIFT)
62#define I2S_FMT_DATA_FORMAT_I2S (0 << I2S_FMT_DATA_FORMAT_SHIFT)
81#define I2S_FMT_DATA_FORMAT_PCM_SHORT (1 << I2S_FMT_DATA_FORMAT_SHIFT)
101#define I2S_FMT_DATA_FORMAT_PCM_LONG (2 << I2S_FMT_DATA_FORMAT_SHIFT)
122#define I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED (3 << I2S_FMT_DATA_FORMAT_SHIFT)
143#define I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED (4 << I2S_FMT_DATA_FORMAT_SHIFT)
146#define I2S_FMT_DATA_ORDER_MSB (0 << 3)
148#define I2S_FMT_DATA_ORDER_LSB BIT(3)
150#define I2S_FMT_DATA_ORDER_INV I2S_FMT_DATA_ORDER_LSB
153#define I2S_FMT_CLK_FORMAT_SHIFT 4
155#define I2S_FMT_CLK_FORMAT_MASK (0x3 << I2S_FMT_CLK_FORMAT_SHIFT)
158#define I2S_FMT_BIT_CLK_INV BIT(4)
160#define I2S_FMT_FRAME_CLK_INV BIT(5)
165#define I2S_FMT_CLK_NF_NB (0 << I2S_FMT_CLK_FORMAT_SHIFT)
166#define I2S_FMT_CLK_NF_IB (1 << I2S_FMT_CLK_FORMAT_SHIFT)
167#define I2S_FMT_CLK_IF_NB (2 << I2S_FMT_CLK_FORMAT_SHIFT)
168#define I2S_FMT_CLK_IF_IB (3 << I2S_FMT_CLK_FORMAT_SHIFT)
173#define I2S_OPT_BIT_CLK_CONT (0 << 0)
175#define I2S_OPT_BIT_CLK_GATED BIT(0)
177#define I2S_OPT_BIT_CLK_MASTER (0 << 1)
179#define I2S_OPT_BIT_CLK_SLAVE BIT(1)
181#define I2S_OPT_FRAME_CLK_MASTER (0 << 2)
183#define I2S_OPT_FRAME_CLK_SLAVE BIT(2)
190#define I2S_OPT_LOOPBACK BIT(7)
200#define I2S_OPT_PINGPONG BIT(6)
317__subsystem
struct i2s_driver_api {
356static inline int z_impl_i2s_configure(
const struct device *dev,
360 const struct i2s_driver_api *api =
361 (
const struct i2s_driver_api *)dev->
api;
363 return api->configure(dev, dir, cfg);
377 const struct i2s_driver_api *api =
378 (
const struct i2s_driver_api *)dev->
api;
380 return api->config_get(dev, dir);
417 const struct i2s_driver_api *api =
418 (
const struct i2s_driver_api *)dev->
api;
478 const struct i2s_driver_api *api =
479 (
const struct i2s_driver_api *)dev->
api;
525static inline int z_impl_i2s_trigger(
const struct device *dev,
529 const struct i2s_driver_api *api =
530 (
const struct i2s_driver_api *)dev->
api;
532 return api->trigger(dev, dir,
cmd);
543#include <syscalls/i2s.h>
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition: ft8xx_reference_api.h:153
static int i2s_write(const struct device *dev, void *mem_block, size_t size)
Write data to the TX queue.
Definition: i2s.h:475
uint8_t i2s_fmt_t
Definition: i2s.h:38
int i2s_configure(const struct device *dev, enum i2s_dir dir, const struct i2s_config *cfg)
Configure operation of a host I2S controller.
int i2s_buf_read(const struct device *dev, void *buf, size_t *size)
Read data from the RX queue into a provided buffer.
static int i2s_read(const struct device *dev, void **mem_block, size_t *size)
Read data from the RX queue.
Definition: i2s.h:414
i2s_dir
I2C Direction.
Definition: i2s.h:205
i2s_state
Definition: i2s.h:215
int i2s_buf_write(const struct device *dev, void *buf, size_t size)
Write data to the TX queue from a provided buffer.
int i2s_trigger(const struct device *dev, enum i2s_dir dir, enum i2s_trigger_cmd cmd)
Send a trigger command.
i2s_trigger_cmd
Definition: i2s.h:234
static const struct i2s_config * i2s_config_get(const struct device *dev, enum i2s_dir dir)
Fetch configuration information of a host I2S controller.
Definition: i2s.h:374
uint8_t i2s_opt_t
Definition: i2s.h:170
@ I2S_DIR_BOTH
Definition: i2s.h:211
@ I2S_DIR_TX
Definition: i2s.h:209
@ I2S_DIR_RX
Definition: i2s.h:207
@ I2S_STATE_ERROR
Definition: i2s.h:230
@ I2S_STATE_NOT_READY
The interface is not ready.
Definition: i2s.h:222
@ I2S_STATE_STOPPING
Definition: i2s.h:228
@ I2S_STATE_RUNNING
Definition: i2s.h:226
@ I2S_STATE_READY
Definition: i2s.h:224
@ I2S_TRIGGER_STOP
Stop the transmission / reception of data.
Definition: i2s.h:251
@ I2S_TRIGGER_PREPARE
Prepare the queues after underrun/overrun error has occurred.
Definition: i2s.h:273
@ I2S_TRIGGER_START
Start the transmission / reception of data.
Definition: i2s.h:241
@ I2S_TRIGGER_DRAIN
Empty the transmit queue.
Definition: i2s.h:260
@ I2S_TRIGGER_DROP
Discard the transmit / receive queue.
Definition: i2s.h:267
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__INT32_TYPE__ int32_t
Definition: stdint.h:44
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373
Interface configuration options.
Definition: i2s.h:301
struct k_mem_slab * mem_slab
Definition: i2s.h:307
i2s_opt_t options
Definition: i2s.h:305
uint8_t word_size
Definition: i2s.h:302
size_t block_size
Definition: i2s.h:308
i2s_fmt_t format
Definition: i2s.h:304
int32_t timeout
Definition: i2s.h:309
uint32_t frame_clk_freq
Definition: i2s.h:306
uint8_t channels
Definition: i2s.h:303
Definition: test_pipe_contexts.c:43