Bluecell_operate.c 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. #include <stdio.h>
  2. #include "main.h"
  3. #include "Bluecell_operate.h"
  4. extern volatile uint32_t LedTimerCnt;
  5. uint8_t Alarm_Status[MAX_ALARM_Len] = {0,};
  6. uint8_t ResultData[1024] = {0,};
  7. void Boot_LED_Toggle(void){
  8. if(LedTimerCnt > 500){
  9. HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_14);
  10. LedTimerCnt = 0;
  11. // printf("LED OF OFF\r\n");
  12. }
  13. }
  14. uint8_t* MBIC_HeaderDataSetting(uint8_t* data){
  15. ResultData[MBIC_PREAMBLE_0] = MBIC_PREAMBLE0;
  16. ResultData[MBIC_PREAMBLE_1] = MBIC_PREAMBLE1;
  17. ResultData[MBIC_PREAMBLE_2] = MBIC_PREAMBLE2;
  18. ResultData[MBIC_PREAMBLE_3] = MBIC_PREAMBLE3;
  19. ResultData[MBIC_SUBUID_0] = MBIC_SUBUID0;
  20. ResultData[MBIC_SUBUID_1] = MBIC_SUBUID1;
  21. ResultData[MBIC_RCODE_0] = data[MBIC_RCODE_0];
  22. ResultData[MBIC_TRID_0] = data[MBIC_TRID_0];
  23. ResultData[MBIC_TRID_1] = data[MBIC_TRID_1];
  24. ResultData[MBIC_SEQSUM_0] = data[MBIC_SEQSUM_0];
  25. ResultData[MBIC_TTL_0] = data[MBIC_TTL_0];
  26. ResultData[MBIC_TIME_0] = data[MBIC_TIME_0];
  27. ResultData[MBIC_TIME_1] = data[MBIC_TIME_1];
  28. ResultData[MBIC_TIME_2] = data[MBIC_TIME_2];
  29. ResultData[MBIC_TIME_3] = data[MBIC_TIME_3];
  30. ResultData[MBIC_TIME_4] = data[MBIC_TIME_4];
  31. ResultData[MBIC_TIME_5] = data[MBIC_TIME_5];
  32. return ResultData;
  33. }
  34. typedef enum{
  35. BLUECELL_DL_PATH1 = 0x01,
  36. BLUECELL_UL_PATH1,
  37. BLUECELL_DL_PATH2,
  38. BLUECELL_UL_PATH2,
  39. BLUECELL_DL_PATH3,
  40. BLUECELL_UL_PATH3,
  41. BLUECELL_DL_PATH4,
  42. BLUECELL_UL_PATH4,
  43. };
  44. typedef enum{
  45. BLUECELL_HEADER,
  46. BLUECELL_TYPE,
  47. BLUECELL_LENGTH,
  48. BLUECELL_CRCINDEX,
  49. BLUECELL_DATA,
  50. };
  51. bool Bluecell_Operate(uint8_t* data){
  52. uint8_t datatype = data[BLUECELL_TYPE];
  53. uint16_t tmp_h = 0,tmp_l = 0;
  54. double ret = 0 ,tmp = 0.1;
  55. switch(datatype){
  56. case ATTDL1 :
  57. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  58. tmp_h = data[BLUECELL_DATA];
  59. tmp_l = data[BLUECELL_DATA + 1];
  60. ret += ((tmp_h << 8) & 0xFF00);
  61. ret += (tmp_l & 0x00FF);
  62. ret /= 100;
  63. printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
  64. break;
  65. case ATT_DL1_PATH_OFF :
  66. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  67. break;
  68. case ATT_DL1_PATH_ON :
  69. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  70. break;
  71. case ATTUL1 :
  72. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  73. tmp_h = data[BLUECELL_DATA];
  74. tmp_l = data[BLUECELL_DATA + 1];
  75. ret += ((tmp_h << 8) & 0xFF00);
  76. ret += (tmp_l & 0x00FF);
  77. ret /= 100;
  78. printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
  79. break;
  80. case ATT_UL1_PATH_OFF :
  81. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  82. break;
  83. case ATT_UL1_PATH_ON :
  84. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  85. break;
  86. case ATT_SelfTest1_OFF :
  87. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  88. break;
  89. case ATT_SelfTest1_ON :
  90. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  91. break;
  92. case ATTDL2 :
  93. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  94. tmp_h = data[BLUECELL_DATA];
  95. tmp_l = data[BLUECELL_DATA + 1];
  96. ret += ((tmp_h << 8) & 0xFF00);
  97. ret += (tmp_l & 0x00FF);
  98. ret /= 100;
  99. printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
  100. break;
  101. case ATT_DL2_PATH_OFF :
  102. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  103. break;
  104. case ATT_DL2_PATH_ON :
  105. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  106. break;
  107. case ATTUL2 :
  108. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  109. tmp_h = data[BLUECELL_DATA];
  110. tmp_l = data[BLUECELL_DATA + 1];
  111. ret += ((tmp_h << 8) & 0xFF00);
  112. ret += (tmp_l & 0x00FF);
  113. ret /= 100;
  114. printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
  115. break;
  116. case ATT_UL2_PATH_OFF :
  117. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  118. break;
  119. case ATT_UL2_PATH_ON :
  120. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  121. break;
  122. case ATT_SelfTest2_OFF :
  123. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  124. break;
  125. case ATT_SelfTest2_ON :
  126. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  127. break;
  128. case ATTDL3 :
  129. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  130. tmp_h = data[BLUECELL_DATA];
  131. tmp_l = data[BLUECELL_DATA + 1];
  132. ret += ((tmp_h << 8) & 0xFF00);
  133. ret += (tmp_l & 0x00FF);
  134. ret /= 100;
  135. printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
  136. break;
  137. case ATT_DL3_PATH_OFF :
  138. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  139. break;
  140. case ATT_DL3_PATH_ON :
  141. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  142. break;
  143. case ATTUL3 :
  144. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  145. tmp_h = data[BLUECELL_DATA];
  146. tmp_l = data[BLUECELL_DATA + 1];
  147. ret += ((tmp_h << 8) & 0xFF00);
  148. ret += (tmp_l & 0x00FF);
  149. ret /= 100;
  150. printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
  151. break;
  152. case ATT_UL3_PATH_OFF :
  153. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  154. break;
  155. case ATT_UL3_PATH_ON :
  156. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  157. break;
  158. case ATT_SelfTest3_OFF :
  159. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  160. break;
  161. case ATT_SelfTest3_ON :
  162. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  163. break;
  164. case ATTDL4 :
  165. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  166. tmp_h = data[BLUECELL_DATA];
  167. tmp_l = data[BLUECELL_DATA + 1];
  168. ret += ((tmp_h << 8) & 0xFF00);
  169. ret += (tmp_l & 0x00FF);
  170. ret /= 100;
  171. printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
  172. break;
  173. case ATT_DL4_PATH_OFF :
  174. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  175. break;
  176. case ATT_DL4_PATH_ON :
  177. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  178. break;
  179. case ATTUL4 :
  180. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  181. tmp_h = data[BLUECELL_DATA];
  182. tmp_l = data[BLUECELL_DATA + 1];
  183. ret += ((tmp_h << 8) & 0xFF00);
  184. ret += (tmp_l & 0x00FF);
  185. ret /= 100;
  186. printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
  187. break;
  188. case ATT_UL4_PATH_OFF:
  189. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  190. break;
  191. case ATT_UL4_PATH_ON :
  192. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  193. break;
  194. case ATT_SelfTest4_OFF :
  195. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  196. break;
  197. case ATT_SelfTest4_ON :
  198. printf("Function : %s Line %d \r\n",__func__,__LINE__);
  199. break;
  200. }
  201. return true;
  202. }
  203. bool MBIC_Operate(uint8_t* data){
  204. uint16_t datatype = 0;
  205. switch(datatype){
  206. case Alarm_Bit_List:
  207. // �븣由� 鍮꾪듃
  208. Uart1_Data_Send(&Alarm_Status[0],MAX_ALARM_Len);
  209. break;
  210. case Alarm_Mask:
  211. break;
  212. case Alarm_Test_Mode:
  213. break;
  214. case Alarm_Test_Dummy:
  215. break;
  216. case CPU_Version:
  217. break;
  218. case ModuleINFORMATION_null1:
  219. break;
  220. case CPU_Current_Bank:
  221. break;
  222. case CPU_Bank_Select_Reboot_by:
  223. break;
  224. case CPU_Bank1_Image_Version:
  225. break;
  226. case CPU_Bank1_Image_BuildTime:
  227. break;
  228. case CPU_Bank1_Image_Name:
  229. break;
  230. case CPU_Bank2_Image_Version:
  231. break;
  232. case CPU_Bank2_Image_BuildTime:
  233. break;
  234. case CPU_Bank2_Image_Name:
  235. break;
  236. case SW_Reset:
  237. break;
  238. case Factory_Set_Initialization:
  239. break;
  240. case Temperature:
  241. break;
  242. case Temperature_Offset:
  243. break;
  244. case Temp_High_Threshold:
  245. break;
  246. case Temp_High_Threshold_Default:
  247. break;
  248. case Temp_High_Alarm:
  249. break;
  250. case LED_TEST:
  251. break;
  252. case Node:
  253. break;
  254. case Type:
  255. break;
  256. case PCB_Version:
  257. break;
  258. case Serial_Number:
  259. break;
  260. case Manufacture:
  261. break;
  262. case Manufacture_Date:
  263. break;
  264. case ENVIRONMENT_INVENTORY_null1:
  265. printf("Function : %s .... Line : %d\r\n",__func__,__LINE__);
  266. break;
  267. case Freq_ID:
  268. break;
  269. case Carrier_ID:
  270. break;
  271. case Carrier_ON_OFF:
  272. break;
  273. }
  274. return true;
  275. }