Browse Source

Merge branch 'BYTON-GB'

FolusWen 5 years ago
parent
commit
dd2da761d5
54 changed files with 5668 additions and 3123 deletions
  1. BIN
      EVSE/Projects/BYTON-GB/Apps/4gModem
  2. 0 467
      EVSE/Projects/BYTON-GB/Apps/4gModem.c
  3. BIN
      EVSE/Projects/BYTON-GB/Apps/EventLogging
  4. 0 218
      EVSE/Projects/BYTON-GB/Apps/EventLogging.c
  5. 0 109
      EVSE/Projects/BYTON-GB/Apps/FWMaker.c
  6. BIN
      EVSE/Projects/BYTON-GB/Apps/FactoryConfig
  7. 0 173
      EVSE/Projects/BYTON-GB/Apps/FactoryConfig.c
  8. BIN
      EVSE/Projects/BYTON-GB/Apps/InternalComm
  9. 0 200
      EVSE/Projects/BYTON-GB/Apps/InternalComm.c
  10. 44 54
      EVSE/Projects/BYTON-GB/Apps/Makefile
  11. 968 0
      EVSE/Projects/BYTON-GB/Apps/Module_AlarmDetect.c
  12. 13 0
      EVSE/Projects/BYTON-GB/Apps/Module_AlarmDetect.h
  13. 344 0
      EVSE/Projects/BYTON-GB/Apps/Module_EventLogging.c
  14. 356 0
      EVSE/Projects/BYTON-GB/Apps/Module_FactoryConfig.c
  15. 2050 0
      EVSE/Projects/BYTON-GB/Apps/Module_InternalComm.c
  16. 65 0
      EVSE/Projects/BYTON-GB/Apps/Module_InternalComm.h
  17. BIN
      EVSE/Projects/BYTON-GB/Apps/Ocpp16
  18. 0 333
      EVSE/Projects/BYTON-GB/Apps/Ocpp16.c
  19. 0 248
      EVSE/Projects/BYTON-GB/Apps/PsuComm.c
  20. 0 69
      EVSE/Projects/BYTON-GB/Apps/UpdateRootfs.c
  21. BIN
      EVSE/Projects/BYTON-GB/Apps/ccs
  22. 0 59
      EVSE/Projects/BYTON-GB/Apps/ccs.c
  23. BIN
      EVSE/Projects/BYTON-GB/Apps/main
  24. 524 390
      EVSE/Projects/BYTON-GB/Apps/main.c
  25. 393 0
      EVSE/Projects/BYTON-GB/Apps/main.h
  26. BIN
      EVSE/Projects/BYTON-GB/Images/MLO
  27. BIN
      EVSE/Projects/BYTON-GB/Images/am335x-evm.dtb
  28. BIN
      EVSE/Projects/BYTON-GB/Images/ramdisk.gz
  29. BIN
      EVSE/Projects/BYTON-GB/Images/u-boot.img
  30. BIN
      EVSE/Projects/BYTON-GB/Images/zImage
  31. BIN
      EVSE/rootfs/root/Module_4g
  32. BIN
      EVSE/rootfs/root/Module_Wifi
  33. BIN
      EVSE/rootfs/root/OcppBackend
  34. BIN
      EVSE/rootfs/root/WebService
  35. BIN
      EVSE/rootfs/root/logPackTools
  36. 149 149
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_System.map
  37. 149 149
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms1.S
  38. 149 149
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms2.S
  39. BIN
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux1
  40. BIN
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux2
  41. 1 1
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version
  42. 18 98
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/.am335x-evm.dtb.dts.tmp
  43. 35 80
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
  44. 31 13
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/.conmakehash.cmd
  45. 33 15
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/.kallsyms.cmd
  46. 36 13
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/.sortextable.cmd
  47. 10 5
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/basic/.bin2c.cmd
  48. 38 20
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/basic/.fixdep.cmd
  49. 33 14
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/mod/.mk_elfconfig.cmd
  50. 39 16
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/usr/.gen_init_cpio.cmd
  51. 38 20
      board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/scripts/basic/.fixdep.cmd
  52. 45 19
      board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/tools/.gen_eth_addr.cmd
  53. 45 19
      board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/tools/.img2srec.cmd
  54. 62 23
      board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/tools/.proftool.cmd

BIN
EVSE/Projects/BYTON-GB/Apps/4gModem


+ 0 - 467
EVSE/Projects/BYTON-GB/Apps/4gModem.c

@@ -1,467 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/termios.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
-#include <linux/sockios.h> 
-#include <linux/socket.h>
-#include <sys/socket.h>
-#include <sys/time.h> 
-#include <sys/timeb.h> 
-#include <netinet/in.h>
-#include <unistd.h>
-#include "define.h"
-
-//#define debug		
-#define CheckModemInterval		30	//sec
-#define CheckSimInterval			10 	//sec
-#define CheckConnectionInterval		5 	//sec
-#define DisconnInterval				60 	//sec
-
-
-
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-struct FanModuleData			*ShmFanModuleData;
-
-
-#ifdef SystemLogMessage
-int StoreLogMsg(unsigned char *DataString)
-{
-	unsigned char Buf[256];
-	time_t CurrentTime;
-	struct tm *tm;
-			
-	memset(Buf,0,sizeof(Buf));
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			DataString,
-			tm->tm_year+1900,tm->tm_mon+1);
-	system(Buf);
-	#ifdef Debug
-	printf("%s \n",DataString);
-	#endif
-}		
-#endif
-
-int DiffTimeb(struct timeb ST, struct timeb ET)
-{
-	//return milli-second
-	unsigned int StartTime,StopTime;
-	
-	StartTime=(unsigned int)ST.time;
-	StopTime=(unsigned int)ET.time;
-	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
-}	
-	
-/**************************************************************************************/
-/**************************Init all share memory *********************************/
-/**************************************************************************************/
-int InitShareMemory()
-{
-	int MeterSMId;
-	
-	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[4gModem]InitShareMemory:shmget ShmSysConfigAndInfo NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[4gModem]InitShareMemory:shmat ShmSysConfigAndInfo NG");
-		#endif		
-		return 0;
-   	 }
-   	 //creat ShmStatusCodeData
-   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[4gModem]InitShareMemory:shmget ShmStatusCodeData NG");
-		#endif		
-		return 0;	
-	}
-    	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[4gModem]InitShareMemory:shmat ShmStatusCodeData NG");
-		#endif		
-		return 0;
-   	 }
-   	
-    	return 1;
-}
-
-
-int Check4GModem()
-{
-	//return 0: No 4G modem equipped
-	//return 1: Qutel 4G modem equipped
-	//return 2: ublox 4G modem equipped
-	
-	int Rtn1,Rtn2;
-	
-	//check Qutel 4G modem
-	Rtn1=Rtn2=-1;
-	Rtn1=access("/dev/ttyUSB0",R_OK);
-	if(Rtn1==0)
-	{
-		Rtn2=access("/dev/ttyUSB2",R_OK);
-		if(Rtn2==0)
-		{
-			#ifdef SystemLogMessage	
-			StoreLogMsg("[4gModem]Check4GModem: Qutel 4G modem be found");
-			#endif	
-			return 1;
-		}
-	}	
-	//check ublox 4G modem
-	Rtn1=Rtn2=-1;
-	Rtn1=access("/dev/ttyACM0",R_OK);
-	if(Rtn1==0)
-	{
-		Rtn2=access("/dev/ttyACM2",R_OK);
-		if(Rtn2==0)
-		{
-			#ifdef SystemLogMessage	
-			StoreLogMsg("[4gModem]Check4GModem: ublox 4G modem be found");
-			#endif	
-			return 2;
-		}
-	}	
-	#ifdef SystemLogMessage	
-	StoreLogMsg("[4gModem]Check4GModem: No 4G modem be found");
-	#endif	
-	return 0;	
-}
-
-int InitComPort(unsigned char ModemModel)
-{
-	int UsbFd;
-	struct termios tios;
-	
-	if(ModemModel==1)	//Qutel 4G modem equipped
-		UsbFd = open("/dev/ttyUSB2", O_RDWR|O_NOCTTY);
-	else if(ModemModel==2)	//ublox 4G modem equipped
-		UsbFd = open("/dev/ttyACM2", O_RDWR|O_NOCTTY);
-	else
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[4gModem]InitComPort: Unknow ModemModel ");
-		#endif		
-		return -1;
-	}	
-	
-	if(UsbFd<0)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[4gModem]InitComPort:  UsbFd open failed");
-		#endif	
-		return -1;
-	}	
-	ioctl (UsbFd, TCGETS, &tios);
-	tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
-	tios.c_lflag = 0;
-	tios.c_iflag = 0;
-	tios.c_oflag = 0;
-  	tios.c_cc[VMIN]=0;   
-	tios.c_cc[VTIME]=100; 
-	tios.c_lflag=0;  
-	tcflush(UsbFd, TCIFLUSH);
-	ioctl (UsbFd, TCSETS, &tios);
-	return UsbFd;
-	
-}
-
-void GetModelName(int Fd, unsigned char *ModelName)
-{
-	//AT command processing
-}
-
-void GetModelVersion(int Fd, unsigned char *ModelVersion)
-{
-	//AT command processing
-}
-
-void GetModelImei(int Fd, unsigned char *ModelImei)
-{
-	//AT command processing
-}
-
-void GetSimImsi(int Fd, unsigned char *SimImsi)
-{
-	//AT command processing
-}
-
-unsigned char GetModemMode(int Fd)
-{
-	int Mode;
-	//AT command processing
-	return Mode;
-}
-
-int GetSignalRssi(int Fd)
-{
-	int RssiValue;
-	//AT command processing
-	return RssiValue;
-}
-
-int GetPPP0Info(unsigned char *IPaddress)
-{
-    	int fd,rd=0;
-	unsigned int address;
-	char buf[128],addr[32],*sptr,*eptr;
-	
-
-    	system("ifconfig ppp0 | grep \"inet addr:\" > /mnt/GetPPP0Info");
-	fd = open("/mnt/GetPPP0Info", O_RDONLY);
-    	if(fd<0)
-   	{
-    		system("rm -f /mnt/GetPPP0Info");
-	        return 0;
-    	}
-    
-    	memset(addr,0,sizeof(addr));
-    	memset(buf,0,sizeof(buf));
-    	rd=read(fd,buf,sizeof(buf));	
-    	if(rd<=0)
-    	{
-    		close(fd);
-    		system("rm -f /mnt/GetPPP0Info");
-        	return 0;
-   	}
-    	close(fd);
-    	if((sptr=strstr(buf,"inet addr:"))==NULL)
-    	{
-    		close(fd);
-    		system("rm -f /mnt/GetPPP0Info");
-        	return 0;
-    	}
-    	sptr+=strlen("inet addr:");
-    	if((eptr=strstr(buf,"  P-t-P:"))==NULL)
-    	{
-    		close(fd);
-    		system("rm -f /mnt/GetPPP0Info");
-        	return 0;
-    	}
-    	memset(IPaddress,0,strlen(IPaddress));
-    	strncpy(IPaddress,sptr,eptr-sptr);   
-    	#ifdef SystemLogMessage	
-	{
-		unsigned char Buffer[128];
-		memset(Buffer,0,sizeof(Buffer));
-		sprintf(Buffer,"[4gModem]GetPPP0Info: 4G IP Address = %s",IPaddress);
-		StoreLogMsg(Buffer);
-	}
-	#endif		
-    	return 1;
-}
-int  Load4gConfiguration()
-{
-	unsigned char CopyTmp[128];
-	
-	if(strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn)<=0)
-		return 0;
-	system("cat /dev/null > /root/ppp/auto-apn.conf");
-	system("chmod 777 /root/ppp/auto-apn.conf");  
-	system("cat /dev/null > /etc/ppp/options"); 
-	system("chmod 777 /etc/ppp/options"); 
-	system("cat /dev/null > /etc/ppp/pap-secrets"); 
-	system("chmod 777 /etc/ppp/pap-secrets"); 
-	system("cat /dev/null > /etc/ppp/chap-secrets"); 
-	system("chmod 777 /etc/ppp/chap-secrets"); 
-	memset(CopyTmp,0,sizeof(CopyTmp));
-	sprintf(CopyTmp,"echo \"APN=\"%s\"\" > /root/ppp/auto-apn.conf",ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
-	system(CopyTmp);
-	system("echo \"ACCOUNT=\" >> /root/ppp/auto-apn.conf");
-	system("echo \"PASSWORD=\" >> /root/ppp/auto-apn.conf");
-	
-	if(strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId)>0)
-	{	
-		memset(CopyTmp,0,sizeof(CopyTmp));
-		sprintf(CopyTmp,"echo \"name %s \" > /etc/ppp/options",ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
-		system(CopyTmp);
-		
-		memset(CopyTmp,0,sizeof(CopyTmp));
-		sprintf(CopyTmp,"echo \"%s * %s \" > /etc/ppp/pap-secrets",
-		ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,
-		((strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd)>0)?ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd : " "));
-		system(CopyTmp);
-
-		memset(CopyTmp,0,sizeof(CopyTmp));
-		sprintf(CopyTmp,"echo \"%s * %s \" > /etc/ppp/chap-secrets",
-		ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,
-		((strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd)>0)?ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd : " "));
-		system(CopyTmp);
-	}	
-	return 1;
-}
-void ResetModem()
-{
-	//power cycle modem by GPIO
-}
-/**************************************************************/
-/************** main function********************************/
-/*************************************************************/
-int main(int argc,char *argv[])
-{
-	unsigned char ModuleModel=0;//0: None, 1: Qutel, 2: ublox SARA-U201
-	int UsbFd=-1;
-	unsigned int StartTime,EndTime,Tmp; 
-	unsigned char TmpIpAddr[16];
-	
-	//Initialization
-	if(InitShareMemory()==0)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[4gModem]main:InitShareMemory NG");
-		#endif		
-		if(ShmStatusCodeData!=NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
-		}	
-		sleep(5);
-		return 0;
-	}	
-	ResetModem();
-	
-ReCheckModem:    
-	//ResetModem();
-	UsbFd=-1;
-	ModuleModel=0;
-	Load4gConfiguration();
-
-	while(1)
-	{
-		ModuleModel=Check4GModem();
-		if(ModuleModel<=0)
-		{
-			sleep(CheckModemInterval);
-			continue;
-		}	
-		if(UsbFd>0)
-			close(UsbFd);
-		UsbFd=InitComPort(ModuleModel);
-		if(UsbFd<0)
-		{
-			sleep(CheckModemInterval);
-			continue;
-		}
-		/**** Record some modem information and dial up if SIM card ready ****/
-		memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface,0,sizeof(struct TeleConfigData));
-		while(1)
-		{
-			if(strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModelName)<=0)
-				GetModelName(UsbFd,ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModelName);
-			if(strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSoftwareVer)<=0)
-				GetModelVersion(UsbFd,ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSoftwareVer);	
-			if(strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei)<=0)
-				GetModelImei(UsbFd,ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);		
-			GetSimImsi(UsbFd,ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);		
-			if(strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi)<=0)
-			{	
-				ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=0;
-				sleep(CheckSimInterval);	
-				if(Check4GModem()<=0)
-					goto ReCheckModem;
-			}
-			else
-			{
-				ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=1;
-				if(strlen(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn)<=0)
-				{
-					sleep(DisconnInterval);
-					goto ReCheckModem;		
-				}
-				system("killall 4GDetection");	
-				sleep(2);
-				if(ModuleModel==1)
-					system("/root/ppp/4GDetection /dev/ttyUSB0 &");	
-				else if(ModuleModel==2)
-					system("/root/ppp/4GDetection /dev/ttyACM0 &");
-				break;	
-			}			
-		}
-		/***** Periodically check RSSI and connection*****/
-		StartTime=time((time_t*)NULL);
-		EndTime=time((time_t*)NULL);
-		while(1)
-		{
-			if((time((time_t*)NULL)-StartTime)>=CheckConnectionInterval)
-			{	
-				//check IP address 
-				memset(TmpIpAddr,0,sizeof(TmpIpAddr));
-				if(GetPPP0Info(TmpIpAddr)<=0)
-				{
-					ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn=0;
-					if((time((time_t*)NULL)-EndTime)>=DisconnInterval)
-						goto ReCheckModem; 
-				}	
-				else
-				{
-					ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn=1;
-					if(strstr(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TmpIpAddr)==NULL)
-					{
-						#ifdef SystemLogMessage	
-						{
-							unsigned char Buffer[128];
-							memset(Buffer,0,sizeof(Buffer));
-							sprintf(Buffer,"[4gModem]main:  4G IP Address changed from %s to %s",ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TmpIpAddr);
-							StoreLogMsg(Buffer);
-						}
-						#endif		
-						memset(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,0,sizeof(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress));
-						strcpy(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TmpIpAddr);
-						system("route del default");
-						system("route add default dev ppp0");
-					}
-					EndTime=time((time_t*)NULL);
-				}	
-				//check RSSI
-				Tmp=GetSignalRssi(UsbFd);
-				if(abs(Tmp-ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi)>=5)
-				{
-					#ifdef SystemLogMessage	
-					{
-						unsigned char Buffer[128];
-						memset(Buffer,0,sizeof(Buffer));
-						sprintf(Buffer,"[4gModem]main: RSSI changed from %d to %d",ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi,Tmp);
-						StoreLogMsg(Buffer);
-					}
-					#endif		
-					ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=Tmp;
-				}	
-				//check Mode
-				Tmp=GetModemMode(UsbFd);
-				if(Tmp!=ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode)
-				{
-					#ifdef SystemLogMessage	
-					{
-						unsigned char Buffer[128];
-						memset(Buffer,0,sizeof(Buffer));
-						sprintf(Buffer,"[4gModem]main: Modem mode changed from %d to %d",ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode,Tmp);
-						StoreLogMsg(Buffer);
-					}
-					#endif
-					ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode=Tmp;
-				}	
-				StartTime=time((time_t*)NULL);
-			}
-		}
-	}//main while loop
-}
-
-

BIN
EVSE/Projects/BYTON-GB/Apps/EventLogging


+ 0 - 218
EVSE/Projects/BYTON-GB/Apps/EventLogging.c

@@ -1,218 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/termios.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
-#include <linux/sockios.h> 
-#include <linux/socket.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/time.h> 
-#include <sys/timeb.h> 
-#include <math.h>//for pow
-#include <unistd.h>
-#include "../../define.h"
-
-//#define Debug
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-
-
-#ifdef SystemLogMessage
-int StoreLogMsg(unsigned char *DataString)
-{
-	unsigned char Buf[256];
-	time_t CurrentTime;
-	struct tm *tm;
-			
-	memset(Buf,0,sizeof(Buf));
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			DataString,
-			tm->tm_year+1900,tm->tm_mon+1);
-	system(Buf);
-	#ifdef Debug
-	printf("%s \n",DataString);
-	#endif
-}		
-#endif
-
-int StoreEventLogMsg(unsigned char *EventCodeString)
-{
-	unsigned char Buf[256];
-	time_t CurrentTime;
-	struct tm *tm;
-			
-	memset(Buf,0,sizeof(Buf));
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/EventLog/[%04d.%02d]EventLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			EventCodeString,
-			tm->tm_year+1900,tm->tm_mon+1);
-	system(Buf);
-	#ifdef Debug
-	printf("%s \n",Buf);
-	#endif
-}		
-
-int DiffTimeb(struct timeb ST, struct timeb ET)
-{
-	//return milli-second
-	unsigned int StartTime,StopTime;
-	
-	StartTime=(unsigned int)ST.time;
-	StopTime=(unsigned int)ET.time;
-	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
-}	
-	
-/**************************************************************************************/
-/**************************Init all share memory *********************************/
-/**************************************************************************************/
-int InitShareMemory()
-{
-	int MeterSMId;
-	
-	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[EventLogging]InitShareMemory:shmget ShmSysConfigAndInfo NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[EventLogging]InitShareMemory:shmat ShmSysConfigAndInfo NG");
-		#endif		
-		return 0;
-   	 }
-   	 //creat ShmStatusCodeData
-   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[EventLogging]InitShareMemory:shmget ShmStatusCodeData NG");
-		#endif		
-		return 0;	
-	}
-    	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[EventLogging]InitShareMemory:shmat ShmStatusCodeData NG");
-		#endif		
-		return 0;
-   	 }
-
-    	return 1;
-}
-
-int main(int argc,char *argv[])
-{
-	int ByteCount,BitCount;
-	unsigned char tmp, EventCodeTmp[7];
-	
-	//Initialization
-	if(InitShareMemory()==0)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[EventLogging]main:InitShareMemory NG");
-		#endif		
-		if(ShmStatusCodeData!=NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
-		}	
-		sleep(5);
-		return 0;
-	}	
-	
-	while(1)
-	{
-		//check Fault Status
-		for(ByteCount=0;ByteCount<4;ByteCount++)
-		{
-			if(ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[ByteCount] != ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount])
-			{
-				tmp=ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[ByteCount]; //prevent be modified during following process
-				for(BitCount=0;BitCount<8;BitCount++)
-				{
-					if(((tmp>>BitCount)&0x01) != ((ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount]>>BitCount)&0x01))
-					{
-						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
-						memcpy(EventCodeTmp,FaultStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
-						if(((tmp>>BitCount)&0x01)==0)//Recovered
-						{	
-							EventCodeTmp[0]=1;
-							ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount]&=(0<<BitCount);
-						}
-						else
-							ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount]|=(1<<BitCount);
-						StoreEventLogMsg(EventCodeTmp);
-					}
-				}
-			}
-		}
-		
-		//check Alarm Status
-		for(ByteCount=0;ByteCount<8;ByteCount++)
-		{
-			if(ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[ByteCount] != ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount])
-			{
-				tmp=ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[ByteCount]; //prevent be modified during following process
-				for(BitCount=0;BitCount<8;BitCount++)
-				{
-					if(((tmp>>BitCount)&0x01) != ((ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount]>>BitCount)&0x01))
-					{
-						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
-						memcpy(EventCodeTmp,AlarmStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
-						if(((tmp>>BitCount)&0x01)==0)//Recovered
-						{	
-							EventCodeTmp[0]=1;
-							ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount]&=(0<<BitCount);
-						}
-						else
-							ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount]|=(1<<BitCount);
-						StoreEventLogMsg(EventCodeTmp);
-					}
-				}
-			}
-		}
-		
-		//check Info Status
-		for(ByteCount=0;ByteCount<8;ByteCount++)
-		{
-			if(ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[ByteCount] != ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount])
-			{
-				tmp=ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[ByteCount]; //prevent be modified during following process
-				for(BitCount=0;BitCount<8;BitCount++)
-				{
-					if(((tmp>>BitCount)&0x01) != ((ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount]>>BitCount)&0x01))
-					{
-						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
-						memcpy(EventCodeTmp,InfoStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
-						if(((tmp>>BitCount)&0x01)==0)//Recovered
-						{	
-							EventCodeTmp[0]=1;
-							ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount]&=(0<<BitCount);
-						}
-						else
-							ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount]|=(1<<BitCount);
-						StoreEventLogMsg(EventCodeTmp);
-					}
-				}
-			}
-		}
-		
-	}//main while loop 
-}
-
-

+ 0 - 109
EVSE/Projects/BYTON-GB/Apps/FWMaker.c

@@ -1,109 +0,0 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <net/if.h> /*struct ifreq*/
-#include <linux/sockios.h> /*SIOCGIFINDEX*/
-#include <linux/socket.h>
-#include <errno.h> 
-#include <sys/time.h> 
-#include <sys/timeb.h> 
-#include <fcntl.h>
-#include <sys/mman.h>
-
-//./FWMaker 172.16.24.126
-int main(int argc,char *argv[])
-{
-	unsigned char *MemBuf,*MemBuf2,buf[64];
-    int fd,rd=0,wrd=0,tmp=0,rd2=0;
-    unsigned int CheckSum=0;
-
-
-
-	memset(buf,0,64);
-	sprintf(buf,"tftp -gr uImage -l /mnt/uImage %s",argv[1]);   
-	system(buf);
-	memset(buf,0,64);
-	sprintf(buf,"tftp -gr rootfs_nor.img -l /mnt/rootfs_nor.img %s",argv[1]);   
-	system(buf);
-
-	if((MemBuf=malloc(0x100000D))==NULL)
-	{
-		printf("Allocate MemBuf memory error\n");
-		return 0;
-	}	
-	memset(MemBuf, 0xff, 0x100000D);
-	fd = open("/mnt/uImage", O_RDWR);
-	if (fd > 0) 
-	{
-	    if((rd=read(fd,MemBuf,0x100000D))<=0)
-	    {
-			printf("/mnt/uImage read Error\n");
-			free(MemBuf);
-			close(fd);
-			return 0;
-	    }   
-	    close(fd);
-	    for(tmp=0;tmp<rd;tmp++)
-	    	CheckSum+=MemBuf[tmp];
-	    strncpy(MemBuf+rd,"DELTADCOK",9);	
-	   *(MemBuf+rd+9)=CheckSum>>24;
-	    *(MemBuf+rd+10)=CheckSum>>16;
-	    *(MemBuf+rd+11)=CheckSum>>8;
-	     *(MemBuf+rd+12)=CheckSum;
-	   // memcpy(MemBuf+rd+9,&CheckSum,4);	
-	    fd = open("/mnt/DcoKImage", O_CREAT|O_RDWR);
-	    wrd=write(fd, MemBuf, rd+13);
-	    if(wrd!=(rd+13))
-	    	printf("write error wrd=0x%x, rd=0x%x\n",wrd,rd+13);
-	   else 
-	   		printf("/mnt/DcoKImage OK\n"); 	
-	    
-	}
-	else	
-	{	
-		free(MemBuf);
-		printf("/mnt/uImage open Error\n");
-		return 0;
-	}
-	
-	
-	memset(MemBuf, 0xff, 0x100000D);
-	CheckSum=rd=0;
-	fd = open("/mnt/rootfs_nor.img", O_RDWR);
-	if (fd > 0) 
-	{
-	    if((rd=read(fd,MemBuf,0x100000D))<=0)
-	    {
-			printf("/mnt/rootfs_nor.img read Error\n");
-			free(MemBuf);
-			close(fd);
-			return 0;
-	    }   
-	    close(fd);
-	    for(tmp=0;tmp<rd;tmp++)
-	    	CheckSum+=MemBuf[tmp];
-	    strncpy(MemBuf+rd,"DELTADCOF",9);	
-	    *(MemBuf+rd+9)=CheckSum>>24;
-	    *(MemBuf+rd+10)=CheckSum>>16;
-	    *(MemBuf+rd+11)=CheckSum>>8;
-	     *(MemBuf+rd+12)=CheckSum;
-	    //memcpy(MemBuf+rd+9,&CheckSum,4);	
-	    fd = open("/mnt/DcoFImage", O_CREAT|O_RDWR);
-	    wrd=write(fd, MemBuf, rd+13);
-	    if(wrd!=(rd+13))
-	    	printf("write error wrd=0x%x, rd=0x%x\n",wrd,rd+13);
-	   else 
-	   		printf("/mnt/DcoFImage OK\n"); 	
-	    
-	}
-	else	
-	{	
-		free(MemBuf);
-		printf("/mnt/rootfs_nor.img open Error\n");
-		return 0;
-	}
-	
-}

BIN
EVSE/Projects/BYTON-GB/Apps/FactoryConfig


+ 0 - 173
EVSE/Projects/BYTON-GB/Apps/FactoryConfig.c

@@ -1,173 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/termios.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
-#include <linux/sockios.h> 
-#include <linux/socket.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/time.h> 
-#include <sys/timeb.h> 
-#include <math.h>//for pow
-#include <unistd.h>
-#include "../../define.h"
-
-
-#ifdef SystemLogMessage
-int StoreLogMsg(unsigned char *DataString)
-{
-	unsigned char Buf[256];
-	time_t CurrentTime;
-	struct tm *tm;
-			
-	memset(Buf,0,sizeof(Buf));
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			DataString,
-			tm->tm_year+1900,tm->tm_mon+1);
-	system(Buf);
-	#ifdef Debug
-	printf("%s \n",DataString);
-	#endif
-}		
-#endif
-
-
-/**************************************************************************************/
-/************This task will create Factory default confgiuration file *****************/
- /***********and store it into mtdblock 10,11,12                               ****************/
-/**************************************************************************************/
-
-int main(int argc,char *argv[])
-{
-	struct SysConfigData 	SysConfig;
-	unsigned int i,Chk;
-	unsigned char *ptr; 
-	int fd,wrd;
-	
-	ptr=malloc(sizeof(struct SysConfigData));
-	if(ptr==NULL)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: malloc for SysConfigData NG");
-		#endif			
-		return 0;
-	}	
-	memset(ptr,0,sizeof(struct SysConfigData));
-	memset(&SysConfig,0,sizeof(struct SysConfigData));
-	
-	//Set default configuration
-	strcpy(SysConfig.Eth0Interface.EthIpAddress,"192.168.0.10");
-	strcpy(SysConfig.Eth0Interface.EthSubmaskAddress,"255.255.255.0");
-	strcpy(SysConfig.Eth0Interface.EthGatewayAddress,"192.168.0.254");
-	strcpy(SysConfig.Eth1Interface.EthIpAddress,"192.168.1.10");
-	strcpy(SysConfig.Eth1Interface.EthSubmaskAddress,"255.255.255.0");
-	strcpy(SysConfig.Eth1Interface.EthGatewayAddress,"192.168.1.254");
-	SysConfig.BackendConnTimeout=300; //300 seconds
-	
-	//copy default configuration to pointer
-	memcpy(ptr,&SysConfig,sizeof(struct SysConfigData));
-	
-	//calculate CRC
-	Chk=0;
-	for(i=0;i<(sizeof(struct SysConfigData)-4);i++)
-	{
-		Chk+=*(ptr+i);
-	}
-	SysConfig.Checksum=Chk;
-	
-	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT);
-	if (fd < 0) 
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: open /mnt/FactoryDefaultConfig.bin NG");
-		#endif	
-		free(ptr);
-		return 0;
-	}   
-
-	wrd=write(fd, &SysConfig, sizeof(struct SysConfigData));
-	close(fd);
-	if(wrd!=(sizeof(struct SysConfigData)))
-	{	
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: write /mnt/FactoryDefaultConfig.bin NG");
-		#endif	
-		free(ptr);
-		return 0;
-	}
-	
-	fd = open("/dev/mtdblock12", O_RDWR);
-	if (fd < 0) 
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: open /dev/mtdblock12 NG");
-		#endif	
-		free(ptr);
-		return 0;
-   	 }
-    	wrd=write(fd, &SysConfig, sizeof(struct SysConfigData));   
-    	close(fd);
-    	if(wrd!=(sizeof(struct SysConfigData)))
-	{	
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: write /dev/mtdblock12 NG");
-		#endif	
-		free(ptr);
-		return 0;
-	}	
-	
-	fd = open("/dev/mtdblock11", O_RDWR);
-	if (fd < 0) 
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: open /dev/mtdblock11 NG");
-		#endif	
-		free(ptr);
-		return 0;
-   	 }
-    	wrd=write(fd, &SysConfig, sizeof(struct SysConfigData));   
-    	close(fd);
-    	if(wrd!=(sizeof(struct SysConfigData)))
-	{	
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: write /dev/mtdblock11 NG");
-		#endif	
-		free(ptr);
-		return 0;
-	}	
-	
-	fd = open("/dev/mtdblock10", O_RDWR);
-	if (fd < 0) 
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: open /dev/mtdblock10 NG");
-		#endif	
-		free(ptr);
-		return 0;
-   	 }
-    	wrd=write(fd, &SysConfig, sizeof(struct SysConfigData));   
-    	close(fd);
-    	if(wrd!=(sizeof(struct SysConfigData)))
-	{	
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[FactoryConfig]main: write /dev/mtdblock10 NG");
-		#endif	
-		free(ptr);
-		return 0;
-	}	
-	
-	free(ptr);
-	#ifdef SystemLogMessage	
-	StoreLogMsg("[FactoryConfig]main: FactoryConfig OK");
-	#endif	
-}

BIN
EVSE/Projects/BYTON-GB/Apps/InternalComm


+ 0 - 200
EVSE/Projects/BYTON-GB/Apps/InternalComm.c

@@ -1,200 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/termios.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
-#include <linux/sockios.h> 
-#include <linux/socket.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/time.h> 
-#include <sys/timeb.h> 
-#include <math.h>//for pow
-#include <unistd.h>
-#include "../../define.h"
-
-
-//#define Debug
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-struct FanModuleData			*ShmFanModuleData;
-struct RelayModuleData			*ShmRelayModuleData;
-
-
-#ifdef SystemLogMessage
-int StoreLogMsg(unsigned char *DataString)
-{
-	unsigned char Buf[256];
-	time_t CurrentTime;
-	struct tm *tm;
-			
-	memset(Buf,0,sizeof(Buf));
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			DataString,
-			tm->tm_year+1900,tm->tm_mon+1);
-	system(Buf);
-	#ifdef Debug
-	printf("%s \n",DataString);
-	#endif
-}		
-#endif
-
-int DiffTimeb(struct timeb ST, struct timeb ET)
-{
-	//return milli-second
-	unsigned int StartTime,StopTime;
-	
-	StartTime=(unsigned int)ST.time;
-	StopTime=(unsigned int)ET.time;
-	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
-}	
-	
-/**************************************************************************************/
-/**************************Init all share memory *********************************/
-/**************************************************************************************/
-int InitShareMemory()
-{
-	int MeterSMId;
-	
-	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitShareMemory:shmget ShmSysConfigAndInfo NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitShareMemory:shmat ShmSysConfigAndInfo NG");
-		#endif		
-		return 0;
-   	 }
-   	 //creat ShmStatusCodeData
-   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitShareMemory:shmget ShmStatusCodeData NG");
-		#endif		
-		return 0;	
-	}
-    	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitShareMemory:shmat ShmStatusCodeData NG");
-		#endif		
-		return 0;
-   	 }
-
-   	//creat ShmFanModuleData
-   	 if ((MeterSMId = shmget(ShmFanBdKey, sizeof(struct FanModuleData),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitShareMemory:shmget ShmFanModuleData NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmFanModuleData = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitShareMemory:shmat ShmFanModuleData NG");
-		#endif		
-		return 0;
-   	 }
-   	 memset(ShmFanModuleData,0,sizeof(struct FanModuleData));
-   	 //creat ShmRelayModuleData
-   	 if ((MeterSMId = shmget(ShmRelayBdKey, sizeof(struct RelayModuleData),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitShareMemory:shmget ShmRelayModuleData NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmRelayModuleData = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitShareMemory:shmat ShmRelayModuleData NG");
-		#endif		
-		return 0;
-   	 }
-    	return 1;
-}
-
-int InitComPort()
-{
-	int fd;
-	struct termios tios;
-	
-	fd = open("/dev/ttyS4", O_RDWR);
-	if(fd<=0)
-	{ 
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]InitComPort: open /dev/ttyS4 NG");
-		#endif	
-		return -1;
-	}
-	ioctl (fd, TCGETS, &tios);
-	tios.c_cflag = B115200| CS8 | CLOCAL | CREAD; 
-	tios.c_lflag = 0;
-	tios.c_iflag = 0; 
-	tios.c_oflag = 0;
-	tios.c_cc[VMIN]=0;    
-	tios.c_cc[VTIME]=1000; 
-	tios.c_lflag=0;  
-	tcflush(fd, TCIFLUSH);
-	ioctl (fd, TCSETS, &tios);
-	return fd;
-}
-
-/**************************************************************/
-/************** main function********************************/
-/*************************************************************/
-int main(int argc,char *argv[])
-{
-	int Uart4Fd;
-
-	//Initialization
-	if(InitShareMemory()==0)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]main:InitShareMemory NG");
-		#endif		
-		if(ShmStatusCodeData!=NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
-		}	
-		sleep(5);
-		return 0;
-	}	
-	Uart4Fd=InitComPort();
-	if(Uart4Fd<0)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[InternalComm]main:InitComPort NG");
-		#endif		
-		if(ShmStatusCodeData!=NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
-		}	
-		sleep(5);
-		return 0;
-	}	
-	
-	while(1)
-	{
-		//processing
-	}//main while loop
-}
-
-

+ 44 - 54
EVSE/Projects/BYTON-GB/Apps/Makefile

@@ -2,68 +2,58 @@
 export PATH=/bin:/sbin:/usr/bin:$(SDK_PATH_TARGET)/usr/bin:$PATH
 
 #define library variable
-Internal485ProtocolLib = -L ../../../Modularization/Internal485Protocol -lInternal485Protocol
-PsuCommProtocolLib = -L ../../../Modularization/PsuCommProtocol -lPsuCommProtocol
+Lib_Module_RFID = -L../../../Modularization -lModule_RFID
+Lib_Module_Upgrade = "-L../../../Modularization" -lModule_Upgrade
+
 
 all: CopyFile apps
-#apps: MainTask PsuCommTask InternalCommTask 4gModemTask FactoryConfigTask EvCommTask UpdateRootfsTask LcmControlTask FWMakerTask PrimaryCommTask OcppBackendTask ErrorHandle
-apps: MainTask FactoryConfigTask
+apps: Module_InternalComm_Task Module_FactoryConfig_Task Module_EventLogging_Task Module_AlarmDetect_Task Module_CSU_Task
 
-MainTask:
-	rm -f main; $(CC) main.c -lm -o main
-#	cp -f main ../Images/root
-	
-PsuCommTask:
-	rm -f PsuComm; $(CC) PsuComm.c ${PsuCommProtocolLib} -lm -o PsuComm
-	cp -f PsuComm ../Images/root	
-	
-InternalCommTask:
-	rm -f InternalComm; $(CC) InternalComm.c ${Internal485ProtocolLib} -lm -o InternalComm	
-	cp -f InternalComm ../Images/root
 
-WiFiModemTask:
-	rm -f WiFiModem; $(CC) WiFiModem.c -o WiFiModem	
-	cp -f WiFiModem ../Images/root
-		
-4gModemTask:
-	rm -f 4gModem; $(CC) 4gModem.c -o 4gModem		
-	cp -f 4gModem ../Images/root
-	
-FactoryConfigTask:
-	rm -f FactoryConfig; $(CC) FactoryConfig.c -o FactoryConfig	
-	cp -f FactoryConfig ../Images/root		
+Module_InternalComm_Task:
+	@echo "===== Module_InternalComm_Task ==================================="
+	rm -f Module_InternalComm 
+	$(CC) "-I../../" "-include../../../Modularization/Module_Upgrade.h" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_InternalComm.o "./Module_InternalComm.c"
+	$(CC) -o Module_InternalComm Module_InternalComm.o ${Lib_Module_Upgrade}
+	rm -f *.o
+	mv -f Module_InternalComm ../Images/root
+	@echo \ 
 	
-EvCommTask:
-	rm -f EvComm; $(CC) EvComm.c -lm -o EvComm	
-	cp -f EvComm ../Images/root
+Module_FactoryConfig_Task:
+	@echo "===== Module_FactoryConfig_Task =================================="
+	rm -f Module_FactoryConfig 
+	$(CC) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_FactoryConfig.o "./Module_FactoryConfig.c"
+	$(CC) -o Module_FactoryConfig Module_FactoryConfig.o 
+	rm -f *.o
+	mv -f Module_FactoryConfig ../Images/root
+	@echo \ 
 	
-UpdateRootfsTask:
-	rm -f UpdateRootfs; $(CC) UpdateRootfs.c -o UpdateRootfs		 
-	cp -f UpdateRootfs ../Images/root	
-
-LcmControlTask:
-	rm -f LcmControl; $(CC) LcmControl.c -o LcmControl
-	cp -f LcmControl ../Images/root			
-
-PrimaryCommTask:
-	rm -f PrimaryComm; $(CC) PrimaryComm.c -o PrimaryComm
-	cp -f PrimaryComm ../Images/root	
-
-Ocpp16Task:
-	rm -f Ocpp16; $(CC) Ocpp16.c -I ../../../GPL/libwebsockets-v2.1-stable/release/include -L ../../../GPL/libwebsockets-v2.1-stable/release/lib -lwebsockets -o Ocpp16
-	cp -f Ocpp16 ../Images/root
+Module_EventLogging_Task:
+	@echo "===== Module_EventLogging_Task ==================================="
+	rm -f Module_EventLogging 
+	$(CC) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_EventLogging.o "./Module_EventLogging.c"
+	$(CC) -o Module_EventLogging Module_EventLogging.o 
+	rm -f *.o
+	mv -f Module_EventLogging ../Images/root
+	@echo \ 
 	
-EventLoggingTask:
-	rm -f EventLogging; $(CC) EventLogging.c -o EventLogging	
-	cp -f EventLogging ../Images/root	
-		
-FWMakerTask:
-	rm -f FWMaker; $(CC) FWMaker.c -o FWMaker	
-	cp -f FWMaker ../Images/root
+Module_AlarmDetect_Task:
+	@echo "===== Module_AlarmDetect_Task ===================================="
+	rm -f Module_AlarmDetect 
+	$(CC) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_AlarmDetect.o "./Module_AlarmDetect.c"
+	$(CC) -o Module_AlarmDetect Module_AlarmDetect.o 
+	rm -f *.o
+	mv -f Module_AlarmDetect ../Images/root	
+	@echo \ 
 	
-ccsTask:
-	rm -f ccs; $(CC) ccs.c -o ccs	
-	cp -f ccs ../Images/root	
+Module_CSU_Task:
+	@echo "===== Module_CSU_Task ============================================"
+	rm -f main 
+	$(CC) "-I../../" "-include../../../Modularization/Module_Upgrade.h" "-include../../../Modularization/Module_RFID.h" -O0 -g3 -Wall -c -fmessage-length=0 -o main.o "./main.c"
+	$(CC) -o main main.o ${Lib_Module_RFID} ${Lib_Module_Upgrade}
+	rm -f *.o
+	mv -f main ../Images/root		
+	@echo \ 
 	
 CopyFile: 
 	rm -rfv ../Images/root

+ 968 - 0
EVSE/Projects/BYTON-GB/Apps/Module_AlarmDetect.c

@@ -0,0 +1,968 @@
+/*
+ * Module_AlarmDetect.c
+ *
+ *  Created on: 2019年8月17日
+ *      Author: foluswen
+ */
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>      /*標準輸入輸出定義*/
+#include    <stdlib.h>     /*標準函數庫定義*/
+#include    <unistd.h>     /*Unix 標準函數定義*/
+#include    <fcntl.h>      /*檔控制定義*/
+#include    <termios.h>    /*PPSIX 終端控制定義*/
+#include    <errno.h>      /*錯誤號定義*/
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include	"define.h"
+#include	"main.h"
+
+#define FILTER_SPEC			50
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+
+#define Debug
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				0
+#define ON					1
+#define OFF					0
+
+#define SPEC_OV				275
+#define SPEC_UV				160
+#define SPEC_OC				(32*1.1)
+#define SPEC_OT				85
+
+#define HYSTERETIC_OUV		10
+#define HYSTERETIC_OT		10
+#define HYSTERETIC_OC		10
+
+struct{
+	unsigned short int	OV[3];
+	unsigned short int	UV[3];
+	unsigned short int	OC;
+	unsigned short int	OT_AMB;
+	unsigned short int	GMI;
+	unsigned short int	Short;
+	unsigned short int	Ac_Leak;
+	unsigned short int	Dc_Leak;
+	unsigned short int	HandShakingTimeout;
+	unsigned short int	EmrgencyBTN;
+	unsigned short int	Relay_Welding;
+	unsigned short int	Relay_DrivingFault;
+	unsigned short int	CP_LevelFail;
+	unsigned short int	MCU_SelfTestFail;
+}Alarm_Counter[2];
+
+void trim(char *s);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+struct Charger					*ShmCharger;
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
+			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+			buffer,
+			tm->tm_year+1900,tm->tm_mon+1,
+			ShmSysConfigAndInfo->SysConfig.ModelName,
+			ShmSysConfigAndInfo->SysConfig.SerialNumber);
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+
+	return rc;
+}
+
+int DiffTimeb(struct timeb ST, struct timeb ET)
+{
+	//return milli-second
+	unsigned int StartTime,StopTime;
+
+	StartTime=(unsigned int)ST.time;
+	StopTime=(unsigned int)ET.time;
+	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
+}
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//creat ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	#ifdef SystemLogMessage
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+		#endif
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+		#ifdef SystemLogMessage
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+		#endif
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	#ifdef SystemLogMessage
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+		#endif
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), IPC_CREAT | 0777)) < 0)
+	{
+
+		DEBUG_ERROR("shmget ShmCharger NG\r\n");
+
+		result = FAIL;
+	}
+	else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+
+		DEBUG_ERROR("shmat ShmCharger NG\r\n");
+
+		result = FAIL;
+	}
+	else
+	{}
+
+    return result;
+}
+
+//==========================================
+// Common routine
+//==========================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+//==========================================
+// Main process
+//==========================================
+int main(void)
+{
+
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("InitShareMemory NG\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		return FAIL;
+	}
+
+	for(;;)
+	{
+		for(int gun_index = 0;gun_index<AC_QUANTITY;gun_index++)
+		{
+			//=====================================
+			// Over voltage detection
+			//=====================================
+			if((ShmSysConfigAndInfo->SysInfo.InputVoltageR > SPEC_OV) &&
+				(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE))
+			{
+				if(Alarm_Counter[gun_index].OV[0] > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_OVER_VOLTAGE : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].OV[0]++;
+				}
+			}
+			else if((ShmSysConfigAndInfo->SysInfo.InputVoltageR < (SPEC_OV-HYSTERETIC_OUV)) &&
+					(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)))
+			{
+				Alarm_Counter[gun_index].OV[0] = 0;
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == ON))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_VOLTAGE;
+					DEBUG_INFO("ALARM_OVER_VOLTAGE : recover \r\n");
+				}
+			}
+
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				if((ShmSysConfigAndInfo->SysInfo.InputVoltageS > SPEC_OV) &&
+				   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE))
+				{
+					if(Alarm_Counter[gun_index].OV[1] > FILTER_SPEC)
+					{
+						if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == OFF))
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_VOLTAGE;
+							DEBUG_INFO("ALARM_OVER_VOLTAGE : alarm \r\n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].OV[1]++;
+					}
+				}
+				else if((ShmSysConfigAndInfo->SysInfo.InputVoltageS < (SPEC_OV-HYSTERETIC_OUV)) &&
+						(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)))
+				{
+					Alarm_Counter[gun_index].OV[1] = 0;
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == ON))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_OVER_VOLTAGE : recover \r\n");
+					}
+				}
+
+				if((ShmSysConfigAndInfo->SysInfo.InputVoltageT > SPEC_OV) &&
+				   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE))
+				{
+					if(Alarm_Counter[gun_index].OV[2] > FILTER_SPEC)
+					{
+						if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == OFF))
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_VOLTAGE;
+							DEBUG_INFO("ALARM_OVER_VOLTAGE : alarm \r\n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].OV[2]++;
+					}
+				}
+				else if((ShmSysConfigAndInfo->SysInfo.InputVoltageT < (SPEC_OV-HYSTERETIC_OUV)) &&
+						(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)))
+				{
+					Alarm_Counter[gun_index].OV[2] = 0;
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == ON))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_OVER_VOLTAGE : recover \r\n");
+					}
+				}
+			}
+
+			//=====================================
+			// Under voltage detection
+			//=====================================
+			if((ShmSysConfigAndInfo->SysInfo.InputVoltageR  < SPEC_UV) &&
+				(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE))
+			{
+				if(Alarm_Counter[gun_index].UV[0] > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_UNDER_VOLTAGE : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].UV[0]++;
+				}
+			}
+			else if((ShmSysConfigAndInfo->SysInfo.InputVoltageR  > (SPEC_UV+HYSTERETIC_OUV)) &&
+					(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)))
+			{
+				Alarm_Counter[gun_index].UV[0] = 0;
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == ON))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_UNDER_VOLTAGE;
+					DEBUG_INFO("ALARM_UNDER_VOLTAGE : recover \r\n");
+				}
+			}
+
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				if((ShmSysConfigAndInfo->SysInfo.InputVoltageS < SPEC_UV) &&
+				   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE))
+				{
+					if(Alarm_Counter[gun_index].UV[1] > FILTER_SPEC)
+					{
+						if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == OFF))
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_UNDER_VOLTAGE;
+							DEBUG_INFO("ALARM_UNDER_VOLTAGE : alarm \r\n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].UV[1]++;
+					}
+				}
+				else if((ShmSysConfigAndInfo->SysInfo.InputVoltageS > (SPEC_UV+HYSTERETIC_OUV)) &&
+						(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)))
+				{
+					Alarm_Counter[gun_index].UV[1] = 0;
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == ON))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_UNDER_VOLTAGE : recover \r\n");
+					}
+				}
+
+				if((ShmSysConfigAndInfo->SysInfo.InputVoltageT < SPEC_UV) &&
+				   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE))
+				{
+					if(Alarm_Counter[gun_index].UV[2] > FILTER_SPEC)
+					{
+						if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == OFF))
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_UNDER_VOLTAGE;
+							DEBUG_INFO("ALARM_UNDER_VOLTAGE : alarm \r\n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].UV[2]++;
+					}
+				}
+				else if((ShmSysConfigAndInfo->SysInfo.InputVoltageT > (SPEC_OV+HYSTERETIC_OUV)) &&
+						(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)))
+				{
+					Alarm_Counter[gun_index].UV[2] = 0;
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == ON))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_UNDER_VOLTAGE : recover \r\n");
+					}
+				}
+			}
+
+			//=====================================
+			// Over current detection
+			//=====================================
+			if((ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0] > SPEC_OC) &&
+			   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT))
+			{
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == OFF))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_CURRENT;
+					DEBUG_INFO("ALARM_OVER_CURRENT : alarm \r\n");
+				}
+			}
+			else if ((ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0] < (SPEC_OC-HYSTERETIC_OC)) &&
+					 (!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)))
+			{
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_CURRENT;
+					DEBUG_INFO("ALARM_OVER_CURRENT : recover \r\n");
+				}
+			}
+
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				if((ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0] > SPEC_OC) &&
+				   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT))
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_CURRENT;
+						DEBUG_INFO("ALARM_OVER_CURRENT : alarm \r\n");
+					}
+				}
+				else if ((ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0] < (SPEC_OC-HYSTERETIC_OC)) &&
+						 (!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)))
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_CURRENT;
+						DEBUG_INFO("ALARM_OVER_CURRENT : recover \r\n");
+					}
+				}
+
+				if((ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0] > SPEC_OC) &&
+				   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT))
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_CURRENT;
+						DEBUG_INFO("ALARM_OVER_CURRENT : alarm \r\n");
+					}
+				}
+				else if ((ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0] < (SPEC_OC-HYSTERETIC_OC)) &&
+						 (!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)))
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_CURRENT;
+						DEBUG_INFO("ALARM_OVER_CURRENT : recover \r\n");
+					}
+				}
+			}
+
+			//=====================================
+			// Over temperature detection
+			//=====================================
+			if(//(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp > SPEC_OT) &&
+			   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_TEMPERATURE))
+			{
+				if(Alarm_Counter[gun_index].OT_AMB > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_TEMPERATURE;
+						DEBUG_INFO("ALARM_OVER_TEMPERATURE : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].OT_AMB++;
+				}
+			}
+			else if(//(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp < (SPEC_OT-10)) &&
+					(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_TEMPERATURE)))
+			{
+				Alarm_Counter[gun_index].OT_AMB = 0;
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP == ON))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_TEMPERATURE;
+					DEBUG_INFO("ALARM_OVER_TEMPERATURE : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Ground fault detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_GROUND_FAIL)
+			{
+				if(Alarm_Counter[gun_index].GMI > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.GbGfdTrip == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.GbGfdTrip = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_GROUND_FAIL;
+						DEBUG_INFO("ALARM_GROUND_FAIL : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].GMI++;
+				}
+			}
+			else if (!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_GROUND_FAIL))
+			{
+				Alarm_Counter[gun_index].GMI = 0;
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.GbGfdTrip == ON ))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.GbGfdTrip = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_GROUND_FAIL;
+					DEBUG_INFO("ALARM_GROUND_FAIL : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// CP level fail detection
+			//====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CP_ERROR)
+			{
+				if(Alarm_Counter[gun_index].CP_LevelFail > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault == OFF)
+					{
+						ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CP_ERROR;
+						DEBUG_INFO("ALARM_CP_ERROR : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].CP_LevelFail++;
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CP_ERROR))
+			{
+				Alarm_Counter[gun_index].CP_LevelFail= 0;
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault == ON)
+				{
+					ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CP_ERROR;
+					DEBUG_INFO("ALARM_CP_ERROR : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Current AC leak detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CURRENT_LEAK_AC)
+			{
+				if(Alarm_Counter[gun_index].Ac_Leak > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CURRENT_LEAK_AC;
+						DEBUG_INFO("ALARM_CURRENT_LEAK_AC : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Ac_Leak++;
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CURRENT_LEAK_AC))
+			{
+				Alarm_Counter[gun_index].Ac_Leak = 0;
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip == ON))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CURRENT_LEAK_AC;
+					DEBUG_INFO("ALARM_CURRENT_LEAK_AC : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Current DC leak detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CURRENT_LEAK_DC)
+			{
+				if(Alarm_Counter[gun_index].Dc_Leak > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CURRENT_LEAK_DC;
+						DEBUG_INFO("ALARM_CURRENT_LEAK_DC : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Dc_Leak++;
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CURRENT_LEAK_DC))
+			{
+				Alarm_Counter[gun_index].Dc_Leak = 0;
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip == ON))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CURRENT_LEAK_DC;
+					DEBUG_INFO("ALARM_CURRENT_LEAK_DC : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// MCU self test fail detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_MCU_TESTFAIL)
+			{
+				if(Alarm_Counter[gun_index].MCU_SelfTestFail > FILTER_SPEC)
+				{
+					if(ShmCharger->gun_info[gun_index].otherAlarmCode.isMcuSelfTest == OFF)
+					{
+						ShmCharger->gun_info[gun_index].otherAlarmCode.isMcuSelfTest = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_MCU_TESTFAIL;
+						DEBUG_INFO("ALARM_MCU_TESTFAIL : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].MCU_SelfTestFail++;
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_MCU_TESTFAIL))
+			{
+				Alarm_Counter[gun_index].MCU_SelfTestFail = 0;
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isMcuSelfTest == ON)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isMcuSelfTest = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_MCU_TESTFAIL;
+					DEBUG_INFO("ALARM_MCU_TESTFAIL : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Hand shaking timeout detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_HANDSHAKE_TIMEOUT)
+			{
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isHandshakingTimeOut == OFF)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isHandshakingTimeOut  = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_HANDSHAKE_TIMEOUT;
+					DEBUG_INFO("ALARM_HANDSHAKE_TIMEOUT : alarm \r\n");
+				}
+
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_HANDSHAKE_TIMEOUT))
+			{
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isHandshakingTimeOut  == ON)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isHandshakingTimeOut  = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_HANDSHAKE_TIMEOUT;
+					DEBUG_INFO("ALARM_HANDSHAKE_TIMEOUT : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Emergency stop detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_EMERGENCY_STOP)
+			{
+				if(Alarm_Counter[gun_index].EmrgencyBTN > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == OFF))
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_EMERGENCY_STOP;
+						DEBUG_INFO("ALARM_EMERGENCY_STOP : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].EmrgencyBTN++;
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_EMERGENCY_STOP))
+			{
+				Alarm_Counter[gun_index].EmrgencyBTN = 0;
+				if((ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == ON))
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_EMERGENCY_STOP;
+					DEBUG_INFO("ALARM_EMERGENCY_STOP : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Relay welding detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_RELAY_STATUS)
+			{
+				if(Alarm_Counter[gun_index].Relay_Welding > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding == OFF))
+					{
+						ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_RELAY_STATUS;
+						DEBUG_INFO("ALARM_RELAY_STATUS : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Relay_Welding++;
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_RELAY_STATUS))
+			{
+				Alarm_Counter[gun_index].Relay_Welding = 0;
+				if((ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding == ON))
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_RELAY_STATUS;
+					DEBUG_INFO("ALARM_RELAY_STATUS : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Relay driving fault detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_RELAY_DRIVE_FAULT)
+			{
+				if(Alarm_Counter[gun_index].Relay_DrivingFault > FILTER_SPEC)
+				{
+					if((ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault == OFF))
+					{
+						ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_RELAY_DRIVE_FAULT;
+						DEBUG_INFO("ALARM_RELAY_DRIVE_FAULT : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Relay_DrivingFault++;
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_RELAY_DRIVE_FAULT))
+			{
+				Alarm_Counter[gun_index].Relay_DrivingFault = 0;
+				if((ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault == ON))
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_RELAY_DRIVE_FAULT;
+					DEBUG_INFO("ALARM_RELAY_DRIVE_FAULT : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Current short detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CIRCUIT_SHORT)
+			{
+				if(Alarm_Counter[gun_index].Short > FILTER_SPEC)
+				{
+					if(ShmCharger->gun_info[gun_index].otherAlarmCode.isCurrentShort == OFF)
+					{
+						ShmCharger->gun_info[gun_index].otherAlarmCode.isCurrentShort = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CIRCUIT_SHORT;
+						DEBUG_INFO("ALARM_CIRCUIT_SHORT : alarm \r\n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Short++;
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CIRCUIT_SHORT))
+			{
+				Alarm_Counter[gun_index].Short = 0;
+
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isCurrentShort == ON)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isCurrentShort = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CIRCUIT_SHORT;
+					DEBUG_INFO("ALARM_CIRCUIT_SHORT : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Rotatory switch detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_ROTATORY_SWITCH_FAULT)
+			{
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isShutter == OFF)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isShutter = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_ROTATORY_SWITCH_FAULT;
+					DEBUG_INFO("ALARM_ROTATORY_SWITCH_FAULT : alarm \r\n");
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_ROTATORY_SWITCH_FAULT))
+			{
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isShutter == ON)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isShutter = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_ROTATORY_SWITCH_FAULT;
+					DEBUG_INFO("ALARM_ROTATORY_SWITCH_FAULT : recover \r\n");
+				}
+			}
+
+			//=====================================
+			// Leakage module detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_LEAK_MODULE_FAIL)
+			{
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isLeakageModule == OFF)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isLeakageModule = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_LEAK_MODULE_FAIL;
+
+					DEBUG_INFO("ALARM_LEAK_MODULE_FAIL : alarm \r\n");
+				}
+			}
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_LEAK_MODULE_FAIL))
+			{
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isLeakageModule == ON)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isLeakageModule = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_LEAK_MODULE_FAIL;
+
+					DEBUG_INFO("ALARM_LEAK_MODULE_FAIL : recover \r\n");
+				}
+			}
+//
+//			//=====================================
+//			// Shutter detection
+//			//=====================================
+//			if(ShmCsuInputInfo->AcChargerInfoData[gun_index].InputAlarmCode & ALARM_SHUTTER_FAULT)
+//			{
+//				if(ShmCsuInputInfo->AcChargerInfoData[gun_index].AlarmCode.bits.SHUTTER_FAULT == OFF)
+//				{
+//					ShmCsuInputInfo->AcChargerInfoData[gun_index].AlarmCode.bits.SHUTTER_FAULT = ON;
+//					ShmCsuInputInfo->AcChargerInfoData[gun_index].SystemAlarmCode |= ALARM_SHUTTER_FAULT;
+//
+//					DEBUG_INFO("ALARM_SHUTTER_FAULT : alarm \r\n");
+//				}
+//			}
+//			else if(!(ShmCsuInputInfo->AcChargerInfoData[gun_index].InputAlarmCode & ALARM_SHUTTER_FAULT))
+//			{
+//				if(ShmCsuInputInfo->AcChargerInfoData[gun_index].AlarmCode.bits.SHUTTER_FAULT == ON)
+//				{
+//					ShmCsuInputInfo->AcChargerInfoData[gun_index].AlarmCode.bits.SHUTTER_FAULT = OFF;
+//					ShmCsuInputInfo->AcChargerInfoData[gun_index].SystemAlarmCode &= ~ALARM_SHUTTER_FAULT;
+//
+//					DEBUG_INFO("ALARM_SHUTTER_FAULT : recover \r\n");
+//				}
+//			}
+//
+//			//=====================================
+//			// Locker detection
+//			//=====================================
+//			if(ShmCsuInputInfo->AcChargerInfoData[gun_index].InputAlarmCode & ALARM_LOCKER_FAULT)
+//			{
+//				if(ShmCsuInputInfo->AcChargerInfoData[gun_index].AlarmCode.bits.LOCKER_FAULT == OFF)
+//				{
+//					ShmCsuInputInfo->AcChargerInfoData[gun_index].AlarmCode.bits.LOCKER_FAULT = ON;
+//					ShmCsuInputInfo->AcChargerInfoData[gun_index].SystemAlarmCode |= ALARM_LOCKER_FAULT;
+//
+//					DEBUG_INFO("ALARM_LOCKER_FAULT : alarm \r\n");
+//				}
+//			}
+//			else if(!(ShmCsuInputInfo->AcChargerInfoData[gun_index].InputAlarmCode & ALARM_LOCKER_FAULT))
+//			{
+//				if(ShmCsuInputInfo->AcChargerInfoData[gun_index].AlarmCode.bits.LOCKER_FAULT == ON)
+//				{
+//					ShmCsuInputInfo->AcChargerInfoData[gun_index].AlarmCode.bits.LOCKER_FAULT = OFF;
+//					ShmCsuInputInfo->AcChargerInfoData[gun_index].SystemAlarmCode &= ~ALARM_LOCKER_FAULT;
+//
+//					DEBUG_INFO("ALARM_LOCKER_FAULT : recover \r\n");
+//				}
+//			}
+//
+//			//=====================================
+//			// Power drop detection
+//			//=====================================
+//			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_POWER_DROP)
+//			{
+//				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isPowerDrop == OFF)
+//				{
+//					ShmCharger->gun_info[gun_index].otherAlarmCode.isPowerDrop = ON;
+//					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_POWER_DROP;
+//
+//					DEBUG_INFO("ALARM_POWER_DROP : alarm \r\n");
+//				}
+//			}
+//			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_POWER_DROP))
+//			{
+//				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isPowerDrop == ON)
+//				{
+//					ShmCharger->gun_info[gun_index].otherAlarmCode.isPowerDrop = OFF;
+//					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_POWER_DROP;
+//
+//					DEBUG_INFO("ALARM_POWER_DROP : recover \r\n");
+//				}
+//			}
+//
+
+
+
+			//=====================================
+			// Latch alarm recover in state A
+			//=====================================
+			if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 1))
+			{
+				/*
+				  TODO: Recover latch alarm here
+				*/
+			}
+
+			//=====================================
+			// Latch alarm recover in state B1 and B2
+			//=====================================
+			if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 2) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 3))
+			{
+				/*
+				TODO: Recover latch alarm here
+				*/
+			}
+
+			//=====================================
+			// Latch alarm recover in state C
+			//=====================================
+			if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 4))
+			{
+				/*
+				  TODO: Recover latch alarm here
+				*/
+			}
+		}
+
+		usleep(100000);
+	}
+
+	return FAIL;
+}

+ 13 - 0
EVSE/Projects/BYTON-GB/Apps/Module_AlarmDetect.h

@@ -0,0 +1,13 @@
+/*
+ * Module_AlarmDetect.h
+ *
+ *  Created on: 2019¦~8¤ë17¤é
+ *      Author: foluswen
+ */
+
+#ifndef MODULE_ALARMDETECT_H_
+#define MODULE_ALARMDETECT_H_
+
+
+
+#endif /* MODULE_ALARMDETECT_H_ */

+ 344 - 0
EVSE/Projects/BYTON-GB/Apps/Module_EventLogging.c

@@ -0,0 +1,344 @@
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>      /*標準輸入輸出定義*/
+#include    <stdlib.h>     /*標準函數庫定義*/
+#include    <unistd.h>     /*Unix 標準函數定義*/
+#include    <fcntl.h>      /*檔控制定義*/
+#include    <termios.h>    /*PPSIX 終端控制定義*/
+#include    <errno.h>      /*錯誤號定義*/
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	"define.h"
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define EVENT_INFO(format, args...) StoreEventLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+
+
+#define Debug
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				-1
+
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+void split(char **arr, char *str, const char *del);
+
+
+#ifdef SystemLogMessage
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
+			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+			buffer,
+			tm->tm_year+1900,tm->tm_mon+1,
+			ShmSysConfigAndInfo->SysConfig.ModelName,
+			ShmSysConfigAndInfo->SysConfig.SerialNumber);
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+
+	return rc;
+}
+#endif
+
+
+int StoreEventLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	sprintf(Buf, "echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]EventLog",
+			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+			buffer,
+			tm->tm_year+1900,tm->tm_mon+1);
+	system(Buf);
+	#ifdef Debug
+	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+	#endif
+
+	return rc;
+}
+
+int DiffTimeb(struct timeb ST, struct timeb ET)
+{
+	//return milli-second
+	unsigned int StartTime,StopTime;
+
+	StartTime=(unsigned int)ST.time;
+	StopTime=(unsigned int)ET.time;
+	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
+}
+
+//=================================
+// Common routine
+//=================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void split(char **arr, char *str, const char *del)
+{
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		s = strtok(NULL, del);
+	}
+}
+
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//creat ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	#ifdef SystemLogMessage
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+		#endif
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+		#ifdef SystemLogMessage
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+		#endif
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	#ifdef SystemLogMessage
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+		#endif
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), IPC_CREAT | 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmStatusCodeData NG");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmStatusCodeData NG");
+		#endif
+		result = FAIL;
+	}
+	else
+	{}
+	memset(ShmStatusCodeData,0,sizeof(struct StatusCodeData));
+
+    return result;
+}
+
+//================================================
+// Main process
+//================================================
+int main(void)
+{
+	int ByteCount,BitCount;
+	unsigned char tmp, EventCodeTmp[7];
+
+	if(InitShareMemory() == FAIL)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("InitShareMemory NG\n");
+		#endif
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		return 0;
+	}
+
+	for(;;)
+	{
+		//check Fault Status
+		for(ByteCount=0;ByteCount<4;ByteCount++)
+		{
+			if(ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[ByteCount] != ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount])
+			{
+				tmp=ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[ByteCount]; //prevent be modified during following process
+				for(BitCount=0;BitCount<8;BitCount++)
+				{
+					if(((tmp>>BitCount)&0x01) != ((ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount]>>BitCount)&0x01))
+					{
+						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
+						memcpy(EventCodeTmp,FaultStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
+						if(((tmp>>BitCount)&0x01)==0)//Recovered
+						{
+							EventCodeTmp[0]=1;
+							ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount]&=~(1<<BitCount);
+						}
+						else
+							ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount]|=(1<<BitCount);
+						EVENT_INFO("%s\n", EventCodeTmp);
+					}
+				}
+			}
+		}
+
+		//check Alarm Status
+		for(ByteCount=0;ByteCount<8;ByteCount++)
+		{
+			if(ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[ByteCount] != ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount])
+			{
+				tmp=ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[ByteCount]; //prevent be modified during following process
+				for(BitCount=0;BitCount<8;BitCount++)
+				{
+					if(((tmp>>BitCount)&0x01) != ((ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount]>>BitCount)&0x01))
+					{
+						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
+						memcpy(EventCodeTmp,AlarmStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
+						if(((tmp>>BitCount)&0x01)==0)//Recovered
+						{
+							EventCodeTmp[0]=1;
+							ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount]&=(0<<BitCount);
+						}
+						else
+							ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount]|=(1<<BitCount);
+						EVENT_INFO("%s\n", EventCodeTmp);
+					}
+				}
+			}
+		}
+
+		//check Info Status
+		for(ByteCount=0;ByteCount<8;ByteCount++)
+		{
+			if(ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[ByteCount] != ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount])
+			{
+				tmp=ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[ByteCount]; //prevent be modified during following process
+				for(BitCount=0;BitCount<8;BitCount++)
+				{
+					if(((tmp>>BitCount)&0x01) != ((ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount]>>BitCount)&0x01))
+					{
+						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
+						memcpy(EventCodeTmp,InfoStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
+						if(((tmp>>BitCount)&0x01)==0)//Recovered
+						{
+							EventCodeTmp[0]=1;
+							ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount]&=(0<<BitCount);
+						}
+						else
+							ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount]|=(1<<BitCount);
+						EVENT_INFO("%s\n", EventCodeTmp);
+					}
+				}
+			}
+		}
+		
+		usleep(100000);
+	}
+
+	return FAIL;
+}

+ 356 - 0
EVSE/Projects/BYTON-GB/Apps/Module_FactoryConfig.c

@@ -0,0 +1,356 @@
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>      /*標準輸入輸出定義*/
+#include    <stdlib.h>     /*標準函數庫定義*/
+#include    <unistd.h>     /*Unix 標準函數定義*/
+#include    <fcntl.h>      /*檔控制定義*/
+#include    <termios.h>    /*PPSIX 終端控制定義*/
+#include    <errno.h>      /*錯誤號定義*/
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	"define.h"
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+
+#define Debug
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				-1
+
+struct SysConfigData 			SysConfig;
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+struct FanModuleData			*ShmFanModuleData;
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+void split(char **arr, char *str, const char *del);
+
+
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
+			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+			buffer,
+			tm->tm_year+1900,tm->tm_mon+1,
+			SysConfig.ModelName,
+			SysConfig.SerialNumber);
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+
+	return rc;
+}
+
+int DiffTimeb(struct timeb ST, struct timeb ET)
+{
+	//return milli-second
+	unsigned int StartTime,StopTime;
+
+	StartTime=(unsigned int)ST.time;
+	StopTime=(unsigned int)ET.time;
+	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
+}
+
+//=================================
+// Common routine
+//=================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void split(char **arr, char *str, const char *del)
+{
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		s = strtok(NULL, del);
+	}
+}
+
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//creat ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	 //creat ShmStatusCodeData
+   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+
+    	result = FAIL;
+   	}
+    else
+    {}
+
+    return result;
+}
+
+//================================================
+// Main process
+//================================================
+int main(void)
+{
+
+	unsigned int i,Chk;
+	unsigned char *ptr;
+	int fd,wrd;
+
+	ptr=malloc(sizeof(struct SysConfigData));
+	if(ptr==NULL)
+	{
+		DEBUG_ERROR("malloc for SysConfigData NG\r\n");
+
+		return 0;
+	}
+	memset(ptr,0,sizeof(struct SysConfigData));
+	memset(&SysConfig,0,sizeof(struct SysConfigData));
+
+	/*
+	 * TODO: Set factory default configuration
+	 */
+	// System configuration
+	time_t t = time(NULL);
+	struct tm tm = *localtime(&t);
+	strcpy((char*)SysConfig.ModelName, "AWLU770100W1P0");
+	strcpy((char*)SysConfig.SerialNumber, "D195200001A0");
+	sprintf((char*)SysConfig.SystemId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
+	sprintf((char*)SysConfig.SystemDateTime, "%d-%d-%d %d:%d:%d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+	SysConfig.AuthorisationMode = 0;	// 0:PH card	1: OCPP backend		2: PH backend	3: Free Mode
+	SysConfig.DefaultLanguage  = 0;		// 0:English	1:Big5				2: GB			3: JN		4: Français 	5: Italiano		6: Español		7: Deutsch		8: Nederland	9: Norsk	10: Suomalainen		11: Svenska		12: Pусский		13: ไทย
+	SysConfig.RfidCardNumEndian = 0;	// 0: Little endian		1: Big endian
+
+	// Charging configuration
+	SysConfig.MaxChargingEnergy = 0;	// 0: No limit	Other: 1~65536 KWH
+	SysConfig.MaxChargingPower = 0;		// 0: No limit	Other: 1~65536 KW
+	SysConfig.MaxChargingCurrent = 0;	// 0: Rating value	Other: 1~Rating A
+	SysConfig.MaxChargingDuration = 0;	// 0: No limit	Other: 1~65536 Minute
+	SysConfig.PhaseLossPolicy = 0;		// 0: Charging	1: Stop charging
+	SysConfig.AcPhaseCount = 1;			// 1: One phase	3: Three phase
+
+	// Network configuration
+	strcpy((char*)SysConfig.FtpServer, "ftp://ipc_ui:pht2016@ftp.phihong.com.tw/");
+	SysConfig.Eth0Interface.EthDhcpClient = 0;
+	strcpy((char*)SysConfig.Eth0Interface.EthIpAddress, "192.168.1.10");
+	strcpy((char*)SysConfig.Eth0Interface.EthSubmaskAddress, "255.255.255.0");
+	strcpy((char*)SysConfig.Eth0Interface.EthGatewayAddress, "192.168.1.254");
+
+	SysConfig.Eth1Interface.EthDhcpClient = 0;
+	strcpy((char*)SysConfig.Eth1Interface.EthIpAddress, "192.168.0.10");
+	strcpy((char*)SysConfig.Eth1Interface.EthSubmaskAddress, "255.255.255.0");
+	strcpy((char*)SysConfig.Eth1Interface.EthGatewayAddress, "192.168.0.254");
+
+	SysConfig.AthInterface.WifiMode = 2;		// 0: Disable	1: Infrastructure client	2: Infrastructure server	3: Ad-Hoc
+	SysConfig.AthInterface.WifiRssi = 0;		// Wifi rssi value
+	SysConfig.AthInterface.WifiDhcpServer = 0;	// 0: Enable	1: Disable
+	SysConfig.AthInterface.WifiDhcpClient = 0;	// 0: Enable	1: Disable
+
+	strcpy((char*)SysConfig.TelecomInterface.TelcomApn, "internet");
+	SysConfig.TelecomInterface.TelcomSimStatus = 0;	// SIM card status
+	SysConfig.TelecomInterface.TelcomModemMode = 0;	//0: No services	1: CDMA		2: GSM/GPRS	3: WCDMA	4: GSM/WCDMA	5: TD_SCDMA		6: Unknown
+
+	// Backend configuration
+	SysConfig.BackendConnTimeout=300; 		// 300 seconds
+	SysConfig.OfflinePolicy = 0;			// 0: Local list	1: PH RFID		2: Free		3: Deny
+	SysConfig.OfflineMaxChargeEnergy = 0;	// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
+	SysConfig.OfflineMaxChargeDuration = 0; // 0: Same as MaxChargeDuration Other: 1~65535 minutes
+	strcpy((char*)SysConfig.OcppServerURL, "ws://evsocket.phihong.com.tw/");
+	sprintf((char*)SysConfig.ChargeBoxId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
+
+
+	// Copy default configuration to pointer
+	memcpy(ptr,&SysConfig,sizeof(struct SysConfigData));
+
+	// Calculate CRC
+	Chk=0;
+	for(i=0;i<(sizeof(struct SysConfigData)-4);i++)
+	{
+		Chk+=*(ptr+i);
+	}
+	SysConfig.Checksum=Chk;
+
+	// Save factory default setting value to file
+	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT);
+	if (fd < 0)
+	{
+
+		DEBUG_ERROR("open /mnt/FactoryDefaultConfig.bin NG\r\n");
+
+		free(ptr);
+		return 0;
+	}
+	wrd=write(fd, &SysConfig, sizeof(struct SysConfigData));
+	close(fd);
+	if(wrd!=(sizeof(struct SysConfigData)))
+	{
+		DEBUG_ERROR("write /mnt/FactoryDefaultConfig.bin NG\r\n");
+
+		free(ptr);
+		return 0;
+	}
+
+	// Save factory default setting value to flash factory default setting block
+	fd = open("/dev/mtdblock12", O_RDWR);
+	if (fd < 0)
+	{
+
+		DEBUG_ERROR("open /dev/mtdblock12 NG\r\n");
+
+		free(ptr);
+		return 0;
+	}
+	wrd=write(fd, &SysConfig, sizeof(struct SysConfigData));
+	close(fd);
+	if(wrd!=(sizeof(struct SysConfigData)))
+	{
+		DEBUG_ERROR("write /dev/mtdblock12 NG\r\n");
+
+		free(ptr);
+		return 0;
+	}
+
+	// Save factory default setting value to flash backup setting block
+	fd = open("/dev/mtdblock11", O_RDWR);
+	if (fd < 0)
+	{
+		DEBUG_ERROR("open /dev/mtdblock11 NG\r\n");
+
+		free(ptr);
+		return 0;
+	}
+	wrd=write(fd, &SysConfig, sizeof(struct SysConfigData));
+	close(fd);
+	if(wrd!=(sizeof(struct SysConfigData)))
+	{
+		DEBUG_ERROR("write /dev/mtdblock11 NG\r\n");
+
+		free(ptr);
+		return 0;
+	}
+
+	// Save factory default setting value to flash setting block
+	fd = open("/dev/mtdblock10", O_RDWR);
+	if (fd < 0)
+	{
+		DEBUG_ERROR("open /dev/mtdblock10 NG\r\n");
+
+		free(ptr);
+		return 0;
+	}
+	wrd=write(fd, &SysConfig, sizeof(struct SysConfigData));
+	close(fd);
+	if(wrd!=(sizeof(struct SysConfigData)))
+	{
+		DEBUG_ERROR("write /dev/mtdblock10 NG\r\n");
+
+		free(ptr);
+		return 0;
+	}
+
+	free(ptr);
+
+	DEBUG_INFO("FactoryConfig OK\r\n");
+
+
+	return FAIL;
+}

+ 2050 - 0
EVSE/Projects/BYTON-GB/Apps/Module_InternalComm.c

@@ -0,0 +1,2050 @@
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include  	<sys/types.h>
+#include  	<sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include  	<stdio.h>      /*標準輸入輸出定義*/
+#include  	<stdlib.h>     /*標準函數庫定義*/
+#include  	<unistd.h>     /*Unix 標準函數定義*/
+#include  	<fcntl.h>      /*檔控制定義*/
+#include  	<termios.h>    /*PPSIX 終端控制定義*/
+#include 	<errno.h>      /*錯誤號定義*/
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include 	<math.h>
+#include	"define.h"
+#include	"main.h"
+#include	"Module_InternalComm.h"
+
+#define FAIL_SPEC_COMM		1000
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				0
+#define ON					1
+#define OFF					0
+
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+struct PrimaryMcuData			*ShmPrimaryMcuData;
+struct OCPP16Data 				*ShmOCPP16Data;
+struct Charger					*ShmCharger;
+
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+void split(char **arr, char *str, const char *del);
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+			buffer,
+			tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+
+	return rc;
+}
+
+int DiffTimeb(struct timeb ST, struct timeb ET)
+{
+	//return milli-second
+	unsigned int StartTime,StopTime;
+
+	StartTime=(unsigned int)ST.time;
+	StopTime=(unsigned int)ET.time;
+	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
+}
+
+//=================================
+// Common routine
+//=================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void split(char **arr, char *str, const char *del)
+{
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		s = strtok(NULL, del);
+	}
+}
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//Initial ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+
+	//Initial ShmStatusCodeData
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+		#endif
+		result = FAIL;
+	}
+
+	//Initial ShmPrimaryMcuKey
+	if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), IPC_CREAT | 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmPrimaryMcuData NG\r\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmPrimaryMcuData NG\r\n");
+		#endif
+		result = FAIL;
+	}
+
+	//Initial ShmOcppModuleKey
+	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), IPC_CREAT | 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmChargerKey NG\r\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmChargerKey NG\r\n");
+		#endif
+		result = FAIL;
+	}
+
+	return result;
+}
+
+int InitComPort()
+{
+	int fd;
+	struct termios tios;
+
+	fd = open("/dev/ttyS1", O_RDWR);
+	if(fd<=0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("open /dev/ttyS1 NG\n");
+		#endif
+		return -1;
+	}
+	ioctl (fd, TCGETS, &tios);
+	tios.c_cflag = B115200| CS8 | CLOCAL | CREAD;
+	tios.c_lflag = 0;
+	tios.c_iflag = 0;
+	tios.c_oflag = 0;
+	tios.c_cc[VMIN]=0;
+	tios.c_cc[VTIME]=(unsigned char)5;		// timeout 0.5 secod
+	tios.c_lflag=0;
+	tcflush(fd, TCIFLUSH);
+	ioctl (fd, TCSETS, &tios);
+
+	return fd;
+}
+
+int tranceive(int fd, unsigned char* cmd, unsigned char cmd_len, unsigned char* rx)
+{
+	int len;
+	//sleep(2); //required to make flush work, for some reason
+	tcflush(fd,TCIOFLUSH);
+	if(write(fd, cmd, cmd_len) >= cmd_len)
+	{
+		usleep(300000);
+		len = read(fd, rx, 512);
+	}
+	else
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("Serial command %s response fail.\n", cmd);
+		#endif
+	}
+
+	return len;
+}
+
+unsigned char Query_FW_Ver(unsigned char fd, unsigned char targetAddr, Ver *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_FW_VER, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			strncpy(Ret_Buf->Version_FW, (char *)rx+6, (rx[4] | rx[5]<<8));
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_HW_Ver(unsigned char fd, unsigned char targetAddr, Ver *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_HW_VER, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			strncpy(Ret_Buf->Version_HW, (char *)rx+6, (rx[4] | rx[5]<<8));
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Present_InputVoltage(unsigned char fd, unsigned char targetAddr, PresentInputVoltage *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_PRESENT_INPUTVOLTAGE, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->inputType = rx[6];
+			Ret_Buf->L1N_L12 =( rx[7] | (rx[8]<<8))/10.0;
+			Ret_Buf->L2N_L23 =( rx[9] | (rx[10]<<8))/10.0;
+			Ret_Buf->L3N_L31 =( rx[11] | (rx[12]<<8))/10.0;
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Present_OutputVoltage(unsigned char fd, unsigned char targetAddr, PresentOutputVoltage *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_PRESENT_OUTPUTVOLTAGE, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->behindFuse_Voltage_C1 =(rx[6] | (rx[7]<<8))/10.0;
+			Ret_Buf->behindRelay_Voltage_C1 =(rx[8] | (rx[9]<<8))/10.0;
+			if((rx[4] | rx[5]<<8) > 4)
+			{
+				Ret_Buf->behindFuse_Voltage_C2 =(rx[10] | (rx[11]<<8))/10.0;
+				Ret_Buf->behindRelay_Voltage_C2 =(rx[12] | (rx[13]<<8))/10.0;
+			}
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Fan_Speed(unsigned char fd, unsigned char targetAddr, FanSpeed *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_FAN_SPEED, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx=0;idx<((rx[4] | rx[5]<<8)>>1);idx++)
+				Ret_Buf->speed[idx] =(rx[6+(2*idx)] | (rx[6+(2*idx)+1]<<8));
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Temperature(unsigned char fd, unsigned char targetAddr, Temperature *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_TEMPERATURE, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+				Ret_Buf->point[idx] = rx[6+idx] - 60;
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Aux_PowerVoltage(unsigned char fd, unsigned char targetAddr, AuxPower *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_AUX_POWERVOLTAGE, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+				Ret_Buf->voltage[idx] = rx[6+idx];
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Relay_Output(unsigned char fd, unsigned char targetAddr, Relay *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_RELAY_OUTPUT, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx_connector=0;idx_connector<(rx[4] | rx[5]<<8);idx_connector++)
+			{
+				for(int idx=0;idx<8;idx++)
+					Ret_Buf->relay_status[idx_connector][idx] = (rx[6+idx_connector]>>idx) & 0x01;
+			}
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Gfd_Adc(unsigned char fd, unsigned char targetAddr, Gfd *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_GFD_ADC, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx_connector=0;idx_connector<((rx[4] | rx[5]<<8)>>2);idx_connector++)
+			{
+				Ret_Buf->adc_value_positive[idx_connector] = (rx[6+(4*idx_connector)] | rx[6+(4*idx_connector)+1]<<8);
+				Ret_Buf->adc_value_negative[idx_connector] = (rx[6+(4*idx_connector)+2] | rx[6+(4*idx_connector)+3]<<8);;
+			}
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Gpio_Input(unsigned char fd, unsigned char targetAddr, Gpio_in *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_GPIO_INPUT, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->AC_Connector 		= (rx[6] >> 0) & 0x01;
+			Ret_Buf->AC_MainBreaker 	= (rx[6] >> 1) & 0x01;
+			Ret_Buf->SPD 				= (rx[6] >> 2) & 0x01;
+			Ret_Buf->Door_Open 			= (rx[6] >> 3) & 0x01;
+			Ret_Buf->GFD[0] 			= (rx[6] >> 4) & 0x01;
+			Ret_Buf->GFD[1] 			= (rx[6] >> 5) & 0x01;
+			Ret_Buf->Button[0] 			= (rx[6] >> 6) & 0x01;
+			Ret_Buf->Button[1] 			= (rx[6] >> 7) & 0x01;
+			Ret_Buf->Button_Emergency	= (rx[7] >> 0) & 0x01;
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Alarm_Log(unsigned char fd, unsigned char targetAddr, Alarm_Log *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[10] = {0xaa, 0x00, targetAddr, CMD_QUERY_ALARM_LOG, 0x03, 0x00, Ret_Buf->logArea, Ret_Buf->alarmIndex&0xff, ((Ret_Buf->alarmIndex>>8)&0xff), 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = Ret_Buf->logArea ^ (Ret_Buf->alarmIndex&0xff) ^ ((Ret_Buf->alarmIndex>>8)&0xff);
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			memcpy(&Ret_Buf->log[0], &rx[8], 8);
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_RTC(unsigned char fd, unsigned char targetAddr, Rtc *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_RTC, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->year = ((rx[6]-'0')*1000) + ((rx[7]-'0')*100) + ((rx[8]-'0')*10) + ((rx[9]-'0')*1);
+			Ret_Buf->month = ((rx[10]-'0')*10) + ((rx[11]-'0')*1);
+			Ret_Buf->day = ((rx[12]-'0')*10) + ((rx[13]-'0')*1);
+			Ret_Buf->hour = ((rx[14]-'0')*10) + ((rx[15]-'0')*1);
+			Ret_Buf->min = ((rx[16]-'0')*10) + ((rx[17]-'0')*1);
+			Ret_Buf->sec = ((rx[18]-'0')*10) + ((rx[19]-'0')*1);
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_AC_MCU_Status(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_AC_STATUS, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->cp_state = rx[6];
+			Ret_Buf->current_limit = rx[7] | (rx[8]<<0x08);
+			Ret_Buf->cp_voltage_positive = (rx[9] | (rx[10]<<0x08))/100.0;
+			Ret_Buf->cp_voltage_negtive = (rx[11] | (rx[12]<<0x08))/100.0;
+			Ret_Buf->locker_state = rx[13];
+			Ret_Buf->relay_state = rx[14];
+			Ret_Buf->shutter_state = rx[15];
+			Ret_Buf->meter_state = rx[16];
+			Ret_Buf->pp_state = rx[17];
+			Ret_Buf->rating_current = rx[18];
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu_Alarm *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_AC_ALARM, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			//rx[6]
+			Ret_Buf->bits.OVP = (((rx[6]>>0)&0x01)?1:0);
+			Ret_Buf->bits.UVP = (((rx[6]>>1)&0x01)?1:0);
+			Ret_Buf->bits.OCP = (((rx[6]>>2)&0x01)?1:0);
+			Ret_Buf->bits.OTP = (((rx[6]>>3)&0x01)?1:0);
+			Ret_Buf->bits.gmi_fault = (((rx[6]>>4)&0x01)?1:0);
+			Ret_Buf->bits.cp_fault = (((rx[6]>>5)&0x01)?1:0);
+			Ret_Buf->bits.ac_leak = (((rx[6]>>6)&0x01)?1:0);
+			Ret_Buf->bits.dc_leak = (((rx[6]>>7)&0x01)?1:0);
+
+			//rx[7]
+			Ret_Buf->bits.mcu_selftest_fail = (((rx[7]>>0)&0x01)?1:0);
+			Ret_Buf->bits.handshaking_timeout = (((rx[7]>>1)&0x01)?1:0);
+			Ret_Buf->bits.emergency_stop = (((rx[7]>>2)&0x01)?1:0);
+			Ret_Buf->bits.relay_welding = (((rx[7]>>3)&0x01)?1:0);
+			Ret_Buf->bits.leak_module_fail = (((rx[7]>>4)&0x01)?1:0);
+			Ret_Buf->bits.shutter_fault = (((rx[7]>>5)&0x01)?1:0);
+			Ret_Buf->bits.locker_fault = (((rx[7]>>6)&0x01)?1:0);
+			Ret_Buf->bits.power_drop = (((rx[7]>>7)&0x01)?1:0);
+
+			//rx[8] 3~7bits reserved
+			Ret_Buf->bits.circuit_short = (((rx[8]>>0)&0x01)?1:0);
+			Ret_Buf->bits.set_circuit = (((rx[8]>>1)&0x01)?1:0);
+			Ret_Buf->bits.relay_drive_fault = (((rx[8]>>2)&0x01)?1:0);
+
+			//rx[9] 0~7bits reserved
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Present_OutputCurrent(unsigned char fd, unsigned char targetAddr, Presentoutputcurrent *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_PRESENT_OUTPUTCURRENT, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			Ret_Buf->L1N_L12[0] = (rx[6] | (rx[7]<<8))/10.0;
+			Ret_Buf->L2N_L23[0] = (rx[8] | (rx[9]<<8))/10.0;
+			Ret_Buf->L3N_L31[0] = (rx[10] | (rx[11]<<8))/10.0;
+			Ret_Buf->L1N_L12[1] = (rx[12] | (rx[13]<<8))/10.0;
+			Ret_Buf->L2N_L23[1] = (rx[14] | (rx[15]<<8))/10.0;
+			Ret_Buf->L3N_L31[1] = (rx[16] | (rx[17]<<8))/10.0;
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Ble_Config(unsigned char fd, unsigned char targetAddr, Ble_Config_Data *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_BLE_CONFIG_DATA, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			Ret_Buf->isLogin = (rx[6]?0x01:0x00);
+			Ret_Buf->isRequestStart = (rx[7]?0x01:0x00);
+			Ret_Buf->isRequestStop = (rx[8]?0x01:0x00);
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Ble_Central_ID(unsigned char fd, unsigned char targetAddr, Ble_Login_Central_Id *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_BLE_CENTRAL_ID, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			memset(Ret_Buf->id, 0x00, ARRAY_SIZE(Ret_Buf->id));
+			memcpy(&Ret_Buf->id[0], &rx[6], (rx[4] | (rx[5]<<8)));
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Power_Consumption(unsigned char fd, unsigned char targetAddr, Power_Consumption *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_POWER_CONSUMPTION, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			Ret_Buf-> power_consumption = ((uint32_t)rx[6] | (((uint32_t)rx[7])<<8) | (((uint32_t)rx[8])<<16) | (((uint32_t)rx[9])<<24));
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Fan_Speed(unsigned char fd, unsigned char targetAddr, FanSpeed *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[15] = {0xaa, 0x00, targetAddr, CMD_CONFIG_FAN_SPEED, 0x08, 0x00, Set_Buf->speed[0]&0xff, (Set_Buf->speed[0]>>8)&0xff, Set_Buf->speed[1]&0xff, (Set_Buf->speed[1]>>8)&0xff, Set_Buf->speed[2]&0xff, (Set_Buf->speed[2]>>8)&0xff, Set_Buf->speed[3]&0xff, (Set_Buf->speed[3]>>8)&0xff, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[14] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+				return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Serial_Number(unsigned char fd, unsigned char targetAddr, Evse_Id *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[27] = {0xaa, 0x00, targetAddr, CMD_CONFIG_SERIAL_NUMBER, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	memcpy(&tx[14], &Set_Buf->serial_number[0], ARRAY_SIZE(Set_Buf->serial_number));
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[26] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Model_Name(unsigned char fd, unsigned char targetAddr, Evse_Id *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[21] = {0xaa, 0x00, targetAddr, CMD_CONFIG_MODEL_NAME, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	memcpy(&tx[6], &Set_Buf->model_name[0], ARRAY_SIZE(Set_Buf->model_name));
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[20] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Relay_Output(unsigned char fd, unsigned char targetAddr, Relay *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[9] = {0xaa, 0x00, targetAddr, CMD_CONFIG_RELAY_OUTPUT, 0x02, 0x00, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	for(int idx_connector=0;idx_connector<2;idx_connector++)
+		for(int idx = 0;idx<8;idx++)
+			tx[6+idx_connector] |= ((Set_Buf->relay_status[idx_connector][idx]?0x01:0x00)<<idx);
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[8] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Gpio_Output(unsigned char fd, unsigned char targetAddr, Gpio_out *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[9] = {0xaa, 0x00, targetAddr, CMD_CONFIG_GPIO_OUTPUT, 0x01, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[6] |= (Set_Buf->AC_Connector?0x01:0x00);
+
+	for(int idx=0;idx<2;idx++)
+		tx[6] |= (Set_Buf->Button_LED[idx]?0x01:0x00)<<(1+idx);
+
+	for(int idx=0;idx<4;idx++)
+			tx[6] |= (Set_Buf->System_LED[idx]?0x01:0x00)<<(3+idx);
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[14] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == tx[6]))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_RTC(unsigned char fd, unsigned char targetAddr, Rtc *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[21];
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_RTC;
+	tx[4] = 0x0e;
+	tx[5] = 0x00;
+	tx[6] = ((Set_Buf->year)/1000)+'0';
+	tx[7] = ((Set_Buf->year)/100%10)+'0';
+	tx[8] = ((Set_Buf->year)/10%10)+'0';
+	tx[9] = (Set_Buf->year)%1000+'0';
+	tx[10] = ((Set_Buf->month)/10)+'0';
+	tx[11] = ((Set_Buf->month)%10)+'0';
+	tx[12] = ((Set_Buf->day)/10)+'0';
+	tx[13] = ((Set_Buf->day)%10)+'0';
+	tx[14] = ((Set_Buf->hour)/10)+'0';
+	tx[15] = ((Set_Buf->hour)%10)+'0';
+	tx[16] = ((Set_Buf->min)/10)+'0';
+	tx[17] = ((Set_Buf->min)%10)+'0';
+	tx[18] = ((Set_Buf->sec)/10)+'0';
+	tx[19] = ((Set_Buf->sec)%10)+'0';
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[20] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_MCU_LED(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu_Led *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[12] ;
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_AC_LED;
+	tx[4] = 0x05;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf->mode;
+	tx[7] = ((Set_Buf->alarm_code>>0)&0xff);
+	tx[8] = ((Set_Buf->alarm_code>>8)&0xff);
+	tx[9] = ((Set_Buf->alarm_code>>16)&0xff);
+	tx[10] = ((Set_Buf->alarm_code>>24)&0xff);
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[11] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_MCU_LEGACY_REQUEST(unsigned char fd, unsigned char targetAddr, Legacy_Request *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[9];
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_MCU_MODE;
+	tx[4] = 0x02;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf->isLegacyRequest;
+	tx[7] = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[8] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_MaxCurrent_And_CpPwmDuty(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu_Cp_Pwm_Duty*Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[9];
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_CURRENT_LINIT;
+	tx[4] = 0x05;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf->max_current;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+			chksum ^= tx[6+idx];
+	tx[8] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+		return result;
+}
+
+unsigned char Update_Start(unsigned char fd, unsigned char targetAddr, unsigned int crc32)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[11] = {0xaa, 0x00, targetAddr, CMD_UPDATE_START, 0x04, 0x00, (crc32>>0)&0xff, (crc32>>8)&0xff, (crc32>>16)&0xff, (crc32>>24)&0xff, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[10] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x00))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Update_Abord(unsigned char fd, unsigned char targetAddr)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_UPDATE_ABOARD, 0x04, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x00))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Update_Transfer(unsigned char fd, unsigned char targetAddr, unsigned int startAddr, unsigned char *data, unsigned short int length)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[11 + length];
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_UPDATE_TRANSFER;
+	tx[4] = (4 + length) & 0xff;
+	tx[5] = ((4 + length)>>8) & 0xff;
+	tx[6] = (startAddr>>0) & 0xff;
+	tx[7] = (startAddr>>8) & 0xff;
+	tx[8] = (startAddr>>16) & 0xff;
+	tx[9] = (startAddr>>24) & 0xff;
+	memcpy(tx+10, data, length);
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[sizeof(tx)-1] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x00))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Update_Finish(unsigned char fd, unsigned char targetAddr)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_UPDATE_END, 0x04, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+				return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+	return result;
+}
+
+
+//================================================
+// Main process
+//================================================
+int main(void)
+{
+	int Uart1Fd;
+
+	unsigned short int failCount[2] = {0,0};
+
+	if(InitShareMemory() == FAIL)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("InitShareMemory NG\n");
+		#endif
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		return 0;
+	}
+	else
+	{
+		DEBUG_INFO("InitShareMemory OK.\r\n");
+	}
+
+	Uart1Fd=InitComPort();
+	if(Uart1Fd<0)
+	{
+		DEBUG_ERROR("InitComPort NG\n");
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+		}
+		sleep(5);
+		return 0;
+	}
+	else
+	{
+		DEBUG_INFO("ttyS1 port open success.\r\n");
+	}
+
+	for(;;)
+	{
+		for(int gun_index=0;gun_index<AC_QUANTITY;gun_index++)
+		{
+			//===============================
+			// Query firmware version
+			//===============================
+			if(ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass != PASS)
+			{
+				if(Query_FW_Ver(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].ver) == PASS)
+				{
+					DEBUG_INFO("MCU-%d get firmware version : %s\r\n", gun_index, ShmCharger->gun_info[gun_index].ver.Version_FW);
+					memcpy(ShmPrimaryMcuData->version, ShmCharger->gun_info[gun_index].ver.Version_FW, sizeof(ShmPrimaryMcuData->version));
+					ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass = PASS;
+
+					failCount[gun_index] = 0;
+				}
+				else
+				{
+					DEBUG_WARN("MCU-%d get firmware version fail...%d\r\n", gun_index, failCount[gun_index]);
+					if(failCount[gun_index]<1000)
+					{
+						failCount[gun_index]++;
+					}
+				}
+			}
+
+			//===============================
+			// Config primary MCU serial number
+			//===============================
+			if(ShmCharger->gun_info[gun_index].mcuFlag.isSetSerialNumberPass != PASS)
+			{
+				memcpy(ShmCharger->evseId.serial_number, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmCharger->evseId.serial_number));
+				if(Config_Serial_Number(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->evseId))
+				{
+					DEBUG_INFO("MCU-%d set serial number OK...\r\n");
+					ShmCharger->gun_info[gun_index].mcuFlag.isSetSerialNumberPass = PASS;
+
+					failCount[gun_index] = 0;
+				}
+				else
+				{
+					DEBUG_WARN("MCU-%d set serial number fail...%d\r\n", gun_index, failCount[gun_index]);
+					if(failCount[gun_index]<1000)
+					{
+						failCount[gun_index]++;
+					}
+				}
+			}
+
+			//===============================
+			// Config primary MCU model name
+			//===============================
+			if(ShmCharger->gun_info[gun_index].mcuFlag.isSetModelNamePass != PASS)
+			{
+				memcpy(ShmCharger->evseId.model_name, ShmSysConfigAndInfo->SysConfig.ModelName, ARRAY_SIZE(ShmCharger->evseId.model_name));
+				if(Config_Model_Name(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->evseId))
+				{
+					DEBUG_INFO("MCU-%d set model name OK...\r\n");
+					ShmCharger->gun_info[gun_index].mcuFlag.isSetModelNamePass = PASS;
+
+					failCount[gun_index] = 0;
+				}
+				else
+				{
+					DEBUG_WARN("MCU-%d set model name fail...%d\r\n", gun_index, failCount[gun_index]);
+					if(failCount[gun_index]<1000)
+					{
+						failCount[gun_index]++;
+					}
+				}
+			}
+
+			//===============================
+			// Query present input voltage
+			//===============================
+			if(Query_Present_InputVoltage(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].inputVoltage) == PASS)
+			{
+				DEBUG_INFO("MCU-%d get input voltage : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
+				ShmSysConfigAndInfo->SysInfo.InputVoltageR = ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12;
+				ShmSysConfigAndInfo->SysInfo.InputVoltageS = ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23;
+				ShmSysConfigAndInfo->SysInfo.InputVoltageT = ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31;
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get input voltage fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+				{
+					failCount[gun_index]++;
+				}
+			}
+
+			//===============================
+			// Query present output current
+			//===============================
+			if(Query_Present_OutputCurrent(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].outputCurrent) == PASS)
+			{
+				DEBUG_INFO("MCU-%d get output current : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get output current fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+					failCount[gun_index]++;
+			}
+
+			//===============================
+			// Query temperature
+			//===============================
+			if(Query_Temperature(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].temperature) == PASS)
+			{
+				DEBUG_INFO("MCU-%d get temperature : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].temperature.point[0]);
+				ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get temperature fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+				{
+					failCount[gun_index]++;
+				}
+			}
+
+			//===============================
+			// Query primary MCU status
+			//===============================
+			if(Query_AC_MCU_Status(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuState))
+			{
+				DEBUG_INFO("MCU-%d get Pilot State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_state);
+				DEBUG_INFO("MCU-%d get Pilot Duty : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
+				DEBUG_INFO("MCU-%d get Pilot Voltage Positive : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive);
+				DEBUG_INFO("MCU-%d get Pilot Voltage Negative : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive);
+				DEBUG_INFO("MCU-%d get Locker State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
+				DEBUG_INFO("MCU-%d get Relay State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
+				DEBUG_INFO("MCU-%d get Shutter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
+				DEBUG_INFO("MCU-%d get Meter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
+				DEBUG_INFO("MCU-%d get PP State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
+				DEBUG_INFO("MCU-%d get Rating Current : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current);
+
+				ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState = ShmCharger->gun_info[gun_index].primaryMcuState.cp_state;
+				ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotDuty = (ShmCharger->gun_info[gun_index].primaryMcuState.current_limit>51?(unsigned char)((ShmCharger->gun_info[gun_index].primaryMcuState.current_limit/2.5)+64):(unsigned char)(ShmCharger->gun_info[gun_index].primaryMcuState.current_limit/0.6));
+				ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotVoltage = ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive;
+				ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltagePositive = ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive;
+				ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltageNegative = ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive;
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get status fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+				{
+					failCount[gun_index]++;
+				}
+			}
+
+			//===============================
+			// Query primary MCU Alarm code
+			//===============================
+			if(Query_AC_MCU_Alarm(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuAlarm))
+			{
+				DEBUG_INFO("MCU-%d get alarm OK...\r\n");
+				/*
+				// Byte[6]
+				// Byte[7]
+				// Byte[8] Alarm code 3~7 bits Reserved
+				// Byte[9] Alarm code 0~7 bits Reserved
+				 */
+
+				//================================================
+				// Byte[6]
+				//================================================
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<0;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<0);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<1;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<1);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<2;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<2);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<3;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<3);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<4;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<4);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<5;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<5);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<6;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<6);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<7;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<7);
+
+				//================================================
+				// Byte[7]
+				//================================================
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<8;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<8);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<9;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<9);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<10;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<10);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<11;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<11);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<12;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<12);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<13;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<13);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<14;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<14);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<15;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<15);
+
+				//================================================
+				// Byte[8]
+				//================================================
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<16;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<16);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<17;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<17);
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault == 0x01)
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<18;
+				else
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<18);
+
+				//================================================
+				// Byte[9]
+				//================================================
+				// Debug print out
+				DEBUG_INFO("MCU-%d get OVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP);
+				DEBUG_INFO("MCU-%d get UVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP);
+				DEBUG_INFO("MCU-%d get OCP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP);
+				DEBUG_INFO("MCU-%d get OTP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP);
+				DEBUG_INFO("MCU-%d get gmi_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault);
+				DEBUG_INFO("MCU-%d get cp_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault);
+				DEBUG_INFO("MCU-%d get ac_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak);
+				DEBUG_INFO("MCU-%d get dc_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak);
+				DEBUG_INFO("MCU-%d get mcu_selftest_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail);
+				DEBUG_INFO("MCU-%d get handshaking_timeout : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout);
+				DEBUG_INFO("MCU-%d get emergency_stop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop);
+				DEBUG_INFO("MCU-%d get relay_welding : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding);
+				DEBUG_INFO("MCU-%d get leak_module_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail);
+				DEBUG_INFO("MCU-%d get shutter_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault);
+				DEBUG_INFO("MCU-%d get locker_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
+				DEBUG_INFO("MCU-%d get power_drop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
+				DEBUG_INFO("MCU-%d get circuit_short : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short);
+				DEBUG_INFO("MCU-%d get set_circuit : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit);
+				DEBUG_INFO("MCU-%d get relay_drive_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
+				DEBUG_INFO("MCU-%d get InputAlarmCode : %x\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get alarm fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+				{
+					failCount[gun_index]++;
+				}
+			}
+
+			//===============================
+			// Query primary MCU BLE config
+			//===============================
+			if(Query_Ble_Config(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleConfigData))
+			{
+				DEBUG_INFO("MCU-%d get isUserLogin : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isLogin);
+				DEBUG_INFO("MCU-%d get isRequestStartCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart);
+				DEBUG_INFO("MCU-%d get isRequestStopCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop);
+
+				ShmSysConfigAndInfo->SysConfig.Bluetooth.isLogin = ShmCharger->gun_info[gun_index].bleConfigData.isLogin;
+				ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart;
+				ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop;
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get ble config fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+				{
+					failCount[gun_index]++;
+				}
+			}
+
+			//===============================
+			// Query primary MCU ble login id
+			//===============================
+			if(Query_Ble_Central_ID(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleLoginCentralId))
+			{
+				DEBUG_INFO("MCU-%d get ble central id : %s\r\n", gun_index, ShmCharger->gun_info[gun_index].bleLoginCentralId.id);
+				memcpy(ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, sizeof ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID);
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get ble login central id fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+				{
+					failCount[gun_index]++;
+				}
+			}
+
+			//===============================
+			// Config primary MCU LED
+			//===============================
+			ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code = ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode;
+			if(Config_AC_MCU_LED(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuLed))
+			{
+				DEBUG_INFO("MCU-%d set Led mode : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.mode);
+				DEBUG_INFO("MCU-%d set Alarm code : %x\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code);
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d set led fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+				{
+					failCount[gun_index]++;
+				}
+			}
+
+			//===============================
+			// Query RTC
+			//===============================
+			if(Query_RTC(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].rtc))
+			{
+				struct timeb csuTime, mcuTime;
+				struct tm *tmCSU;
+				struct tm tmMcu;
+				ftime(&csuTime);
+				tmCSU = localtime(&csuTime.time);
+				tmMcu.tm_year = ShmCharger->gun_info[gun_index].rtc.year-1900;
+				tmMcu.tm_mon = ShmCharger->gun_info[gun_index].rtc.month-1;
+				tmMcu.tm_mday = ShmCharger->gun_info[gun_index].rtc.day;
+				tmMcu.tm_hour = ShmCharger->gun_info[gun_index].rtc.hour;
+				tmMcu.tm_min = ShmCharger->gun_info[gun_index].rtc.min;
+				tmMcu.tm_sec = ShmCharger->gun_info[gun_index].rtc.sec;
+				mcuTime.time = mktime(&tmMcu);
+
+
+				if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin && !ShmOCPP16Data->OcppConnStatus)
+				{
+					if(abs(DiffTimeb(csuTime, mcuTime)) > 10000)
+					{
+						char cmdBuf[128];
+						sprintf(cmdBuf, "date -u -s \"%04d-%02d-%02d %02d:%02d:%02d\"", ShmCharger->gun_info[gun_index].rtc.year,
+																						ShmCharger->gun_info[gun_index].rtc.month,
+																						ShmCharger->gun_info[gun_index].rtc.day,
+																						ShmCharger->gun_info[gun_index].rtc.hour,
+																						ShmCharger->gun_info[gun_index].rtc.min,
+																						ShmCharger->gun_info[gun_index].rtc.sec);
+						system(cmdBuf);
+						system("hwclock -w -u");
+						system("hwclock -s");
+
+						DEBUG_INFO("Sync from MCU-%d rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
+																								  ShmCharger->gun_info[gun_index].rtc.year,
+																								  ShmCharger->gun_info[gun_index].rtc.month,
+																								  ShmCharger->gun_info[gun_index].rtc.day,
+																								  ShmCharger->gun_info[gun_index].rtc.hour,
+																								  ShmCharger->gun_info[gun_index].rtc.min,
+																								  ShmCharger->gun_info[gun_index].rtc.sec);
+					}
+				}
+				else
+				{
+					if(abs(DiffTimeb(csuTime, mcuTime)) > 10000)
+					{
+						ShmCharger->gun_info[gun_index].rtc.year = tmCSU->tm_year+1900;
+						ShmCharger->gun_info[gun_index].rtc.month = tmCSU->tm_mon+1;
+						ShmCharger->gun_info[gun_index].rtc.day = tmCSU->tm_mday;
+						ShmCharger->gun_info[gun_index].rtc.hour = tmCSU->tm_hour;
+						ShmCharger->gun_info[gun_index].rtc.min = tmCSU->tm_hour;
+						ShmCharger->gun_info[gun_index].rtc.sec = tmCSU->tm_sec;
+						Config_RTC(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].rtc);
+
+						DEBUG_INFO("MCU-%d set rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
+																							ShmCharger->gun_info[gun_index].rtc.year,
+																							ShmCharger->gun_info[gun_index].rtc.month,
+																							ShmCharger->gun_info[gun_index].rtc.day,
+																							ShmCharger->gun_info[gun_index].rtc.hour,
+																							ShmCharger->gun_info[gun_index].rtc.min,
+																							ShmCharger->gun_info[gun_index].rtc.sec);
+					}
+				}
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get rtc fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+					failCount[gun_index]++;
+			}
+
+			//===============================
+			// Query primary MCU power consumption
+			//===============================
+			if(Query_Power_Consumption(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].powerConsumption))
+			{
+				DEBUG_INFO("MCU-%d get power consumption : %f\r\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100.0));
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get power consumption fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+					failCount[gun_index]++;
+			}
+
+			//===============================
+			// Config primary Legacy request
+			//===============================
+			if(Config_AC_MCU_LEGACY_REQUEST(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1),&ShmCharger->gun_info[gun_index].legacyRequest))
+			{
+				DEBUG_INFO("MCU-%d set relay request : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
+				DEBUG_INFO("========================================\n");
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d set relay request fail...%d\r\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<1000)
+					failCount[gun_index]++;
+			}
+
+			//===============================
+			// Upgrade MCU
+			//===============================
+			if(ShmCharger->gun_info[gun_index].mcuFlag.isMcuUpgradeReq)
+			{
+				unsigned char cmd[512];
+				if(Upgrade_UART(Uart1Fd, AC_WALLMOUNT_CONTROLLER, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), ShmCharger->fwUpgradeInfo.location, ShmCharger->fwUpgradeInfo.modelName))
+				{
+					DEBUG_INFO("MCU-%d upgrade firmware OK...%s\r\n", gun_index, ShmCharger->gun_info[gun_index].ver.Version_FW);
+					sleep(20);
+					ShmCharger->gun_info[gun_index].mcuFlag.isMcuUpgradeReq = OFF;
+					failCount[gun_index] = 0;
+				}
+				else
+				{
+					DEBUG_WARN("MCU-%d upgrade firmware fail...%d\r\n", gun_index, failCount[gun_index]);
+					if(failCount[gun_index]<1000)
+						failCount[gun_index]++;
+				}
+
+				sprintf((char*)cmd, "yes|rm %s", ShmCharger->fwUpgradeInfo.location);
+				system((char*)cmd);
+			}
+
+			//===============================
+			// Config primary set CP PWN duty
+			//===============================
+//			ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 32;
+//			if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
+//			{
+//				DEBUG_INFO("MCU-%d cp pwn duty : %d\r\n",gun_index, &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
+//			}
+//			else
+//			{
+//				DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\r\n", gun_index, failCount[gun_index]);
+//				if(failCount[gun_index]<1000)
+//				{
+//					failCount[gun_index]++;
+//				}
+//			}
+//
+//			if(failCount[gun_index]>=1000)
+//			{
+//				DEBUG_ERROR("Primary MCU-%d communication fault", gun_index);
+//			}
+
+
+			//===============================
+			// Communication fail check
+			//===============================
+			if(failCount[gun_index] >= FAIL_SPEC_COMM)
+			{
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.comm_timeout == OFF)
+				{
+					DEBUG_ERROR("Primary MCU-%d communication fault", gun_index);
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.comm_timeout = ON;
+				}
+			}
+			else
+			{
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.comm_timeout == ON)
+				{
+					DEBUG_ERROR("Primary MCU-%d communication recover", gun_index);
+					ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.comm_timeout = OFF;
+				}
+			}
+		}
+		sleep(3);
+	}
+
+	return FAIL;
+}

+ 65 - 0
EVSE/Projects/BYTON-GB/Apps/Module_InternalComm.h

@@ -0,0 +1,65 @@
+/*
+ * Module_InternalComm.h
+ *
+ *  Created on: 2019¦~8¤ë28¤é
+ *      Author: USER
+ */
+
+#ifndef MODULE_INTERNALCOMM_H_
+#define MODULE_INTERNALCOMM_H_
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+
+extern int StoreLogMsg(const char *fmt, ...);
+
+enum MESSAGE_COMMAND
+{
+	CMD_QUERY_FW_VER = 0x01,
+	CMD_QUERY_HW_VER = 0x02,
+	CMD_QUERY_PRESENT_INPUTVOLTAGE = 0x03,
+	CMD_QUERY_PRESENT_OUTPUTVOLTAGE = 0x04,
+	CMD_QUERY_FAN_SPEED = 0x05,
+	CMD_QUERY_TEMPERATURE = 0x06,
+	CMD_QUERY_AUX_POWERVOLTAGE = 0x07,
+	CMD_QUERY_RELAY_OUTPUT = 0x08,
+	CMD_QUERY_GFD_ADC = 0x09,
+	CMD_QUERY_GPIO_INPUT = 0x0a,
+	CMD_QUERY_ALARM_LOG = 0x22,
+	CMD_QUERY_RTC = 0x26,
+	CMD_QUERY_PRESENT_OUTPUTCURRENT = 0x27,
+	CMD_QUERY_AC_STATUS = 0x28,
+	CMD_QUERY_AC_ALARM = 0x29,
+	CMD_QUERY_BLE_CONFIG_DATA = 0x2A,
+	CMD_QUERY_BLE_CENTRAL_ID = 0x2B,
+	CMD_QUERY_POWER_CONSUMPTION = 0x2C,
+
+	CMD_CONFIG_FAN_SPEED = 0x81,
+	CMD_CONFIG_SERIAL_NUMBER = 0x82,
+	CMD_CONFIG_MODEL_NAME = 0x83,
+	CMD_CONFIG_RELAY_OUTPUT = 0x85,
+	CMD_CONFIG_GPIO_OUTPUT = 0x86,
+	CMD_CONFIG_RTC = 0x87,
+	CMD_CONFIG_AC_LED = 0x88,
+	CMD_CONFIG_CURRENT_LINIT = 0x89,
+	CMD_CONFIG_MCU_MODE = 0x8A,
+
+	CMD_UPDATE_START = 0xe0,
+	CMD_UPDATE_ABOARD = 0xe1,
+	CMD_UPDATE_TRANSFER = 0xe2,
+	CMD_UPDATE_END = 0xe3
+};
+
+enum MESSAGE_ADDRESS
+{
+	ADDR_AUX = 0x01,
+	ADDR_FAN = 0x02,
+	ADDR_RELAY = 0x03,
+	ADDR_DC_PRIMARY = 0x04,
+	ADDR_AC_PRIMARY_1 = 0xff,
+	ADDR_AC_PRIMARY_2 = 0xff
+};
+
+
+#endif /* MODULE_INTERNALCOMM_H_ */

BIN
EVSE/Projects/BYTON-GB/Apps/Ocpp16


+ 0 - 333
EVSE/Projects/BYTON-GB/Apps/Ocpp16.c

@@ -1,333 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/termios.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
-#include <linux/sockios.h> 
-#include <linux/socket.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/time.h> 
-#include <sys/timeb.h> 
-#include <libwebsockets.h>
-#include <lws_config.h>
-#include "../../define.h"
-
-#define Debug
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-struct OCPP16Data 			*ShmOCPP16Data;
-
-
-struct lws *wsi;
-struct lws_context *context;
-
-unsigned char *SendBuffer;
-int SendBufLen=(1024*3);
-int ConnectionEstablished=0;
-
-
-#ifdef SystemLogMessage
-int StoreLogMsg(unsigned char *DataString)
-{
-	unsigned char Buf[256];
-	time_t CurrentTime;
-	struct tm *tm;
-			
-	memset(Buf,0,sizeof(Buf));
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			DataString,
-			tm->tm_year+1900,tm->tm_mon+1);
-	system(Buf);
-	#ifdef Debug
-	printf("%s \n",DataString);
-	#endif
-}		
-#endif
-
-int DiffTimeb(struct timeb ST, struct timeb ET)
-{
-	//return milli-second
-	unsigned int StartTime,StopTime;
-	
-	StartTime=(unsigned int)ST.time;
-	StopTime=(unsigned int)ET.time;
-	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
-}	
-
-/**************************************************************************************/
-/**************************Init all share memory *********************************/
-/**************************************************************************************/
-int InitShareMemory()
-{
-	int MeterSMId;
-	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]InitShareMemory:shmget ShmSysConfigAndInfo NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]InitShareMemory:shmat ShmSysConfigAndInfo NG");
-		#endif		
-		return 0;
-   	 }
-   	 //creat ShmStatusCodeData
-   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]InitShareMemory:shmget ShmStatusCodeData NG");
-		#endif		
-		return 0;	
-	}
-    	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]InitShareMemory:shmat ShmStatusCodeData NG");
-		#endif		
-		return 0;
-   	 }
-   	 //creat ShmOCPP16Data
-   	 if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]InitShareMemory:shmget ShmOCPP16Data NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]InitShareMemory:shmat ShmOCPP16Data NG");
-		#endif		
-		return 0;
-   	 }
-   	memset(ShmOCPP16Data,0,sizeof(struct PsuData));
-    	return 1;
-}
-
-
-int SendData(struct lws *wsi) 
-{
-    int n;
-    int len;
-    unsigned char *out = NULL;
-
-    len = strlen(SendBuffer);
-    out = (char *)malloc(sizeof(char)*(LWS_SEND_BUFFER_PRE_PADDING + len + LWS_SEND_BUFFER_POST_PADDING));
-    memcpy (out + LWS_SEND_BUFFER_PRE_PADDING, SendBuffer, len );
-   
-    n = lws_write(wsi, out + LWS_SEND_BUFFER_PRE_PADDING, len, LWS_WRITE_TEXT);
-   
-    free(out);
-    return n;
-}
-
-static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len)
-{	
-
-	#ifdef Debug
-	printf("OCPP16Callback:reason=%d\n",reason);
-	#endif
-	switch (reason) 
-	{
-		case LWS_CALLBACK_CLIENT_ESTABLISHED://3
-			#ifdef SystemLogMessage	
-			StoreLogMsg("[Ocpp16]OCPP16Callback:LWS_CALLBACK_CLIENT_ESTABLISHED");
-			#endif		
-			//connected
-			ConnectionEstablished=1;
-			break;
-		case LWS_CALLBACK_CLIENT_CONNECTION_ERROR://1
-			#ifdef Debug
-			printf("OCPP16Callback:LWS_CALLBACK_CLIENT_CONNECTION_ERROR:%s\n",in);
-			#endif
-			#ifdef SystemLogMessage	
-			StoreLogMsg("[Ocpp16]OCPP16Callback:LWS_CALLBACK_CLIENT_CONNECTION_ERROR");
-			#endif		
-			//disconnected
-			ConnectionEstablished=0;
-			break;
-		case LWS_CALLBACK_CLOSED://4
-			#ifdef SystemLogMessage	
-			StoreLogMsg("[Ocpp16]OCPP16Callback:LWS_CALLBACK_CLOSED");
-			#endif
-			//disconnected
-			ConnectionEstablished=0;
-			break;
-		case LWS_CALLBACK_CLIENT_WRITEABLE://10
-			//sif(need to send message and its relevant data already store into SendBuffer)
-				SendData(wsi);
-			break;
-		case LWS_CALLBACK_CLIENT_RECEIVE://8
-			((char *)in)[len] = '\0';
-			#ifdef Debug
-			printf("OCPP16Callback:LWS_CALLBACK_CLIENT_RECEIVE : rx %d '%s'\n", (int)len, (char *)in);
-			#endif
-			//parsing received message and do something
-			break;
-		default:
-			break;
-	}
-
-	return 0;
-}
-
-static struct lws_protocols protocols[] = {
-
-	{
-		"ocpp1.6",		
-		OCPP16Callback,
-		10240,	
-		10240,
-	},
-	{
-		"ocpp1.6",		
-		OCPP16Callback,
-		10240,	
-		10240,
-	},
-	{
-		NULL, NULL, 0		/* End of list */
-	}
-};
-
-int ConnectWsServer()
-{	
-	struct lws_context_creation_info ContextInfo;
-	struct lws_client_connect_info ConnInfo;
-	int use_ssl=0;
-	
-	if(context!=NULL)
-		lws_context_destroy(context);
-	memset(&ContextInfo, 0, sizeof(struct lws_context_creation_info));
-	ContextInfo.port=CONTEXT_PORT_NO_LISTEN;
-	ContextInfo.iface=NULL;
-	ContextInfo.ssl_private_key_password=NULL; 
-	ContextInfo.ssl_cert_filepath=NULL; 
-	ContextInfo.ssl_private_key_filepath=NULL; 
-	ContextInfo.ssl_ca_filepath="/root/cacert.pem"; 
-	ContextInfo.ssl_cipher_list=NULL; //use default one
-	ContextInfo.gid=-1;
-	ContextInfo.uid=-1;
-	//if(security connection)
-	//	ContextInfo.options |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
-	ContextInfo.protocols=protocols;
-	ContextInfo.timeout_secs= 30;
-	//if(ping pong enabled)
-		//ContextInfo.ws_ping_pong_interval= 15;//0 for none, else interval in seconds 
-	ContextInfo.ws_ping_pong_interval= 0;	
-	context = lws_create_context(&ContextInfo);
-	if (context == NULL) 
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]ConnectWsServer: lws_create_context NG");
-		#endif	
-		return 0;
-	}
-	memset(&ConnInfo,0,sizeof(struct lws_client_connect_info));
-	ConnInfo.context = context;
-
-	// fill up below information
-	//ConnInfo.address=ServerIpAddress;
-	//ConnInfo.port = ServerSrcPort;
-	//ConnInfo.path=ServerPath;
-	//ConnInfo.host=ServerHost;
-	//ConnInfo.origin=ServerOrigin;
-
-	/* ws://192.168.1.1:9091/greenlots/ocpp*/
-	ConnInfo.address = "192.168.1.1";
-	ConnInfo.port = 9091;
-	ConnInfo.path="/ocpp/T123456789";
-	ConnInfo.host = "192.168.1.1:9091";
-	ConnInfo.origin = "192.168.1.1:9091";	
-
-	use_ssl = LCCSCF_USE_SSL | LCCSCF_ALLOW_SELFSIGNED | LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK;
-	//if(security connection)
-	//	ConnInfo.ssl_connection = use_ssl;
-	//else
-		ConnInfo.ssl_connection=0;
-
-	ConnInfo.protocol = protocols[1].name;
-	ConnInfo.ietf_version_or_minus_one=-1;
-	wsi=lws_client_connect_via_info(&ConnInfo);						 
-	if (!wsi) 
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]ConnectWsServer: lws_client_connect_via_info NG");
-		#endif	
-		return 0;
-	}
-	return 1;
-}
-
-int main(int argc,char *argv[])
-{
-	unsigned int StartTime=0;
-	/**************** Initialization **********/		
-	/*if(InitShareMemory()==0)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]main:InitShareMemory NG");
-		#endif		
-		if(ShmStatusCodeData!=NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
-		}	
-		sleep(5);
-		return 0;
-	}*/	
-  	if((SendBuffer=malloc(SendBufLen))==NULL)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[Ocpp16]main: malloc(SendBufLen) NG");
-		#endif	
-		sleep(5);
-		return 0;	
-	}	
-	while(ConnectionEstablished==0)
-	{
-		if((time((time_t*)NULL)-StartTime)>=60)
-		{
-			#ifdef debug
-			printf("[OCPP16:]main:Execute ConnectWsServer1\n");
-			#endif
-			ConnectWsServer();
-			StartTime=time((time_t*)NULL);
-		}	
-		lws_service(context, 10000);//timeout_ms	
-	}
-	memset(SendBuffer,0,SendBufLen);
-	sprintf(SendBuffer,"[2,\"%s\",\"%s\",{\"chargePointVendor\":\"%s\",\"chargePointModel\":\"%s\",\"chargePointSerialNumber\":\"%s\",\"chargeBoxSerialNumber\":\"%s\",\"firmwareVersion\":\"%s\",\"imsi\":\"%s\"}]",
-					"11112222",
-					"BootNotification",
-					"CpVendor",
-					"CpModel",
-					"CpSN",
-					"CbSN",
-					"CpFwVersion",
-					"CpImsi");
-	lws_callback_on_writable(wsi);
-	while(1)
-	{
-		//prcessing
-		lws_service(context, 500);//500 timeout_ms 	
-	};
-	
-
-	free(SendBuffer);
-}

+ 0 - 248
EVSE/Projects/BYTON-GB/Apps/PsuComm.c

@@ -1,248 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/termios.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
-#include <linux/sockios.h> 
-#include <linux/socket.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/time.h> 
-#include <sys/timeb.h> 
-#include <math.h>//for pow
-#include <net/if.h>
-#include <linux/can.h>
-#include <linux/can/raw.h>
-#include <unistd.h>
-#include "../../define.h"
-
-//#define Debug
-
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-struct PsuData 				*ShmPsuData ;
-pid_t						CANReceiverPid;
-int 							CanFd;
-
-
-#ifdef SystemLogMessage
-int StoreLogMsg(unsigned char *DataString)
-{
-	unsigned char Buf[256];
-	time_t CurrentTime;
-	struct tm *tm;
-			
-	memset(Buf,0,sizeof(Buf));
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			DataString,
-			tm->tm_year+1900,tm->tm_mon+1);
-	system(Buf);
-	#ifdef Debug
-	printf("%s \n",DataString);
-	#endif
-}		
-#endif
-
-int DiffTimeb(struct timeb ST, struct timeb ET)
-{
-	//return milli-second
-	unsigned int StartTime,StopTime;
-	
-	StartTime=(unsigned int)ST.time;
-	StopTime=(unsigned int)ET.time;
-	return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
-}	
-	
-/**************************************************************************************/
-/**************************Init all share memory *********************************/
-/**************************************************************************************/
-int InitShareMemory()
-{
-	int MeterSMId;
-	
-	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitShareMemory:shmget ShmSysConfigAndInfo NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitShareMemory:shmat ShmSysConfigAndInfo NG");
-		#endif		
-		return 0;
-   	 }
-   	 //creat ShmStatusCodeData
-   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitShareMemory:shmget ShmStatusCodeData NG");
-		#endif		
-		return 0;	
-	}
-    	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitShareMemory:shmat ShmStatusCodeData NG");
-		#endif		
-		return 0;
-   	 }
-
-   	 //creat ShmPsuData
-   	 if ((MeterSMId = shmget(ShmPsuKey, sizeof(struct PsuData),  0777)) < 0) 
-    	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitShareMemory:shmget ShmPsuData NG");
-		#endif			
-		return 0;
-	}
-    	else if ((ShmPsuData = shmat(MeterSMId, NULL, 0)) == (void *) -1) 
-    	{
-    		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitShareMemory:shmat ShmPsuData NG");
-		#endif		
-		return 0;
-   	 }
-   	memset(ShmPsuData,0,sizeof(struct PsuData));
-    	return 1;
-}
-
-int InitCanBus()
-{
-	int 					s0,nbytes;
-	struct timeval			tv;
-	struct ifreq 			ifr0;
-	struct sockaddr_can	addr0;
-	
-	system("/sbin/ip link set can1 type can bitrate 500000 restart-ms 100");				  
-	system("/sbin/ip link set can1 up");
-	
-	s0 = socket(PF_CAN, SOCK_RAW, CAN_RAW);
-	
-	tv.tv_sec = 0; 
-    	tv.tv_usec = 10000; 
-   	 if (setsockopt(s0, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0) 
-    	{
-	       	#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitCanBus:Set SO_RCVTIMEO NG");
-		#endif		
-    	}
-    	nbytes=40960;
-    	if (setsockopt(s0, SOL_SOCKET,  SO_RCVBUF, &nbytes, sizeof(int)) < 0) 
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitCanBus:Set SO_RCVBUF NG");
-		#endif	
-	}
-    	nbytes=40960;
-    	if (setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0) 
-    	{
-       		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitCanBus:Set SO_SNDBUF NG");
-		#endif	
-    	}
-    
-   	strcpy(ifr0.ifr_name, "can1" );
-	ioctl(s0, SIOCGIFINDEX, &ifr0); /* ifr.ifr_ifindex gets filled with that device's index */
-	addr0.can_family = AF_CAN;
-	addr0.can_ifindex = ifr0.ifr_ifindex;
-	bind(s0, (struct sockaddr *)&addr0, sizeof(addr0));
-	return s0;
-}
-
-
-/**************************************************************/
-/************** Receiving Task*******************************/
-/*************************************************************/
-void CANReceiver(int fd)
-{
-	pid_t tmp=0;
-	struct can_frame frame;
-	struct timeb StartTime,EndTime;
-	int nbytes;
-	unsigned char FanspeedGetTime=0;
-	
-	if(CANReceiverPid==0)
-	{
-		tmp=fork();
-		if(tmp>0)
-		{
-			CANReceiverPid=tmp;	
-			{
-				unsigned char buf[64];
-				memset(buf,0,sizeof(buf));
-				sprintf(buf,"renice -20 -p %d",tmp);
-				system(buf);
-			}
-			return;
-		}
-	}
-	
-	while(1)
-	{
-		memset(&frame,0,sizeof(struct can_frame));
-		nbytes = read(fd, &frame, sizeof(struct can_frame));
-		//handle received packet
-	}
-}
-
-/**************************************************************/
-/************** main function***********************************/
-/*************************************************************/
-int main(int argc,char *argv[])
-{
-	int CanFd;
-	struct can_frame frame;
-
-	
-	//Initialization
-	if(InitShareMemory()==0)
-	{
-		#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]main:InitShareMemory NG");
-		#endif		
-		if(ShmStatusCodeData!=NULL)
-		{
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
-		}	
-		sleep(5);
-		return 0;
-	}	
-	CanFd=InitCanBus();
-	CANReceiverPid=0;
-	CANReceiver(CanFd);
-
-	//main loop
-	while(1)
-	{
-		//processing
-	}
-	
-EndProcess:	
-	if(CANReceiverPid>0)
-	{
-		char Buf[32];
-		memset(Buf,0,32);
-		sprintf(Buf,"kill %d",CANReceiverPid);
-		system(Buf);
-	}
-	close(CanFd); 
-	system("/sbin/ip link set can1 down");
-	system("/sbin/ip link set can1 type can bitrate 500000 restart-ms 100");
-	system("/sbin/ip link set can1 up");
-	system("/sbin/ip link set can1 down");
-	system("killall PsuComm");
-}

+ 0 - 69
EVSE/Projects/BYTON-GB/Apps/UpdateRootfs.c

@@ -1,69 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/termios.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
-#include <linux/sockios.h> 
-#include <linux/socket.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/time.h> 
-#include <sys/timeb.h> 
-#include <math.h>//for pow
-#include "../../define.h"
-
-
-int main(int argc,char *argv[])
-{
-	unsigned int MaxLen=25*1024*1024, ImageLen=0;
-	unsigned char *ptr; 
-	int fd,wrd;
-	
-	ptr=malloc(MaxLen);
-	if(ptr==NULL)
-	{
-		printf("UpdateRootfs NG - can not malloc\n");
-		return 0;
-	}	
-	memset(ptr,0xFF,MaxLen);
-	
-	fd = open(argv[1], O_RDONLY);
-	if(fd < 0)
-	{
-		printf("UpdateRootfs NG - can not open rootfs\n");
-		free(ptr);
-		return 0;
-	}
-    	ImageLen=read(fd,ptr,MaxLen);
-	close(fd);	
-	printf("ImageLen=0x%x\n",ImageLen);
-	if(ImageLen<(24*1024*1024))
-	{
-		printf("ImageLen size mismatch\n");
-		free(ptr);
-		return 0;
-	}	
-	fd = open("/dev/mtdblock8", O_RDWR);
-	if (fd < 0) 
-	{
-		printf("UpdateRootfs NG - can not open mtdblock8\n");
-		free(ptr);
-		return 0;
-    	}
-    	wrd=write(fd, ptr, ImageLen);   
-    	close(fd);
-   	if(wrd!=ImageLen)
-	{	
-		printf("UpdateRootfs NG - wrd(0x%x) != ImageLen(0x%x)\n",wrd,ImageLen);
-		free(ptr);
-		return 0;
-	}	
-	free(ptr);
-	printf("UpdateRootfs OK\n");
-}

BIN
EVSE/Projects/BYTON-GB/Apps/ccs


+ 0 - 59
EVSE/Projects/BYTON-GB/Apps/ccs.c

@@ -1,59 +0,0 @@
-// raw_sock.c
-#include<stdio.h>
-#include<stdlib.h>
-#include<string.h>
-#include<netinet/ip.h>
-#include<sys/socket.h>
-#include<arpa/inet.h>
-#include <unistd.h>
-
-int main() {
-    // Structs that contain source IP addresses
-    struct sockaddr_in source_socket_address, dest_socket_address;
-
-    int packet_size;
-	struct timeval			tv;
-    // Allocate string buffer to hold incoming packet data
-    unsigned char *buffer = (unsigned char *)malloc(65536);
-    // Open the raw socket
-    int sock = socket (PF_INET, SOCK_RAW, IPPROTO_TCP);
-    tv.tv_sec = 0; 
-    	tv.tv_usec = 10000; 
-   	 if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0) 
-    	{
-	       	#ifdef SystemLogMessage	
-		StoreLogMsg("[PsuCOmm]InitCanBus:Set SO_RCVTIMEO NG");
-		#endif		
-    	}
-    if(sock == -1)
-    {
-        //socket creation failed, may be because of non-root privileges
-        printf("Failed to create socket\n");
-        return 1;
-    }
-    while(1) {
-      // recvfrom is used to read data from a socket
-      packet_size = recvfrom(sock , buffer , 65536 , 0 , NULL, NULL);
-      if (packet_size == -1) 
-      {
-		printf("Failed to get packets\n");
-		sleep(5);
-        	continue;
-      }
- 	printf("get packets, packet_size=%d\n",packet_size);
-      struct iphdr *ip_packet = (struct iphdr *)buffer;
-
-      memset(&source_socket_address, 0, sizeof(source_socket_address));
-      source_socket_address.sin_addr.s_addr = ip_packet->saddr;
-      memset(&dest_socket_address, 0, sizeof(dest_socket_address));
-      dest_socket_address.sin_addr.s_addr = ip_packet->daddr;
-
-      printf("Incoming Packet: \n");
-      printf("Packet Size (bytes): %d\n",ntohs(ip_packet->tot_len));
-      printf("Source Address: %s\n", (char *)inet_ntoa(source_socket_address.sin_addr));
-      printf("Destination Address: %s\n", (char *)inet_ntoa(dest_socket_address.sin_addr));
-      printf("Identification: %d\n\n", ntohs(ip_packet->id));
-    }
-
-    return 0;
-}

BIN
EVSE/Projects/BYTON-GB/Apps/main


File diff suppressed because it is too large
+ 524 - 390
EVSE/Projects/BYTON-GB/Apps/main.c


+ 393 - 0
EVSE/Projects/BYTON-GB/Apps/main.h

@@ -0,0 +1,393 @@
+/*
+ * Config.h
+ *
+ *  Created on: 2019年12月25日
+ *      Author: EasonYang
+ */
+
+#ifndef CONFIG_MAIN_H_
+#define CONFIG_MAIN_H_
+
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+#include	<dirent.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>      /*標準輸入輸出定義*/
+#include    <stdlib.h>     /*標準函數庫定義*/
+#include    <unistd.h>     /*Unix 標準函數定義*/
+#include    <fcntl.h>      /*檔控制定義*/
+#include    <termios.h>    /*PPSIX 終端控制定義*/
+#include    <errno.h>      /*錯誤號定義*/
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	<stdbool.h>
+#include	<stddef.h>
+#include	<stdint.h>
+
+//==========================
+//	Define system mode constant
+//==========================
+#define MODE_BOOTING				0
+#define MODE_IDLE					1
+#define MODE_AUTHORIZING			2
+#define MODE_PREPARING				3
+#define MODE_CHARGING				4
+#define MODE_TERMINATING			5
+#define MODE_ALARM					6
+#define MODE_FAULT					7
+#define MODE_RESERVATION			8
+#define MODE_BOOKING				9
+#define MODE_MAINTAIN				10
+#define MODE_DEBUG					11
+
+//===================================
+//	Define CP State constant
+//===================================
+#define CP_STATE_UNKNOWN			0
+#define CP_STATE_A					1
+#define CP_STATE_B					2
+#define CP_STATE_C					3
+#define CP_STATE_D					4
+#define CP_STATE_E					5
+#define CP_STATE_F					6
+
+//===================================
+// Define start mode constant
+//===================================
+#define START_METHOD_MANUAL 		0
+#define START_METHOD_RFID	 		1
+#define START_METHOD_BACKEND 		2
+#define START_METHOD_BLE	 		3
+
+//===================================
+// Define Speaker type constant
+//===================================
+#define SPEAKER_STOP				0
+#define SPEAKER_ALWAYS_ON			1
+#define SPEAKER_SHORT				2
+#define SPEAKER_LONG				3
+#define SPEAKER_INTERVAL_SHORT		4
+#define SPEAKER_INTERVAL_LONG		5
+#define SPEAKER_INTERVAL_3COUNT		6
+
+//===================================
+// Define Alarm code constant
+//===================================
+#define ALARM_OVER_VOLTAGE          0x000001
+#define ALARM_UNDER_VOLTAGE         0x000002
+#define ALARM_OVER_CURRENT          0x000004
+#define ALARM_OVER_TEMPERATURE      0x000008
+#define ALARM_GROUND_FAIL           0x000010
+#define ALARM_CP_ERROR              0x000020
+#define ALARM_CURRENT_LEAK_AC       0x000040
+#define ALARM_CURRENT_LEAK_DC       0x000080
+#define ALARM_MCU_TESTFAIL          0x000100
+#define ALARM_HANDSHAKE_TIMEOUT     0x000200
+#define ALARM_EMERGENCY_STOP        0x000400
+#define ALARM_RELAY_STATUS          0x000800
+#define ALARM_LEAK_MODULE_FAIL      0x001000
+#define ALARM_SHUTTER_FAULT         0x002000
+#define ALARM_LOCKER_FAULT          0x004000
+#define ALARM_POWER_DROP            0x008000
+#define ALARM_CIRCUIT_SHORT         0x010000
+#define ALARM_ROTATORY_SWITCH_FAULT 0x020000
+#define ALARM_RELAY_DRIVE_FAULT     0x040000
+
+//===================================
+// Define Led constant
+//===================================
+#define LED_ACTION_INIT             	0
+#define LED_ACTION_IDLE             	1
+#define LED_ACTION_AUTHED           	2
+#define LED_ACTION_CONNECTED        	3
+#define LED_ACTION_CHARGING         	4
+#define LED_ACTION_STOP             	5
+#define LED_ACTION_ALARM            	6
+#define LED_ACTION_MAINTAIN         	7
+#define LED_ACTION_RFID_PASS        	8
+#define LED_ACTION_RFID_FAIL        	9
+#define LED_ACTION_BLE_CONNECT      	10
+#define LED_ACTION_BLE_DISABLE      	11
+#define LED_ACTION_DEBUG            	12
+#define LED_ACTION_ALL_OFF          	13
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+
+extern int StoreLogMsg(const char *fmt, ...);
+
+
+//============================================================
+// Private shared memory key define
+//============================================================
+#define ShmChargerKey		2001
+
+typedef struct Verion
+{
+	char Version_FW[32];
+	char Version_HW[32];
+}Ver;
+
+typedef struct PRESENTINPUTVOLTAGE
+{
+	unsigned char inputType;	// 0x00: Line to Line       0x01: Line to Neutral
+	double L1N_L12;
+	double L2N_L23;
+	double L3N_L31;
+}PresentInputVoltage;
+
+typedef struct PRESENTOUTPUTVOLTAGE
+{
+	double behindFuse_Voltage_C1;
+	double behindRelay_Voltage_C1;
+	double behindFuse_Voltage_C2;
+	double behindRelay_Voltage_C2;
+}PresentOutputVoltage;
+
+typedef struct FANSPEED
+{
+	unsigned short int speed[4];
+}FanSpeed;
+
+typedef struct TEMPERATURE
+{
+	unsigned char point[8];
+}Temperature;
+
+typedef struct AUXPOWER
+{
+	unsigned char voltage[8];
+}AuxPower;
+
+typedef struct RELAY
+{
+	unsigned char relay_status[2][8];
+}Relay;
+
+typedef struct GFD
+{
+	unsigned short int adc_value_positive[2];
+	unsigned short int adc_value_negative[2];
+}Gfd;
+
+typedef struct GPIO_IN
+{
+	unsigned char AC_Connector;
+	unsigned char AC_MainBreaker;
+	unsigned char SPD;
+	unsigned char Door_Open;
+	unsigned char GFD[2];
+	unsigned char Button[2];
+	unsigned char Button_Emergency;
+}Gpio_in;
+
+typedef struct GPIO_OUT
+{
+	unsigned char AC_Connector;
+	unsigned char Button_LED[2];
+	unsigned char System_LED[4];
+}Gpio_out;
+
+typedef struct ALARM_LOG
+{
+	unsigned char logArea;
+	unsigned int alarmIndex;
+	unsigned char log[8];
+}Alarm_Log;
+
+typedef struct BLE_CONFIG_DATA
+{
+	unsigned char isLogin:1;
+	unsigned char isRequestStart:1;
+	unsigned char isRequestStop:1;
+}Ble_Config_Data;
+
+typedef struct BLE_LONGIN_CENTRAL_ID
+{
+	unsigned char id[32];
+}Ble_Login_Central_Id;
+
+typedef struct RTC
+{
+	unsigned short int year;
+	unsigned char month;
+	unsigned char day;
+	unsigned char hour;
+	unsigned char min;
+	unsigned char sec;
+}Rtc;
+
+typedef struct PRESENTOUTPUTCURRENT
+{
+	double L1N_L12[2];
+	double L2N_L23[2];
+	double L3N_L31[2];
+}Presentoutputcurrent;
+
+typedef struct AC_PRIMARY_MCU
+{
+	unsigned char cp_state;
+	unsigned int  current_limit;
+	unsigned int  cp_voltage_positive;
+	unsigned int  cp_voltage_negtive;
+	unsigned char locker_state;
+	unsigned char relay_state;
+	unsigned char shutter_state;
+	unsigned char meter_state;
+	unsigned char pp_state;
+	unsigned char rating_current;
+}Ac_Primary_Mcu;
+
+typedef struct AC_PRIMARY_MCU_ALARM
+{
+	union
+	{
+		unsigned long InputAlarmCode;
+		struct
+		{
+			unsigned long OVP:1;
+			unsigned long UVP:1;
+			unsigned long OCP:1;
+			unsigned long OTP:1;
+			unsigned long gmi_fault:1;
+			unsigned long cp_fault:1;
+			unsigned long ac_leak:1;
+			unsigned long dc_leak:1;
+			unsigned long mcu_selftest_fail:1;
+			unsigned long handshaking_timeout:1;
+			unsigned long emergency_stop:1;
+			unsigned long relay_welding:1;
+			unsigned long leak_module_fail:1;
+			unsigned long shutter_fault:1;
+			unsigned long locker_fault:1;
+			unsigned long power_drop:1;
+			unsigned long circuit_short:1;
+			unsigned long set_circuit:1;
+			unsigned long relay_drive_fault:1;
+			unsigned long comm_timeout:1;
+		}bits;
+	};
+}Ac_Primary_Mcu_Alarm;
+
+typedef struct AC_PRIMARY_MCU_LED
+{
+	unsigned char mode;
+	unsigned long alarm_code;
+}Ac_Primary_Mcu_Led;
+
+typedef struct EVSE_ID
+{
+	unsigned char model_name[14];
+	unsigned char serial_number[12];
+}Evse_Id;
+
+typedef struct AC_PRIMARY_MCU_CP_PWM_DUTY
+{
+	unsigned int max_current;
+}Ac_Primary_Mcu_Cp_Pwm_Duty;
+
+typedef struct LEGACY_REQUEST
+{
+	unsigned char isLegacyRequest:1;
+}Legacy_Request;
+
+typedef struct POWER_CONSUMPTION
+{
+	uint32_t power_consumption;
+
+}Power_Consumption;
+
+typedef struct MCU_OP_FLAG
+{
+	unsigned char isSetModePass:1;
+	unsigned char isSetSerialNumberPass:1;
+	unsigned char isSetModelNamePass:1;
+	unsigned char isReadFwVerPass:1;
+	unsigned char isMcuUpgradeReq:1;
+}Mcu_Op_Flag;
+
+typedef struct SYSTEM_ALARM_CODE
+{
+	unsigned long SystemAlarmCode;
+
+}System_Alarm_Code;
+
+typedef struct OTHER_ALARM_CODE
+{
+	unsigned char isMcuSelfTest:1;
+	unsigned char isCurrentShort:1;
+	unsigned char isLeakageModule:1;
+	unsigned char isShutter:1;
+	unsigned char isLocker:1;
+	unsigned char isRotatorySwitchr:1;
+	unsigned char isPowerDrop:1;
+	unsigned char isOverCurrent:1;
+	unsigned char isHandshakingTimeOut:1;
+	unsigned char HandShakingAlarmRequest:1;
+}Other_Alarm_Code;
+
+typedef struct PILOT_VOLTAGE
+{
+	float PilotVoltagePositive;
+	float PilotVoltageNegative;
+
+}Pilot_Voltage;
+
+typedef struct FW_UPGRADE_INFO
+{
+	int fwType;
+	char modelName[17];
+	char location[384];
+}Fw_Upgrade_Info;
+
+typedef struct GUN_INFO
+{
+	Ver 											ver;
+	PresentInputVoltage 							inputVoltage;
+	Presentoutputcurrent							outputCurrent;
+	Temperature 									temperature;
+	Ble_Config_Data									bleConfigData;
+	Ble_Login_Central_Id							bleLoginCentralId;
+	Rtc												rtc;
+	Ac_Primary_Mcu									primaryMcuState;
+	Ac_Primary_Mcu_Alarm							primaryMcuAlarm;
+	Ac_Primary_Mcu_Led								primaryMcuLed;
+	Mcu_Op_Flag										mcuFlag;
+	Power_Consumption								powerConsumption;
+	Legacy_Request									legacyRequest;
+	System_Alarm_Code								systemAlarmCode;
+	Ac_Primary_Mcu_Cp_Pwm_Duty						primaryMcuCp_Pwn_Duty;
+	Other_Alarm_Code								otherAlarmCode;
+	Pilot_Voltage									PilotVoltage;
+}Gun_Info;
+
+struct Charger
+{
+	Ver 					ver;
+	Evse_Id					evseId;
+	Gun_Info 				gun_info[2];
+	Fw_Upgrade_Info			fwUpgradeInfo;
+	unsigned char			rfidReq:1;
+
+	unsigned char 			speaker_type;
+	unsigned char			isSpeakerOn:1;
+};
+
+#endif /* CONFIG_MAIN_H_ */

BIN
EVSE/Projects/BYTON-GB/Images/MLO


BIN
EVSE/Projects/BYTON-GB/Images/am335x-evm.dtb


BIN
EVSE/Projects/BYTON-GB/Images/ramdisk.gz


BIN
EVSE/Projects/BYTON-GB/Images/u-boot.img


BIN
EVSE/Projects/BYTON-GB/Images/zImage


BIN
EVSE/rootfs/root/Module_4g


BIN
EVSE/rootfs/root/Module_Wifi


BIN
EVSE/rootfs/root/OcppBackend


BIN
EVSE/rootfs/root/WebService


BIN
EVSE/rootfs/root/logPackTools


+ 149 - 149
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_System.map

@@ -34572,155 +34572,155 @@ c0a00000 R __start_rodata
 c0a00000 A __start_rodata_section_aligned
 c0a00000 R _etext
 c0a00010 R linux_proc_banner
-c0a00068 R linux_banner
-c0a000fc r __func__.5825
-c0a0010c r sqrt_oddadjust
-c0a0012c r sqrt_evenadjust
-c0a0014c r __func__.5807
-c0a0015c r cc_map
-c0a0017c r isa_modes
-c0a0018c r processor_modes
-c0a0020c r sigpage_mapping
-c0a0021c r regoffset_table
-c0a002b4 r user_arm_view
-c0a002c8 r arm_regsets
-c0a00334 r hwcap_str
-c0a00390 r hwcap2_str
-c0a003a8 r proc_arch
-c0a003ec R cpuinfo_op
-c0a003fc R sigreturn_codes
-c0a00418 r handler
-c0a0042c r atags_fops
-c0a004a4 r pmresrn_table.31150
-c0a004b4 r pmresrn_table.31002
-c0a004c0 r scorpion_perf_cache_map
-c0a00568 r scorpion_perf_map
-c0a00590 r krait_perf_cache_map
-c0a00638 r krait_perf_map
-c0a00660 r krait_perf_map_no_branch
-c0a00688 r armv7_a5_perf_cache_map
-c0a00730 r armv7_a5_perf_map
-c0a00758 r armv7_a7_perf_cache_map
-c0a00800 r armv7_a7_perf_map
-c0a00828 r armv7_a8_perf_cache_map
-c0a008d0 r armv7_a8_perf_map
-c0a008f8 r armv7_a9_perf_cache_map
-c0a009a0 r armv7_a9_perf_map
-c0a009c8 r armv7_a12_perf_cache_map
-c0a00a70 r armv7_a12_perf_map
-c0a00a98 r armv7_a15_perf_cache_map
-c0a00b40 r armv7_a15_perf_map
-c0a00b68 r armv7_pmu_probe_table
-c0a00b8c r armv7_pmu_of_device_ids
-c0a013f8 r usermode_action
-c0a01410 r alignment_proc_fops
-c0a01488 r subset.21772
-c0a014a8 r subset.21782
-c0a014b8 r __param_str_alignment
-c0a014c4 r cpu_arch_name
-c0a014ca r cpu_elf_name
-c0a014d0 r l2c220_data
-c0a01518 r omap_types
-c0a0152c r __func__.28508
-c0a01544 r __func__.29284
-c0a01564 r __func__.29289
-c0a01584 r am33xx_control_reg_offsets
-c0a01644 r am43xx_control_reg_offsets
-c0a01720 r omap_scrm_dt_match_table
-c0a01ec8 r omap2_ctrl_data
-c0a01ed0 r omap_mux_dbg_signal_fops
-c0a01f48 r omap_mux_dbg_board_fops
-c0a01fc0 r __func__.28699
-c0a01fd4 r __func__.28741
-c0a01fec r __func__.28758
-c0a02004 r __func__.28788
-c0a02018 r __func__.29075
-c0a0202c r __func__.29089
-c0a02040 r __func__.29126
-c0a02050 r __func__.29002
-c0a02068 r __func__.29015
-c0a02084 r __func__.29102
-c0a02098 r __func__.30036
-c0a020b8 r __func__.30084
-c0a020cc r __func__.30078
-c0a020dc r __func__.36712
-c0a020f0 r omap_pm_ops
-c0a02118 r reg_map
-c0a021ec r __func__.31257
-c0a02208 r __func__.27253
-c0a02220 r __func__.27271
-c0a02238 r __func__.28011
-c0a02248 r name
-c0a02254 r __func__.27252
-c0a02268 r __func__.36709
-c0a02278 r modck.36708
-c0a02280 r __func__.37246
-c0a0229c r __func__.28074
-c0a022b4 r __func__.28070
-c0a022d0 r __func__.28103
-c0a022e4 r __func__.28109
-c0a022f8 r __func__.28161
-c0a02310 r __func__.28135
-c0a02330 r __func__.25577
-c0a02344 r __func__.23975
-c0a02364 r __func__.23985
-c0a02380 r __func__.30938
-c0a02390 r debug_fops
-c0a02408 r pm_dbg_option_fops
-c0a02480 r pwrdm_suspend_fops
-c0a024f8 r pwrdm_state_names
-c0a02508 r __func__.30154
-c0a02520 r __func__.30166
-c0a02540 r __func__.30177
-c0a02564 r __func__.30189
-c0a02580 r __func__.30203
-c0a0259c r __func__.30215
-c0a025bc r __func__.30227
-c0a025d4 r __func__.30239
-c0a025ec r __func__.30248
-c0a02608 r __func__.30257
-c0a02624 r __func__.19941
-c0a02638 r __func__.19953
-c0a02654 r __func__.19965
-c0a02670 r __func__.19977
-c0a02688 r __func__.19988
-c0a026a0 r __func__.28041
-c0a026b4 r __func__.28049
-c0a026c4 r __func__.28057
-c0a026d4 r __func__.28062
-c0a026f0 r __func__.28068
-c0a0270c r __func__.28076
-c0a02728 r __func__.28081
-c0a02740 r __func__.14518
-c0a02754 r __func__.14345
-c0a02768 r __func__.14379
-c0a02780 r __func__.14532
-c0a02798 r __func__.14512
-c0a027ac r __func__.27364
-c0a027bc r __func__.27389
-c0a027d8 r __func__.27402
-c0a027e8 r __func__.27409
-c0a027f8 r __func__.34357
-c0a02810 r __func__.34364
-c0a02830 r __func__.27872
-c0a02844 r __func__.29301
-c0a02854 r __func__.36945
-c0a02868 r __func__.36957
-c0a02878 r __func__.36800
-c0a0288c r __func__.26969
-c0a028a4 r __func__.26938
-c0a028bc r __func__.26928
-c0a028d0 r omap_timer_match
-c0a02ef0 r __func__.27014
-c0a02f04 r __func__.26797
-c0a02f1c r __func__.26943
-c0a02f38 r __func__.26966
-c0a02f54 r __func__.26977
-c0a02f70 r CSWTCH.92
-c0a02f7c r __func__.26836
-c0a02f98 r __func__.26648
-c0a02fb4 r __func__.26712
-c0a02fd4 r omap3plus_pdata
+c0a0006c R linux_banner
+c0a00100 r __func__.5825
+c0a00110 r sqrt_oddadjust
+c0a00130 r sqrt_evenadjust
+c0a00150 r __func__.5807
+c0a00160 r cc_map
+c0a00180 r isa_modes
+c0a00190 r processor_modes
+c0a00210 r sigpage_mapping
+c0a00220 r regoffset_table
+c0a002b8 r user_arm_view
+c0a002cc r arm_regsets
+c0a00338 r hwcap_str
+c0a00394 r hwcap2_str
+c0a003ac r proc_arch
+c0a003f0 R cpuinfo_op
+c0a00400 R sigreturn_codes
+c0a0041c r handler
+c0a00430 r atags_fops
+c0a004a8 r pmresrn_table.31150
+c0a004b8 r pmresrn_table.31002
+c0a004c4 r scorpion_perf_cache_map
+c0a0056c r scorpion_perf_map
+c0a00594 r krait_perf_cache_map
+c0a0063c r krait_perf_map
+c0a00664 r krait_perf_map_no_branch
+c0a0068c r armv7_a5_perf_cache_map
+c0a00734 r armv7_a5_perf_map
+c0a0075c r armv7_a7_perf_cache_map
+c0a00804 r armv7_a7_perf_map
+c0a0082c r armv7_a8_perf_cache_map
+c0a008d4 r armv7_a8_perf_map
+c0a008fc r armv7_a9_perf_cache_map
+c0a009a4 r armv7_a9_perf_map
+c0a009cc r armv7_a12_perf_cache_map
+c0a00a74 r armv7_a12_perf_map
+c0a00a9c r armv7_a15_perf_cache_map
+c0a00b44 r armv7_a15_perf_map
+c0a00b6c r armv7_pmu_probe_table
+c0a00b90 r armv7_pmu_of_device_ids
+c0a013fc r usermode_action
+c0a01414 r alignment_proc_fops
+c0a0148c r subset.21772
+c0a014ac r subset.21782
+c0a014bc r __param_str_alignment
+c0a014c8 r cpu_arch_name
+c0a014ce r cpu_elf_name
+c0a014d4 r l2c220_data
+c0a0151c r omap_types
+c0a01530 r __func__.28508
+c0a01548 r __func__.29284
+c0a01568 r __func__.29289
+c0a01588 r am33xx_control_reg_offsets
+c0a01648 r am43xx_control_reg_offsets
+c0a01724 r omap_scrm_dt_match_table
+c0a01ecc r omap2_ctrl_data
+c0a01ed4 r omap_mux_dbg_signal_fops
+c0a01f4c r omap_mux_dbg_board_fops
+c0a01fc4 r __func__.28699
+c0a01fd8 r __func__.28741
+c0a01ff0 r __func__.28758
+c0a02008 r __func__.28788
+c0a0201c r __func__.29075
+c0a02030 r __func__.29089
+c0a02044 r __func__.29126
+c0a02054 r __func__.29002
+c0a0206c r __func__.29015
+c0a02088 r __func__.29102
+c0a0209c r __func__.30036
+c0a020bc r __func__.30084
+c0a020d0 r __func__.30078
+c0a020e0 r __func__.36712
+c0a020f4 r omap_pm_ops
+c0a0211c r reg_map
+c0a021f0 r __func__.31257
+c0a0220c r __func__.27253
+c0a02224 r __func__.27271
+c0a0223c r __func__.28011
+c0a0224c r name
+c0a02258 r __func__.27252
+c0a0226c r __func__.36709
+c0a0227c r modck.36708
+c0a02284 r __func__.37246
+c0a022a0 r __func__.28074
+c0a022b8 r __func__.28070
+c0a022d4 r __func__.28103
+c0a022e8 r __func__.28109
+c0a022fc r __func__.28161
+c0a02314 r __func__.28135
+c0a02334 r __func__.25577
+c0a02348 r __func__.23975
+c0a02368 r __func__.23985
+c0a02384 r __func__.30938
+c0a02394 r debug_fops
+c0a0240c r pm_dbg_option_fops
+c0a02484 r pwrdm_suspend_fops
+c0a024fc r pwrdm_state_names
+c0a0250c r __func__.30154
+c0a02524 r __func__.30166
+c0a02544 r __func__.30177
+c0a02568 r __func__.30189
+c0a02584 r __func__.30203
+c0a025a0 r __func__.30215
+c0a025c0 r __func__.30227
+c0a025d8 r __func__.30239
+c0a025f0 r __func__.30248
+c0a0260c r __func__.30257
+c0a02628 r __func__.19941
+c0a0263c r __func__.19953
+c0a02658 r __func__.19965
+c0a02674 r __func__.19977
+c0a0268c r __func__.19988
+c0a026a4 r __func__.28041
+c0a026b8 r __func__.28049
+c0a026c8 r __func__.28057
+c0a026d8 r __func__.28062
+c0a026f4 r __func__.28068
+c0a02710 r __func__.28076
+c0a0272c r __func__.28081
+c0a02744 r __func__.14518
+c0a02758 r __func__.14345
+c0a0276c r __func__.14379
+c0a02784 r __func__.14532
+c0a0279c r __func__.14512
+c0a027b0 r __func__.27364
+c0a027c0 r __func__.27389
+c0a027dc r __func__.27402
+c0a027ec r __func__.27409
+c0a027fc r __func__.34357
+c0a02814 r __func__.34364
+c0a02834 r __func__.27872
+c0a02848 r __func__.29301
+c0a02858 r __func__.36945
+c0a0286c r __func__.36957
+c0a0287c r __func__.36800
+c0a02890 r __func__.26969
+c0a028a8 r __func__.26938
+c0a028c0 r __func__.26928
+c0a028d4 r omap_timer_match
+c0a02ef4 r __func__.27014
+c0a02f08 r __func__.26797
+c0a02f20 r __func__.26943
+c0a02f3c r __func__.26966
+c0a02f58 r __func__.26977
+c0a02f74 r CSWTCH.92
+c0a02f80 r __func__.26836
+c0a02f9c r __func__.26648
+c0a02fb8 r __func__.26712
+c0a02fd8 r omap3plus_pdata
 c0a02fe8 r execdomains_proc_fops
 c0a03060 r tnts
 c0a03090 r __param_str_crash_kexec_post_notifiers

+ 149 - 149
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms1.S

@@ -34580,155 +34580,155 @@ kallsyms_offsets:
 	.long	0x9f8000
 	.long	0x9f8000
 	.long	0x9f8010
-	.long	0x9f8068
-	.long	0x9f80fc
-	.long	0x9f810c
-	.long	0x9f812c
-	.long	0x9f814c
-	.long	0x9f815c
-	.long	0x9f817c
-	.long	0x9f818c
-	.long	0x9f820c
-	.long	0x9f821c
-	.long	0x9f82b4
-	.long	0x9f82c8
-	.long	0x9f8334
-	.long	0x9f8390
-	.long	0x9f83a8
-	.long	0x9f83ec
-	.long	0x9f83fc
-	.long	0x9f8418
-	.long	0x9f842c
-	.long	0x9f84a4
-	.long	0x9f84b4
-	.long	0x9f84c0
-	.long	0x9f8568
-	.long	0x9f8590
-	.long	0x9f8638
-	.long	0x9f8660
-	.long	0x9f8688
-	.long	0x9f8730
-	.long	0x9f8758
-	.long	0x9f8800
-	.long	0x9f8828
-	.long	0x9f88d0
-	.long	0x9f88f8
-	.long	0x9f89a0
-	.long	0x9f89c8
-	.long	0x9f8a70
-	.long	0x9f8a98
-	.long	0x9f8b40
-	.long	0x9f8b68
-	.long	0x9f8b8c
-	.long	0x9f93f8
-	.long	0x9f9410
-	.long	0x9f9488
-	.long	0x9f94a8
-	.long	0x9f94b8
-	.long	0x9f94c4
-	.long	0x9f94ca
-	.long	0x9f94d0
-	.long	0x9f9518
-	.long	0x9f952c
-	.long	0x9f9544
-	.long	0x9f9564
-	.long	0x9f9584
-	.long	0x9f9644
-	.long	0x9f9720
-	.long	0x9f9ec8
-	.long	0x9f9ed0
-	.long	0x9f9f48
-	.long	0x9f9fc0
-	.long	0x9f9fd4
-	.long	0x9f9fec
-	.long	0x9fa004
-	.long	0x9fa018
-	.long	0x9fa02c
-	.long	0x9fa040
-	.long	0x9fa050
-	.long	0x9fa068
-	.long	0x9fa084
-	.long	0x9fa098
-	.long	0x9fa0b8
-	.long	0x9fa0cc
-	.long	0x9fa0dc
-	.long	0x9fa0f0
-	.long	0x9fa118
-	.long	0x9fa1ec
-	.long	0x9fa208
-	.long	0x9fa220
-	.long	0x9fa238
-	.long	0x9fa248
-	.long	0x9fa254
-	.long	0x9fa268
-	.long	0x9fa278
-	.long	0x9fa280
-	.long	0x9fa29c
-	.long	0x9fa2b4
-	.long	0x9fa2d0
-	.long	0x9fa2e4
-	.long	0x9fa2f8
-	.long	0x9fa310
-	.long	0x9fa330
-	.long	0x9fa344
-	.long	0x9fa364
-	.long	0x9fa380
-	.long	0x9fa390
-	.long	0x9fa408
-	.long	0x9fa480
-	.long	0x9fa4f8
-	.long	0x9fa508
-	.long	0x9fa520
-	.long	0x9fa540
-	.long	0x9fa564
-	.long	0x9fa580
-	.long	0x9fa59c
-	.long	0x9fa5bc
-	.long	0x9fa5d4
-	.long	0x9fa5ec
-	.long	0x9fa608
-	.long	0x9fa624
-	.long	0x9fa638
-	.long	0x9fa654
-	.long	0x9fa670
-	.long	0x9fa688
-	.long	0x9fa6a0
-	.long	0x9fa6b4
-	.long	0x9fa6c4
-	.long	0x9fa6d4
-	.long	0x9fa6f0
-	.long	0x9fa70c
-	.long	0x9fa728
-	.long	0x9fa740
-	.long	0x9fa754
-	.long	0x9fa768
-	.long	0x9fa780
-	.long	0x9fa798
-	.long	0x9fa7ac
-	.long	0x9fa7bc
-	.long	0x9fa7d8
-	.long	0x9fa7e8
-	.long	0x9fa7f8
-	.long	0x9fa810
-	.long	0x9fa830
-	.long	0x9fa844
-	.long	0x9fa854
-	.long	0x9fa868
-	.long	0x9fa878
-	.long	0x9fa88c
-	.long	0x9fa8a4
-	.long	0x9fa8bc
-	.long	0x9fa8d0
-	.long	0x9faef0
-	.long	0x9faf04
-	.long	0x9faf1c
-	.long	0x9faf38
-	.long	0x9faf54
-	.long	0x9faf70
-	.long	0x9faf7c
-	.long	0x9faf98
-	.long	0x9fafb4
-	.long	0x9fafd4
+	.long	0x9f806c
+	.long	0x9f8100
+	.long	0x9f8110
+	.long	0x9f8130
+	.long	0x9f8150
+	.long	0x9f8160
+	.long	0x9f8180
+	.long	0x9f8190
+	.long	0x9f8210
+	.long	0x9f8220
+	.long	0x9f82b8
+	.long	0x9f82cc
+	.long	0x9f8338
+	.long	0x9f8394
+	.long	0x9f83ac
+	.long	0x9f83f0
+	.long	0x9f8400
+	.long	0x9f841c
+	.long	0x9f8430
+	.long	0x9f84a8
+	.long	0x9f84b8
+	.long	0x9f84c4
+	.long	0x9f856c
+	.long	0x9f8594
+	.long	0x9f863c
+	.long	0x9f8664
+	.long	0x9f868c
+	.long	0x9f8734
+	.long	0x9f875c
+	.long	0x9f8804
+	.long	0x9f882c
+	.long	0x9f88d4
+	.long	0x9f88fc
+	.long	0x9f89a4
+	.long	0x9f89cc
+	.long	0x9f8a74
+	.long	0x9f8a9c
+	.long	0x9f8b44
+	.long	0x9f8b6c
+	.long	0x9f8b90
+	.long	0x9f93fc
+	.long	0x9f9414
+	.long	0x9f948c
+	.long	0x9f94ac
+	.long	0x9f94bc
+	.long	0x9f94c8
+	.long	0x9f94ce
+	.long	0x9f94d4
+	.long	0x9f951c
+	.long	0x9f9530
+	.long	0x9f9548
+	.long	0x9f9568
+	.long	0x9f9588
+	.long	0x9f9648
+	.long	0x9f9724
+	.long	0x9f9ecc
+	.long	0x9f9ed4
+	.long	0x9f9f4c
+	.long	0x9f9fc4
+	.long	0x9f9fd8
+	.long	0x9f9ff0
+	.long	0x9fa008
+	.long	0x9fa01c
+	.long	0x9fa030
+	.long	0x9fa044
+	.long	0x9fa054
+	.long	0x9fa06c
+	.long	0x9fa088
+	.long	0x9fa09c
+	.long	0x9fa0bc
+	.long	0x9fa0d0
+	.long	0x9fa0e0
+	.long	0x9fa0f4
+	.long	0x9fa11c
+	.long	0x9fa1f0
+	.long	0x9fa20c
+	.long	0x9fa224
+	.long	0x9fa23c
+	.long	0x9fa24c
+	.long	0x9fa258
+	.long	0x9fa26c
+	.long	0x9fa27c
+	.long	0x9fa284
+	.long	0x9fa2a0
+	.long	0x9fa2b8
+	.long	0x9fa2d4
+	.long	0x9fa2e8
+	.long	0x9fa2fc
+	.long	0x9fa314
+	.long	0x9fa334
+	.long	0x9fa348
+	.long	0x9fa368
+	.long	0x9fa384
+	.long	0x9fa394
+	.long	0x9fa40c
+	.long	0x9fa484
+	.long	0x9fa4fc
+	.long	0x9fa50c
+	.long	0x9fa524
+	.long	0x9fa544
+	.long	0x9fa568
+	.long	0x9fa584
+	.long	0x9fa5a0
+	.long	0x9fa5c0
+	.long	0x9fa5d8
+	.long	0x9fa5f0
+	.long	0x9fa60c
+	.long	0x9fa628
+	.long	0x9fa63c
+	.long	0x9fa658
+	.long	0x9fa674
+	.long	0x9fa68c
+	.long	0x9fa6a4
+	.long	0x9fa6b8
+	.long	0x9fa6c8
+	.long	0x9fa6d8
+	.long	0x9fa6f4
+	.long	0x9fa710
+	.long	0x9fa72c
+	.long	0x9fa744
+	.long	0x9fa758
+	.long	0x9fa76c
+	.long	0x9fa784
+	.long	0x9fa79c
+	.long	0x9fa7b0
+	.long	0x9fa7c0
+	.long	0x9fa7dc
+	.long	0x9fa7ec
+	.long	0x9fa7fc
+	.long	0x9fa814
+	.long	0x9fa834
+	.long	0x9fa848
+	.long	0x9fa858
+	.long	0x9fa86c
+	.long	0x9fa87c
+	.long	0x9fa890
+	.long	0x9fa8a8
+	.long	0x9fa8c0
+	.long	0x9fa8d4
+	.long	0x9faef4
+	.long	0x9faf08
+	.long	0x9faf20
+	.long	0x9faf3c
+	.long	0x9faf58
+	.long	0x9faf74
+	.long	0x9faf80
+	.long	0x9faf9c
+	.long	0x9fafb8
+	.long	0x9fafd8
 	.long	0x9fafe8
 	.long	0x9fb060
 	.long	0x9fb090

+ 149 - 149
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms2.S

@@ -34580,155 +34580,155 @@ kallsyms_offsets:
 	.long	0x9f8000
 	.long	0x9f8000
 	.long	0x9f8010
-	.long	0x9f8068
-	.long	0x9f80fc
-	.long	0x9f810c
-	.long	0x9f812c
-	.long	0x9f814c
-	.long	0x9f815c
-	.long	0x9f817c
-	.long	0x9f818c
-	.long	0x9f820c
-	.long	0x9f821c
-	.long	0x9f82b4
-	.long	0x9f82c8
-	.long	0x9f8334
-	.long	0x9f8390
-	.long	0x9f83a8
-	.long	0x9f83ec
-	.long	0x9f83fc
-	.long	0x9f8418
-	.long	0x9f842c
-	.long	0x9f84a4
-	.long	0x9f84b4
-	.long	0x9f84c0
-	.long	0x9f8568
-	.long	0x9f8590
-	.long	0x9f8638
-	.long	0x9f8660
-	.long	0x9f8688
-	.long	0x9f8730
-	.long	0x9f8758
-	.long	0x9f8800
-	.long	0x9f8828
-	.long	0x9f88d0
-	.long	0x9f88f8
-	.long	0x9f89a0
-	.long	0x9f89c8
-	.long	0x9f8a70
-	.long	0x9f8a98
-	.long	0x9f8b40
-	.long	0x9f8b68
-	.long	0x9f8b8c
-	.long	0x9f93f8
-	.long	0x9f9410
-	.long	0x9f9488
-	.long	0x9f94a8
-	.long	0x9f94b8
-	.long	0x9f94c4
-	.long	0x9f94ca
-	.long	0x9f94d0
-	.long	0x9f9518
-	.long	0x9f952c
-	.long	0x9f9544
-	.long	0x9f9564
-	.long	0x9f9584
-	.long	0x9f9644
-	.long	0x9f9720
-	.long	0x9f9ec8
-	.long	0x9f9ed0
-	.long	0x9f9f48
-	.long	0x9f9fc0
-	.long	0x9f9fd4
-	.long	0x9f9fec
-	.long	0x9fa004
-	.long	0x9fa018
-	.long	0x9fa02c
-	.long	0x9fa040
-	.long	0x9fa050
-	.long	0x9fa068
-	.long	0x9fa084
-	.long	0x9fa098
-	.long	0x9fa0b8
-	.long	0x9fa0cc
-	.long	0x9fa0dc
-	.long	0x9fa0f0
-	.long	0x9fa118
-	.long	0x9fa1ec
-	.long	0x9fa208
-	.long	0x9fa220
-	.long	0x9fa238
-	.long	0x9fa248
-	.long	0x9fa254
-	.long	0x9fa268
-	.long	0x9fa278
-	.long	0x9fa280
-	.long	0x9fa29c
-	.long	0x9fa2b4
-	.long	0x9fa2d0
-	.long	0x9fa2e4
-	.long	0x9fa2f8
-	.long	0x9fa310
-	.long	0x9fa330
-	.long	0x9fa344
-	.long	0x9fa364
-	.long	0x9fa380
-	.long	0x9fa390
-	.long	0x9fa408
-	.long	0x9fa480
-	.long	0x9fa4f8
-	.long	0x9fa508
-	.long	0x9fa520
-	.long	0x9fa540
-	.long	0x9fa564
-	.long	0x9fa580
-	.long	0x9fa59c
-	.long	0x9fa5bc
-	.long	0x9fa5d4
-	.long	0x9fa5ec
-	.long	0x9fa608
-	.long	0x9fa624
-	.long	0x9fa638
-	.long	0x9fa654
-	.long	0x9fa670
-	.long	0x9fa688
-	.long	0x9fa6a0
-	.long	0x9fa6b4
-	.long	0x9fa6c4
-	.long	0x9fa6d4
-	.long	0x9fa6f0
-	.long	0x9fa70c
-	.long	0x9fa728
-	.long	0x9fa740
-	.long	0x9fa754
-	.long	0x9fa768
-	.long	0x9fa780
-	.long	0x9fa798
-	.long	0x9fa7ac
-	.long	0x9fa7bc
-	.long	0x9fa7d8
-	.long	0x9fa7e8
-	.long	0x9fa7f8
-	.long	0x9fa810
-	.long	0x9fa830
-	.long	0x9fa844
-	.long	0x9fa854
-	.long	0x9fa868
-	.long	0x9fa878
-	.long	0x9fa88c
-	.long	0x9fa8a4
-	.long	0x9fa8bc
-	.long	0x9fa8d0
-	.long	0x9faef0
-	.long	0x9faf04
-	.long	0x9faf1c
-	.long	0x9faf38
-	.long	0x9faf54
-	.long	0x9faf70
-	.long	0x9faf7c
-	.long	0x9faf98
-	.long	0x9fafb4
-	.long	0x9fafd4
+	.long	0x9f806c
+	.long	0x9f8100
+	.long	0x9f8110
+	.long	0x9f8130
+	.long	0x9f8150
+	.long	0x9f8160
+	.long	0x9f8180
+	.long	0x9f8190
+	.long	0x9f8210
+	.long	0x9f8220
+	.long	0x9f82b8
+	.long	0x9f82cc
+	.long	0x9f8338
+	.long	0x9f8394
+	.long	0x9f83ac
+	.long	0x9f83f0
+	.long	0x9f8400
+	.long	0x9f841c
+	.long	0x9f8430
+	.long	0x9f84a8
+	.long	0x9f84b8
+	.long	0x9f84c4
+	.long	0x9f856c
+	.long	0x9f8594
+	.long	0x9f863c
+	.long	0x9f8664
+	.long	0x9f868c
+	.long	0x9f8734
+	.long	0x9f875c
+	.long	0x9f8804
+	.long	0x9f882c
+	.long	0x9f88d4
+	.long	0x9f88fc
+	.long	0x9f89a4
+	.long	0x9f89cc
+	.long	0x9f8a74
+	.long	0x9f8a9c
+	.long	0x9f8b44
+	.long	0x9f8b6c
+	.long	0x9f8b90
+	.long	0x9f93fc
+	.long	0x9f9414
+	.long	0x9f948c
+	.long	0x9f94ac
+	.long	0x9f94bc
+	.long	0x9f94c8
+	.long	0x9f94ce
+	.long	0x9f94d4
+	.long	0x9f951c
+	.long	0x9f9530
+	.long	0x9f9548
+	.long	0x9f9568
+	.long	0x9f9588
+	.long	0x9f9648
+	.long	0x9f9724
+	.long	0x9f9ecc
+	.long	0x9f9ed4
+	.long	0x9f9f4c
+	.long	0x9f9fc4
+	.long	0x9f9fd8
+	.long	0x9f9ff0
+	.long	0x9fa008
+	.long	0x9fa01c
+	.long	0x9fa030
+	.long	0x9fa044
+	.long	0x9fa054
+	.long	0x9fa06c
+	.long	0x9fa088
+	.long	0x9fa09c
+	.long	0x9fa0bc
+	.long	0x9fa0d0
+	.long	0x9fa0e0
+	.long	0x9fa0f4
+	.long	0x9fa11c
+	.long	0x9fa1f0
+	.long	0x9fa20c
+	.long	0x9fa224
+	.long	0x9fa23c
+	.long	0x9fa24c
+	.long	0x9fa258
+	.long	0x9fa26c
+	.long	0x9fa27c
+	.long	0x9fa284
+	.long	0x9fa2a0
+	.long	0x9fa2b8
+	.long	0x9fa2d4
+	.long	0x9fa2e8
+	.long	0x9fa2fc
+	.long	0x9fa314
+	.long	0x9fa334
+	.long	0x9fa348
+	.long	0x9fa368
+	.long	0x9fa384
+	.long	0x9fa394
+	.long	0x9fa40c
+	.long	0x9fa484
+	.long	0x9fa4fc
+	.long	0x9fa50c
+	.long	0x9fa524
+	.long	0x9fa544
+	.long	0x9fa568
+	.long	0x9fa584
+	.long	0x9fa5a0
+	.long	0x9fa5c0
+	.long	0x9fa5d8
+	.long	0x9fa5f0
+	.long	0x9fa60c
+	.long	0x9fa628
+	.long	0x9fa63c
+	.long	0x9fa658
+	.long	0x9fa674
+	.long	0x9fa68c
+	.long	0x9fa6a4
+	.long	0x9fa6b8
+	.long	0x9fa6c8
+	.long	0x9fa6d8
+	.long	0x9fa6f4
+	.long	0x9fa710
+	.long	0x9fa72c
+	.long	0x9fa744
+	.long	0x9fa758
+	.long	0x9fa76c
+	.long	0x9fa784
+	.long	0x9fa79c
+	.long	0x9fa7b0
+	.long	0x9fa7c0
+	.long	0x9fa7dc
+	.long	0x9fa7ec
+	.long	0x9fa7fc
+	.long	0x9fa814
+	.long	0x9fa834
+	.long	0x9fa848
+	.long	0x9fa858
+	.long	0x9fa86c
+	.long	0x9fa87c
+	.long	0x9fa890
+	.long	0x9fa8a8
+	.long	0x9fa8c0
+	.long	0x9fa8d4
+	.long	0x9faef4
+	.long	0x9faf08
+	.long	0x9faf20
+	.long	0x9faf3c
+	.long	0x9faf58
+	.long	0x9faf74
+	.long	0x9faf80
+	.long	0x9faf9c
+	.long	0x9fafb8
+	.long	0x9fafd8
 	.long	0x9fafe8
 	.long	0x9fb060
 	.long	0x9fb090

BIN
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux1


BIN
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux2


+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version

@@ -1 +1 @@
-346
+347

+ 18 - 98
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/.am335x-evm.dtb.dts.tmp

@@ -1199,35 +1199,22 @@
 
 
 
-   0x020 (((1 << 5) | (1 << 3)) | 7)
-   0x024 (((1 << 5) | (1 << 3)) | 7)
-   0x028 (((1 << 5) | (1 << 3)) | 7)
-   0x02C (((1 << 5) | (1 << 3)) | 7)
    0x144 (((1 << 5) | (1 << 3)) | 7)
    0x1B0 (((1 << 3)) | 7)
    0x1B4 (((1 << 5) | (1 << 3)) | 7)
 
 
-   0x030 (((1 << 5) | (1 << 3)) | 7)
-   0x034 (((1 << 5) | (1 << 3)) | 7)
-   0x038 (((1 << 5) | (1 << 3)) | 7)
-   0x03C (((1 << 5) | (1 << 3)) | 7)
-
-
-   0x0EC (((1 << 3)) | 7)
-   0x0E4 (((1 << 3)) | 7)
+   0x08C (((1 << 3)) | 7)
+   0x0A0 (((1 << 3)) | 7)
+   0x0A4 (((1 << 3)) | 7)
+   0x0A8 (((1 << 3)) | 7)
+   0x0AC (((1 << 3)) | 7)
+   0x0B0 (((1 << 3)) | 7)
+   0x0B4 (((1 << 3)) | 7)
    0x0E8 (((1 << 5) | (1 << 3)) | 7)
-   0x0E0 (((1 << 5) | (1 << 3)) | 7)
-
+   0x0E0 (((1 << 3)) | 7)
 
-   0x194 (((1 << 5) | (1 << 3)) | 7)
-   0x1A0 (((1 << 5) | (1 << 3)) | 7)
-   0x19C (((1 << 5) | (1 << 3)) | 7)
-   0x190 (((1 << 3)) | 7)
-   0x1A4 (((1 << 3)) | 7)
-   0x198 (((1 << 3)) | 7)
    0x1A8 (((1 << 3)) | 7)
-
   >;
  };
 
@@ -1272,14 +1259,7 @@
    0x164 (0 | 1)
   >;
  };
-
- uart5_pins: pinmux_uart5_pins {
-  pinctrl-single,pins = <
-   0x0C0 (0 | 4)
-   0x0C4 (((1 << 5) | (1 << 4)) | 4)
-  >;
- };
-
+# 136 "arch/arm/boot/dts/am335x-evm.dts"
  clkout2_pin: pinmux_clkout2_pin {
   pinctrl-single,pins = <
    0x1b4 (0 | 3)
@@ -1330,12 +1310,12 @@
   pinctrl-single,pins = <
 
 
-   0x108 (((1 << 5) | (1 << 4)) | 0)
-   0x10C(((1 << 5) | (1 << 4)) | 0)
+
+
    0x110 (((1 << 5) | (1 << 4)) | 0)
+   0x118 (((1 << 5) | (1 << 4)) | 0)
    0x12c (((1 << 5) | (1 << 4)) | 0)
    0x130 (((1 << 5) | (1 << 4)) | 0)
-   0x118 (((1 << 5) | (1 << 4)) | 0)
    0x134 (((1 << 5) | (1 << 4)) | 0)
    0x138 (((1 << 5) | (1 << 4)) | 0)
    0x13c (((1 << 5) | (1 << 4)) | 0)
@@ -1346,23 +1326,6 @@
    0x124 (0 | 0)
    0x128 (0 | 0)
 
-
-   ((((0x878)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 1)
-   ((((0x888)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 2)
-
-   ((((0x858)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 1)
-   ((((0x85c)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 1)
-   ((((0x844)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 1)
-   ((((0x860)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 1)
-   ((((0x864)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 1)
-   ((((0x868)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 1)
-   ((((0x86c)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 1)
-   ((((0x840)) & 0xffff) - (0x0800)) (0 | 1)
-   ((((0x848)) & 0xffff) - (0x0800)) (0 | 1)
-   ((((0x84c)) & 0xffff) - (0x0800)) (0 | 1)
-   ((((0x850)) & 0xffff) - (0x0800)) (0 | 1)
-   ((((0x854)) & 0xffff) - (0x0800)) (0 | 1)
-
   >;
  };
 
@@ -1382,23 +1345,6 @@
    0x13c (((1 << 5)) | 7)
    0x140 (((1 << 5)) | 7)
 
-
-   ((((0x888)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x840)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x844)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x848)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x84c)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x850)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x854)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x858)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x85c)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x860)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x864)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x868)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-   ((((0x86c)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-
-   ((((0x878)) & 0xffff) - (0x0800)) (((1 << 5)) | 7)
-
   >;
  };
 
@@ -1437,14 +1383,7 @@
    0x17C (((1 << 5)) | 2)
   >;
  };
-
- dcan1_pins_default: dcan1_pins_default {
-  pinctrl-single,pins = <
-   0x168 (((1 << 4)) | 2)
-   0x16C (((1 << 5)) | 2)
-  >;
- };
-# 327 "arch/arm/boot/dts/am335x-evm.dts"
+# 280 "arch/arm/boot/dts/am335x-evm.dts"
 };
 
 
@@ -1476,14 +1415,7 @@
 
  status = "okay";
 };
-
-&uart5 {
- pinctrl-names = "default";
- pinctrl-0 = <&uart5_pins>;
-
- status = "okay";
-};
-
+# 319 "arch/arm/boot/dts/am335x-evm.dts"
 &i2c0 {
  pinctrl-names = "default";
  pinctrl-0 = <&i2c0_pins>;
@@ -1546,7 +1478,7 @@
 &elm {
  status = "okay";
 };
-# 449 "arch/arm/boot/dts/am335x-evm.dts"
+# 402 "arch/arm/boot/dts/am335x-evm.dts"
 &gpmc {
  status = "okay";
  pinctrl-names = "default", "sleep";
@@ -1732,7 +1664,7 @@
   };
  };
 };
-# 555 "arch/arm/boot/dts/am335x-evm.dts" 2
+# 508 "arch/arm/boot/dts/am335x-evm.dts" 2
 
 &tps {
  vcc1-supply = <&vbat>;
@@ -1815,7 +1747,6 @@
  pinctrl-names = "default", "sleep";
  pinctrl-0 = <&cpsw_default>;
  pinctrl-1 = <&cpsw_sleep>;
- dual_emac = <1>;
  status = "okay";
 };
 
@@ -1824,20 +1755,15 @@
  pinctrl-0 = <&davinci_mdio_default>;
  pinctrl-1 = <&davinci_mdio_sleep>;
  status = "okay";
+
 };
 
 &cpsw_emac0 {
  phy_id = <&davinci_mdio>, <1>;
   phy-mode = "mii";
-  dual_emac_res_vlan = <1>;
-};
 
-&cpsw_emac1 {
- phy_id = <&davinci_mdio>, <2>;
-  phy-mode = "mii";
-  dual_emac_res_vlan = <2>;
 };
-
+# 614 "arch/arm/boot/dts/am335x-evm.dts"
 &tscadc {
  status = "okay";
 
@@ -1884,9 +1810,3 @@
  pinctrl-names = "default";
  pinctrl-0 = <&dcan0_pins_default>;
 };
-
-&dcan1 {
- status = "okay";
- pinctrl-names = "default";
- pinctrl-0 = <&dcan1_pins_default>;
-};

+ 35 - 80
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts

@@ -64,36 +64,23 @@
 		pinctrl-single,pins = <
 		
 			/** Offset: 0x800 */
-			/** GPIO 0 */   
-			0x020 (PIN_INPUT | MUX_MODE7)			/* GPMC_AD8			=> 	GPIO0_22 */	/*ID BD1_1*/
-			0x024 (PIN_INPUT | MUX_MODE7)    			/* GPMC_AD9			=>	GPIO0_23 */	/*ID BD1_2*/
-			0x028 (PIN_INPUT | MUX_MODE7)    			/* GPMC_AD10		=>	GPIO0_26 */	/*IO BD1_1*/
-			0x02C (PIN_INPUT | MUX_MODE7)    		/* GPMC_AD11		=>	GPIO0_27 */	/*IO BD1_2*/
+			/** GPIO 0 */ 
 			0x144 (PIN_INPUT | MUX_MODE7)    			/* RMII1_REF_CLK		=>	GPIO0_29 */	/*USB 0 OCP detection*/
 			0x1B0 (PIN_OUTPUT | MUX_MODE7)			/*XDMA_EVENT_INTR0	=>	GPIO0_19 */	/*AM_RFID_RST*/
 			0x1B4 (PIN_INPUT | MUX_MODE7)			/*XDMA_EVENT_INTR1	=>	GPIO0_20 */	/*AM_RFID_ICC*/
-			
-			/** GPIO 1 */
-			0x030 (PIN_INPUT | MUX_MODE7)			/* GPMC_AD12	=> 	GPIO1_12 */	/*ID BD2_1*/
-			0x034 (PIN_INPUT | MUX_MODE7)    			/* GPMC_AD13	=>	GPIO1_13 */	/*ID BD2_2*/
-			0x038 (PIN_INPUT | MUX_MODE7)    			/* GPMC_AD14	=>	GPIO1_14 */	/*IO BD2_1*/
-			0x03C (PIN_INPUT | MUX_MODE7)    		/* GPMC_AD15	=>	GPIO1_15 */	/*IO BD2_2*/
-			
+			/** GPIO 1 */			
 			/** GPIO 2 */
-			0x0EC (PIN_OUTPUT | MUX_MODE7)			/*LCD_AC_BIAS_EN	=>	GPIO2_25*/	/*RS-485 for module DE control*/
-			0x0E4 (PIN_OUTPUT | MUX_MODE7)			/*LCD_HSYNC		=>	GPIO2_23*/	/*RS-485 for module RE control*/
-			0x0E8 (PIN_INPUT | MUX_MODE7)			/*LCD_PCLK		=>	GPIO2_24*/	/*CCS communication board 1 proximity*/
-			0x0E0 (PIN_INPUT | MUX_MODE7)			/*LCD_VSYNC		=>	GPIO2_22*/	/*CCS communication board 2 proximity*/
-			
+			0x08C (PIN_OUTPUT | MUX_MODE7)			/*GPMC_CLK	=>	GPIO2_1*/	/*Speaker*/
+			0x0A0 (PIN_OUTPUT | MUX_MODE7)			/*LCD_DATA0	=>	GPIO2_6*/	/*Panel LED control-BB_LEDR1*/
+			0x0A4 (PIN_OUTPUT | MUX_MODE7)			/*LCD_DATA1	=>	GPIO2_7*/	/*Panel LED control-BB_LEDG1*/
+			0x0A8 (PIN_OUTPUT | MUX_MODE7)			/*LCD_DATA2	=>	GPIO2_8*/	/*Panel LED control-BB_LEDB1*/
+			0x0AC (PIN_OUTPUT | MUX_MODE7)			/*LCD_DATA3	=>	GPIO2_9*/	/*Panel LED control-BB_LEDR2*/
+			0x0B0 (PIN_OUTPUT | MUX_MODE7)			/*LCD_DATA4	=>	GPIO2_10*/	/*Panel LED control-BB_LEDG2*/
+			0x0B4 (PIN_OUTPUT | MUX_MODE7)			/*LCD_DATA5	=>	GPIO2_11*/	/*Panel LED control-BB_LEDB2*/
+			0x0E8 (PIN_INPUT | MUX_MODE7)			/*LCD_PCLK	=>	GPIO2_24*/	/*communication board proximity*/
+			0x0E0 (PIN_OUTPUT | MUX_MODE7)			/*LCD_VSYNC	=>	GPIO2_22*/	/*Breath LED*/
 			/** GPIO 3 */
-			0x194 (PIN_INPUT | MUX_MODE7)			/*MCASP0_FSX		=>	GPIO3_15*/	/*Emergency Stop button detect*/
-			0x1A0 (PIN_INPUT | MUX_MODE7)			/*MCASP0_ACLKR	=>	GPIO3_18*/	/*USB1 OCP detect*/
-			0x19C (PIN_INPUT | MUX_MODE7)			/*MCASP0_AHCLKR	=>	GPIO3_17*/	/*Emergency IO for AM3352 and STM32F407*/
-			0x190 (PIN_OUTPUT | MUX_MODE7)			/*MCASP0_ACLKX	=>	GPIO3_14*/	/*Ethernet PHY reset*/
-			0x1A4 (PIN_OUTPUT | MUX_MODE7)			/* MCASP0_FSR		=>	GPIO3_19 */	/*SMR Enable control_1*/
-			0x198 (PIN_OUTPUT | MUX_MODE7)			/* MCASP0_AXR0	=>	GPIO3_16 */	/*CSU board function OK indicator.*/
-			0x1A8 (PIN_OUTPUT | MUX_MODE7)			/* MCASP0_AXR1	=>	GPIO3_20 */	/*SMR Enable control_2*/
-			
+			0x1A8 (PIN_OUTPUT | MUX_MODE7)			/* MCASP0_AXR1	=>	GPIO3_20 */	/*control MCU to output CP PWM*/
 		>;
 	};
 	
@@ -138,14 +125,14 @@
 			0x164 (PIN_OUTPUT_PULLDOWN | MUX_MODE1)	/* ECAP0_IN_PWM0_OUT		=>	uart3_txd */
 		>;
 	};
-
+#if 0
 	uart5_pins: pinmux_uart5_pins {
 		pinctrl-single,pins = <
-			0x0C0 (PIN_OUTPUT_PULLDOWN | MUX_MODE4)		/* LCD_DATA8	=>	DUART5_TX*/
-			0x0C4 (PIN_INPUT_PULLUP | MUX_MODE4)			/* LCD_DATA9	=>	UART5_RX*/
+			0x0C0 (PIN_INPUT_PULLUP | MUX_MODE4)		/* LCD_DATA8	=>	UART5_RXD*/
+			0x0C4 (PIN_OUTPUT_PULLDOWN | MUX_MODE4)	/* LCD_DATA9	=>	UART5_TXD*/
 		>;
 	};
-	
+#endif	
 	clkout2_pin: pinmux_clkout2_pin {
 		pinctrl-single,pins = <
 			0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)	/* xdma_event_intr1.clkout2 */
@@ -196,12 +183,12 @@
 		pinctrl-single,pins = <					
 		
 			/* Slave 1 */
-			0x108 (PIN_INPUT_PULLUP | MUX_MODE0)		/* MII1_COL.gmii1_col */
-			0x10C(PIN_INPUT_PULLUP | MUX_MODE0)		/* MII1_CRS.MII1_CRS */
+			//0x108 (PIN_INPUT_PULLDOWN | MUX_MODE0)		/* MII1_COL.gmii1_col */
+			//0x10C(PIN_INPUT_PULLDOWN | MUX_MODE0)		/* MII1_CRS.MII1_CRS */
 			0x110 (PIN_INPUT_PULLUP | MUX_MODE0)		/* MII1_RX_ER.gmii1_rxerr */
+			0x118 (PIN_INPUT_PULLUP | MUX_MODE0)		/* mii1_rxdv.mii1_rxdv */
 			0x12c (PIN_INPUT_PULLUP | MUX_MODE0)		/* mii1_txclk.mii1_txclk */
 			0x130 (PIN_INPUT_PULLUP | MUX_MODE0)		/* mii1_rxclk.mii1_rxclk */
-			0x118 (PIN_INPUT_PULLUP | MUX_MODE0)		/* mii1_rxdv.mii1_rxdv */
 			0x134 (PIN_INPUT_PULLUP | MUX_MODE0)		/* mii1_rxd3.rgmii1_rd3 */
 			0x138 (PIN_INPUT_PULLUP | MUX_MODE0)		/* mii1_rxd2.rgmii1_rd2 */
 			0x13c (PIN_INPUT_PULLUP | MUX_MODE0)		/* mii1_rxd1.rgmii1_rd1 */
@@ -210,24 +197,7 @@
 			0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE0)		/* mii1_txd3.rgmii1_td3 */
 			0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)		/* mii1_txd2.rgmii1_td2 */
 			0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)		/* mii1_txd1.rgmii1_td1 */
-			0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)		/* mii1_txd0.rgmii1_td0 */      	
-			
-			/* Slave 2 */
-			AM33XX_IOPAD(0x878, PIN_INPUT_PULLUP | MUX_MODE1)					/* gpmc_ben1.mii2_col */
-			AM33XX_IOPAD(0x888, PIN_INPUT_PULLUP | MUX_MODE2)					/* GPMC_CSn3.rmii2_crs_dv*/								
-			/*AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE1)*/					/* gpmc_wpn.mii2_rxerr */
-			AM33XX_IOPAD(0x858, PIN_INPUT_PULLUP | MUX_MODE1)					/* gpmc_a6.mii2_txclk */
-			AM33XX_IOPAD(0x85c, PIN_INPUT_PULLUP | MUX_MODE1)					/* gpmc_a7.mii2_rxclk */
-			AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE1)					/* gpmc_a1.mii2_rxdv */
-			AM33XX_IOPAD(0x860, PIN_INPUT_PULLUP | MUX_MODE1)					/* gpmc_a8.mii2_rxd3 */
-			AM33XX_IOPAD(0x864, PIN_INPUT_PULLUP | MUX_MODE1)					/* gpmc_a9.mii2_rxd2 */
-			AM33XX_IOPAD(0x868, PIN_INPUT_PULLUP | MUX_MODE1)					/* gpmc_a10.mii2_rxd1 */
-			AM33XX_IOPAD(0x86c, PIN_INPUT_PULLUP | MUX_MODE1)					/* gpmc_a11.mii2_rxd0 */
-			AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE1)				/* gpmc_a0.mii2_txen */
-			AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE1)				/* gpmc_a2.mii2_txd3 */
-			AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE1)				/* gpmc_a3.mii2_txd2 */
-			AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE1)				/* gpmc_a4.mii2_txd1 */
-			AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE1)				/* gpmc_a5.mii2_txd0 */
+			0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)		/* mii1_txd0.rgmii1_td0 */      
 
 		>;
 	};
@@ -248,23 +218,6 @@
 			0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
 			0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)		
 			
-			/* Slave 2 */
-			AM33XX_IOPAD(0x888, PIN_INPUT_PULLDOWN | MUX_MODE7)					/* GPMC_CSn3.rmii2_crs_dv*/	
-			AM33XX_IOPAD(0x840, PIN_INPUT_PULLDOWN | MUX_MODE7)				/* gpmc_a0.mii2_txen */
-			AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a1.mii2_rxdv */
-			AM33XX_IOPAD(0x848, PIN_INPUT_PULLDOWN | MUX_MODE7)				/* gpmc_a2.mii2_txd3 */
-			AM33XX_IOPAD(0x84c, PIN_INPUT_PULLDOWN | MUX_MODE7)			/* gpmc_a3.mii2_txd2 */
-			AM33XX_IOPAD(0x850, PIN_INPUT_PULLDOWN | MUX_MODE7)				/* gpmc_a4.mii2_txd1 */
-			AM33XX_IOPAD(0x854, PIN_INPUT_PULLDOWN | MUX_MODE7)				/* gpmc_a5.mii2_txd0 */
-			AM33XX_IOPAD(0x858, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a6.mii2_txclk */
-			AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a7.mii2_rxclk */
-			AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a8.mii2_rxd3 */
-			AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a9.mii2_rxd2 */
-			AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a10.mii2_rxd1 */
-			AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a11.mii2_rxd0 */
-			/*AM33XX_IOPAD(0x874, PIN_INPUT_PULLDOWN | MUX_MODE7)*/	/* gpmc_wpn.mii2_rxerr */
-			AM33XX_IOPAD(0x878, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ben1.mii2_col */
-			
 		>;
 	};
 
@@ -303,14 +256,14 @@
 			0x17C (PIN_INPUT_PULLDOWN | MUX_MODE2)		/* uart1_rtsn	=>	d_can0_rx */
 		>;
 	};
-	
+#if 0	
 	dcan1_pins_default: dcan1_pins_default {
 		pinctrl-single,pins = <
 			0x168 (PIN_OUTPUT_PULLUP | MUX_MODE2)		/* UART0_CTSn		=>	d_can1_tx */
 			0x16C (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* UART0_RTSn		=>	d_can1_rx */
 		>;
 	};
-#if 0
+
 	ehrpwm1_pins: ehrpwm1_pins {
 		pinctrl-single,pins = <			
 			0x0C8 (PIN_OUTPUT | MUX_MODE2) /* LCD_DATA10.eHRPWM1A */
@@ -355,14 +308,14 @@
 
 	status = "okay";
 };
-
+#if 0
 &uart5 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart5_pins>;
 
 	status = "okay";
 };
-
+#endif
 &i2c0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c0_pins>;
@@ -373,11 +326,11 @@
 	tps: tps@2d {
 		reg = <0x2d>;
 	};
-	
+
 /*	rtc0: rtc@51 {
-                compatible = "nxp,pcf85063";
-                reg = <0x51>;
-        };*/	
+		compatible = "nxp,pcf85063";
+		reg = <0x51>;
+	};*/
 };
 #if 1
 &i2c1 {
@@ -634,7 +587,6 @@
 	pinctrl-names = "default", "sleep";
 	pinctrl-0 = <&cpsw_default>;
 	pinctrl-1 = <&cpsw_sleep>;
-	dual_emac = <1>;
 	status = "okay";
 };
 
@@ -643,19 +595,21 @@
 	pinctrl-0 = <&davinci_mdio_default>;
 	pinctrl-1 = <&davinci_mdio_sleep>;
 	status = "okay";
+	//reset-gpios = <&gpio3 14 GPIO_ACTIVE_LOW>;
 };
 
 &cpsw_emac0 {
 	phy_id = <&davinci_mdio>, <1>;
  	phy-mode = "mii";
- 	dual_emac_res_vlan = <1>;
-};
 
+};
+#if 0
 &cpsw_emac1 {
 	phy_id = <&davinci_mdio>, <2>;
  	phy-mode = "mii";
- 	dual_emac_res_vlan = <2>;
+
 };
+#endif
 
 &tscadc {
 	status = "okay";
@@ -703,9 +657,10 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&dcan0_pins_default>;
 };
-
+#if 0
 &dcan1 {
 	status = "okay";	
 	pinctrl-names = "default";
 	pinctrl-0 = <&dcan1_pins_default>;
 };
+#endif

+ 31 - 13
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/.conmakehash.cmd

@@ -5,18 +5,23 @@ source_scripts/conmakehash := scripts/conmakehash.c
 deps_scripts/conmakehash := \
   /usr/include/stdc-predef.h \
   /usr/include/stdio.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
@@ -24,29 +29,42 @@ deps_scripts/conmakehash := \
   /usr/include/stdlib.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
+  /usr/include/x86_64-linux-gnu/sys/types.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
-  /usr/include/x86_64-linux-gnu/sys/types.h \
-  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/sysexits.h \
   /usr/include/string.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/ctype.h \
 
 scripts/conmakehash: $(deps_scripts/conmakehash)

+ 33 - 15
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/.kallsyms.cmd

@@ -6,18 +6,23 @@ deps_scripts/kallsyms := \
     $(wildcard include/config/page/offset.h) \
   /usr/include/stdc-predef.h \
   /usr/include/stdio.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
@@ -25,31 +30,44 @@ deps_scripts/kallsyms := \
   /usr/include/stdlib.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
+  /usr/include/x86_64-linux-gnu/sys/types.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
-  /usr/include/x86_64-linux-gnu/sys/types.h \
-  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/string.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/ctype.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/syslimits.h \
   /usr/include/limits.h \
   /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
   /usr/include/x86_64-linux-gnu/bits/local_lim.h \

+ 36 - 13
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/.sortextable.cmd

@@ -8,33 +8,49 @@ deps_scripts/sortextable := \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/time.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/x86_64-linux-gnu/sys/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman-linux.h \
+  /usr/include/x86_64-linux-gnu/bits/mman-shared.h \
   /usr/include/x86_64-linux-gnu/sys/stat.h \
   /usr/include/x86_64-linux-gnu/bits/stat.h \
   /usr/include/getopt.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_core.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_ext.h \
   /usr/include/elf.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h \
   /usr/include/stdint.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/x86_64-linux-gnu/bits/wchar.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
   /usr/include/x86_64-linux-gnu/bits/auxv.h \
   /usr/include/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl.h \
@@ -44,10 +60,13 @@ deps_scripts/sortextable := \
   /usr/include/x86_64-linux-gnu/bits/setjmp.h \
   /usr/include/x86_64-linux-gnu/bits/setjmp2.h \
   /usr/include/stdio.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
@@ -55,19 +74,23 @@ deps_scripts/sortextable := \
   /usr/include/stdlib.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/string.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/unistd.h \
   /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
   /usr/include/x86_64-linux-gnu/bits/environments.h \
   /usr/include/x86_64-linux-gnu/bits/confname.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
   /usr/include/x86_64-linux-gnu/bits/unistd.h \
   tools/include/tools/be_byteshift.h \
   tools/include/tools/le_byteshift.h \

+ 10 - 5
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/basic/.bin2c.cmd

@@ -5,18 +5,23 @@ source_scripts/basic/bin2c := scripts/basic/bin2c.c
 deps_scripts/basic/bin2c := \
   /usr/include/stdc-predef.h \
   /usr/include/stdio.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \

+ 38 - 20
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/basic/.fixdep.cmd

@@ -12,61 +12,81 @@ deps_scripts/basic/fixdep := \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/time.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/x86_64-linux-gnu/sys/stat.h \
   /usr/include/x86_64-linux-gnu/bits/stat.h \
   /usr/include/x86_64-linux-gnu/sys/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman-linux.h \
+  /usr/include/x86_64-linux-gnu/bits/mman-shared.h \
   /usr/include/unistd.h \
   /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
   /usr/include/x86_64-linux-gnu/bits/environments.h \
   /usr/include/x86_64-linux-gnu/bits/confname.h \
-  /usr/include/getopt.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_core.h \
   /usr/include/x86_64-linux-gnu/bits/unistd.h \
   /usr/include/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl2.h \
   /usr/include/string.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/stdlib.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/stdio.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
   /usr/include/x86_64-linux-gnu/bits/stdio2.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/syslimits.h \
   /usr/include/limits.h \
   /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
   /usr/include/x86_64-linux-gnu/bits/local_lim.h \
@@ -75,12 +95,9 @@ deps_scripts/basic/fixdep := \
   /usr/include/ctype.h \
   /usr/include/arpa/inet.h \
   /usr/include/netinet/in.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h \
-  /usr/include/stdint.h \
-  /usr/include/x86_64-linux-gnu/bits/wchar.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
   /usr/include/x86_64-linux-gnu/sys/socket.h \
-  /usr/include/x86_64-linux-gnu/sys/uio.h \
-  /usr/include/x86_64-linux-gnu/bits/uio.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h \
   /usr/include/x86_64-linux-gnu/bits/socket.h \
   /usr/include/x86_64-linux-gnu/bits/socket_type.h \
   /usr/include/x86_64-linux-gnu/bits/sockaddr.h \
@@ -88,6 +105,7 @@ deps_scripts/basic/fixdep := \
   /usr/include/asm-generic/socket.h \
   /usr/include/x86_64-linux-gnu/asm/sockios.h \
   /usr/include/asm-generic/sockios.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_osockaddr.h \
   /usr/include/x86_64-linux-gnu/bits/socket2.h \
   /usr/include/x86_64-linux-gnu/bits/in.h \
 

+ 33 - 14
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/scripts/mod/.mk_elfconfig.cmd

@@ -5,18 +5,23 @@ source_scripts/mod/mk_elfconfig := scripts/mod/mk_elfconfig.c
 deps_scripts/mod/mk_elfconfig := \
   /usr/include/stdc-predef.h \
   /usr/include/stdio.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
@@ -24,32 +29,46 @@ deps_scripts/mod/mk_elfconfig := \
   /usr/include/stdlib.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
+  /usr/include/x86_64-linux-gnu/sys/types.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
-  /usr/include/x86_64-linux-gnu/sys/types.h \
-  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/string.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/elf.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h \
   /usr/include/stdint.h \
   /usr/include/x86_64-linux-gnu/bits/wchar.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
   /usr/include/x86_64-linux-gnu/bits/auxv.h \
 
 scripts/mod/mk_elfconfig: $(deps_scripts/mod/mk_elfconfig)

+ 39 - 16
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/usr/.gen_init_cpio.cmd

@@ -5,18 +5,23 @@ source_usr/gen_init_cpio := usr/gen_init_cpio.c
 deps_usr/gen_init_cpio := \
   /usr/include/stdc-predef.h \
   /usr/include/stdio.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
@@ -24,19 +29,31 @@ deps_usr/gen_init_cpio := \
   /usr/include/stdlib.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
+  /usr/include/x86_64-linux-gnu/sys/types.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
-  /usr/include/x86_64-linux-gnu/sys/types.h \
-  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
@@ -44,16 +61,22 @@ deps_usr/gen_init_cpio := \
   /usr/include/x86_64-linux-gnu/sys/stat.h \
   /usr/include/x86_64-linux-gnu/bits/stat.h \
   /usr/include/string.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/unistd.h \
   /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
   /usr/include/x86_64-linux-gnu/bits/environments.h \
   /usr/include/x86_64-linux-gnu/bits/confname.h \
-  /usr/include/getopt.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_core.h \
   /usr/include/x86_64-linux-gnu/bits/unistd.h \
+  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h \
   /usr/include/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
@@ -65,8 +88,8 @@ deps_usr/gen_init_cpio := \
   /usr/include/asm-generic/errno.h \
   /usr/include/asm-generic/errno-base.h \
   /usr/include/ctype.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/syslimits.h \
   /usr/include/limits.h \
   /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
   /usr/include/x86_64-linux-gnu/bits/local_lim.h \

+ 38 - 20
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/scripts/basic/.fixdep.cmd

@@ -14,61 +14,81 @@ deps_scripts/basic/fixdep := \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/time.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/x86_64-linux-gnu/sys/stat.h \
   /usr/include/x86_64-linux-gnu/bits/stat.h \
   /usr/include/x86_64-linux-gnu/sys/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman-linux.h \
+  /usr/include/x86_64-linux-gnu/bits/mman-shared.h \
   /usr/include/unistd.h \
   /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
   /usr/include/x86_64-linux-gnu/bits/environments.h \
   /usr/include/x86_64-linux-gnu/bits/confname.h \
-  /usr/include/getopt.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_core.h \
   /usr/include/x86_64-linux-gnu/bits/unistd.h \
   /usr/include/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl2.h \
   /usr/include/string.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/stdlib.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/stdio.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
   /usr/include/x86_64-linux-gnu/bits/stdio2.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/syslimits.h \
   /usr/include/limits.h \
   /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
   /usr/include/x86_64-linux-gnu/bits/local_lim.h \
@@ -77,12 +97,9 @@ deps_scripts/basic/fixdep := \
   /usr/include/ctype.h \
   /usr/include/arpa/inet.h \
   /usr/include/netinet/in.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h \
-  /usr/include/stdint.h \
-  /usr/include/x86_64-linux-gnu/bits/wchar.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
   /usr/include/x86_64-linux-gnu/sys/socket.h \
-  /usr/include/x86_64-linux-gnu/sys/uio.h \
-  /usr/include/x86_64-linux-gnu/bits/uio.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h \
   /usr/include/x86_64-linux-gnu/bits/socket.h \
   /usr/include/x86_64-linux-gnu/bits/socket_type.h \
   /usr/include/x86_64-linux-gnu/bits/sockaddr.h \
@@ -90,6 +107,7 @@ deps_scripts/basic/fixdep := \
   /usr/include/asm-generic/socket.h \
   /usr/include/x86_64-linux-gnu/asm/sockios.h \
   /usr/include/asm-generic/sockios.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_osockaddr.h \
   /usr/include/x86_64-linux-gnu/bits/socket2.h \
   /usr/include/x86_64-linux-gnu/bits/in.h \
 

+ 45 - 19
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/tools/.gen_eth_addr.cmd

@@ -7,15 +7,21 @@ deps_tools/gen_eth_addr := \
   include/libfdt_env.h \
   include/compiler.h \
     $(wildcard include/config/use/stdint.h) \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h \
   /usr/include/stdint.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+  /usr/include/x86_64-linux-gnu/bits/types.h \
+  /usr/include/x86_64-linux-gnu/bits/typesizes.h \
   /usr/include/x86_64-linux-gnu/bits/wchar.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
   /usr/include/errno.h \
   /usr/include/x86_64-linux-gnu/bits/errno.h \
   /usr/include/linux/errno.h \
@@ -25,50 +31,69 @@ deps_tools/gen_eth_addr := \
   /usr/include/stdlib.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/x86_64-linux-gnu/sys/types.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
-  /usr/include/x86_64-linux-gnu/bits/types.h \
-  /usr/include/x86_64-linux-gnu/bits/typesizes.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/sys/types.h \
-  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/stdio.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
   /usr/include/x86_64-linux-gnu/bits/stdio2.h \
   /usr/include/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/x86_64-linux-gnu/sys/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman-linux.h \
+  /usr/include/x86_64-linux-gnu/bits/mman-shared.h \
   /usr/include/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
-  /usr/include/x86_64-linux-gnu/bits/uio.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h \
+  /usr/include/linux/falloc.h \
   /usr/include/x86_64-linux-gnu/bits/stat.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl2.h \
   /usr/include/byteswap.h \
+  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/time.h \
   /usr/include/x86_64-linux-gnu/bits/timex.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
   /usr/include/linux/posix_types.h \
@@ -82,12 +107,13 @@ deps_tools/gen_eth_addr := \
   /usr/include/x86_64-linux-gnu/asm/types.h \
   /usr/include/asm-generic/types.h \
   /usr/include/asm-generic/int-ll64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdbool.h \
   /usr/include/unistd.h \
   /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
   /usr/include/x86_64-linux-gnu/bits/environments.h \
   /usr/include/x86_64-linux-gnu/bits/confname.h \
-  /usr/include/getopt.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_core.h \
   /usr/include/x86_64-linux-gnu/bits/unistd.h \
 
 tools/gen_eth_addr: $(deps_tools/gen_eth_addr)

+ 45 - 19
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/tools/.img2srec.cmd

@@ -7,15 +7,21 @@ deps_tools/img2srec := \
   include/libfdt_env.h \
   include/compiler.h \
     $(wildcard include/config/use/stdint.h) \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h \
   /usr/include/stdint.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+  /usr/include/x86_64-linux-gnu/bits/types.h \
+  /usr/include/x86_64-linux-gnu/bits/typesizes.h \
   /usr/include/x86_64-linux-gnu/bits/wchar.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
   /usr/include/errno.h \
   /usr/include/x86_64-linux-gnu/bits/errno.h \
   /usr/include/linux/errno.h \
@@ -25,50 +31,69 @@ deps_tools/img2srec := \
   /usr/include/stdlib.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/x86_64-linux-gnu/sys/types.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
-  /usr/include/x86_64-linux-gnu/bits/types.h \
-  /usr/include/x86_64-linux-gnu/bits/typesizes.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/sys/types.h \
-  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/stdio.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
   /usr/include/x86_64-linux-gnu/bits/stdio2.h \
   /usr/include/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/x86_64-linux-gnu/sys/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman-linux.h \
+  /usr/include/x86_64-linux-gnu/bits/mman-shared.h \
   /usr/include/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
-  /usr/include/x86_64-linux-gnu/bits/uio.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h \
+  /usr/include/linux/falloc.h \
   /usr/include/x86_64-linux-gnu/bits/stat.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl2.h \
   /usr/include/byteswap.h \
+  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/time.h \
   /usr/include/x86_64-linux-gnu/bits/timex.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
   /usr/include/linux/posix_types.h \
@@ -82,7 +107,7 @@ deps_tools/img2srec := \
   /usr/include/x86_64-linux-gnu/asm/types.h \
   /usr/include/asm-generic/types.h \
   /usr/include/asm-generic/int-ll64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdbool.h \
   tools/os_support.h \
   include/compiler.h \
   /usr/include/ctype.h \
@@ -92,7 +117,8 @@ deps_tools/img2srec := \
   /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
   /usr/include/x86_64-linux-gnu/bits/environments.h \
   /usr/include/x86_64-linux-gnu/bits/confname.h \
-  /usr/include/getopt.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_core.h \
   /usr/include/x86_64-linux-gnu/bits/unistd.h \
 
 tools/img2srec: $(deps_tools/img2srec)

+ 62 - 23
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/tools/.proftool.cmd

@@ -7,15 +7,21 @@ deps_tools/proftool := \
   include/libfdt_env.h \
   include/compiler.h \
     $(wildcard include/config/use/stdint.h) \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h \
   /usr/include/stdint.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+  /usr/include/x86_64-linux-gnu/bits/types.h \
+  /usr/include/x86_64-linux-gnu/bits/typesizes.h \
   /usr/include/x86_64-linux-gnu/bits/wchar.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
   /usr/include/errno.h \
   /usr/include/x86_64-linux-gnu/bits/errno.h \
   /usr/include/linux/errno.h \
@@ -25,50 +31,69 @@ deps_tools/proftool := \
   /usr/include/stdlib.h \
   /usr/include/x86_64-linux-gnu/bits/waitflags.h \
   /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn.h \
+  /usr/include/x86_64-linux-gnu/bits/floatn-common.h \
+  /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
+  /usr/include/x86_64-linux-gnu/sys/types.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/time_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
   /usr/include/endian.h \
   /usr/include/x86_64-linux-gnu/bits/endian.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap.h \
-  /usr/include/x86_64-linux-gnu/bits/types.h \
-  /usr/include/x86_64-linux-gnu/bits/typesizes.h \
   /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \
-  /usr/include/xlocale.h \
-  /usr/include/x86_64-linux-gnu/sys/types.h \
-  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
   /usr/include/x86_64-linux-gnu/sys/select.h \
   /usr/include/x86_64-linux-gnu/bits/select.h \
-  /usr/include/x86_64-linux-gnu/bits/sigset.h \
-  /usr/include/x86_64-linux-gnu/bits/time.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
   /usr/include/x86_64-linux-gnu/bits/select2.h \
   /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+  /usr/include/x86_64-linux-gnu/bits/sysmacros.h \
   /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
+  /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
+  /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
   /usr/include/alloca.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
   /usr/include/x86_64-linux-gnu/bits/stdlib.h \
   /usr/include/stdio.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
   /usr/include/x86_64-linux-gnu/bits/stdio2.h \
   /usr/include/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string.h \
-  /usr/include/x86_64-linux-gnu/bits/string2.h \
-  /usr/include/x86_64-linux-gnu/bits/string3.h \
+  /usr/include/strings.h \
+  /usr/include/x86_64-linux-gnu/bits/strings_fortified.h \
+  /usr/include/x86_64-linux-gnu/bits/string_fortified.h \
   /usr/include/x86_64-linux-gnu/sys/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman.h \
   /usr/include/x86_64-linux-gnu/bits/mman-linux.h \
+  /usr/include/x86_64-linux-gnu/bits/mman-shared.h \
   /usr/include/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
-  /usr/include/x86_64-linux-gnu/bits/uio.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h \
+  /usr/include/linux/falloc.h \
   /usr/include/x86_64-linux-gnu/bits/stat.h \
   /usr/include/x86_64-linux-gnu/bits/fcntl2.h \
   /usr/include/byteswap.h \
+  /usr/include/time.h \
+  /usr/include/x86_64-linux-gnu/bits/time.h \
   /usr/include/x86_64-linux-gnu/bits/timex.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
   /usr/include/linux/posix_types.h \
@@ -82,32 +107,46 @@ deps_tools/proftool := \
   /usr/include/x86_64-linux-gnu/asm/types.h \
   /usr/include/asm-generic/types.h \
   /usr/include/asm-generic/int-ll64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdbool.h \
   /usr/include/assert.h \
   /usr/include/ctype.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/syslimits.h \
   /usr/include/limits.h \
   /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
   /usr/include/x86_64-linux-gnu/bits/local_lim.h \
   /usr/include/linux/limits.h \
   /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \
   /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \
+  /usr/include/x86_64-linux-gnu/bits/uio_lim.h \
   /usr/include/regex.h \
   /usr/include/unistd.h \
   /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
   /usr/include/x86_64-linux-gnu/bits/environments.h \
   /usr/include/x86_64-linux-gnu/bits/confname.h \
-  /usr/include/getopt.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
+  /usr/include/x86_64-linux-gnu/bits/getopt_core.h \
   /usr/include/x86_64-linux-gnu/bits/unistd.h \
   /usr/include/x86_64-linux-gnu/sys/param.h \
   /usr/include/signal.h \
   /usr/include/x86_64-linux-gnu/bits/signum.h \
-  /usr/include/x86_64-linux-gnu/bits/siginfo.h \
+  /usr/include/x86_64-linux-gnu/bits/signum-generic.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sig_atomic_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/siginfo_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__sigval_t.h \
+  /usr/include/x86_64-linux-gnu/bits/siginfo-arch.h \
+  /usr/include/x86_64-linux-gnu/bits/siginfo-consts.h \
+  /usr/include/x86_64-linux-gnu/bits/siginfo-consts-arch.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigval_t.h \
+  /usr/include/x86_64-linux-gnu/bits/types/sigevent_t.h \
+  /usr/include/x86_64-linux-gnu/bits/sigevent-consts.h \
   /usr/include/x86_64-linux-gnu/bits/sigaction.h \
   /usr/include/x86_64-linux-gnu/bits/sigcontext.h \
-  /usr/include/x86_64-linux-gnu/bits/sigstack.h \
+  /usr/include/x86_64-linux-gnu/bits/types/stack_t.h \
   /usr/include/x86_64-linux-gnu/sys/ucontext.h \
+  /usr/include/x86_64-linux-gnu/bits/sigstack.h \
+  /usr/include/x86_64-linux-gnu/bits/ss_flags.h \
+  /usr/include/x86_64-linux-gnu/bits/types/struct_sigstack.h \
   /usr/include/x86_64-linux-gnu/bits/sigthread.h \
   /usr/include/x86_64-linux-gnu/bits/param.h \
   /usr/include/linux/param.h \

Some files were not shown because too many files changed in this diff