1 /*
2  * Copyright (C) 2017-2019 Alibaba Group Holding Limited
3  */
4 
5 
6 /******************************************************************************
7  * @file     drv_common.h
8  * @brief    Header File for Common Driver
9  * @version  V1.0
10  * @date     19. Feb 2019
11  * @model    common
12  ******************************************************************************/
13 
14 #ifndef _DRV_COMMON_H_
15 #define _DRV_COMMON_H_
16 
17 #include <stdint.h>
18 #include <drv/errno.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /// \details driver handle
25 typedef void *drv_handle_t;
26 
27 #ifndef CONFIG_PARAM_NOT_CHECK
28 #define HANDLE_PARAM_CHK(para, err)                                                                \
29     do {                                                                                           \
30         if ((int32_t)para == (int32_t)NULL) {                                                      \
31             return (err);                                                                          \
32         }                                                                                          \
33     } while (0)
34 
35 #define HANDLE_PARAM_CHK_NORETVAL(para, err)                                                          \
36     do {                                                                                           \
37         if ((int32_t)para == (int32_t)NULL) {                                                      \
38             return;                                                                                \
39         }                                                                                          \
40     } while (0)
41 #else
42 #define HANDLE_PARAM_CHK(para, err)
43 #define HANDLE_PARAM_CHK_NORETVAL(para, err)
44 #endif
45 
46 
47 /**
48 \brief General power states
49 */
50 typedef enum  {
51     DRV_POWER_OFF,                        ///< Power off: no operation possible
52     DRV_POWER_LOW,                        ///< Low Power mode: retain state, detect and signal wake-up events
53     DRV_POWER_FULL,                       ///< Power on: full operation at maximum performance
54     DRV_POWER_SUSPEND,                    ///< Power suspend: power saving operation
55 } csi_power_stat_e;
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif /* _DRV_COMMON_H */
62 
63