MainTask.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /********************************************************************************
  2. * File Name: MainTask.h
  3. * Function Describe: Header file for MainTask.c
  4. * Explain:
  5. * Writer: ShiLiangWen
  6. * Date: 2015-1-30
  7. #define PC_Q_NUM 5
  8. #define PC_MSG_BUF_LEN 300
  9. extern unsigned char PcMsgBuf[PC_Q_NUM][PC_MSG_BUF_LEN];
  10. extern int GpsMsgBufIndex;
  11. extern OS_EVENT *GpsQ;
  12. *******************************************************************************/
  13. #ifndef __MAIN_TASK_H
  14. #define __MAIN_TASK_H
  15. /************************************file begin*******************************/
  16. #include <rtl.h>
  17. //#include "MsgQueue.h"
  18. #include "stm32f10x.h"
  19. #define MIN_PWR_LEVEL 345 //低于此电压后不工作 //330
  20. #define WARN_PWR_LEVEL 353 //提示请充电电压
  21. typedef enum{
  22. MCU_UNKNOWN,
  23. MCU_HK,
  24. MCU_ST,
  25. }MUC_TYPE;
  26. extern MUC_TYPE Mcu_Type;
  27. #define USE_RUNNING_MAKE
  28. #ifdef USE_RUNNING_MAKE
  29. void RunningMake(unsigned short FileID, unsigned long line);
  30. #define RunMake(FileID) RunningMake(FileID, __LINE__)
  31. #else
  32. #define RunMake(FileID) (void)0
  33. #endif
  34. #define ONOFF_CK_PIN GPIO_Pin_9
  35. #define ONOFF_CK_PORT GPIOB
  36. #define PWR_EN_PIN GPIO_Pin_2
  37. #define PWR_EN_PORT GPIOC
  38. #define PWR_EN_HIGH PWR_EN_PORT->BSRR = PWR_EN_PIN
  39. #define PWR_EN_LOW PWR_EN_PORT->BRR = PWR_EN_PIN//BRR
  40. #define START_TTS_LENGTH (20*4)//开机播报最多20个中文
  41. #define MAIN_TASK_STK_SIZE 2024/8 //2024
  42. //extern SUT_MSG_QUEUE PcMsgQueue;
  43. void SetPowerEn(unsigned char en);
  44. void PowerCtrlInit(void);
  45. void UC2UL(unsigned char *pUC,unsigned long *pUL);
  46. void UL2UC(unsigned long UL, unsigned char *pUC);
  47. void SysParaInit(void);
  48. void SystemReset(void);
  49. void ADCInit(void);
  50. int GetVbat(void);
  51. void CheckVbat(int Vbat);
  52. //void ReportVbat(int Vbat);
  53. //void ReportCSQ(int CSQ);
  54. int OnOffCheck(void);
  55. void ReportVbatCsqGps(void);
  56. void ReportVersion(void);
  57. void ReportUserGroupName(void);
  58. int GetParaFromStr(char *Str,char *Para,char *Value);
  59. unsigned long ReadPsnFromFlash(void);
  60. void SavePsnToFlash(unsigned long PSN);
  61. void SaveParaToFlash(void);
  62. void ReadParaFromFlash(void);
  63. void IWDG_Configuration(unsigned int );
  64. void ReportMcuVer(void);
  65. void ReportModemVer(int ver);
  66. void AscStrToHexStr(char *AscStr, char *HexStr);
  67. void EnterGTMode(void);
  68. void GPIO_Config_ALL_AIN(void);
  69. void Sys_Standby(void);
  70. void UpdataPocVersion(void);
  71. void OsDelayTime(unsigned short t);//系统延时 带喂狗
  72. void TSMakeSendStrData(void);
  73. void GTMode_Detected(void);
  74. void ResetModem(void);
  75. void PcMsgHandle2(char *msg);
  76. int GetOneceVbat();
  77. void MCU_FACTORY_RECOGNIZE();
  78. __task void MainTask(void);
  79. unsigned char AscToHex(unsigned char aHex);
  80. short FindTargetIndex(char *source, char sourceEndIndicator, char *target, unsigned char targetLen,unsigned char witchOne);
  81. unsigned char GetStringIP2Bytes(unsigned char *IPBytes,char *IPString);
  82. void MakeStrEndByNewLine(char *str);
  83. uint16_t StrUnicodeToAnsi(uint8_t *dest,uint16_t size,const char *src);
  84. uint16_t AnsiToStrUnicode(uint8_t *dest,uint16_t size,const char *src);
  85. void StrAsciiToHex(char *src, unsigned char *des);
  86. void makeAuthCode(unsigned char *auth);
  87. void cmdShutDown(char );
  88. void PrintBufferData(unsigned char *data, unsigned short length);
  89. extern unsigned char modemInitReady;
  90. extern unsigned char modemPwrOffNow;
  91. extern unsigned char pocTimeOutTime;
  92. extern unsigned char g_usSOSCnt;
  93. extern unsigned char g_usLightCnt;
  94. extern unsigned char bootFlag;
  95. extern unsigned int bootMapCnt;
  96. extern unsigned int pttPressFreeCt;
  97. extern unsigned char g_uslockCnt;
  98. extern unsigned char g_uslockflag;
  99. extern unsigned char Ui_LockFlag;
  100. extern unsigned char g_usVoiceCnt;
  101. extern unsigned char g_usFastInterfaceCnt;
  102. extern unsigned char g_usFactory;
  103. extern unsigned char Pttfreeflag;
  104. extern int g_iVbat;
  105. extern unsigned short g_usFileID;
  106. extern unsigned long g_ulFileLine;
  107. extern unsigned char g_ucGtMode;
  108. extern OS_TID idMainTask;
  109. extern U64 stkMainTask[MAIN_TASK_STK_SIZE];
  110. extern unsigned char g_ucEnterGroupFlag;
  111. extern unsigned char m_GroupSwitch;
  112. extern unsigned char g_ucBackLightCnt;
  113. extern char sysStartTTS[START_TTS_LENGTH];
  114. extern unsigned int Vbat;
  115. extern unsigned char ReCharge;
  116. extern unsigned char g_usGtcnt;
  117. extern unsigned char Ui_VolLvFlag;
  118. extern unsigned char Ui_VolLvCnt;
  119. extern unsigned char g_uckeybeep;
  120. extern unsigned char g_ucPoweroffcnt;
  121. extern unsigned char g_cMenuBack;
  122. /************************************file end ******************************************/
  123. #endif