1 /* 2 * Copyright (C) 2015-2017 Alibaba Group Holding Limited 3 */ 4 5 #ifndef K_ERR_H 6 #define K_ERR_H 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /** @addtogroup aos_rhino err 13 * System error code, and error hook. 14 * 15 * @{ 16 */ 17 18 /* Define basic errno for rhino modules */ 19 typedef enum 20 { 21 RHINO_SUCCESS = 0u, 22 RHINO_SYS_FATAL_ERR, 23 RHINO_SYS_SP_ERR, 24 RHINO_RUNNING, 25 RHINO_STOPPED, 26 RHINO_INV_PARAM, 27 RHINO_NULL_PTR, 28 RHINO_INV_ALIGN, 29 RHINO_KOBJ_TYPE_ERR, 30 RHINO_KOBJ_DEL_ERR, 31 RHINO_KOBJ_DOCKER_EXIST, 32 RHINO_KOBJ_BLK, 33 RHINO_KOBJ_SET_FULL, 34 RHINO_NOTIFY_FUNC_EXIST, 35 36 RHINO_MM_POOL_SIZE_ERR = 100u, 37 RHINO_MM_ALLOC_SIZE_ERR, 38 RHINO_MM_FREE_ADDR_ERR, 39 RHINO_MM_CORRUPT_ERR, 40 RHINO_DYN_MEM_PROC_ERR, 41 RHINO_NO_MEM, 42 RHINO_RINGBUF_FULL, 43 RHINO_RINGBUF_EMPTY, 44 45 RHINO_SCHED_DISABLE = 200u, 46 RHINO_SCHED_ALREADY_ENABLED, 47 RHINO_SCHED_LOCK_COUNT_OVF, 48 RHINO_INV_SCHED_WAY, 49 50 RHINO_TASK_INV_STACK_SIZE = 300u, 51 RHINO_TASK_NOT_SUSPENDED, 52 RHINO_TASK_DEL_NOT_ALLOWED, 53 RHINO_TASK_SUSPEND_NOT_ALLOWED, 54 RHINO_TASK_CANCELED, 55 RHINO_SUSPENDED_COUNT_OVF, 56 RHINO_BEYOND_MAX_PRI, 57 RHINO_PRI_CHG_NOT_ALLOWED, 58 RHINO_INV_TASK_STATE, 59 RHINO_IDLE_TASK_EXIST, 60 61 RHINO_NO_PEND_WAIT = 400u, 62 RHINO_BLK_ABORT, 63 RHINO_BLK_TIMEOUT, 64 RHINO_BLK_DEL, 65 RHINO_BLK_INV_STATE, 66 RHINO_BLK_POOL_SIZE_ERR, 67 68 RHINO_TIMER_STATE_INV = 500u, 69 70 RHINO_NO_THIS_EVENT_OPT = 600u, 71 72 RHINO_BUF_QUEUE_INV_SIZE = 700u, 73 RHINO_BUF_QUEUE_SIZE_ZERO, 74 RHINO_BUF_QUEUE_FULL, 75 RHINO_BUF_QUEUE_MSG_SIZE_OVERFLOW, 76 RHINO_QUEUE_FULL, 77 RHINO_QUEUE_NOT_FULL, 78 79 RHINO_SEM_OVF = 800u, 80 RHINO_SEM_TASK_WAITING, 81 82 RHINO_MUTEX_NOT_RELEASED_BY_OWNER = 900u, 83 RHINO_MUTEX_OWNER_NESTED, 84 RHINO_MUTEX_NESTED_OVF, 85 86 RHINO_NOT_CALLED_BY_INTRPT = 1000u, 87 RHINO_TRY_AGAIN, 88 89 RHINO_WORKQUEUE_EXIST = 1100u, 90 RHINO_WORKQUEUE_NOT_EXIST, 91 RHINO_WORKQUEUE_WORK_EXIST, 92 RHINO_WORKQUEUE_BUSY, 93 RHINO_WORKQUEUE_WORK_RUNNING, 94 95 RHINO_TASK_STACK_OVF = 1200u, 96 RHINO_INTRPT_STACK_OVF, 97 98 RHINO_STATE_ALIGN = INT_MAX /* keep enum 4 bytes at 32bit machine */ 99 } kstat_t; 100 101 /** 102 * Critical error callback. 103 * 104 * @param[in] err error code 105 * 106 * @return none 107 */ 108 typedef void (*krhino_err_proc_t)(kstat_t err); 109 110 /** 111 * Callback register, e.g. 'g_err_proc = app_error_handler();' 112 */ 113 extern krhino_err_proc_t g_err_proc; 114 115 /** 116 * Error process entry. 117 */ 118 extern void k_err_proc_debug(kstat_t err, char *file, int line); 119 120 /** 121 * Error proc for rhino module. 122 */ 123 #define k_err_proc(err) k_err_proc_debug(err, __FILE__, __LINE__) 124 125 /** @} */ 126 127 #ifdef __cplusplus 128 } 129 #endif 130 131 #endif /* K_ERR_H */ 132 133