main.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /****************************************Copyright (c)****************************************************
  2. **
  3. ** http://www.powermcu.com
  4. **
  5. **--------------File Info---------------------------------------------------------------------------------
  6. ** File name: main.c
  7. ** Descriptions: The UCOSII application function
  8. **
  9. **--------------------------------------------------------------------------------------------------------
  10. ** Created by: AVRman
  11. ** Created date: 2010-11-9
  12. ** Version: v1.0
  13. ** Descriptions: The original version
  14. **
  15. **--------------------------------------------------------------------------------------------------------
  16. ** Modified by:
  17. ** Modified date:
  18. ** Version:
  19. ** Descriptions:
  20. **
  21. *********************************************************************************************************/
  22. /* Includes ------------------------------------------------------------------*/
  23. #include "includes.h"
  24. /**********************************************************************************************************
  25. * main()
  26. *
  27. * Description : This is the standard entry point for C code. It is assumed that your code will call
  28. * main() once you have performed all necessary initialization.
  29. *
  30. * Argument(s) : none.
  31. *
  32. * Return(s) : none.
  33. **********************************************************************************************************/
  34. extern unsigned char g_ucTickFlag;
  35. extern unsigned char g_ucSecFlag;
  36. /********************************************************************
  37. *ReadProductParaFromFlash
  38. 将sutNetPara重要参数从FLASH中读取出来
  39. *********************************************************************/
  40. void ReadProductParaFromFlash(void)
  41. {
  42. static const unsigned char DefMark[4]={'F','T','O','K'};
  43. unsigned char Rand;
  44. Rand=GetRandBySTM32ID();
  45. ReadFlashData(APP_CONFIG_ADDR,(unsigned char *)&sutProductPara,sizeof(SUT_PRODUCT_PARA));
  46. }
  47. int main (void)
  48. {
  49. char buf[50];
  50. W25Q64_Init();
  51. MsgDataBufferInit();
  52. MsgQueueInit(&ModemMsgQueue);
  53. Uart1Init();
  54. if (SysTick_Config(SystemCoreClock / 100)){
  55. //IapTrace("SysTick_Config Error!");
  56. while (1);
  57. }
  58. IapTrace(IAP_VERSION_NAME);
  59. ReadProductParaFromFlash();
  60. memset(&sutMsg,0,sizeof(SUT_MSG));
  61. NewTask(TASK_WAIT);
  62. while(1)
  63. {
  64. if(sutMsg.Uart1Recv){ //Use for PC
  65. Uart1Msg();
  66. sutMsg.Uart1Recv=0;
  67. memset(IapRxBuf,0,sizeof(IapRxBuf));
  68. }
  69. if(sutMsg.TaskStart){
  70. sutMsg.TaskStart=0;
  71. StartMsg();
  72. }
  73. if(sutMsg.Tick10ms){
  74. sutMsg.Tick10ms=0;
  75. }
  76. if(sutMsg.Tick500ms){
  77. sutMsg.Tick500ms=0;
  78. Tick500Msg();
  79. }
  80. }
  81. return (0);
  82. }
  83. //void assert_failed(uint8_t* file, uint32_t line)
  84. //{
  85. // printf("[AF]f:%s,l:%d\r\n",file,line);
  86. // while (1)
  87. // {}
  88. //}
  89. /*********************************************************************************************************
  90. END FILE
  91. *********************************************************************************************************/