1 /*
2  * Copyright (c) 2017 comsuisse AG
3  * Copyright (c) 2018 Intel Corporation
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef I2S_API_TEST_H
9 #define I2S_API_TEST_H
10 
11 #include <zephyr/kernel.h>
12 #include <zephyr/drivers/i2s.h>
13 
14 extern struct k_mem_slab rx_mem_slab;
15 extern struct k_mem_slab tx_mem_slab;
16 
17 #define SAMPLE_NO	32
18 #define TIMEOUT		2000
19 #define FRAME_CLK_FREQ	8000
20 
21 extern int16_t data_l[SAMPLE_NO];
22 extern int16_t data_r[SAMPLE_NO];
23 
24 extern const struct device *dev_i2s_rx;
25 extern const struct device *dev_i2s_tx;
26 extern const struct device *dev_i2s;
27 extern bool dir_both_supported;
28 
29 #define I2S_DEV_NODE_RX DT_ALIAS(i2s_node0)
30 #ifdef CONFIG_I2S_TEST_SEPARATE_DEVICES
31 #define I2S_DEV_NODE_TX DT_ALIAS(i2s_node1)
32 #else
33 #define I2S_DEV_NODE_TX DT_ALIAS(i2s_node0)
34 #endif
35 #define BLOCK_SIZE (2 * sizeof(data_l))
36 
37 #define NUM_RX_BLOCKS	4
38 #define NUM_TX_BLOCKS	4
39 
40 int tx_block_write(const struct device *dev_i2s, int att, int err);
41 int rx_block_read(const struct device *dev_i2s, int att);
42 
43 void fill_buf_const(int16_t *tx_block, int16_t val_l, int16_t val_r);
44 int verify_buf_const(int16_t *rx_block, int16_t val_l, int16_t val_r);
45 
46 int configure_stream(const struct device *dev_i2s, enum i2s_dir dir);
47 
48 #endif
49