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 MIPI_CSI_TEST_H
10 #define MIPI_CSI_TEST_H
11
12 #include "hdf_device_desc.h"
13 #include "mipi_csi_if.h"
14
15 /**
16 * @brief Pal mipi csi test case number.
17 *
18 * The sequence number is related to the test logic, which is different from the actual call.
19 * 1, 4, 8 and 9 need to be called according to the actual situation.
20 *
21 * @since 1.0
22 */
23 enum MipiCsiTestCmd {
24 MIPI_CSI_TEST_SET_HS_MODE = 0,
25 MIPI_CSI_TEST_DISABLE_MIPI_CLOCK = 1, /* for test */
26 MIPI_CSI_TEST_ENABLE_MIPI_CLOCK = 2,
27 MIPI_CSI_TEST_RESET_RX = 3,
28 MIPI_CSI_TEST_DISABLE_SENSOR_CLOCK = 4, /* for test */
29 MIPI_CSI_TEST_ENABLE_SENSOR_CLOCK = 5,
30 MIPI_CSI_TEST_RESET_SENSOR = 6,
31 MIPI_CSI_TEST_SET_DEV_ATTR = 7,
32 MIPI_CSI_TEST_SET_PHY_CMVMODE = 8, /* for test */
33 MIPI_CSI_TEST_SET_EXT_DATA_TYPE = 9, /* for test */
34 MIPI_CSI_TEST_UNRESET_RX = 10,
35 MIPI_CSI_TEST_UNRESET_SENSOR = 11,
36 MIPI_CSI_TEST_MAX = 12,
37 };
38
39 struct MipiCsiTest {
40 struct IDeviceIoService service;
41 struct HdfDeviceObject *device;
42 int32_t (*doTest)(struct MipiCsiTest *test, uint8_t cmd);
43 DevHandle handle;
44 uint32_t total;
45 uint32_t fails;
46
47 uint8_t cntlrId;
48 ComboDevAttr attr;
49 uint8_t devno;
50 PhyCmvMode cmvMode;
51 ExtDataType dataType;
52 LaneDivideMode laneDivideMode;
53 uint8_t comboDev;
54 uint8_t snsClkSource;
55 uint8_t snsResetSource;
56 };
57
MipiCsiTestServiceGet(void)58 static inline struct MipiCsiTest *MipiCsiTestServiceGet(void)
59 {
60 return (struct MipiCsiTest *)DevSvcManagerClntGetService("PLATFORM_MIPI_CSI_TEST");
61 }
62 #endif /* MIPI_CSI_TEST_H */
63