hpocapp(4102).c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. void startSubTask(void);
  22. static void mainTask(void *param){
  23. dataInit();
  24. boardInit();
  25. startSubTask();//线程会调用外设接口,必须在boardInit后启动
  26. appRun();//应用主程序(pt)
  27. }
  28. /*
  29. appimg_enter
  30. cat one入口函数
  31. */
  32. LSAPI_OSI_Thread_t * mainThreadPtr=NULL;
  33. int appimg_enter(void *param){
  34. if(NULL==(mainThreadPtr=LSAPI_OSI_ThreadCreate("main", mainTask, NULL, LSAPI_OSI_PRIORITY_NORMAL, PT_THREAD_STACK, 5))){
  35. for(;;){
  36. LSAPI_Log_Debug("main task failed");
  37. LSAPI_OSI_ThreadSleep(1000);
  38. }
  39. }
  40. return 0;
  41. }
  42. void startSubTask(void){
  43. if(NULL==LSAPI_OSI_ThreadCreate("sub", subTask, NULL, LSAPI_OSI_PRIORITY_NORMAL, SUB_TASK_THREAD_STACK, 10)){
  44. MSG_ERR(1, "sub task failed");
  45. }else MSG_ERR(1, "sub task ok");
  46. }