25 #ifndef __ONLP_ONLP_H__ 26 #define __ONLP_ONLP_H__ 32 typedef enum onlp_status_e {
34 ONLP_STATUS_E_GENERIC = -1,
35 ONLP_STATUS_E_UNSUPPORTED = -10,
36 ONLP_STATUS_E_MISSING = -11,
37 ONLP_STATUS_E_INVALID = -12,
38 ONLP_STATUS_E_INTERNAL = -13,
39 ONLP_STATUS_E_PARAM = -14,
40 ONLP_STATUS_E_I2C = -15,
44 #define ONLP_IF_ERROR_RETURN(_expr) \ 52 #define ONLP_FAILURE(_rv) ((_rv) < 0) 53 #define ONLP_SUCCESS(_rv) (!(ONLP_FAILURE(_rv))) 54 #define ONLP_UNSUPPORTED(_rv) \ 55 ((_rv) == ONLP_STATUS_E_UNSUPPORTED) 57 #define ONLP_TRY(_expr) \ 60 if(ONLP_FAILURE(_rv)) { \ 61 AIM_LOG_ERROR("%s returned %{onlp_status}", #_expr, _rv); \ 66 #define ONLP_SUPPORTED(_rv) \ 67 (ONLP_SUCCESS(_rv) || !ONLP_UNSUPPORTED(_rv)) 69 #define ONLP_RETURN_IF_SUPPORTED(_expr) \ 72 if(ONLP_SUPPORTED(_rv)) { \ 80 int onlp_sw_init(
const char* platform);
82 int onlp_hw_init(uint32_t flags);
84 int onlp_sw_denit(
void);
91 void onlp_platform_dump(aim_pvs_t* pvs, uint32_t flags);
92 void onlp_platform_show(aim_pvs_t* pvs, uint32_t flags);
95 #define ONLP_MILLI_NORMAL_INTEGER(_m) (_m / 1000) 96 #define ONLP_MILLI_NORMAL_TENTHS(_m) ( (_m % 1000) / 100) 97 #define ONLP_MILLI_NORMAL_INTEGER_TENTHS(_m) ONLP_MILLI_NORMAL_INTEGER(_m), ONLP_MILLI_NORMAL_TENTHS(_m) 112 const char* onlp_status_name(onlp_status_t e);
115 int onlp_status_value(
const char* str, onlp_status_t* e,
int substr);
118 const char* onlp_status_desc(onlp_status_t e);
121 int onlp_status_valid(onlp_status_t e);
124 #define ONLP_STATUS_VALID(_e) \ 125 (onlp_status_valid((_e))) 128 extern aim_map_si_t onlp_status_map[];
130 extern aim_map_si_t onlp_status_desc_map[];
onlp Configuration Header