hpocapp(6392).c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. //#define OSI_LOG_TAG OSI_MAKE_LOG_TAG()
  13. #include "includes.h"
  14. /*
  15. appimg_exit
  16. 仅在程序退出时打印
  17. */
  18. void appimg_exit(void){
  19. LSAPI_Log_Debug("application image exit");
  20. }
  21. //POC 回调输出信息
  22. void virtual_uart_read(char *data, int len){
  23. pocCmdHandler(data, len);
  24. }
  25. void startSubTask(void);
  26. static void mainTask(void *param){
  27. LSAPI_OSI_ThreadSleep(10000);
  28. dataInit();
  29. boardInit();
  30. startSubTask();//线程会调用外设接口,必须在boardInit后启动
  31. LSAPI_GWSD_Register_Callback(virtual_uart_read);
  32. appRun();//应用主程序(pt)
  33. }
  34. /*
  35. appimg_enter
  36. cat one入口函数
  37. */
  38. LSAPI_OSI_Thread_t * mainThreadPtr=NULL;
  39. int appimg_enter(void *param){
  40. if(NULL==(mainThreadPtr=LSAPI_OSI_ThreadCreate("main", mainTask, NULL, LSAPI_OSI_PRIORITY_NORMAL, PT_THREAD_STACK, 5))){
  41. for(;;){
  42. LSAPI_Log_Debug("main task failed");
  43. LSAPI_OSI_ThreadSleep(1000);
  44. }
  45. }
  46. return 0;
  47. }
  48. void startSubTask(void){
  49. if(NULL==LSAPI_OSI_ThreadCreate("sub", subTask, NULL, LSAPI_OSI_PRIORITY_NORMAL, SUB_TASK_THREAD_STACK, 10)){
  50. MSG_ERR(1, "sub task failed");
  51. }else MSG_ERR(1, "sub task ok");
  52. }