ql_init.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. /*================================================================
  2. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  3. Quectel Wireless Solution Proprietary and Confidential.
  4. =================================================================*/
  5. /*=================================================================
  6. EDIT HISTORY FOR MODULE
  7. This section contains comments describing changes made to the module.
  8. Notice that changes are listed in reverse chronological order.
  9. WHEN WHO WHAT, WHERE, WHY
  10. ------------ ------- -------------------------------------------------------------------------------
  11. =================================================================*/
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include <stdlib.h>
  15. #include "ql_app_feature_config.h"
  16. #include "ql_api_osi.h"
  17. #include "ql_log.h"
  18. #include "ql_pin_cfg.h"
  19. #include "nw_demo.h"
  20. #include "gpio_demo.h"
  21. #include "gpio_int_demo.h"
  22. #include "datacall_demo.h"
  23. #include "osi_demo.h"
  24. #include "ql_dev_demo.h"
  25. #include "adc_demo.h"
  26. #include "led_cfg_demo.h"
  27. #include "ql_sim_demo.h"
  28. #include "power_demo.h"
  29. #include "ql_api_dev.h"
  30. #include "app_loader.h"
  31. #include "hal_config.h"
  32. #ifdef QL_APP_FEATURE_USB
  33. #include "usb_demo.h"
  34. #endif
  35. #ifdef QL_APP_FEATURE_MMS
  36. #include "mms_demo.h"
  37. #endif
  38. #ifdef QL_APP_FEATURE_UART
  39. #include "uart_demo.h"
  40. #endif
  41. #ifdef QL_APP_FEATURE_RS485
  42. #include "rs485_demo.h"
  43. #endif
  44. #ifdef QL_APP_FEATURE_AUDIO
  45. #include "audio_demo.h"
  46. #endif
  47. #ifdef QL_APP_FEATURE_LCD
  48. #include "lcd_demo.h"
  49. #endif
  50. #ifdef QL_APP_FEATURE_LVGL
  51. #include "lvgl_demo.h"
  52. #endif
  53. #ifdef QL_APP_FEATURE_HTTP
  54. #include "http_demo.h"
  55. #endif
  56. #define QL_APP_FEATURE_FTP
  57. #ifdef QL_APP_FEATURE_FTP
  58. #include "ftp_demo.h"
  59. #endif
  60. #ifdef QL_APP_FEATURE_MQTT
  61. #include "mqtt_demo.h"
  62. #endif
  63. #ifdef QL_APP_FEATURE_SSL
  64. #include "ssl_demo.h"
  65. #endif
  66. #ifdef QL_APP_FEATURE_PING
  67. #include "ping_demo.h"
  68. #endif
  69. #ifdef QL_APP_FEATURE_NTP
  70. #include "ntp_demo.h"
  71. #endif
  72. #ifdef QL_APP_FEATURE_LBS
  73. #include "lbs_demo.h"
  74. #endif
  75. #ifdef QL_APP_FEATURE_QTHSDK
  76. #include "qthsdk_demo.h"
  77. #endif
  78. #ifdef QL_APP_FEATURE_SOCKET
  79. #include "socket_demo.h"
  80. #endif
  81. #ifdef QL_APP_FEATURE_FILE_ZIP
  82. #include "zip_demo.h"
  83. #endif
  84. #ifdef QL_APP_FEATURE_BT
  85. #ifdef QL_APP_FEATURE_BT_SPP
  86. #include "bt_spp_demo.h"
  87. #endif
  88. #ifdef QL_APP_FEATURE_BT_HFP
  89. #include "bt_hfp_demo.h"
  90. #endif
  91. #ifdef QL_APP_FEATURE_BT_A2DP_AVRCP
  92. #include "bt_a2dp_avrcp_demo.h"
  93. #endif
  94. #ifdef QL_APP_FEATURE_BLE_GATT
  95. #include "ble_gatt_demo.h"
  96. #endif
  97. #endif
  98. #ifdef QL_APP_FEATURE_FILE
  99. #include "ql_fs_demo.h"
  100. #endif
  101. #ifdef QL_APP_FEATURE_SMS
  102. #include "sms_demo.h"
  103. #endif
  104. #ifdef QL_APP_FEATURE_VOICE_CALL
  105. #include "voice_call_demo.h"
  106. #endif
  107. #ifdef QL_APP_FEATURE_GNSS
  108. #include "gnss_demo.h"
  109. #endif
  110. #ifdef QL_APP_FEATURE_HD_GNSS
  111. #include "hd_gnss_demo.h"
  112. #endif
  113. #ifdef QL_APP_FEATURE_SPI
  114. #include "spi_demo.h"
  115. #endif
  116. #ifdef QL_APP_FEATURE_SPI_NOR_FLASH
  117. #include "spi_nor_flash_demo.h"
  118. #endif
  119. #ifdef QL_APP_FEATURE_SPI4_EXT_NOR_SFFS
  120. #include "spi4_ext_nor_sffs_demo.h"
  121. #endif
  122. #ifdef QL_APP_FEATURE_SPI6_EXT_NOR
  123. #include "spi6_ext_nor_flash_demo.h"
  124. #endif
  125. #ifdef QL_APP_FEATURE_SPI_NAND_FLASH
  126. #include "spi_nand_flash_demo.h"
  127. #endif
  128. #ifdef QL_APP_FEATURE_CAMERA
  129. #include "camera_demo.h"
  130. #endif
  131. #ifdef QL_APP_FEATURE_WIFISCAN
  132. #include "wifi_scan_demo.h"
  133. #endif
  134. #ifdef QL_APP_FEATURE_HTTP_FOTA
  135. #include "fota_http_demo.h"
  136. #endif
  137. #ifdef QL_APP_FEATURE_FTP_FOTA
  138. #include "fota_ftp_demo.h"
  139. #endif
  140. #ifdef QL_APP_FEATURE_DECODER
  141. #include "decoder_demo.h"
  142. #endif
  143. #ifdef QL_APP_FEATURE_APP_IMG_AT
  144. #include "app_img_at_demo.h"
  145. #endif
  146. #ifdef QL_APP_FEATURE_VOLTE
  147. #include "volte_demo.h"
  148. #endif
  149. #ifdef QL_APP_FEATURE_VSIM_ADAPT
  150. #include "vsim_adapt_demo.h"
  151. #endif
  152. #ifdef QL_APP_FEATURE_KEYPAD
  153. #include "keypad_demo.h"
  154. #endif
  155. #ifdef QL_APP_FEATURE_RTC
  156. #include "ql_rtc_demo.h"
  157. #endif
  158. #ifdef QL_APP_FEATURE_SECURE_BOOT
  159. #include "ql_api_dev.h"
  160. #endif
  161. #ifdef QL_APP_FEATURE_USB_CHARGE
  162. #include "charge_demo.h"
  163. #endif
  164. #ifdef QL_APP_FEATURE_QCLOUD_IOT
  165. #include "qcloud_demo.h"
  166. #endif
  167. #ifdef QL_APP_FEATURE_VIRT_AT
  168. #include "ql_virt_at_demo.h"
  169. #endif
  170. #ifdef QL_APP_FEATURE_TTS
  171. #include "tts_demo.h"
  172. #endif
  173. #ifdef QL_APP_FEATURE_I2C
  174. #include "I2C_demo.h"
  175. #endif
  176. #ifdef QL_APP_FEATURE_PBK
  177. #include "ql_pbk_demo.h"
  178. #endif
  179. #ifdef QL_APP_FEATURE_SDMMC
  180. #include "ql_sdmmc_demo.h"
  181. #endif
  182. #ifdef QL_APP_FEATURE_ALI_LINKSDK
  183. #include "ali_demo.h"
  184. #endif
  185. #ifdef QL_APP_FEATURE_USBNET
  186. #include "usbnet_demo.h"
  187. #endif
  188. #ifdef QL_APP_FEATURE_FS_NAND_FLASH
  189. #include "fs_nand_flash_demo.h"
  190. #endif
  191. #ifdef QL_APP_FEATURE_FS_NOR_FLASH
  192. #include "fs_nor_flash_demo.h"
  193. #endif
  194. #ifdef QL_APP_FEATURE_SFTP
  195. #include "sftp_demo.h"
  196. #endif
  197. #ifdef QL_APP_FEATURE_MXML
  198. #include "mxml_demo.h"
  199. #endif
  200. #ifdef QL_APP_FEATURE_CLOUDOTA
  201. #include "cloudota_demo.h"
  202. #endif
  203. #ifdef QL_APP_FEATURE_EMBED_NOR_FLASH
  204. #include "embed_nor_flash_demo.h"
  205. #endif
  206. #ifdef QL_APP_FEATURE_EXT_NOR_FLASH
  207. #include "ext_nor_flash_demo.h"
  208. #endif
  209. #ifdef QL_APP_FEATURE_HILINK
  210. #include "hilink.h"
  211. #endif
  212. #ifdef QL_APP_FEATURE_PSM
  213. #include "psm_demo.h"
  214. #endif
  215. #ifdef QL_APP_FEATURE_STK
  216. #include "stk_demo.h"
  217. #endif
  218. #ifdef QL_APP_FEATURE_GPRS_DATA_TRANSFER
  219. #include "gprs_data_transfer_demo.h"
  220. #endif
  221. #ifdef QL_APP_FEATURE_TP
  222. #include "tp_demo.h"
  223. #endif
  224. #ifdef QL_APP_FEATURE_ALIOTSMARTCARD
  225. #include "aliotsmartcard_demo.h"
  226. #endif
  227. #ifdef QL_APP_FEATURE_ALIPAY_IOT_SDK
  228. extern void ql_alipay_iot_sdk_app_init(void);
  229. #endif
  230. #ifdef QL_APP_FEATURE_NTRIP_RTK
  231. #include "ntrip_rtk_demo.h"
  232. #endif
  233. #ifdef QL_APP_FEATURE_ETHERNET
  234. #include "ethernet_demo.h"
  235. #endif
  236. #ifdef QL_APP_FEATURE_WEBSOCKET
  237. #include "websocket_demo.h"
  238. #endif
  239. #ifdef QL_APP_FEATURE_WIFI
  240. #include "wifi_demo.h"
  241. #endif
  242. #define QL_INIT_LOG_LEVEL QL_LOG_LEVEL_INFO
  243. #define QL_INIT_LOG(msg, ...) QL_LOG(QL_INIT_LOG_LEVEL, "ql_INIT", msg, ##__VA_ARGS__)
  244. #define QL_INIT_LOG_PUSH(msg, ...) QL_LOG_PUSH("ql_INIT", msg, ##__VA_ARGS__)
  245. static void prvInvokeGlobalCtors(void)
  246. {
  247. extern void (*__init_array_start[])();
  248. extern void (*__init_array_end[])();
  249. size_t count = __init_array_end - __init_array_start;
  250. for (size_t i = 0; i < count; ++i)
  251. __init_array_start[i]();
  252. }
  253. static void ql_init_demo_thread(void *param)
  254. {
  255. QL_INIT_LOG("init demo thread enter, param 0x%x", param);
  256. /*Caution:If the macro of secure boot and the function are opened, download firmware and restart will enable secure boot.
  257. the secret key cannot be changed forever*/
  258. #ifdef QL_APP_FEATURE_SECURE_BOOT
  259. //ql_dev_enable_secure_boot();
  260. #endif
  261. #if 0
  262. ql_gpio_app_init();
  263. ql_gpioint_app_init();
  264. #endif
  265. #ifdef QL_APP_FEATURE_LEDCFG
  266. ql_ledcfg_app_init();
  267. #endif
  268. /*
  269. 1. 验证usb虚拟U盘功能需要在target.config中打开宏CONFIG_QUEC_PROJECT_FEATURE_USB_MASS_STORAGE
  270. 2. 映射sd卡到PC端需要打开sd卡demo(ql_sdmmc_app_init)去挂载sd卡文件系统
  271. 3. 映射6线flash到PC端需要打开6线flash demo(ql_spi6_ext_nor_flash_demo_init)挂载6线flash文件系统
  272. */
  273. #ifdef QL_APP_FEATURE_USB
  274. //ql_usb_app_init();
  275. #endif
  276. #ifdef QL_APP_FEATURE_AUDIO
  277. //ql_audio_app_init();
  278. #ifdef QL_APP_FEATURE_HEADSET_DET
  279. //ql_headset_det_app_init();
  280. #endif
  281. #endif
  282. #ifdef QL_APP_FEATURE_TTS
  283. /*
  284. *demo1直接调用TTS库和audio播放api进行TTS播放,
  285. *demo2对TTS库和audio的播放api进行封装,封装后的TTS api与我司asr系列的TTS api类似
  286. *注意:由于audio播放器只有一个,因此这两个demo只能运行一个,不能两个demo同时播放
  287. *用户如需将TTS库放到内核,则在target.config中将 CONFIG_QUEC_PROJECT_FEATURE_TTS_IN_KERNEL 置为 y,
  288. 并修改分区,将内核分区增大250k左右,其余的内容不变
  289. */
  290. //ql_tts_demo1_init();
  291. //ql_tts_demo2_init();
  292. #endif
  293. #ifdef QL_APP_FEATURE_LCD
  294. //ql_lcd_app_init();
  295. #endif
  296. #ifdef QL_APP_FEATURE_LVGL
  297. //ql_lvgl_app_init();
  298. #endif
  299. //ql_nw_app_init();
  300. //ql_datacall_app_init();
  301. //ql_osi_demo_init();
  302. #ifdef QL_APP_FEATURE_SDMMC
  303. //ql_sdmmc_app_init();
  304. #endif
  305. #ifdef QL_APP_FEATURE_FILE
  306. //ql_fs_demo_init();
  307. #endif
  308. //ql_dev_app_init();
  309. //ql_adc_app_init();
  310. #ifdef QL_APP_FEATURE_UART
  311. //ql_uart_app_init();
  312. //ql_uart_rb_app_init();
  313. #endif
  314. #ifdef QL_APP_FEATURE_RS485
  315. //ql_rs485_app_init();
  316. #endif
  317. #ifdef QL_APP_FEATURE_BT
  318. #ifdef QL_APP_FEATURE_BT_SPP
  319. #endif
  320. #ifdef QL_APP_FEATURE_BLE_GATT
  321. //ql_ble_gatt_server_demo_init();
  322. //ql_ble_gatt_client_demo_init();
  323. #endif
  324. #ifdef QL_APP_FEATURE_BT_HFP
  325. //ql_bt_hfp_demo_init();
  326. #endif
  327. #ifdef QL_APP_FEATURE_BT_A2DP_AVRCP
  328. //ql_bt_a2dp_avrcp_app_init();
  329. #endif
  330. #endif
  331. //ql_sim_app_init();
  332. ql_power_app_init();
  333. #ifdef QL_APP_FEATURE_PSM
  334. //ql_psm_app_init();
  335. #endif
  336. #ifdef QL_APP_FEATURE_CLOUDOTA
  337. //ql_cloudota_app_init();
  338. #endif
  339. #ifdef QL_APP_FEATURE_PWK
  340. //ql_pwrkey_app_init();
  341. #endif
  342. #ifdef QL_APP_FEATURE_FTP
  343. //ql_ftp_app_init();
  344. //ql_ftp_app_demo_init();
  345. #endif
  346. #ifdef QL_APP_FEATURE_HTTP
  347. //ql_http_app_init();
  348. //ql_http_post_app_init();
  349. //ql_http_put_app_init();
  350. //ql_https_get_app_init();
  351. #endif
  352. #ifdef QL_APP_FEATURE_MQTT
  353. //ql_mqtt_app_init();
  354. #endif
  355. #ifdef QL_APP_FEATURE_SSL
  356. //ql_ssl_app_init();
  357. #endif
  358. #ifdef QL_APP_FEATURE_PING
  359. //ql_ping_app_init();
  360. #endif
  361. #ifdef QL_APP_FEATURE_NTP
  362. //ql_ntp_app_init();
  363. #endif
  364. #ifdef QL_APP_FEATURE_LBS
  365. //ql_lbs_app_init();
  366. #if defined (QL_APP_FEATURE_WIFISCAN)
  367. //ql_lbs_wifi_app_init();
  368. #endif
  369. #endif
  370. #ifdef QL_APP_FEATURE_QTHSDK
  371. //ql_qthsdk_app_init();
  372. #endif
  373. #ifdef QL_APP_FEATURE_SOCKET
  374. //ql_socket_app_init();
  375. #endif
  376. #ifdef QL_APP_FEATURE_MMS
  377. //ql_mms_app_init();
  378. #endif
  379. #ifdef QL_APP_FEATURE_SMS
  380. //ql_sms_app_init();
  381. #endif
  382. #ifdef QL_APP_FEATURE_PBK
  383. //ql_pbk_app_init();
  384. #endif
  385. #ifdef QL_APP_FEATURE_STK
  386. // ql_stk_app_init();
  387. #endif
  388. #ifdef QL_APP_FEATURE_VOICE_CALL
  389. //ql_voice_call_app_init();
  390. #endif
  391. #ifdef QL_APP_FEATURE_VOLTE
  392. //ql_volte_app_init();
  393. #endif
  394. #ifdef QL_APP_FEATURE_VSIM_ADAPT
  395. //ql_vsim_adapt_init();
  396. #endif
  397. #ifdef QL_APP_FEATURE_GNSS //内置GNSS
  398. //ql_gnss_app_init();
  399. #endif
  400. #ifdef QL_APP_FEATURE_HD_GNSS //外挂华大GNSS
  401. //ql_hd_gnss_app_init();
  402. #endif
  403. #ifdef QL_APP_FEATURE_FILE_ZIP
  404. //ql_zip_app_init();
  405. #endif
  406. #ifdef QL_APP_FEATURE_SPI
  407. ql_spi_demo_init();
  408. ql_ftp_app_demo_init();
  409. #endif
  410. #ifdef QL_APP_FEATURE_CAMERA
  411. /*因为camera被i2c用来演示功能,所以打开camera demo时不可同时打开i2c demo*/
  412. /*because camera as a demonstration for i2c, so camera demo can not be opened when the i2c demo open */
  413. //ql_camera_app_init();
  414. #endif
  415. #ifdef QL_APP_FEATURE_SPI_NOR_FLASH
  416. //ql_spi_nor_flash_demo_init();
  417. #endif
  418. #ifdef QL_APP_FEATURE_SPI4_EXT_NOR_SFFS
  419. //ql_spi4_ext_nor_sffs_demo_init();
  420. #endif
  421. #ifdef QL_APP_FEATURE_SPI6_EXT_NOR
  422. //ql_spi6_ext_nor_flash_demo_init();
  423. #endif
  424. #ifdef QL_APP_FEATURE_SPI_NAND_FLASH
  425. //ql_spi_nand_flash_demo_init();
  426. #endif
  427. #if defined (QL_APP_FEATURE_WIFISCAN)
  428. //ql_wifiscan_app_init();
  429. #endif
  430. #ifdef QL_APP_FEATURE_HTTP_FOTA
  431. //ql_fota_http_app_init();
  432. #endif
  433. #ifdef QL_APP_FEATURE_FTP_FOTA
  434. //ql_fota_ftp_app_init();
  435. #endif
  436. #ifdef QL_APP_FEATURE_DECODER
  437. //ql_decoder_app_init();
  438. #endif
  439. #ifdef QL_APP_FEATURE_APP_IMG_AT
  440. //ql_app_img_at_init();
  441. #endif
  442. #ifdef QL_APP_FEATURE_KEYPAD
  443. //ql_keypad_app_init();
  444. #endif
  445. #ifdef QL_APP_FEATURE_RTC
  446. //ql_rtc_app_init();
  447. #endif
  448. #ifdef QL_APP_FEATURE_USB_CHARGE
  449. //ql_charge_app_init();
  450. #endif
  451. #ifdef QL_APP_FEATURE_ALI_LINKSDK
  452. //ql_ali_sdk_mqtt_client_test_init(); /* mqtt_basic_demo.c */
  453. //ql_ali_sdk_bootstrap_test_init(); /* bootstrap_posix_demo.c */
  454. //ql_ali_sdk_cota_test_init(); /* cota_basic_demo.c */
  455. //ql_ali_sdk_das_test_init(); /* das_basic_demo.c */
  456. //ql_ali_sdk_data_model_test_init(); /* data_model_basic_demo.c */
  457. //ql_ali_sdk_devinfo_test_init(); /* devinfo_posix_demo.c */
  458. //ql_ali_sdk_diag_test_init(); /* diag_basic_demo.c */
  459. //ql_ali_sdk_dynreg_test_init(); /* dynreg_basic_demo.c */
  460. //ql_ali_sdk_dynregmq_test_init(); /* dynregmq_basic_demo.c */
  461. //ql_ali_sdk_fota_test_init(); /* fota_basic_demo.c */
  462. //ql_ali_sdk_http_client_test_init(); /* http_basic_demo.c */
  463. //ql_ali_sdk_logpost_test_init(); /* logpost_basic_demo.c */
  464. //ql_ali_sdk_mqtt_broadcast_test_init(); /* mqtt_broadcast_demo.c */
  465. //ql_ali_sdk_rrpc_test_init(); /* mqtt_rrpc_demo.c */
  466. //ql_ali_sdk_ntp_test_init(); /* ntp_posix_demo.c */
  467. //ql_ali_sdk_shadow_test_init(); /* shadow_basic_demo.c */
  468. #endif
  469. #ifdef QL_APP_FEATURE_QCLOUD_IOT
  470. //light_data_template_sample_start();/* light_data_template_sample_start_demo.c */
  471. //mqtt_sample_start(); /* mqtt_sample_start_demo.c */
  472. //data_template_sample_start(); /* data_template_sample_start_demo.c */
  473. //ota_mqtt_sample_start(); /* ota_mqtt_sample_start_demo.c */
  474. //raw_data_sample_start(); /* raw_data_sample_start_demo.c */
  475. //dynreg_dev_sample_start(); /* dynreg_dev_sample_start_demo.c */
  476. //gateway_sample_start(); /* gateway_sample_start_demo.c */
  477. #endif
  478. #ifdef QL_APP_FEATURE_VIRT_AT
  479. //ql_virt_at_app_init();
  480. #endif
  481. #ifdef QL_APP_FEATURE_I2C
  482. /*因为i2c通过camera来演示功能,所以打开i2c demo时不可同时打开camera demo*/
  483. /*because I2C uses the camera as a demonstration, so i2c demo can not be opened when the camera demo open */
  484. //ql_i2c_demo_init();
  485. #endif
  486. #ifdef QL_APP_FEATURE_USBNET
  487. //ql_usbnet_app_init();
  488. #endif
  489. #ifdef QL_APP_FEATURE_FS_NAND_FLASH
  490. //ql_fs_nand_flash_demo_init();
  491. #endif
  492. #ifdef QL_APP_FEATURE_FS_NOR_FLASH
  493. //ql_fs_nor_flash_demo_init();
  494. #endif
  495. #ifdef QL_APP_FEATURE_SFTP
  496. //ql_sftp_app_init();
  497. #endif
  498. #ifdef QL_APP_FEATURE_MXML
  499. //ql_mxml_app_init();
  500. #endif
  501. #ifdef QL_APP_FEATURE_EMBED_NOR_FLASH
  502. //ql_embed_nor_flash_app_init();
  503. #endif
  504. #ifdef QL_APP_FEATURE_EXT_NOR_FLASH
  505. //ql_ext_nor_flash_app_init();
  506. #endif
  507. #ifdef QL_APP_FEATURE_HILINK
  508. //hilink_main();
  509. #endif
  510. #ifdef QL_APP_FEATURE_GPRS_DATA_TRANSFER
  511. //ql_gprs_data_transfer_app_init();
  512. #endif
  513. #ifdef QL_APP_FEATURE_TP
  514. //ql_tp_demo_init();
  515. #endif
  516. #ifdef QL_APP_FEATURE_ALIPAY_IOT_SDK
  517. //ql_alipay_iot_sdk_app_init();
  518. #endif
  519. #ifdef QL_APP_FEATURE_ALIOTSMARTCARD
  520. //ql_aliotsmartcard_app_init();
  521. #endif
  522. #ifdef QL_APP_FEATURE_WEBSOCKET
  523. //ql_websocket_app_init();
  524. #endif
  525. #ifdef QL_APP_FEATURE_NTRIP_RTK
  526. //ql_ntrip_rtk_demo_init();
  527. #endif
  528. #ifdef QL_APP_FEATURE_ETHERNET
  529. //ql_ethernet_demo_init();
  530. #endif
  531. #ifdef QL_APP_FEATURE_WIFI
  532. //ql_wifi_demo_init();
  533. #endif
  534. ql_rtos_task_sleep_ms(1000); /*Chaos change: set to 1000 for the camera power on*/
  535. /*To save logs to sdcard/nandflash, you must call this function after initializing sdcard/nandflash file system;*/
  536. /*Logs before this point can be output via USB or debug port, which can be configured in prvTraceInit of app_start*/
  537. //ql_fs_trace_init();
  538. #ifdef QL_APP_FEATURE_APPIMG2
  539. void appimg_jump(void);
  540. appimg_jump();
  541. #endif
  542. ql_rtos_task_delete(NULL);
  543. }
  544. int appimg_enter(void *param)
  545. {
  546. QlOSStatus err = QL_OSI_SUCCESS;
  547. ql_task_t ql_init_task = NULL;
  548. QL_INIT_LOG("init demo enter APP: %s @ %s", QL_APP_VERSION, QL_APP_BUILD_RELEASE_TYPE);
  549. prvInvokeGlobalCtors();
  550. if(0 == strcasecmp(QL_APP_BUILD_RELEASE_TYPE, "release"))
  551. {
  552. ql_dev_cfg_wdt(1);
  553. //open the kernel log
  554. //ql_quec_trace_enable(1);
  555. }
  556. else
  557. {
  558. ql_dev_cfg_wdt(0);
  559. //close the kernel log
  560. //ql_quec_trace_enable(0);
  561. }
  562. err = ql_rtos_task_create(&ql_init_task, 1024*4, APP_PRIORITY_NORMAL, "ql_init", ql_init_demo_thread, NULL, 1);
  563. if(err != QL_OSI_SUCCESS)
  564. {
  565. QL_INIT_LOG("init failed");
  566. }
  567. return err;
  568. }
  569. void appimg_exit(void)
  570. {
  571. QL_INIT_LOG("init demo exit");
  572. }
  573. #ifdef QL_APP_FEATURE_APPIMG2
  574. void appimg_jump(void)
  575. {
  576. #if 0
  577. #ifdef CONFIG_APPIMG_LOAD_FLASH
  578. const unsigned flash_img_address = (const unsigned)CONFIG_APPIMG_FLASH_ADDRESS;
  579. const unsigned flash_img_size = (const unsigned)CONFIG_APPIMG_FLASH_SIZE;
  580. const unsigned flash_ram_address = (const unsigned)CONFIG_APP_FLASHIMG_RAM_ADDRESS;
  581. const unsigned flash_ram_size = (const unsigned)CONFIG_APP_FLASHIMG_RAM_SIZE;
  582. #else
  583. const unsigned flash_ram_address = (const unsigned)CONFIG_APP_FILEIMG_RAM_ADDRESS;
  584. const unsigned flash_ram_size = (const unsigned)CONFIG_APP_FILEIMG_RAM_SIZE;
  585. #endif
  586. #else
  587. #ifdef CONFIG_APPIMG_LOAD_FLASH
  588. const unsigned flash_img_address = (const unsigned)CONFIG_APPIMG2_FLASH_ADDRESS;
  589. const unsigned flash_img_size = (const unsigned)CONFIG_APPIMG2_FLASH_SIZE;
  590. const unsigned flash_ram_address = (const unsigned)CONFIG_APP2_FLASHIMG_RAM_ADDRESS;
  591. const unsigned flash_ram_size = (const unsigned)CONFIG_APP2_FLASHIMG_RAM_SIZE;
  592. #else
  593. const unsigned flash_ram_address = (const unsigned)CONFIG_APP2_FILEIMG_RAM_ADDRESS;
  594. const unsigned flash_ram_size = (const unsigned)CONFIG_APP2_FILEIMG_RAM_SIZE;
  595. #endif
  596. #endif
  597. #ifdef CONFIG_APPIMG_LOAD_FLASH
  598. appImageHandler_t AppImgFlash = {};
  599. if(ql_app_image_from_flash(flash_img_address,flash_img_size,flash_ram_address,flash_ram_size,&AppImgFlash))
  600. {
  601. QL_INIT_LOG("Find app image at 0x%x", flash_img_address);
  602. AppImgFlash.enter(NULL);
  603. }
  604. else
  605. {
  606. QL_INIT_LOG("app jump failed");
  607. }
  608. #endif
  609. #ifdef CONFIG_APPIMG_LOAD_FILE
  610. appImageHandler_t AppImgFile = {};
  611. if(ql_app_image_from_file(CONFIG_APPIMG2_LOAD_FILE_NAME,flash_ram_address,flash_ram_size,&AppImgFile))
  612. {
  613. QL_INIT_LOG("Find file image at " CONFIG_APPIMG2_LOAD_FILE_NAME);
  614. AppImgFile.enter(NULL);
  615. }
  616. else
  617. {
  618. QL_INIT_LOG("app jump failed");
  619. }
  620. #endif
  621. }
  622. #endif