1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 *
4 * HDF is dual licensed: you can use it either under the terms of
5 * the GPL, or the BSD license, at your option.
6 * See the LICENSE file in the root of this repository for complete details.
7 */
8
9 #ifndef I2S_TEST_H
10 #define I2S_TEST_H
11
12 #include "hdf_device_desc.h"
13 #include "platform_if.h"
14
15 enum I2sTestCmd {
16 I2S_SET_CFG_TEST,
17 I2S_GET_CFG_TEST,
18 I2S_OPEN_TEST,
19 I2S_CLOSE_TEST,
20 I2S_ENABLE_TEST,
21 I2S_DISABLE_TEST,
22 I2S_READ_START_TEST,
23 I2S_WRITE_START_TEST,
24 I2S_WRITE_TEST,
25 I2S_WRITE_STOP_TEST,
26 I2S_READ_TEST,
27 I2S_READ_STOP_TEST,
28 I2S_RELIABILITY_TEST,
29 I2S_RECORD_TEST,
30 I2S_PLAY_TEST,
31 };
32
33 struct I2sTest {
34 struct IDeviceIoService service;
35 struct HdfDeviceObject *device;
36 int32_t (*TestEntry)(struct I2sTest *test, int32_t cmd);
37 DevHandle handle;
38 uint8_t sampleRate; /**< I2S sample rate, 8k,16k,32k... */
39 uint8_t type; /**< I2S protocol type */
40 uint8_t channelMode; /**< I2S mode,data channel */
41 uint8_t samplePrecision; /**< bit */
42 uint8_t channelIfMode;
43 uint8_t writeChannel;
44 uint8_t i2slFsSel;
45 uint32_t mclk; /**< KHZ */
46 uint32_t bclk; /**< KHZ */
47 uint32_t len;
48 uint8_t *wbuf;
49 uint8_t *rbuf;
50 };
51
GetI2sTest(void)52 static inline struct I2sTest *GetI2sTest(void)
53 {
54 return (struct I2sTest *)DevSvcManagerClntGetService("I2S_TEST");
55 }
56
57 #endif /* I2S_TEST_H */
58