ql_osi_def.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. /*================================================================
  2. Copyright (c) 2021, Quectel Wireless Solutions Co., Ltd. All rights reserved.
  3. Quectel Wireless Solutions Proprietary and Confidential.
  4. =================================================================*/
  5. #ifndef QUEC_API_EVENT_DEF_H
  6. #define QUEC_API_EVENT_DEF_H
  7. #include "ql_api_common.h"
  8. /*************************** general define *******************************/
  9. /*************************** app event id defination *******************************/
  10. //event id, unsigned type
  11. /*
  12. * event ID definition
  13. *
  14. * 4 bytes, little endian, unsigned type, as below:
  15. *
  16. * ------------------------------------------------------------------------------------------------------
  17. * | 4 | 3 | 2 | 1 |
  18. * ------------------------------------------------------------------------------------------------------
  19. * | High byte of component ID | low byte of component ID | High byte of event ID | low byte of event ID|
  20. * ------------------------------------------------------------------------------------------------------
  21. *
  22. * component ID defined at enum type <ql_errcode_component_e>.
  23. * detail errcode defined by each component.
  24. *
  25. */
  26. typedef enum
  27. {
  28. QUEC_APP_EVENT_ID_MIN = 1|(QL_COMPONENT_OSI<<16),
  29. QUEC_TEST_EVENT_ID_1,
  30. QUEC_TEST_EVENT_ID_2,
  31. QUEC_TEST_EVENT_ID_3,
  32. QUEC_KERNEL_FEED_DOG,
  33. //network
  34. QUEC_NW_SIGNAL_QUALITY_IND = 1|(QL_COMPONENT_NETWORK<<16),
  35. QUEC_NW_VOICE_REG_STATUS_IND,
  36. QUEC_NW_DATA_REG_STATUS_IND,
  37. QUEC_NW_NITZ_TIME_UPDATE_IND,
  38. QUEC_NW_JAMMING_DETECT_IND,
  39. QUEC_NW_CAUSE_IND,
  40. QUEC_NW_CELL_INFO_REQ,
  41. QUEC_NW_CELL_INFO_IND,
  42. //datacall
  43. QUEC_DATACALL_ACT_RSP_IND = 1|(QL_COMPONENT_NETWORK_MANAGE<<16),
  44. QUEC_DATACALL_DEACT_RSP_IND,
  45. QUEC_DATACALL_PDP_DEACTIVE_IND,
  46. //usbnet
  47. QUEC_USBNET_START_RSP_IND = 1|(QL_COMPONENT_NETWORK_USBNET<<16), //response of usbnet start
  48. QUEC_USBNET_DEACTIVE_IND, //usbnet down, The cause may be loss of network coverage or detached by the network
  49. QUEC_USBNET_PORT_CONNECT_IND, //usb plug in
  50. QUEC_USBNET_PORT_DISCONNECT_IND, //usb pull out
  51. //uart
  52. QUEC_UART_RX_RECV_DATA_IND = 1|(QL_COMPONENT_BSP_UART<<16),
  53. QUEC_UART_RX_OVERFLOW_IND,
  54. QUEC_UART_TX_FIFO_COMPLETE_IND,
  55. QUEC_UART_TX_COMPLETE_APP_IND,
  56. QUEC_UART_RX_RECV_DATA_APP_IND,
  57. //usb
  58. QUEC_USB_LINESTATE_IND = 1|(QL_COMPONENT_BSP_USB<<16), //only used for kernel, to handle usb linestate
  59. //uac
  60. QUEC_USB_AUDIO_CREATE_DONE = 2000|(QL_COMPONENT_BSP_USB<<16), //UAC created ok, only used for kernel
  61. QUEC_USB_AUDIO_DATA_IN = 2001|(QL_COMPONENT_BSP_USB<<16), //UAC received data, only used for kernel
  62. QUEC_USB_AUDIO_START_PLAY = 2002|(QL_COMPONENT_BSP_USB<<16), //UAC start receive data, only used for kernel
  63. QUEC_USB_AUDIO_STOP_PLAY = 2003|(QL_COMPONENT_BSP_USB<<16), //UAC stop receive data, only used for kernel
  64. QUEC_USB_AUDIO_START_RECORD = 2004|(QL_COMPONENT_BSP_USB<<16), //UAC start send data to host, only used for kernel
  65. QUEC_USB_AUDIO_STOP_RECORD = 2005|(QL_COMPONENT_BSP_USB<<16), //UAC stop send data to host, only used for kernel
  66. //bt
  67. QUEC_BT_START_STATUS_IND = 1|(QL_COMPONENT_BSP_BT<<16), //bt/ble start
  68. QUEC_BT_STOP_STATUS_IND, //bt/ble stop
  69. QUEC_BT_BLE_RESET_IND, //bt/ble reset.need to stop bt and restart
  70. QUEC_BT_VISIBILE_IND, //
  71. QUEC_BT_HIDDEN_IND,
  72. QUEC_BT_SET_LOCALNAME_IND,
  73. QUEC_BT_SET_LOCALADDR_IND,
  74. QUEC_BT_INQUIRY_IND,
  75. QUEC_BT_INQUIRY_END_IND,
  76. QUEC_BT_BOND_IND,
  77. QUEC_BT_BOND_STATE_IND,
  78. QUEC_BT_CONNECT_IND,
  79. QUEC_BT_DISCONNECT_IND,
  80. QUEC_BT_HFP_CONNECTION_IND,
  81. //ble
  82. //all:server and client can recieve this event
  83. //server:only server can recieve this event
  84. //client:only client can recieve this event
  85. QUEC_BLE_CONNECT_IND = 100|(QL_COMPONENT_BSP_BT<<16), //all:ble connect
  86. QUEC_BLE_DISCONNECT_IND, //all:ble disconnect
  87. QUEC_BLE_UPDATE_CONN_PARAM_IND, //all:ble update connection parameter
  88. QUEC_BLESCAN_REPORT_IND, //client:ble gatt cliet scan and report other devices
  89. QUEC_BLE_GATT_MTU, //all:ble connection mtu
  90. QUEC_BLE_GATT_RECV_IND, //server:when ble client write characteristic value or descriptor,server get the notice
  91. QUEC_BLE_GATT_RECV_READ_IND, //server:when ble client read characteristic value or descriptor,server get the notice
  92. QUEC_BLE_GATT_RECV_NOTIFICATION_IND, //client:client recieve notification
  93. QUEC_BLE_GATT_RECV_INDICATION_IND, //client:client recieve indication
  94. QUEC_BLE_GATT_SEND_END, //server send notification,and recieve send end notice
  95. QUEC_BLE_GATT_START_DISCOVER_SERVICE_IND, //client:start discover service
  96. QUEC_BLE_GATT_DISCOVER_SERVICE_IND, //client:discover service
  97. QUEC_BLE_GATT_DISCOVER_CHARACTERISTIC_DATA_IND, //client:discover characteristic
  98. QUEC_BLE_GATT_DISCOVER_CHARA_DESC_IND, //client:discover characteristic descriptor
  99. QUEC_BLE_GATT_CHARA_WRITE_WITH_RSP_IND, //client:write characterisctc value with response
  100. QUEC_BLE_GATT_CHARA_WRITE_WITHOUT_RSP_IND, //client:write characteristic value without response
  101. QUEC_BLE_GATT_CHARA_READ_IND, //client:read characteristic value by hanlde
  102. QUEC_BLE_GATT_CHARA_READ_BY_UUID_IND, //client:read characteristic value by uuid
  103. QUEC_BLE_GATT_CHARA_MULTI_READ_IND, //client:read miltiple characteristic value
  104. QUEC_BLE_GATT_DESC_WRITE_WITH_RSP_IND, //client:wirte characteristic descriptor
  105. QUEC_BLE_GATT_DESC_READ_IND, //client:read characteristic descriptor
  106. QUEC_BLE_GATT_ATT_ERROR_IND, //client:attribute error
  107. QUEC_BLE_GATT_STATE_CHANGE_IND, //server:通道改变
  108. QUEC_BLE_GATT_SEND_NODIFY_IND, //server:通知server线程从缓存里读取数据发送,只在标准版本使用
  109. QUEC_BT_HFP_CONNECT_IND= 200|(QL_COMPONENT_BSP_BT<<16), //bt hfp connected
  110. QUEC_BT_HFP_DISCONNECT_IND, //bt hfp disconnected
  111. QUEC_BT_HFP_CALL_IND, //bt hfp call state callback
  112. QUEC_BT_HFP_CALL_SETUP_IND, //bt hfp call setup state callback
  113. QUEC_BT_HFP_NETWORK_IND, //bt hfp network state callback
  114. QUEC_BT_HFP_NETWORK_SIGNAL_IND, //bt hfp network signal callback
  115. QUEC_BT_HFP_BATTERY_IND, //bt hfp battery level callback
  116. QUEC_BT_HFP_CALLHELD_IND, //bt hfp callheld state callback
  117. QUEC_BT_HFP_AUDIO_IND, //bt hfp audio state callback
  118. QUEC_BT_HFP_VOLUME_IND, //bt hfp volume type callback
  119. QUEC_BT_HFP_NETWORK_TYPE_IND, //bt hfp network type callback
  120. QUEC_BT_HFP_RING_IND, //bt hfp ring indication callback
  121. QUEC_BT_HFP_CODEC_IND, //bt hfp codec type callback
  122. QUEC_BT_A2DP_AUDIO_CONFIG_IND = 300|(QL_COMPONENT_BSP_BT<<16), //bt a2dp audio config callback
  123. QUEC_BT_A2DP_AUDIO_STATE_START_IND, //bt a2dp audio state start callback
  124. QUEC_BT_A2DP_AUDIO_STATE_STOPPED_IND, //bt a2dp audio state stop callback
  125. QUEC_BT_A2DP_CONNECTION_STATE_CONNECTED_IND, //bt a2dp connect callback
  126. QUEC_BT_A2DP_CONNECTION_STATE_DISCONNECTED_IND, //bt a2dp disconnect callback
  127. QUEC_BT_AVRCP_CONNECTION_STATE_CONNECTED_IND = 400|(QL_COMPONENT_BSP_BT<<16), //bt avrcp connect callback
  128. QUEC_BT_AVRCP_CONNECTION_STATE_DISCONNECTED_IND, //bt avrcp disconnect callback
  129. QUEC_BT_AVRCP_VOLUME_CHANGE_IND, //bt avrcp volume change callback
  130. QUEC_BT_SPP_CONNECT_IND= 500|(QL_COMPONENT_BSP_BT<<16),//bt spp connected callback
  131. QUEC_BT_SPP_DISCONNECT_IND, //bt spp disconnected callback
  132. QUEC_BT_SPP_REVDATA_IND, //bt spp receive data callback
  133. //led_cfg(network status for netlight)
  134. QUEC_LEDCFG_EVENT_IND = 1|(QL_COMPONENT_BSP_PWM<<16),
  135. QUEC_LEDCFG_CB_CREATE_IND,
  136. QUEC_VIRTUAL_PWM_EVENT,
  137. QUEC_LEDCFG_VIRT_PWM_EVENT,
  138. QUEC_HR_VIRT_PWM_EVENT,
  139. //sleep
  140. QUEC_SLEEP_ENETR_AUTO_SLEPP = 1 | (QL_COMPONENT_PM_SLEEP << 16),
  141. QUEC_SLEEP_EXIT_AUTO_SLEPP = 2 | (QL_COMPONENT_PM_SLEEP << 16),
  142. //power
  143. QUEC_SLEEP_QUICK_POWER_DOWM = 1 | (QL_COMPONENT_PM << 16),
  144. QUEC_SLEEP_NORMAL_POWER_DOWM = 2 | (QL_COMPONENT_PM << 16),
  145. QUEC_SLEEP_QUICK_RESET = 3 | (QL_COMPONENT_PM << 16),
  146. QUEC_SLEEP_NORMAL_RESET = 4 | (QL_COMPONENT_PM << 16),
  147. QUEC_SLEEP_FAST_POWEROFF = 5 | (QL_COMPONENT_PM << 16),
  148. //sim
  149. QL_PBK_INIT_OK_IND = 1 | (QL_COMPONENT_SIM << 16),
  150. QUEC_SIM_APREADY_CMD_IND = 2 | (QL_COMPONENT_SIM << 16),
  151. //vsim adapt
  152. QUEC_VSIM_ADAPT_POWERON_IND = 1 | (QL_COMPONENT_VSIM_ADAPT << 16),
  153. QUEC_VSIM_ADAPT_RDY_IND = 2 | (QL_COMPONENT_VSIM_ADAPT << 16), //FOR standard AT solution, not cared in OPEN project.
  154. QUEC_VSIM_ADAPT_VSIM_AT_IND = 3 | (QL_COMPONENT_VSIM_ADAPT << 16), //FOR standard AT solution, not cared in OPEN project. //old feature, don't used
  155. //pwrkey
  156. QUEC_PWRKEY_SHUTDOWN_START_IND = 1 | (QL_COMPONENT_BSP_KEYPAD << 16),
  157. QUEC_PWRKEY_PRESS_IND,
  158. QUEC_PWRKEY_RELEASE_IND,
  159. QUEC_PWRKEY_LONGPRESS_IND,
  160. //wifiscan
  161. QUEC_WIFISCAN_EVENT_DO = 1 | (QL_COMPONENT_BSP_WIFISCAN << 16),
  162. QUEC_WIFISCAN_EVENT_TIMEOUT = 2 | (QL_COMPONENT_BSP_WIFISCAN << 16),
  163. QUEC_WIFISCAN_EVENT_ASYNC_IND = 5 | (QL_COMPONENT_BSP_WIFISCAN << 16),
  164. //gnss
  165. QUEC_GNSS_REC_NMEA_IND = 1 | (QL_COMPONENT_BSP_GNSS<<16),
  166. QUEC_GNSS_POWER_EVENT_REQ,
  167. QUEC_GNSS_RESTART_EVENT_REQ,
  168. QUEC_GNSS_MODE_AND_AGNSS_IND,
  169. QUEC_GNSS_AGPS_IND,
  170. QUEC_GNSS_START_RF_REQ,
  171. QUEC_GNSS_SLEEP_IND,
  172. QUEC_GNSS_FIX_IND,
  173. QUEC_GNSS_MODE_CONVER_IND,
  174. QUEC_GNSS_HSL_ABORT_IND,
  175. QUEC_GNSS_HSL_RECOVERY_IND,
  176. QUEC_GNSS_STARTMODE_IND,
  177. QUEC_GNSS_STATE_IND,
  178. QUEC_GNSS_DISABLE_STATUS_IND,
  179. //lvgl
  180. QUEC_LVGL_QUIT_IND= 1|(QL_COMPONENT_BSP_LVGL<<16),
  181. //virt at
  182. QUEC_VIRT_AT_RX_RECV_DATA_IND = 1 | (QL_COMPONENT_BSP_VIRT_AT<<16),
  183. //sd
  184. QUEC_SDDET_EVENT_IND = 1 | (QL_COMPONENT_STORAGE_SDEMMC<<16),
  185. //tts
  186. QUEC_TTS_START_PLAY = 1 | (QL_COMPONENT_AUDIO_TTS<<16),
  187. //headset_det
  188. QUEC_HEADSET_DET_EVENT_IND = 1 | (QL_COMPONENT_AUDIO_HEADSET<<16),
  189. //stk
  190. QUEC_STK_PROACTIVE_CMD_IND = 1 | (QL_COMPONENT_STK<<16),
  191. QUEC_STK_NO_PROACTIVE_CMD_IND = 2 | (QL_COMPONENT_STK<<16),
  192. QUEC_STK_TIMEOUT_IND = 3 | (QL_COMPONENT_STK<<16),
  193. QUEC_STK_SIM_LOST_IND = 4 | (QL_COMPONENT_STK<<16),
  194. // tcpip app
  195. QUEC_TCPIP_APP_PDP_EVT_IND = 1 | (QL_COMPONENT_LWIP << 16),
  196. //AT Command
  197. QUEC_RECEIVE_NEW_AT = 1|(QL_COMPONENT_AT << 16),
  198. QUEC_AT_RESP = 2|(QL_COMPONENT_AT << 16),
  199. QUEC_AT_RECEIVE_DATA = 3|(QL_COMPONENT_AT << 16),
  200. QUEC_AT_FINISH = 4|(QL_COMPONENT_AT << 16),
  201. QUEC_AT_RECEIVE_CB = 5|(QL_COMPONENT_AT << 16),
  202. QUEC_AT_BYPASS_NEW_DATA = 6|(QL_COMPONENT_AT << 16),
  203. QUEC_AT_CMUX_NEW_DATA = 7|(QL_COMPONENT_AT << 16),
  204. QUEC_AT_CMUX_SEND_DATA = 8|(QL_COMPONENT_AT << 16),
  205. QUEC_AT_CMUX_CLOSE = 9|(QL_COMPONENT_AT << 16),
  206. //queclocator
  207. QUEC_LBS_EVENT_WIFISCAN_REC = 1 | (QL_COMPONENT_LWIP_LBS << 16),
  208. //BSP GPIO
  209. QUEC_GPIOCTRL_EVENT_IND = 1 | (QL_COMPONENT_BSP_GPIO << 16),
  210. QUEC_GPIOCTRL_TIMER_EVENT_IND = 2 | (QL_COMPONENT_BSP_GPIO << 16),
  211. //ETHERNET
  212. QUEC_ETHERNET_DRV_INT = 1 | (QL_COMPONENT_ETHERNET<<16),
  213. QUEC_ETHERNET_DRV_DATA_OUTPUT = 2 | (QL_COMPONENT_ETHERNET<<16),
  214. QUEC_ETHERNET_DRV_STATUS_CHECK = 3 | (QL_COMPONENT_ETHERNET<<16),
  215. QUEC_ETHERNET_DRV_TRY_RESET = 4 | (QL_COMPONENT_ETHERNET<<16),
  216. QUEC_ETHERNET_DRV_TRY_CONNECT = 5 | (QL_COMPONENT_ETHERNET<<16),
  217. QUEC_ETHERNET_DRV_NET_CREATE = 6 | (QL_COMPONENT_ETHERNET<<16),
  218. QUEC_ETHERNET_APP_CONNECTED = 7 | (QL_COMPONENT_ETHERNET<<16),
  219. QUEC_ETHERNET_APP_DISCONNECTED = 8 | (QL_COMPONENT_ETHERNET<<16),
  220. //
  221. //next is reserved for app to add event id!
  222. //
  223. QL_EVENT_APP_START = 1 | (QL_COMPONENT_APP_START<<16),//app event start
  224. QL_EVEN_MAX = 0xFFFF | (QL_COMPONENT_MAX<<16),//event max
  225. }ql_api_event_id_e;
  226. /*************************** task priority defination ******************************/
  227. typedef enum
  228. {
  229. APP_PRIORITY_IDLE = 1, // reserved
  230. APP_PRIORITY_LOW = 4,
  231. APP_PRIORITY_BELOW_NORMAL = 8,
  232. APP_PRIORITY_NORMAL = 12,
  233. APP_PRIORITY_ABOVE_NORMAL = 16,
  234. APP_PRIORITY_HIGH = 25,
  235. APP_PRIORITY_REALTIME = 30
  236. }APP_ThreadPriority_e;
  237. /**************************** error code about osi ***************************/
  238. typedef enum
  239. {
  240. QL_OSI_SUCCESS = 0,
  241. QL_OSI_TASK_PARAM_INVALID = 1 | (QL_COMPONENT_OSI << 16),
  242. QL_OSI_TASK_CREATE_FAIL,
  243. QL_OSI_NO_MEMORY,
  244. QL_OSI_TASK_DELETE_FAIL,
  245. QL_OSI_TASK_PRIO_INVALID,
  246. QL_OSI_TASK_NAME_INVALID,
  247. QL_OSI_TASK_EVENT_COUNT_INVALID,
  248. QL_OSI_INVALID_TASK_REF,
  249. QL_OSI_TASK_CNT_REACH_MAX,
  250. QL_OSI_TASK_BIND_EVENT_FAIL,
  251. QL_OSI_TASK_UNBIND_EVENT_FAIL,
  252. QL_OSI_TASK_GET_REF_FAIL,
  253. QL_OSI_TASK_GET_PRIO_FAIL,
  254. QL_OSI_TASK_SET_PRIO_FAIL,
  255. QL_OSI_TASK_GET_STATUS_FAIL,
  256. QL_OSI_TASK_HAS_BINDED_TIMER,
  257. QL_OSI_QUEUE_CREATE_FAIL = 50 | (QL_COMPONENT_OSI << 16),
  258. QL_OSI_QUEUE_DELETE_FAIL,
  259. QL_OSI_QUEUE_IS_FULL,
  260. QL_OSI_QUEUE_RELEASE_FAIL,
  261. QL_OSI_QUEUE_RECEIVE_FAIL,
  262. QL_OSI_QUEUE_GET_CNT_FAIL,
  263. QL_OSI_QUEUE__FAIL,
  264. QL_OSI_SEMA_CREATE_FAILE = 100 | (QL_COMPONENT_OSI << 16),
  265. QL_OSI_SEMA_DELETE_FAIL,
  266. QL_OSI_SEMA_IS_FULL,
  267. QL_OSI_SEMA_RELEASE_FAIL,
  268. QL_OSI_SEMA_GET_FAIL,
  269. QL_OSI_SEMA__FAIL,
  270. QL_OSI_MUTEX_CREATE_FAIL = 150 | (QL_COMPONENT_OSI << 16),
  271. QL_OSI_MUTEX_DELETE_FAIL,
  272. QL_OSI_MUTEX_LOCK_FAIL,
  273. QL_OSI_MUTEX_UNLOCK_FAIL,
  274. QL_OSI_EVENT_SEND_FAIL = 200 | (QL_COMPONENT_OSI << 16),
  275. QL_OSI_EVENT_GET_FAIL,
  276. QL_OSI_EVENT_REGISTER_FAIL,
  277. QL_OSI_TIMER_CREATE_FAIL = 250 | (QL_COMPONENT_OSI << 16),
  278. QL_OSI_TIMER_START_FAIL,
  279. QL_OSI_TIMER_STOP_FAIL,
  280. QL_OSI_TIMER_DELETE_FAIL,
  281. QL_OSI_TIMER_BIND_TASK_FAIL,
  282. QL_OSI_SWDOG_REGISTER_FAIL = 300 | (QL_COMPONENT_OSI << 16),
  283. QL_OSI_SWDOG_UNREGISTER_FAIL,
  284. QL_OSI_SWDOG_FEED_DOG_FAIL,
  285. QL_OSI_SWDOG_ENABLE_FAIL,
  286. QL_OSI_SWDOG_DISABLE_FAIL,
  287. QL_OSI_EGROUP_CREATE_FAILE = 350 | (QL_COMPONENT_OSI << 16),
  288. QL_OSI_EGROUP_DELETE_FAIL,
  289. QL_OSI_EGROUP_CLEAR_BITS_FAIL,
  290. QL_OSI_EGROUP_SET_BITS_FAIL,
  291. QL_OSI_EGROUP_GET_BITS_FAIL,
  292. QL_OSI_EGROUP_WAIT_BITS_FAIL,
  293. QL_OSI_EGROUP_SYNC_FAIL,
  294. }osi_errcode_e;
  295. #endif