Module_PsuComm.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #include <sys/time.h>
  2. #include <sys/timeb.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6. #include <sys/ioctl.h>
  7. #include <sys/socket.h>
  8. #include <sys/ipc.h>
  9. #include <sys/shm.h>
  10. #include <sys/shm.h>
  11. #include <sys/mman.h>
  12. #include <linux/wireless.h>
  13. #include <linux/can.h>
  14. #include <linux/can/raw.h>
  15. #include <arpa/inet.h>
  16. #include <netinet/in.h>
  17. #include <unistd.h>
  18. #include <stdarg.h>
  19. #include <stdio.h> /*標準輸入輸出定義*/
  20. #include <stdlib.h> /*標準函數庫定義*/
  21. #include <unistd.h> /*Unix 標準函數定義*/
  22. #include <fcntl.h> /*檔控制定義*/
  23. #include <termios.h> /*PPSIX 終端控制定義*/
  24. #include <errno.h> /*錯誤號定義*/
  25. #include <errno.h>
  26. #include <string.h>
  27. #include <time.h>
  28. #include <ctype.h>
  29. #include <ifaddrs.h>
  30. #include <math.h>
  31. #include "../../define.h"
  32. #include <stdbool.h>
  33. typedef unsigned char byte;
  34. typedef unsigned short word;
  35. typedef unsigned int unit;
  36. #define PREPARE_STEP_NONE 0
  37. #define PREPARE_STEP_CABLE_CHECK 1
  38. #define PREPARE_STEP_GFD_DONE 2
  39. #define PREPARE_STEP_PRECHARGE 3
  40. #define PREPARE_STEP_CHARGING 4
  41. struct ChargingInfoData *chargingInfo[CONNECTOR_QUANTITY];
  42. bool isStartOutputSwitch[CONNECTOR_QUANTITY];
  43. bool isCharging = false;
  44. bool isWaitingAver = false;
  45. bool isReadToCharging = false;
  46. bool CanAverageCharging = false;
  47. int preChargingTarget;
  48. int preChargingCur;
  49. float toAverVolPoint;
  50. byte toAverVolCount;
  51. int connector_1[12];
  52. int connector_2[12];
  53. byte conn_1_count = 0;
  54. byte conn_2_count = 0;
  55. enum _PSU_ON_OFF_CMD
  56. {
  57. _PSU_OFF = 0,
  58. _PSU_ON = 1,
  59. };
  60. enum _PSU_TEMP_TYPE
  61. {
  62. _PSU_TMP_DCDC = 0,
  63. _PSU_TMP_PFC = 1,
  64. };
  65. enum _PSU_CMD_SEQ
  66. {
  67. _PSU_CMD_STATUS = 1,
  68. _PSU_CMD_VERSION = 2,
  69. _PSU_CMD_CAP = 10,
  70. _PSU_CMD_OUTPUT = 11,
  71. _PSU_CMD_IVAILIABLE = 12,
  72. _PSU_CMD_TEMP = 13
  73. };
  74. enum _CURRENT_CONFIG_MODE
  75. {
  76. _CURRENT_MODE_NONE = 0,
  77. _CURRENT_MODE_BALANCE = 1,
  78. _CURRENT_MODE_INCREASE = 2,
  79. _CURRENT_MODE_DECREASE = 3,
  80. _CURRENT_MODE_DERATING = 4,
  81. };
  82. enum _EXTEND_TYPE
  83. {
  84. _EXTEND_TYPE_NONE = 0,
  85. _EXTEND_TYPE_QUANTITY = 1,
  86. _EXTEND_TYPE_POWER = 2,
  87. };
  88. #define STR_EXTEND_CONFLICT_NONE "No Conflict"
  89. #define STR_EXTEND_CONFLICT_AVAILABLE "Available Conflict"
  90. #define STR_EXTEND_CONFLICT_AVERAGE "Average Conflict"
  91. #define STR_EXTEND_CONFLICT_PRIORITY "Priority Conflict"
  92. #define STR_EXTEND_CONFLICT_UNKNOWN "Unknown Conflict"
  93. enum _EXTEND_CONFLICT
  94. {
  95. _CONFLICT_NONE = 0,
  96. _CONFLICT_AVAILABLE = 1,
  97. _CONFLICT_AVERAGE = 2,
  98. _CONFLICT_PRIORITY = 3,
  99. _CONFLICT_UNKNOWN = 4,
  100. };