123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
- * All rights reserved.
- *
- * This software is supplied "AS IS" without any warranties.
- * RDA assumes no responsibility or liability for the use of the software,
- * conveys no license or title under any patent, copyright, or mask work
- * right to the product. RDA reserves the right to make changes in the
- * software without notification. RDA also make no representation or
- * warranty that such application will be suitable for the specified use
- * without further testing or modification.
- */
- //#define OSI_LOG_TAG OSI_MAKE_LOG_TAG()
- #include "includes.h"
- /*
- appimg_exit
- 仅在程序退出时打印
- */
- void appimg_exit(void){
- LSAPI_Log_Debug("application image exit");
- }
- //POC 回调输出信息
- void virtual_uart_read(char *data, int len){
- pocCmdHandler(data, len);
- }
- LSAPI_OSI_Thread_t * ToneThreadPtr=NULL;
- #define HANDSET_THREAD_STACK 4*1024
- void ToneThread(void *param){
- LSAPI_OSI_Event_t waitevent;
-
- for(;;){
- LSAPI_OSI_EventWait(LSAPI_OSI_ThreadCurrent(), &waitevent);
- if(sutPocStatus.beep!=0){
- if(sutPocStatus.spk==0||sutPocStatus.beep==2){//100
-
- if(!sutPocStatus.PttFail)LSAPI_AUD_CusToneV2(TONEFRE,TONEFRE,100,LSAPI_CUSTONE_GAIN_NEGA_24,0);//24
- else LSAPI_AUD_CusToneV2(1000,1000,100,LSAPI_CUSTONE_GAIN_NEGA_24,0);//24
-
- LSAPI_AUD_SetPlayVolumeLevel(newPara.spkVol*7);//10
-
- if(sutPocStatus.prePtt){
- msgAtSend("AT+POC=reqspk00");
- //sutPocStatus.prePtt=0;
- }
- MSG_INFO(1, "TONE satrt");
- }
- }
-
- sutPocStatus.beep=0;
- sutPocStatus.PttFail=0;
- sutPocStatus.prePtt=0;
- }
- }
- void ToneInit(void){
- ToneThreadPtr=LSAPI_OSI_ThreadCreate("tonedet", ToneThread, NULL, LSAPI_OSI_PRIORITY_NORMAL, HANDSET_THREAD_STACK, 4);
- if(ToneThreadPtr==NULL)MSG_INFO(1,"tone thread failed");
- }
- void startSubTask(void);
- static void mainTask(void *param){
- LSAPI_OSI_ThreadSleep(10000);
- ToneInit();
- dataInit();
- boardInit();
- startSubTask();//线程会调用外设接口,必须在boardInit后启动
- LSAPI_GWSD_Register_Callback(virtual_uart_read);
- appRun();//应用主程序(pt)
- }
- /*
- appimg_enter
- cat one入口函数
- */
- LSAPI_OSI_Thread_t * mainThreadPtr=NULL;
- int appimg_enter(void *param){
- if(NULL==(mainThreadPtr=LSAPI_OSI_ThreadCreate("main", mainTask, NULL, LSAPI_OSI_PRIORITY_NORMAL, PT_THREAD_STACK, 5))){
- for(;;){
- LSAPI_Log_Debug("main task failed");
- LSAPI_OSI_ThreadSleep(1000);
- }
- }
- return 0;
- }
- void startSubTask(void){
- if(NULL==LSAPI_OSI_ThreadCreate("sub", subTask, NULL, LSAPI_OSI_PRIORITY_NORMAL, SUB_TASK_THREAD_STACK, 10)){
- MSG_ERR(1, "sub task failed");
- }else MSG_ERR(1, "sub task ok");
- }
|