MainTask.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #define MIN_PWR_LEVEL 330 //低于此电压后不工作
  19. #define WARN_PWR_LEVEL 340 //提示请充电电压
  20. #define USE_RUNNING_MAKE
  21. #ifdef USE_RUNNING_MAKE
  22. void RunningMake(unsigned short FileID, unsigned long line);
  23. #define RunMake(FileID) RunningMake(FileID, __LINE__)
  24. #else
  25. #define RunMake(FileID) (void)0
  26. #endif
  27. extern unsigned short g_usFileID;
  28. extern unsigned long g_ulFileLine;
  29. #define ONOFF_CK_PIN GPIO_Pin_9
  30. #define ONOFF_CK_PORT GPIOB
  31. #define PWR_EN_PIN GPIO_Pin_5
  32. #define PWR_EN_PORT GPIOB
  33. #define PWR_EN_HIGH PWR_EN_PORT->BSRR = PWR_EN_PIN
  34. #define PWR_EN_LOW PWR_EN_PORT->BRR = PWR_EN_PIN
  35. #define MAIN_TASK_STK_SIZE 1024/8
  36. extern OS_TID idMainTask;
  37. extern U64 stkMainTask[MAIN_TASK_STK_SIZE];
  38. extern int g_iVbat;
  39. //extern SUT_MSG_QUEUE PcMsgQueue;
  40. void SetPowerEn(unsigned char en);
  41. void PowerCtrlInit(void);
  42. void UC2UL(unsigned char *pUC,unsigned long *pUL);
  43. void UL2UC(unsigned long UL, unsigned char *pUC);
  44. void SysParaInit(void);
  45. void SystemReset(void);
  46. void ADCInit(void);
  47. int GetVbat(void);
  48. void CheckVbat(int Vbat);
  49. int OnOffCheck(void);
  50. void ReportVbatCsqGps(void);
  51. void ReportVersion(void);
  52. void ReportUserGroupName(void);
  53. int GetParaFromStr(char *Str,char *Para,char *Value);
  54. unsigned long ReadPsnFromFlash(void);
  55. void SavePsnToFlash(unsigned long PSN);
  56. void SaveParaToFlash(void);
  57. void ReadParaFromFlash(void);
  58. void IWDG_Configuration(unsigned int);
  59. void ReportMcuVer(void);
  60. void ReportModemVer(int ver);
  61. void AscStrToHexStr(char *AscStr, char *HexStr);
  62. void AscStrToHexStr1(char *AscStr, char *HexStr,unsigned char len);
  63. void EnterGTMode(void);
  64. void GPIO_Config_ALL_AIN(void);
  65. void Sys_Standby(void);
  66. void ExitGroupSelect(void);
  67. unsigned char AscToHex(unsigned char aHex);
  68. extern unsigned char GroupSelectStat;
  69. extern unsigned char GroupSelectFlag;
  70. extern unsigned char g_net_flag;
  71. //从source查找长度为targetLen目标的target,找到后返回目标段后一字节的索引,没找到返回-1,source结束为sourceEndIndicator
  72. //witchOne: 找第几个目标
  73. short FindTargetIndex(char *source, char sourceEndIndicator, char *target, unsigned char targetLen,unsigned char witchOne);
  74. __task void MainTask(void);
  75. void ReportPocGpsIP(void);
  76. char changeDataFormat(char *asciiData, unsigned short len);
  77. void MakeStrEndByNewLine(char *str);
  78. void Select_Net(unsigned char net);
  79. void GetMododexWithCard(void);
  80. void BroadCast_Net();
  81. void CSQ_Prompt();
  82. void NumStrToUnicode(char *pNum,char *pUnicode);
  83. extern unsigned char g_ucEnterGroupFlag;
  84. unsigned char GetStringIP2Bytes(unsigned char *IPBytes,char *IPString);
  85. extern unsigned char modemInitReady;
  86. extern unsigned char modemPwrOffNow;
  87. extern unsigned char pocTimeOutTime;
  88. extern unsigned char g_net_cnt;
  89. extern unsigned char net_sure;
  90. extern unsigned char CSQ_flag;
  91. extern unsigned char CSQ_ct;
  92. /************************************file end ******************************************/
  93. #endif