shmMem.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4. #include <string.h>
  5. #include <stdbool.h>
  6. #include <unistd.h>
  7. #include <sys/ipc.h>
  8. #include <sys/shm.h>
  9. #include "../Define/define.h"
  10. //#include "../AudiCust.h"
  11. #include "../SelectGun/SelectGun.h"
  12. #include "../common.h"
  13. #include "../Log/log.h"
  14. #include "../Config.h"
  15. #include "shmMem.h"
  16. //------------------------------------------------------------------------------
  17. static struct SysConfigAndInfo *ShmSysConfigAndInfo = NULL;
  18. //static struct SysInfoData *ShmSysInfoData = NULL;
  19. //static struct SysConfigData *ShmSysConfigData = NULL;
  20. //static struct WARNING_CODE_INFO *SysWarningInfo = NULL;
  21. static struct StatusCodeData *ShmStatusCodeData = NULL;
  22. //static struct AlarmCodeData *ShmAlarmCodeData = NULL;
  23. //static struct FaultCodeData *ShmFaultCodeData = NULL;
  24. //static struct InfoCodeData *ShmInfoCodeData = NULL;
  25. static struct PsuData *ShmPsuData = NULL;
  26. static struct CHAdeMOData *ShmCHAdeMOData = NULL;
  27. static struct GBTData *ShmGBTData = NULL;
  28. static struct CcsData *ShmCcsData = NULL;
  29. static struct PrimaryMcuData *ShmPrimaryMcuData = NULL;
  30. static struct FanModuleData *ShmFanModuleData = NULL;
  31. static struct RelayModuleData *ShmRelayModuleData = NULL;
  32. static struct LedModuleData *ShmLedModuleData = NULL;
  33. static struct OCPP16Data *ShmOCPP16Data = NULL;
  34. static struct OCPP20Data* ShmOCPP20Data = NULL;
  35. static SelectGunInfo *ShmSelectGunInfo = NULL;
  36. static DcCommonInfo *ShmDcCommonData = NULL;
  37. static struct ChargingInfoData *DcChargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY] = {NULL};
  38. static struct ChargingInfoData *AcChargingData[AC_QUANTITY] = {NULL};
  39. static GunIndexInfo gGunIndexInfo = {0};
  40. //struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
  41. //struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  42. //struct WARNING_CODE_INFO *pSysWarning = (struct WARNING_CODE_INFO *)GetShmSysWarningInfo();
  43. //struct AlarmCodeData *pAlarmCode = (struct AlarmCodeData *)GetShmAlarmCodeData();
  44. //struct InfoCodeData *pInfoCode = (struct InfoCodeData *)GetShmInfoCodeData();
  45. //struct FaultCodeData *pFaultCode = (struct FaultCodeData *)GetShmFaultCodeData();
  46. //struct PsuData *ShmPsuData = (struct PsuData *)GetShmPsuData();
  47. //struct CHAdeMOData *ShmCHAdeMOData = (struct CHAdeMOData *)GetShmCHAdeMOData();
  48. //struct GBTData *ShmGBTData = (struct GBTData *)GetShmGBTData();
  49. //struct CcsData *ShmCcsData = (struct CcsData *)GetShmCcsData();
  50. //struct PrimaryMcuData *ShmPrimaryMcuData = (struct PrimaryMcuData *)GetShmPrimaryMcuData();
  51. //struct FanModuleData *ShmFanModuleData = (struct FanModuleData *)GetShmFanModuleData();
  52. //struct RelayModuleData *ShmRelayModuleData = (struct RelayModuleData *)GetShmRelayModuleData();
  53. //struct LedModuleData *ShmLedModuleData = (struct LedModuleData *)GetShmLedModuleData();
  54. //struct OCPP16Data *ShmOCPP16Data = (struct OCPP16Data *)GetShmOCPP16Data();
  55. //SelectGunInfo *ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
  56. //DcCommonInfo *ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
  57. //struct ChargingInfoData *pDcChargingInfo = NULL;
  58. //struct ChargingInfoData *pAcChargingInfo = NULL;
  59. //------------------------------------------------------------------------------
  60. void *GetGunIndexInfo(void)
  61. {
  62. return &gGunIndexInfo;
  63. }
  64. #if 0
  65. static int findChargingInfoData(uint8_t target, struct ChargingInfoData **chargingData)
  66. {
  67. uint8_t i = 0;
  68. for (i = 0; i < CHAdeMO_QUANTITY; i++) {
  69. if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[i].Index == target) {
  70. chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[i];
  71. return PASS;
  72. }
  73. }
  74. for (i = 0; i < CCS_QUANTITY; i++) {
  75. if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[i].Index == target) {
  76. log_info("Index = %d, %d", target, ShmSysConfigAndInfo->SysInfo.CcsChargingData[i].Index);
  77. chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[i];
  78. return PASS;
  79. }
  80. }
  81. for (i = 0; i < GB_QUANTITY; i++) {
  82. if (ShmSysConfigAndInfo->SysInfo.GbChargingData[i].Index == target) {
  83. chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[i];
  84. return PASS;
  85. }
  86. }
  87. return FAIL;
  88. }
  89. void MappingChargingInfoData(void) //DS60-120 add
  90. {
  91. bool isPass = true;
  92. uint8_t i = 0;
  93. while (isPass) {
  94. for (i = 0; i < 2; i++) {
  95. if (!findChargingInfoData(i, &DcChargingData[0])) {
  96. log_error("Find ChargingInfoData failed");
  97. isPass = false;
  98. break;
  99. }
  100. }
  101. sleep(1);
  102. }
  103. }
  104. #endif //0
  105. void SetAcChargingInfoData(uint8_t index, struct ChargingInfoData *chargingInfoIndex)
  106. {
  107. AcChargingData[index] = chargingInfoIndex;
  108. }
  109. void *GetAcChargingInfoData(uint8_t index)
  110. {
  111. return AcChargingData[index];
  112. }
  113. void SetDcChargingInfoData(uint8_t index, struct ChargingInfoData *chargingInfoIndex)
  114. {
  115. DcChargingData[index] = chargingInfoIndex;
  116. }
  117. void *GetDcChargingInfoData(uint8_t index)
  118. {
  119. return DcChargingData[index];
  120. }
  121. void *GetShmSysWarningInfo(void)
  122. {
  123. if (ShmSysConfigAndInfo == NULL) {
  124. return NULL;
  125. }
  126. return &ShmSysConfigAndInfo->SysWarningInfo;
  127. }
  128. void *GetShmSysConfigData(void)
  129. {
  130. if (ShmSysConfigAndInfo == NULL) {
  131. return NULL;
  132. }
  133. return &ShmSysConfigAndInfo->SysConfig;
  134. }
  135. void *GetShmSysInfoData(void)
  136. {
  137. if (ShmSysConfigAndInfo == NULL) {
  138. return NULL;
  139. }
  140. return &ShmSysConfigAndInfo->SysInfo;
  141. }
  142. void *GetShmSysConfigAndInfo(void)
  143. {
  144. if (ShmSysConfigAndInfo == NULL) {
  145. return NULL;
  146. }
  147. return ShmSysConfigAndInfo;
  148. }
  149. void *GetShmInfoCodeData(void)
  150. {
  151. if (ShmStatusCodeData == NULL) {
  152. return NULL;
  153. }
  154. return &ShmStatusCodeData->InfoCode;
  155. }
  156. void *GetShmFaultCodeData(void)
  157. {
  158. if (ShmStatusCodeData == NULL) {
  159. return NULL;
  160. }
  161. return &ShmStatusCodeData->FaultCode;
  162. }
  163. void *GetShmAlarmCodeData(void)
  164. {
  165. if (ShmStatusCodeData == NULL) {
  166. return NULL;
  167. }
  168. return &ShmStatusCodeData->AlarmCode;
  169. }
  170. void *GetShmStatusCodeData(void)
  171. {
  172. if (ShmStatusCodeData == NULL) {
  173. return NULL;
  174. }
  175. return ShmStatusCodeData;
  176. }
  177. void *GetShmPsuData(void)
  178. {
  179. if (ShmPsuData == NULL) {
  180. return NULL;
  181. }
  182. return ShmPsuData;
  183. }
  184. void *GetShmCHAdeMOData(void)
  185. {
  186. if (ShmCHAdeMOData == NULL) {
  187. return NULL;
  188. }
  189. return ShmCHAdeMOData;
  190. }
  191. void *GetShmGBTData(void)
  192. {
  193. if (ShmGBTData == NULL) {
  194. return NULL;
  195. }
  196. return ShmGBTData;
  197. }
  198. void *GetShmCcsData(void)
  199. {
  200. if (ShmCcsData == NULL) {
  201. return NULL;
  202. }
  203. return ShmCcsData;
  204. }
  205. void *GetShmPrimaryMcuData(void)
  206. {
  207. if (ShmPrimaryMcuData == NULL) {
  208. return NULL;
  209. }
  210. return ShmPrimaryMcuData;
  211. }
  212. void *GetShmFanModuleData(void)
  213. {
  214. if (ShmFanModuleData == NULL) {
  215. return NULL;
  216. }
  217. return ShmFanModuleData;
  218. }
  219. void *GetShmRelayModuleData(void)
  220. {
  221. if (ShmRelayModuleData == NULL) {
  222. return NULL;
  223. }
  224. return ShmRelayModuleData;
  225. }
  226. void *GetShmLedModuleData(void)
  227. {
  228. if (ShmLedModuleData == NULL) {
  229. return NULL;
  230. }
  231. return ShmLedModuleData;
  232. }
  233. void *GetShmOCPP16Data(void)
  234. {
  235. if (ShmOCPP16Data == NULL) {
  236. return NULL;
  237. }
  238. return ShmOCPP16Data;
  239. }
  240. void* GetShmOCPP20Data(void)
  241. {
  242. if (ShmOCPP20Data == NULL) {
  243. return NULL;
  244. }
  245. return ShmOCPP20Data;
  246. }
  247. void *GetShmSelectGunInfo(void)
  248. {
  249. if (ShmSelectGunInfo == NULL) {
  250. return NULL;
  251. }
  252. return ShmSelectGunInfo;
  253. }
  254. void *GetShmDcCommonData(void)
  255. {
  256. if (ShmDcCommonData == NULL) {
  257. return NULL;
  258. }
  259. return ShmDcCommonData;
  260. }
  261. //------------------------------------------------------------------------------
  262. static void initialGunIndexToUnUse(void)
  263. {
  264. uint8_t index = 0;
  265. struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  266. for (index = 0; index < CHAdeMO_QUANTITY; index++) {
  267. pSysInfo->ChademoChargingData[index].Index = NO_DEFINE;
  268. }
  269. for (index = 0; index < CCS_QUANTITY; index++) {
  270. pSysInfo->CcsChargingData[index].Index = NO_DEFINE;
  271. }
  272. for (index = 0; index < GB_QUANTITY; index++) {
  273. pSysInfo->GbChargingData[index].Index = NO_DEFINE;
  274. }
  275. for (index = 0; index < AC_QUANTITY; index++) {
  276. pSysInfo->AcChargingData[index].Index = NO_DEFINE;
  277. }
  278. }
  279. #if 0
  280. static void getFirmwareVersion(void)
  281. {
  282. uint8_t count = 0, chademo = 0, ccs = 0, gb = 0;
  283. uint8_t index = 0;
  284. struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
  285. struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  286. // Get CSU root file system version
  287. sprintf((char *)pSysInfo->CsuRootFsFwRev, fwVersion);
  288. for (index = 0; index < 3; index++) {
  289. if (pSysConfig->ModelName[7 + index] == 'J') {
  290. chademo++;
  291. count++;
  292. } else if (pSysConfig->ModelName[7 + index] == 'G') {
  293. gb++;
  294. count++;
  295. } else if (pSysConfig->ModelName[7 + index] == 'U' ||
  296. pSysConfig->ModelName[7 + index] == 'V' ||
  297. pSysConfig->ModelName[7 + index] == 'E') {
  298. ccs++;
  299. count++;
  300. }
  301. }
  302. if (count == 1) {
  303. if (chademo > 0) {
  304. pSysInfo->CsuRootFsFwRev[7] = '1';
  305. } else if (ccs > 0) {
  306. pSysInfo->CsuRootFsFwRev[7] = '2';
  307. } else if (gb > 0) {
  308. pSysInfo->CsuRootFsFwRev[7] = '3';
  309. }
  310. } else {
  311. if (chademo > 0 && ccs > 0) {
  312. pSysInfo->CsuRootFsFwRev[7] = '4';
  313. } else if (chademo > 0 && gb > 0) {
  314. pSysInfo->CsuRootFsFwRev[7] = '5';
  315. } else if (ccs > 0 && gb > 0) {
  316. pSysInfo->CsuRootFsFwRev[7] = '6';
  317. }
  318. }
  319. // Get network option from model name
  320. switch (pSysConfig->ModelName[10]) {
  321. case 'B':
  322. case 'U':
  323. //Blue tooth
  324. pSysInfo->CsuRootFsFwRev[9] = '3';
  325. break;
  326. case 'W':
  327. // WIFI
  328. pSysInfo->CsuRootFsFwRev[9] = '1';
  329. break;
  330. case 'T':
  331. // 3G/4G
  332. pSysInfo->CsuRootFsFwRev[9] = '2';
  333. break;
  334. case 'D': //DS60-120 add
  335. pSysInfo->CsuRootFsFwRev[9] = '5';
  336. break;
  337. default:
  338. // LAN
  339. pSysInfo->CsuRootFsFwRev[9] = '0';
  340. break;
  341. }
  342. // Get rating power from model name
  343. memcpy(&pSysInfo->CsuRootFsFwRev[10], &pSysConfig->ModelName[4], 0x03);
  344. // Get IEC or UL
  345. char _buf[3] = {0};
  346. memcpy(_buf, &pSysConfig->ModelName[2], 2);
  347. if (strcmp(_buf, "YE") == EQUAL || strcmp(_buf, "YC") == EQUAL) {
  348. pSysInfo->ChargerType = _CHARGER_TYPE_IEC;
  349. log_info("IEC model");
  350. } else if (strcmp(_buf, "WU") == EQUAL) {
  351. pSysInfo->ChargerType = _CHARGER_TYPE_UL;
  352. log_info("UL model");
  353. }
  354. }
  355. #endif //0
  356. void InitialShareMemoryInfo(void)
  357. {
  358. FILE *fp = NULL;
  359. char cmd[512] = {0};
  360. char buf[512] = {0};
  361. struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
  362. struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  363. struct AlarmCodeData *pAlarmCode = (struct AlarmCodeData *)GetShmAlarmCodeData();
  364. //SysConfig init
  365. sprintf((char *)pSysConfig->TelecomInterface.TelcomApn, "Internet");
  366. sprintf((char *)pSysConfig->TelecomInterface.TelcomChapPapId, " ");
  367. sprintf((char *)pSysConfig->TelecomInterface.TelcomChapPapPwd, " ");
  368. pSysConfig->TotalConnectorCount = 0;
  369. pSysConfig->AcConnectorCount = 0;
  370. memcpy(pSysInfo->CsuBootLoadFwRev,
  371. pSysConfig->CsuBootLoadFwRev,
  372. ARRAY_SIZE(pSysConfig->CsuBootLoadFwRev));
  373. strcpy((char *) pSysConfig->UserId, "");
  374. pSysConfig->QRCodeMadeMode = NO; //DS60-120 add
  375. pSysConfig->SwitchDebugFlag = NO;
  376. pSysConfig->AlwaysGfdFlag = NO;
  377. //SysInfo init
  378. pSysInfo->FactoryConfiguration = 0;
  379. pSysInfo->InputVoltageR = 0;
  380. pSysInfo->InputVoltageS = 0;
  381. pSysInfo->InputVoltageT = 0;
  382. pSysInfo->SystemFanRotaSpeed = 0;
  383. pSysInfo->PsuFanRotaSpeed = 0;
  384. pSysInfo->AuxPower5V = 0;
  385. pSysInfo->AuxPower12V = 0;
  386. pSysInfo->AuxPower24V = 0;
  387. pSysInfo->AuxPower48V = 0;
  388. sprintf((char *)pSysInfo->CsuHwRev, "REV:5.0");
  389. sprintf(cmd, "/bin/uname -r");
  390. fp = popen(cmd, "r");
  391. if (fp == NULL) {
  392. sprintf((char *)pSysInfo->CsuKernelFwRev, "Unknown version");
  393. } else {
  394. while (fgets(buf, sizeof(buf), fp) != NULL) {
  395. strcpy((char *)pSysInfo->CsuKernelFwRev, buf);
  396. }
  397. }
  398. // 雙槍 CCS + Chademo
  399. //getFirmwareVersion();
  400. //sprintf((char *) pSysInfo->CsuRootFsFwRev, fwVersion);
  401. sprintf((char *) pSysInfo->CsuPrimFwRev, " ");
  402. sprintf((char *)pSysInfo->LcmHwRev, " ");
  403. sprintf((char *)pSysInfo->LcmFwRev, " ");
  404. sprintf((char *)pSysInfo->PsuHwRev, " ");
  405. sprintf((char *)pSysInfo->PsuPrimFwRev, " ");
  406. sprintf((char *)pSysInfo->PsuSecFwRev, " ");
  407. sprintf((char *)pSysInfo->AuxPwrHwRev, " ");
  408. sprintf((char *)pSysInfo->AuxPwrFwRev, " ");
  409. sprintf((char *)pSysInfo->FanModuleHwRev, " ");
  410. sprintf((char *)pSysInfo->FanModuleFwRev, " ");
  411. sprintf((char *)pSysInfo->RelayModuleHwRev, " ");
  412. sprintf((char *)pSysInfo->RelayModuleFwRev, " ");
  413. sprintf((char *)pSysInfo->TelcomModemFwRev, " ");
  414. pSysInfo->SystemAmbientTemp = 0;
  415. pSysInfo->SystemCriticalTemp = 0;
  416. pSysInfo->PsuAmbientTemp = 0;
  417. pSysInfo->CcsConnectorTemp = 0;
  418. pSysInfo->InternetConn = 0;
  419. pSysInfo->OcppConnStatus = 0;
  420. pSysInfo->OrderCharging = NO_DEFINE;
  421. memset(pSysInfo->FanModuleFwRev, 0, ARRAY_SIZE(pSysInfo->FanModuleFwRev));
  422. memset(pSysInfo->RelayModuleFwRev, 0, ARRAY_SIZE(pSysInfo->RelayModuleFwRev));
  423. #if defined DD360Audi
  424. pSysInfo->SystemPage = _LCM_SELECT_GUN;
  425. #else
  426. pSysInfo->SystemPage = _LCM_NONE;
  427. #endif //defined DD360Audi
  428. pSysInfo->MainChargingMode = _MAIN_CHARGING_MODE_MAX;
  429. pSysInfo->ReAssignedFlag = _REASSIGNED_NONE;
  430. pSysInfo->CurGunSelectedByAc = NO_DEFINE;
  431. pSysInfo->BootingStatus = BOOTTING; //DS60-120 add
  432. //other board init
  433. ShmPrimaryMcuData->SelfTest_Comp = NO;
  434. ShmRelayModuleData->SelfTest_Comp = NO;
  435. ShmFanModuleData->SelfTest_Comp = NO;
  436. ShmLedModuleData->SelfTest_Comp = NO;
  437. ShmFanModuleData->TestFanSpeed = 0;
  438. //status code init
  439. pAlarmCode->AlarmEvents.bits.RelayboardStestFail = NO;
  440. pAlarmCode->AlarmEvents.bits.FanboardStestFail = NO;
  441. pAlarmCode->AlarmEvents.bits.PrimaryStestFail = NO;
  442. pAlarmCode->AlarmEvents.bits.LedboardStestFail = NO; //DS60-120 Add
  443. pAlarmCode->AlarmEvents.bits.ChademoboardStestFail = NO;
  444. pAlarmCode->AlarmEvents.bits.CCSboardStestFail = NO;
  445. pAlarmCode->AlarmEvents.bits.AcContactStestFail = NO;
  446. pAlarmCode->AlarmEvents.bits.PsuModuleStestFail = NO;
  447. pAlarmCode->AlarmEvents.bits.PsuDipSwitchStestFail = NO; //DS60-120 Add
  448. pAlarmCode->AlarmEvents.bits.ModelNameNoneMatchStestFail = NO;
  449. pAlarmCode->AlarmEvents.bits.PsuNoResource = NO;
  450. pAlarmCode->AlarmEvents.bits.FailToCreateShareMemory = NO;
  451. initialGunIndexToUnUse();//DS60-120 add
  452. //ShmDcCommonData->CcsVersion = _CCS_VERSION_CHECK_TAG_V015S0;
  453. //ShmDcCommonData->psuKeepCommunication = NO;
  454. //ShmDcCommonData->acContactSwitch = NO;
  455. ShmDcCommonData->ConnectErrList[0].GunErrMessage = 0;
  456. ShmDcCommonData->ConnectErrList[1].GunErrMessage = 0;
  457. ShmDcCommonData->TestTemperature = NO;
  458. //ShmDcCommonData->LcmFwVersion = 0;
  459. }
  460. int InitSelectGunShmMem(void)
  461. {
  462. int MeterSMId = FAIL;
  463. #if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
  464. return;
  465. #endif //!defined DD360 && !defined DD360Audi && !defined DD360ComBox
  466. if ((MeterSMId = shmget(ShmSelectGunInfoKey, sizeof(SelectGunInfo), IPC_CREAT | 0777)) < 0) {
  467. return FAIL;
  468. } else if ((ShmSelectGunInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  469. return FAIL;
  470. }
  471. return PASS;
  472. }
  473. int InitCommonShmMem(void)
  474. {
  475. int MeterSMId = FAIL;
  476. if ((MeterSMId = shmget(ShmCommonKey, sizeof(DcCommonInfo), IPC_CREAT | 0777)) < 0) {
  477. return FAIL;
  478. } else if ((ShmDcCommonData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  479. return FAIL;
  480. }
  481. return PASS;
  482. }
  483. //int InitCSUMeterShmMem(void)
  484. //{
  485. // int MeterSMId = FAIL;
  486. //
  487. // if ((MeterSMId = shmget(ShmCsuMeterKey, sizeof(struct MeterInformation), IPC_CREAT | 0777)) < 0) {
  488. // return FAIL;
  489. // } else if ((ShmCsuMeterInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  490. // return FAIL;
  491. // }
  492. //
  493. // return PASS;
  494. //}
  495. int InitOCPPShmMem(void)
  496. {
  497. int MeterSMId = FAIL;
  498. if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), IPC_CREAT | 0777)) < 0) {
  499. log_info("Get OCPP share memory error");
  500. return FAIL;
  501. } else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  502. log_info("Create OCPP share memory error");
  503. return FAIL;
  504. }
  505. return PASS;
  506. }
  507. int InitOCPP20ShmMem(void)
  508. {
  509. int MeterSMId = FAIL;
  510. if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), IPC_CREAT | 0777)) < 0) {
  511. log_info("Get OCPP20 share memory error");
  512. return FAIL;
  513. } else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void*)-1) {
  514. log_info("Create OCPP20 share memory error");
  515. return FAIL;
  516. }
  517. return PASS;
  518. }
  519. int InitLEDShmMem(void)
  520. {
  521. int MeterSMId = FAIL;
  522. if ((MeterSMId = shmget(ShmLedBdKey, sizeof(struct LedModuleData), IPC_CREAT | 0777)) < 0) {
  523. return FAIL;
  524. } else if ((ShmLedModuleData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  525. return FAIL;
  526. }
  527. return PASS;
  528. }
  529. int InitRelayShmMem(void)
  530. {
  531. int MeterSMId = FAIL;
  532. if ((MeterSMId = shmget(ShmRelayBdKey, sizeof(struct RelayModuleData), IPC_CREAT | 0777)) < 0) {
  533. return FAIL;
  534. } else if ((ShmRelayModuleData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  535. return FAIL;
  536. }
  537. return PASS;
  538. }
  539. int InitFanShmMem(void)
  540. {
  541. int MeterSMId = FAIL;
  542. if ((MeterSMId = shmget(ShmFanBdKey, sizeof(struct FanModuleData), IPC_CREAT | 0777)) < 0) {
  543. return FAIL;
  544. } else if ((ShmFanModuleData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  545. return FAIL;
  546. }
  547. return PASS;
  548. }
  549. int InitPrimaryShmMem(void)
  550. {
  551. int MeterSMId = FAIL;
  552. if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), IPC_CREAT | 0777)) < 0) {
  553. return FAIL;
  554. } else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  555. return FAIL;
  556. }
  557. return PASS;
  558. }
  559. int InitCCSShmMem(void)
  560. {
  561. int MeterSMId = FAIL;
  562. if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData), IPC_CREAT | 0777)) < 0) {
  563. return FAIL;
  564. } else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  565. return FAIL;
  566. }
  567. return PASS;
  568. }
  569. int InitGBShmMem(void)
  570. {
  571. int MeterSMId = FAIL;
  572. if ((MeterSMId = shmget(ShmGBTCommKey, sizeof(struct GBTData), IPC_CREAT | 0777)) < 0) {
  573. return FAIL;
  574. } else if ((ShmGBTData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  575. return FAIL;
  576. }
  577. return PASS;
  578. }
  579. int InitCHADeMoShmMem(void)
  580. {
  581. int MeterSMId = FAIL;
  582. if ((MeterSMId = shmget(ShmCHAdeMOCommKey, sizeof(struct CHAdeMOData), IPC_CREAT | 0777)) < 0) {
  583. return FAIL;
  584. } else if ((ShmCHAdeMOData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  585. return FAIL;
  586. }
  587. return PASS;
  588. }
  589. int InitPSUDataShmMem(void)
  590. {
  591. int MeterSMId = FAIL;
  592. //creat ShmPsuData
  593. if ((MeterSMId = shmget(ShmPsuKey, sizeof(struct PsuData), IPC_CREAT | 0777)) < 0) {
  594. return FAIL;
  595. } else if ((ShmPsuData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  596. return FAIL;
  597. }
  598. return PASS;
  599. }
  600. int InitStatusCodeShmMem(void)
  601. {
  602. int MeterSMId = FAIL;
  603. if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), IPC_CREAT | 0777)) < 0) {
  604. return FAIL;
  605. } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  606. return FAIL;
  607. }
  608. return PASS;
  609. }
  610. int InitSysConfigAndInfoShmMem(void)
  611. {
  612. int MeterSMId = FAIL;
  613. if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0) {
  614. printf("1 InitSysConfigAndInfoShmMem");
  615. return FAIL;
  616. } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
  617. printf("2 InitSysConfigAndInfoShmMem");
  618. return FAIL;
  619. }
  620. return PASS;
  621. }
  622. void ClearAllShmMemParameter(void)
  623. {
  624. uint8_t i = 0;
  625. memset(ShmSysConfigAndInfo, 0, sizeof(struct SysConfigAndInfo));
  626. memset(ShmStatusCodeData, 0, sizeof(struct StatusCodeData));
  627. memset(ShmPsuData, 0, sizeof(struct PsuData));
  628. if (CHAdeMO_QUANTITY > 0) {
  629. memset(ShmCHAdeMOData, 0, sizeof(struct CHAdeMOData));
  630. }
  631. if (GB_QUANTITY > 0) {
  632. memset(ShmGBTData, 0, sizeof(struct GBTData));
  633. }
  634. if (CCS_QUANTITY > 0) {
  635. memset(ShmCcsData, 0, sizeof(struct CcsData));
  636. }
  637. memset(ShmPrimaryMcuData, 0, sizeof(struct PrimaryMcuData));
  638. memset(ShmFanModuleData, 0, sizeof(struct FanModuleData));
  639. memset(ShmRelayModuleData, 0, sizeof(struct RelayModuleData));
  640. memset(ShmLedModuleData, 0, sizeof(struct LedModuleData));
  641. //memset(ShmOCPP16Data,0,sizeof(struct OCPP16Data));
  642. //memset(ShmCsuMeterInfo, 0, sizeof(struct MeterInformation));
  643. memset(ShmDcCommonData, 0, sizeof(DcCommonInfo));
  644. #if defined DD360 || defined DD360Audi || defined DD360ComBox
  645. memset(ShmSelectGunInfo, 0, sizeof(SelectGunInfo));
  646. for (i = 0; i < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; i++) {
  647. ShmSelectGunInfo->PricesInfo[i].Balance = FAIL_BALANCE_PRICES;
  648. }
  649. #endif //defined DD360 || defined DD360Audi || defined DD360ComBox
  650. }
  651. static void setAcGunTiggerStatus(void)
  652. {
  653. struct ChargingInfoData *pAcChargingInfo = NULL;
  654. if (gGunIndexInfo.AcGunIndex == 0) {
  655. return;
  656. }
  657. pAcChargingInfo = (struct ChargingInfoData *)GetAcChargingInfoData(gGunIndexInfo.AcGunIndex);
  658. pAcChargingInfo->schedule.isTriggerStart = NO; //DS60-120 add
  659. pAcChargingInfo->schedule.isTriggerStop = NO; //DS60-120 add
  660. }
  661. static int findAcChargingInfoData(uint8_t gunIndex)
  662. {
  663. struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  664. //acChargingData[gunIndex] = &pSysInfo->AcChargingData[0];
  665. SetAcChargingInfoData(gunIndex, &pSysInfo->AcChargingData[0]);
  666. return PASS;
  667. }
  668. static int findDcChargingInfoData(uint8_t gunIndex)
  669. {
  670. uint8_t i = 0;
  671. struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  672. //printf("Chademo count = %d\n", gGunIndexInfo.ChademoIndex);
  673. for (i = 0; i < gGunIndexInfo.DcGunIndex; i++) {
  674. if (pSysInfo->ChademoChargingData[i].Index == gunIndex) {
  675. //printf("chademo index = %d, %d\n", pSysInfo->ChademoChargingData[i].Index, gunIndex);
  676. //dcChargingData[gunIndex] = &pSysInfo->ChademoChargingData[i];
  677. SetDcChargingInfoData(pSysInfo->ChademoChargingData[i].Index, &pSysInfo->ChademoChargingData[i]);
  678. return PASS;
  679. }
  680. }
  681. //printf("ccs count = %d\n", gGunIndexInfo.CcsIndex);
  682. for (i = 0; i < gGunIndexInfo.DcGunIndex; i++) {
  683. if (pSysInfo->CcsChargingData[i].Index == gunIndex) {
  684. //printf("ccs index = %d, %d\n", pSysInfo->CcsChargingData[i].Index, gunIndex);
  685. //dcChargingData[gunIndex] = (struct ChargingInfoData *)&pSysInfo->CcsChargingData[i];
  686. SetDcChargingInfoData(pSysInfo->CcsChargingData[i].Index, &pSysInfo->CcsChargingData[i]);
  687. return PASS;
  688. }
  689. }
  690. for (i = 0; i < gGunIndexInfo.DcGunIndex; i++) {
  691. if (pSysInfo->GbChargingData[i].Index == gunIndex) {
  692. //dcChargingData[gunIndex] = &pSysInfo->GbChargingData[i];
  693. SetDcChargingInfoData(pSysInfo->GbChargingData[i].Index, &pSysInfo->GbChargingData[i]);
  694. return PASS;
  695. }
  696. }
  697. return FAIL;
  698. }
  699. static bool addGunInfoByConnector(uint8_t typeValue, uint8_t slots,char *whichtask)
  700. {
  701. bool result = true;
  702. struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  703. struct ChargingInfoData *pDcChargingInfo = NULL;
  704. struct ChargingInfoData *pAcChargingInfo = (struct ChargingInfoData *)GetAcChargingInfoData(gGunIndexInfo.AcGunIndex);
  705. struct CcsData *pCcsData = (struct CcsData *)GetShmCcsData();
  706. switch (typeValue) {
  707. // AC Gun Type -------------------------------------------------------------
  708. case '0': // none
  709. break;
  710. case '1': // IEC 62196-2 Type 1/SAE J1772 Plug
  711. break;
  712. case '2': // IEC 62196-2 Type 1/SAE J1772 Socket
  713. break;
  714. case '3': // IEC 62196-2 Type 2 Plug
  715. case '4': // IEC 62196-2 Type 2 Socket
  716. if (AC_QUANTITY > gGunIndexInfo.AcIndex) {
  717. pAcChargingInfo = (struct ChargingInfoData *)&pSysInfo->AcChargingData[gGunIndexInfo.AcIndex];
  718. // AC 固定 index
  719. pAcChargingInfo->Index = 0;
  720. pAcChargingInfo->ReservationId = -1;
  721. pAcChargingInfo->SystemStatus = S_IDLE;
  722. pAcChargingInfo->Type = _Type_AC;
  723. pAcChargingInfo->schedule.isTriggerStart = NO; //DS60-120 add
  724. pAcChargingInfo->schedule.isTriggerStop = NO; //DS60-120 add
  725. //if( strcmp(whichtask,"CSU task") == EQUAL )
  726. {
  727. gGunIndexInfo.AcIndex++;
  728. gGunIndexInfo.AcGunIndex++;
  729. pAcChargingInfo->IsAvailable = YES;
  730. }
  731. } else {
  732. result = false;
  733. }
  734. break;
  735. case '5': // GB/T AC Plug
  736. break;
  737. case '6': // GB/T AC Socket
  738. break;
  739. //DC Gun Type --------------------------------------------------------------
  740. case 'J': // CHAdeMO
  741. case 'K': // CHAdeMO 200A
  742. if (CHAdeMO_QUANTITY > gGunIndexInfo.ChademoIndex) {
  743. pDcChargingInfo = (struct ChargingInfoData *)&pSysInfo->ChademoChargingData[gGunIndexInfo.ChademoIndex];
  744. pDcChargingInfo->Index = gGunIndexInfo.DcGunIndex;
  745. pDcChargingInfo->ReservationId = -1;
  746. pDcChargingInfo->slotsIndex = slots;
  747. //pDcChargingInfo->SystemStatus = S_BOOTING;
  748. //pDcChargingInfo->SystemStatus = S_IDLE;
  749. pDcChargingInfo->Type = _Type_Chademo;
  750. pDcChargingInfo->type_index = gGunIndexInfo.ChademoIndex;
  751. setAcGunTiggerStatus();
  752. //if( strcmp(whichtask,"CSU task") == EQUAL )
  753. {
  754. pDcChargingInfo->IsAvailable = YES;
  755. gGunIndexInfo.ChademoIndex++;
  756. gGunIndexInfo.DcGunIndex++;
  757. }
  758. } else {
  759. result = false;
  760. }
  761. break;
  762. case 'V': // Liquid CCS1 combo
  763. case 'F': // Liquid CCS2 combo
  764. case 'T': // Rema CCS1
  765. case 'D': // Rema CCS2
  766. case 'U': // CCS1 combo
  767. case 'E': // CCS2 combo
  768. case 'M': // 80A CCS2
  769. case 'N': // 80A CCS1
  770. case 'P': // 急電弓
  771. if (CCS_QUANTITY > gGunIndexInfo.CcsIndex) {
  772. pDcChargingInfo = (struct ChargingInfoData *)&pSysInfo->CcsChargingData[gGunIndexInfo.CcsIndex];
  773. pDcChargingInfo->Index = gGunIndexInfo.DcGunIndex;
  774. pDcChargingInfo->ReservationId = -1;
  775. pDcChargingInfo->slotsIndex = slots;
  776. //pDcChargingInfo->SystemStatus = S_BOOTING;
  777. pDcChargingInfo->Type = _Type_CCS_2;
  778. pDcChargingInfo->type_index = gGunIndexInfo.CcsIndex;
  779. setAcGunTiggerStatus();
  780. // 現階段預設為走 DIN70121
  781. pCcsData->CommProtocol = _CCS_COMM_V2GMessage_DIN70121;
  782. //if( strcmp(whichtask,"CSU task") == EQUAL )
  783. {
  784. pDcChargingInfo->IsAvailable = YES;
  785. gGunIndexInfo.CcsIndex++;
  786. gGunIndexInfo.DcGunIndex++;
  787. }
  788. if(typeValue == 'P') {
  789. pDcChargingInfo->PantographFlag = YES;
  790. } else if (typeValue == 'V') {
  791. pDcChargingInfo->CCSGunType = _TYPE_CCS1_Liquid;
  792. } else if (typeValue == 'F') {
  793. pDcChargingInfo->CCSGunType = _TYPE_CCS2_Liquid;
  794. } else if (typeValue == 'T' || typeValue == 'U' || typeValue == 'N') {
  795. pDcChargingInfo->CCSGunType = _TYPE_CCS1_Natural;
  796. } else if (typeValue == 'D' || typeValue == 'E' || typeValue == 'M') {
  797. pDcChargingInfo->CCSGunType = _TYPE_CCS2_Natural;
  798. } else
  799. pDcChargingInfo->CCSGunType = _TYPE_CCS_NONE;
  800. } else {
  801. result = false;
  802. }
  803. break;
  804. case 'G': // GBT DC
  805. case 'B': // GBT YG PT100
  806. if (GB_QUANTITY > gGunIndexInfo.GbIndex) {
  807. pDcChargingInfo = (struct ChargingInfoData *)&pSysInfo->GbChargingData[gGunIndexInfo.GbIndex];
  808. pDcChargingInfo->Index = gGunIndexInfo.DcGunIndex;
  809. pDcChargingInfo->ReservationId = -1;
  810. pDcChargingInfo->slotsIndex = slots;
  811. //pDcChargingInfo->SystemStatus = S_BOOTING;
  812. pDcChargingInfo->Type = _Type_GB;
  813. pDcChargingInfo->type_index = gGunIndexInfo.GbIndex;
  814. setAcGunTiggerStatus();
  815. //if( strcmp(whichtask,"CSU task") == EQUAL )
  816. {
  817. pDcChargingInfo->IsAvailable = YES;
  818. gGunIndexInfo.GbIndex++;
  819. gGunIndexInfo.DcGunIndex++;
  820. }
  821. } else {
  822. result = false;
  823. }
  824. break;
  825. //case 'D': // GBT DC x 2
  826. // break;
  827. //default:
  828. // result = false;
  829. // break;
  830. }
  831. return result;
  832. }
  833. bool MappingGunChargingInfo(char *whichTask)
  834. {
  835. bool result = true;
  836. uint8_t typeIndex = 0;
  837. uint8_t slots = 1;
  838. uint8_t gunIndex = 0;
  839. struct SysConfigData *pSysConfig = NULL;
  840. //struct ChargingInfoData *pDcChargingInfo = NULL;
  841. struct ChargingInfoData *pAcChargingInfo = NULL;
  842. if (ShmSysConfigAndInfo == NULL) {
  843. log_error("ShmSysConfigAndInfo failed");
  844. return false;
  845. }
  846. pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
  847. if (strlen((char *)pSysConfig->ModelName) < 9) {
  848. log_error("Module name length < 9 get %s", (char *)pSysConfig->ModelName);
  849. return false;
  850. }
  851. ShmDcCommonData->ChillerValve.MultiChillerGun = 0;
  852. //printf("1 CheckConnectorTypeStatus\n");
  853. for (typeIndex = 7; typeIndex <= 9; typeIndex++) {
  854. if (!addGunInfoByConnector(pSysConfig->ModelName[typeIndex], slots, whichTask)) {
  855. log_error("%s add gun info failed", whichTask);
  856. return false;
  857. }
  858. //確認有幾把水冷槍
  859. if (strncmp((char *)&pSysConfig->ModelName[typeIndex], "V", 1) == 0 ||
  860. strncmp((char *)&pSysConfig->ModelName[typeIndex], "F", 1) == 0
  861. ) {
  862. ShmDcCommonData->ChillerValve.MultiChillerGun++; //水冷槍數
  863. }
  864. slots++;
  865. }
  866. if (ShmDcCommonData->ChillerValve.MultiChillerGun != 0) {
  867. ShmDcCommonData->ChillerValve.MultiChillerGun |= 0x80; //有水冷槍標記
  868. if (strncmp(whichTask, "CSU Task", 8) == EQUAL) {
  869. log_info("get chiller gun = %x, chiller gun count = %d",
  870. (ShmDcCommonData->ChillerValve.MultiChillerGun & 0x80) >> 7,
  871. ShmDcCommonData->ChillerValve.MultiChillerGun & 0x7F);
  872. }
  873. }
  874. // AC index 接在 DC 後面
  875. //if (AC_QUANTITY > 0) {
  876. if (gGunIndexInfo.AcIndex > 0) { //DS60-120 add
  877. pAcChargingInfo = (struct ChargingInfoData *)GetAcChargingInfoData(0);
  878. pAcChargingInfo->Index += gGunIndexInfo.DcGunIndex;
  879. }
  880. pSysConfig->TotalConnectorCount = gGunIndexInfo.DcGunIndex;
  881. pSysConfig->AcConnectorCount = gGunIndexInfo.AcGunIndex;
  882. if (strcmp(whichTask, "CSU Task") == 0) {
  883. log_info("DC connector Quality = %d, AC connector Quality = %d",
  884. pSysConfig->TotalConnectorCount,
  885. pSysConfig->AcConnectorCount);
  886. }
  887. for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
  888. findDcChargingInfoData(gunIndex);
  889. }
  890. findAcChargingInfoData(gunIndex);
  891. //log_info("Type 0~3 = CHAdeMO, CCS, GB, AC");
  892. if (pSysConfig->TotalConnectorCount == 0 && pSysConfig->AcConnectorCount == 0) {
  893. log_error("DC %d or AC %d connector failed",
  894. pSysConfig->TotalConnectorCount,
  895. pSysConfig->AcConnectorCount);
  896. result = false;
  897. }
  898. return result;
  899. }
  900. int CreateAllCsuShareMemory(void)
  901. {
  902. int ret = FAIL;
  903. if ((ret = InitSysConfigAndInfoShmMem()) == FAIL) {
  904. return ret;
  905. }
  906. if ((ret = InitStatusCodeShmMem()) == FAIL) {
  907. return ret;
  908. }
  909. if ((ret = InitPSUDataShmMem()) == FAIL) {
  910. return ret;
  911. }
  912. if (CHAdeMO_QUANTITY > 0) {
  913. if ((ret = InitCHADeMoShmMem()) == FAIL) {
  914. return ret;
  915. }
  916. }
  917. if (GB_QUANTITY > 0) {
  918. if ((ret = InitGBShmMem()) == FAIL) {
  919. return ret;
  920. }
  921. }
  922. //creat ShmCcsData
  923. if (CCS_QUANTITY > 0) {
  924. if ((ret = InitCCSShmMem()) == FAIL) {
  925. return ret;
  926. }
  927. }
  928. if ((ret = InitPrimaryShmMem()) == FAIL) {
  929. return ret;
  930. }
  931. if ((ret = InitFanShmMem()) == FAIL) {
  932. return ret;
  933. }
  934. if ((ret = InitRelayShmMem()) == FAIL) {
  935. return ret;
  936. }
  937. if ((ret = InitLEDShmMem()) == FAIL) {
  938. return ret;
  939. }
  940. if ((ret = InitOCPPShmMem()) == FAIL) {
  941. return ret;
  942. }
  943. if ((ret = InitOCPP20ShmMem()) == FAIL) {
  944. return ret;
  945. }
  946. if ((ret = InitSelectGunShmMem()) == FAIL) {
  947. return ret;
  948. }
  949. if ((ret = InitSelectGunShmMem()) == FAIL) {
  950. return ret;
  951. }
  952. if ((ret = InitCommonShmMem()) == FAIL) {
  953. return ret;
  954. }
  955. //ClearAllShmMemParameter();
  956. //MappingChargingInfoData();
  957. //initialShareMemoryParameter();
  958. //initialGunIndexToUnUse();
  959. sleep(1);
  960. return PASS;
  961. }