zhangbo 5 жил өмнө
parent
commit
25a4f8e6e7
73 өөрчлөгдсөн 3997 нэмэгдсэн , 192 устгасан
  1. 2 0
      app/Makefile
  2. 23 0
      app/bmc/AuthChip/CM_BURNFUZE.c
  3. 41 0
      app/bmc/AuthChip/CM_DATA.c
  4. 184 0
      app/bmc/AuthChip/CM_GPA.c
  5. 61 0
      app/bmc/AuthChip/CM_GPA.h
  6. 241 0
      app/bmc/AuthChip/CM_I2C.c
  7. 123 0
      app/bmc/AuthChip/CM_I2C.h
  8. 49 0
      app/bmc/AuthChip/CM_I2C_L.h
  9. 190 0
      app/bmc/AuthChip/CM_LIB.h
  10. 35 0
      app/bmc/AuthChip/CM_NOPOWER.c
  11. 54 0
      app/bmc/AuthChip/CM_PASSWORD.c
  12. 34 0
      app/bmc/AuthChip/CM_RDCFG.c
  13. 29 0
      app/bmc/AuthChip/CM_RDCKSUM.c
  14. 27 0
      app/bmc/AuthChip/CM_RDFUZE.c
  15. 33 0
      app/bmc/AuthChip/CM_RDUSER.c
  16. 16 0
      app/bmc/AuthChip/CM_READ.c
  17. 13 0
      app/bmc/AuthChip/CM_RESETPSW.c
  18. 19 0
      app/bmc/AuthChip/CM_RESETSEC.c
  19. 22 0
      app/bmc/AuthChip/CM_RND.c
  20. 92 0
      app/bmc/AuthChip/CM_SECURE.c
  21. 70 0
      app/bmc/AuthChip/CM_SELECT.c
  22. 30 0
      app/bmc/AuthChip/CM_SETUSER.c
  23. 36 0
      app/bmc/AuthChip/CM_SRDUSER.c
  24. 35 0
      app/bmc/AuthChip/CM_SWRUSER.c
  25. 659 0
      app/bmc/AuthChip/CM_TEST.c
  26. 10 0
      app/bmc/AuthChip/CM_TRUE.c
  27. 37 0
      app/bmc/AuthChip/CM_WRCFG.c
  28. 33 0
      app/bmc/AuthChip/CM_WRCKSUM.c
  29. 16 0
      app/bmc/AuthChip/CM_WRITE.c
  30. 35 0
      app/bmc/AuthChip/CM_WRUSER.c
  31. 39 1
      app/bmc/Makefile
  32. 1 0
      app/bmc/OemFRU.c
  33. BIN
      app/bmc/bmc_app
  34. 31 0
      app/bmc/main.c
  35. 3 0
      app/common_include/com_gpio.h
  36. 1 1
      app/driver/GPIO/.gpio.mod.o.cmd
  37. 4 1
      app/driver/GPIO/.gpio_main.o.cmd
  38. 1 0
      app/driver/GPIO/Makefile
  39. BIN
      app/driver/GPIO/gpio.ko
  40. 35 0
      app/driver/GPIO/gpio_main.c
  41. 1 0
      app/driver/GPIO_I2C/.gpio_i2c.ko.cmd
  42. 296 0
      app/driver/GPIO_I2C/.gpio_i2c.mod.o.cmd
  43. 1 0
      app/driver/GPIO_I2C/.gpio_i2c.o.cmd
  44. 503 0
      app/driver/GPIO_I2C/.gpio_i2c_main.o.cmd
  45. 2 0
      app/driver/GPIO_I2C/.tmp_versions/gpio_i2c.mod
  46. 1 0
      app/driver/GPIO_I2C/Makefile
  47. 0 0
      app/driver/GPIO_I2C/Module.symvers
  48. BIN
      app/driver/GPIO_I2C/gpio_i2c.ko
  49. 21 0
      app/driver/GPIO_I2C/gpio_i2c.mod.c
  50. 171 23
      app/driver/GPIO_I2C/gpio_i2c_main.c
  51. 1 0
      app/driver/GPIO_I2C/modules.order
  52. BIN
      app/driver/I2C/i2c.ko
  53. 3 1
      app/driver/I2C/i2c_main.c
  54. 9 9
      app/driver/STM32F4xx_HAL_Driver/.system_stm32f4xx.o.cmd
  55. 5 5
      app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal.o.cmd
  56. 5 5
      app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_dma.o.cmd
  57. 5 5
      app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_gpio.o.cmd
  58. 5 5
      app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_sram.o.cmd
  59. 5 5
      app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_ll_fmc.o.cmd
  60. 2 0
      app/driver/driver.h
  61. 12 8
      app/goahead-3.6.5/src/web_interface/src/sel.c
  62. BIN
      app/goahead-5.1.0.tar.gz
  63. 47 0
      app/hal_api/hal_gpio_i2c_interface.c
  64. 103 28
      app/hal_api/hal_gpio_interface.c
  65. 5 0
      app/hal_api/hal_interface_api.h
  66. BIN
      app/ipmitool-1.8.18.tar.bz2
  67. BIN
      app/ipmitool-1.8.18/ipmitool
  68. 1 1
      app/test_app/Makefile
  69. 13 20
      app/test_app/test.c
  70. BIN
      app/test_app/test_app
  71. 340 0
      app/test_app/usart.c
  72. 71 70
      gd32450i-eval.initramfs
  73. 5 4
      local/rc

+ 2 - 0
app/Makefile

@@ -6,6 +6,7 @@ all	:
 	make -C ./driver/ADC
 	make -C ./driver/I2C 
 	make -C ./driver/SPI
+	make -C ./driver/GPIO_I2C
 	
 	# make apps
 	make -C ./bmc
@@ -24,3 +25,4 @@ clean	:
 	make -C ./driver/ADC clean
 	make -C ./driver/I2C clean
 	make -C ./driver/SPI clean
+	make -C ./driver/GPIO_I2C clean

+ 23 - 0
app/bmc/AuthChip/CM_BURNFUZE.c

@@ -0,0 +1,23 @@
+// Burn Fuze
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include <stdint.h>
+
+uint8_t ucCmdWrFuze[4] = {0xb4, 0x01, 0x00, 0x00};
+
+// Burn Fuse
+uint8_t cm_BurnFuse(uint8_t ucFuze)
+{
+	uint8_t ucReturn;
+	
+  // Burn Fuze
+	ucCmdWrFuze[2] = ucFuze;
+	if((ucReturn = CM_LOW_LEVEL.SendCommand(ucCmdWrFuze))!= SUCCESS) return ucReturn;
+	
+  // done	
+	return  CM_LOW_LEVEL.ReceiveRet(NULL,0);
+}

+ 41 - 0
app/bmc/AuthChip/CM_DATA.c

@@ -0,0 +1,41 @@
+// Data and Configuration for the CryptoMemory Library
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+
+// Data Structures that configure the low level CryptoMemory functions
+
+// CryptoMemory Low Level Linkage
+// 
+cm_low_level CM_LOW_LEVEL = {
+    cm_TRUE,         // Carddetect
+    cm_PowerOff,     // PowerOff
+    cm_PowerOn,      // PowerOn
+    cm_SendCommand,  // SendCommand
+    cm_ReceiveData,  // ReceiveRet
+    cm_SendData,     // SendData
+    cm_RandGen,      // RandomGen
+    cm_WaitClock,    // WaitClock
+    cm_SendCmdByte   // SendCmdByte
+};
+
+// CryptoMemory Low Level Configuration
+//
+// Note: the port address is included in a manner that does not require a chip
+//       specific header file. Note, the address of the port is the LAST address
+//       of the group of three addresses of the port (the port output register).
+//
+cm_port_cfg  CM_PORT_CFG = {
+    0xb0, // ucChipSelect        (0xb0 is default address for CryptoMemory)
+    0x32, // ucClockPort         (0x32 is PORTD)
+    0,    // ucClockPin          (SCL on bit 0)
+    0x32, // ucDataPort          (0x32 is PORTD)
+    2,    // ucDataPin           (SDA on bit 2)    
+    0x32, // ucCardSensePort     (0x32 is PORTD)
+    1,    // ucCardSensePin      (card sense switch, if any, on bit 2) 
+    TRUE, // ucCardSensePolarity (TRUE -> "1" on bit in register means card is inserted)
+    0x32, // ucPowerPort         (0x32 is PORTD)
+    3,    // ucPowerPin          (power control, if any, on bit 3)
+    TRUE, // ucPowerPolarity     (TRUE -> "1" on bit in register supplies power)
+    100,  // ucDelayCount
+    10    // ucStartTries
+};

+ 184 - 0
app/bmc/AuthChip/CM_GPA.c

@@ -0,0 +1,184 @@
+// Encryption Functions
+//
+// Note: the naming conventions in this module do not match those used in all other modules. This
+//       is because the name used in this module are intended to be as close to those used in the
+//       Atmel documentation to make verification of these functions simpler.
+
+#include "CM_GPA.h"
+#include <stdint.h>
+
+// -------------------------------------------------------------------------------------------------
+// Data
+// -------------------------------------------------------------------------------------------------
+
+uint8_t ucGpaRegisters[Gpa_Regs];
+
+// -------------------------------------------------------------------------------------------------
+// Functions
+// -------------------------------------------------------------------------------------------------
+
+// Reset the cryptographic state
+void cm_ResetCrypto(void)
+{
+    uint8_t i;
+    
+    for (i = 0; i < Gpa_Regs; ++i) ucGpaRegisters[i] = 0;
+    ucCM_Encrypt = ucCM_Authenticate = FALSE;
+}
+
+// Generate next value
+uint8_t cm_GPAGen(uint8_t Datain)
+{
+	uint8_t Din_gpa;
+	uint8_t Ri, Si, Ti;
+	uint8_t R_sum, S_sum, T_sum;
+	
+	// Input Character
+	Din_gpa = Datain^Gpa_byte;
+	Ri = Din_gpa&0x1f;   			                //Ri[4:0] = Din_gpa[4:0]
+	Si = ((Din_gpa<<3)&0x78)|((Din_gpa>>5)&0x07);   //Si[6:0] = {Din_gpa[3:0], Din_gpa[7:5]}
+	Ti = (Din_gpa>>3)&0x1f;  		                //Ti[4:0] = Din_gpa[7:3];
+       
+	//R polynomial
+	R_sum = cm_Mod(RD, cm_RotR(RG), CM_MOD_R);
+	RG = RF;
+	RF = RE;
+	RE = RD;
+	RD = RC^Ri;
+	RC = RB;
+	RB = RA;
+	RA = R_sum;
+	
+	//S ploynomial
+	S_sum = cm_Mod(SF, cm_RotS(SG), CM_MOD_S);
+	SG = SF;
+	SF = SE^Si;
+	SE = SD;
+	SD = SC;
+	SC = SB;
+	SB = SA;
+	SA = S_sum;
+	
+	//T polynomial
+	T_sum = cm_Mod(TE,TC,CM_MOD_T);
+	TE = TD;
+	TD = TC;
+	TC = TB^Ti;
+	TB = TA;
+	TA = T_sum;
+
+    // Output Stage
+    Gpa_byte =(Gpa_byte<<4)&0xF0;                                  // shift gpa_byte left by 4
+    Gpa_byte |= ((((RA^RE)&0x1F)&(~SA))|(((TA^TD)&0x1F)&SA))&0x0F; // concat 4 prev bits and 4 new bits
+	return Gpa_byte;
+}
+
+// Do authenticate/encrypt chalange encryption
+void cm_AuthenEncryptCal(uint8_t *Ci, uint8_t *G_Sk, uint8_t *Q, uint8_t *Ch)
+{	
+    uint8_t i, j;
+    
+    // Reset all registers
+		cm_ResetCrypto();//by jgw must attention this : its will infect ucCM_Authenticate and ucCM_Encrypt
+    
+    // Setup the cyptographic registers
+    for(j = 0; j < 4; j++) {
+	    for(i = 0; i<3; i++) cm_GPAGen(Ci[2*j]);	
+	    for(i = 0; i<3; i++) cm_GPAGen(Ci[2*j+1]);
+	    cm_GPAGen(Q[j]);
+    }
+	
+    for(j = 0; j<4; j++ ) {
+	    for(i = 0; i<3; i++) cm_GPAGen(G_Sk[2*j]);
+	    for(i = 0; i<3; i++) cm_GPAGen(G_Sk[2*j+1]);
+	    cm_GPAGen(Q[j+4]);
+    }
+	
+    // begin to generate Ch
+    cm_GPAGenN(6);                    // 6 0x00s
+    Ch[0] = Gpa_byte;
+
+    for (j = 1; j<8; j++) {
+	    cm_GPAGenN(7);                // 7 0x00s
+	    Ch[j] = Gpa_byte;
+    }
+	
+    // then calculate new Ci and Sk, to compare with the new Ci and Sk read from eeprom
+    Ci[0] = 0xff;		              // reset AAC 
+    for(j = 1; j<8; j++) {
+	    cm_GPAGenN(2);                // 2 0x00s
+	      Ci[j] = Gpa_byte;
+    }
+
+    for(j = 0; j<8; j++) {
+	     cm_GPAGenN(2);                // 2 0x00s
+	     G_Sk[j] = Gpa_byte;
+    }
+   
+	cm_GPAGenN(3);                    // 3 0x00s
+}
+
+// Calaculate Checksum
+void cm_CalChecksum(uint8_t *Ck_sum)
+{
+	cm_GPAGenN(15);                    // 15 0x00s
+	Ck_sum[0] = Gpa_byte;
+	cm_GPAGenN(5);                     // 5 0x00s
+	Ck_sum[1] = Gpa_byte;	
+}
+
+// The following functions are "macros" for commonly done actions
+
+// Clock some zeros into the state machine
+void cm_GPAGenN(uint8_t Count)
+{
+    while(Count--) cm_GPAGen(0x00);
+}
+
+// Clock some zeros into the state machine, then clock in a byte of data
+void cm_GPAGenNF(uint8_t Count, uint8_t DataIn)
+{
+    cm_GPAGenN(Count);                             // First ones are allways zeros
+    cm_GPAGen(DataIn);                             // Final one is sometimes different
+}
+
+// Include 2 bytes of a command into a polynominal
+void cm_GPAcmd2(uint8_t * pucInsBuff)
+{
+	  cm_GPAGenNF(5, pucInsBuff[2]);
+	  cm_GPAGenNF(5, pucInsBuff[3]);
+}
+    
+// Include 3 bytes of a command into a polynominal
+void cm_GPAcmd3(uint8_t * pucInsBuff)
+{
+	  cm_GPAGenNF(5, pucInsBuff[1]);
+	  cm_GPAcmd2(pucInsBuff);
+}
+    
+// Include the data in the polynominals and decrypt it required
+void cm_GPAdecrypt(uint8_t ucEncrypt, uint8_t * pucBuffer, uint8_t ucCount)
+{
+	  uint8_t i;
+	   
+	  for (i = 0; i < ucCount; ++i) {
+          if (ucEncrypt) pucBuffer[i] = pucBuffer[i]^Gpa_byte;
+ 	      cm_GPAGen(pucBuffer[i]);
+          cm_GPAGenN(5);        // 5 clocks with 0x00 data
+    }
+}
+
+// Include the data in the polynominals and encrypt it required
+void cm_GPAencrypt(uint8_t ucEncrypt, uint8_t * pucBuffer, uint8_t ucCount)
+{
+    uint8_t i, ucData; 
+
+  	for (i = 0; i<ucCount; i++) {
+  		cm_GPAGenN(5);                          // 5 0x00s
+  		ucData = pucBuffer[i];
+  		if (ucEncrypt) pucBuffer[i] = pucBuffer[i]^Gpa_byte;
+  		cm_GPAGen(ucData);
+  	}
+}
+
+

+ 61 - 0
app/bmc/AuthChip/CM_GPA.h

@@ -0,0 +1,61 @@
+
+#ifndef CM_GPA_H
+#define CM_GPA_H
+
+// -------------------------------------------------------------------------------------------------
+// Other includes required by this header file
+// -------------------------------------------------------------------------------------------------
+
+#include "CM_LIB.h"
+
+// Macros for all of the registers
+#define RA       (ucGpaRegisters[0])
+#define RB       (ucGpaRegisters[1])
+#define RC       (ucGpaRegisters[2])
+#define RD       (ucGpaRegisters[3])
+#define RE       (ucGpaRegisters[4])
+#define RF       (ucGpaRegisters[5])
+#define RG       (ucGpaRegisters[6])
+#define TA       (ucGpaRegisters[7])
+#define TB       (ucGpaRegisters[8])
+#define TC       (ucGpaRegisters[9])
+#define TD       (ucGpaRegisters[10])
+#define TE       (ucGpaRegisters[11])
+#define SA       (ucGpaRegisters[12])
+#define SB       (ucGpaRegisters[13])
+#define SC       (ucGpaRegisters[14])
+#define SD       (ucGpaRegisters[15])
+#define SE       (ucGpaRegisters[16])
+#define SF       (ucGpaRegisters[17])
+#define SG       (ucGpaRegisters[18])
+#define Gpa_byte (ucGpaRegisters[19])
+#define Gpa_Regs (20)
+
+
+// Defines for constants used
+#define CM_MOD_R (0x1F)
+#define CM_MOD_T (0x1F)
+#define CM_MOD_S (0x7F)
+
+// Macros for common operations
+#define cm_Mod(x,y,m) ((x+y)>m?(x+y-m):(x+y))
+#define cm_RotT(x)    (((x<<1)&0x1e)|((x>>4)&0x01))
+#define cm_RotR(x)    (((x<<1)&0x1e)|((x>>4)&0x01))
+#define cm_RotS(x)    (((x<<1)&0x7e)|((x>>6)&0x01))
+
+// Externals
+extern uint8_t ucGpaRegisters[Gpa_Regs];
+
+// Function Prototypes
+void cm_ResetCrypto(void);
+uint8_t cm_GPAGen(uint8_t Datain);
+void cm_CalChecksum(uint8_t *Ck_sum);
+void cm_AuthenEncryptCal(uint8_t *Ci, uint8_t *G_Sk, uint8_t *Q, uint8_t *Ch);
+void cm_GPAGenN(uint8_t Count);
+void cm_GPAGenNF(uint8_t Count, uint8_t DataIn);
+void cm_GPAcmd2(uint8_t * pucInsBuff);
+void cm_GPAcmd3(uint8_t * pucInsBuff);
+void cm_GPAdecrypt(uint8_t ucEncrypt, uint8_t * pucBuffer, uint8_t ucCount);
+void cm_GPAencrypt(uint8_t ucEncrypt, uint8_t * pucBuffer, uint8_t ucCount); 
+
+#endif

+ 241 - 0
app/bmc/AuthChip/CM_I2C.c

@@ -0,0 +1,241 @@
+// Functions that directly control the hardware
+
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "hal_interface_api.h"
+#include <unistd.h>
+
+// Delay
+void cm_Delay(uint8_t ucDelay)
+{
+	uint32_t ucTimer;
+	uint8_t a,b = 0;  
+    while(ucDelay) {
+    	ucTimer = 2000;
+        while(ucTimer) 
+        {
+            ucTimer--;
+            a = b;
+        }
+    	ucDelay--;
+    }	
+}
+
+// 1/2 Clock Cycle transition to HIGH
+//
+void cm_Clockhigh(void)
+{
+    cm_Delay(1);
+    CM_CLK_HI;
+    cm_Delay(1);
+}
+
+// 1/2 Clock Cycle transition to LOW
+//
+void cm_Clocklow(void)
+{
+    cm_Delay(1);
+    CM_CLK_LO;
+    cm_Delay(1);
+}
+
+// Do one full clock cycle
+//
+// Changed 1/19/05 to eliminate one level of return stack requirements
+//
+void cm_ClockCycle(void)
+{
+    cm_Clocklow();
+    cm_Clockhigh();
+}
+
+// Do a number of clock cycles
+//
+void cm_ClockCycles(uint8_t ucCount)
+{
+    uint8_t i;
+    
+    for (i = 0; i < ucCount; ++i) cm_ClockCycle();
+}
+
+// Send a start sequence
+//
+// Modified 7-21-04 to correctly set SDA to be an output
+// 
+void cm_Start(void)
+{
+	cm_Delay(50);//by jgw for delay to avoid i2c dead because of too fast
+	  CM_DATA_OUT;                         // Data line must be an output to send a start sequence
+	  //cm_Clocklow();
+	  CM_DATA_HI;
+	  cm_Delay(4);
+	  cm_Clockhigh();
+	  cm_Delay(4);
+	  CM_DATA_LO;
+	  cm_Delay(8);
+	  cm_Clocklow();
+	  cm_Delay(8);
+}
+
+// Send a stop sequence
+//
+// Modified 7-21-04 to correctly set SDA to be an output
+// 
+void cm_Stop(void)
+{
+	cm_Delay(10);//by jgw for delay to avoid i2c dead because of too fast
+	CM_DATA_OUT;                         // Data line must be an output to send a stop sequence
+	cm_Clocklow();
+	CM_DATA_LO;
+	cm_Delay(4);
+	cm_Clockhigh();
+	cm_Delay(8);
+	CM_DATA_HI;
+	cm_Delay(4);
+}
+
+// Write a byte
+//
+// Returns 0 if write successed, 1 if write fails failure
+//
+// Modified 7-21-04 to correctly control SDA
+// 
+uint8_t cm_Write(uint8_t ucData)
+{
+    uint8_t i;
+
+	cm_Delay(10);//by jgw for delay to avoid i2c dead because of too fast
+    CM_DATA_OUT;                         // Set data line to be an output
+    for(i=0; i<8; i++) {                 // Send 8 bits of data
+        cm_Clocklow();
+        if (ucData&0x80) CM_DATA_HI;
+        else             CM_DATA_LO;
+        cm_Clockhigh();
+        ucData = ucData<<1;
+    }
+    cm_Clocklow();
+
+    // wait for the ack
+    CM_DATA_IN;                      // Set data line to be an input
+    cm_Delay(8);
+    cm_Clockhigh();
+    while(i>1) {                    // loop waiting for ack (loop above left i == 8)
+        cm_Delay(2);
+        if (CM_DATA_RD) i--;        // if SDA is high level decrement retry counter
+        else i = 0;
+    }      
+    cm_Clocklow();
+    CM_DATA_OUT;                     // Set data line to be an output
+    return i;
+}
+
+// Send a ACK or NAK or to the device
+void cm_AckNak(uint8_t ucAck)
+{
+	cm_Delay(10);//by jgw for delay to avoid i2c dead because of too fast
+	CM_DATA_OUT;                         // Data line must be an output to send an ACK
+	cm_Clocklow();
+	if (ucAck) CM_DATA_LO;               // Low on data line indicates an ACK
+	else       CM_DATA_HI;               // High on data line indicates an NACK
+	cm_Delay(2);
+	cm_Clockhigh();
+	cm_Delay(8);
+	cm_Clocklow();
+}
+
+//     Read a byte from device, MSB
+//
+// Modified 7-21-04 to correctly control SDA
+// 
+uint8_t cm_Read(void)
+{
+	uint8_t i;
+	uint8_t rByte = 0;	
+	CM_DATA_IN;                          // Set data line to be an input
+	CM_DATA_HI;
+	for(i=0x80; i; i=i>>1)
+	{
+		cm_ClockCycle();
+		if (CM_DATA_RD) rByte |= i;
+		cm_Clocklow();
+	}
+	CM_DATA_OUT;                         // Set data line to be an output
+	return rByte;
+}
+
+void cm_WaitClock(uint8_t loop)
+{
+	uint8_t i, j;
+	
+	CM_DATA_LO;
+	for(j=0; j<loop; j++) {
+		cm_Start();
+		for(i = 0; i<15; i++) cm_ClockCycle();
+		cm_Stop();
+	}
+}
+
+// Send a command
+//
+uint8_t cm_SendCommand(uint8_t * pucInsBuff)
+{
+    uint8_t i, ucCmd;
+	
+    i = CM_START_TRIES;
+    ucCmd = (pucInsBuff[0]&0x0F)|CM_PORT_CFG.ucChipSelect;
+    while (i) {
+        cm_Start();
+        if (cm_Write(ucCmd) == 0) break;
+        if (--i == 0) return FAIL_CMDSTART;
+    }
+	
+    for(i = 1; i< 4; i++) {
+        if (cm_Write(pucInsBuff[i]) != 0) return FAIL_CMDSEND;
+    }
+    return SUCCESS;
+}
+
+uint8_t cm_ReceiveData(uint8_t * pucRecBuf, uint8_t ucLen)
+{
+    int i;
+
+    for(i = 0; i < (ucLen-1); i++) {
+        pucRecBuf[i] = cm_Read();
+        cm_AckNak(TRUE);
+    }
+    pucRecBuf[i] = cm_Read();
+    cm_AckNak(FALSE);
+    cm_Stop();
+    return SUCCESS;
+}
+
+uint8_t cm_SendData(uint8_t * pucSendBuf, uint8_t ucLen)
+{
+	int i;
+	for(i = 0; i< ucLen; i++) {
+		if (cm_Write(pucSendBuf[i])==1) return FAIL_WRDATA;
+	}
+	cm_Stop();
+	
+	return SUCCESS;
+}
+
+
+// Send a command byte
+//
+uint8_t cm_SendCmdByte(uint8_t ucCommand)
+{
+    uint8_t i, ucCmd;
+	
+    i = CM_START_TRIES;
+
+    ucCmd = (ucCommand&0x0F)|CM_PORT_CFG.ucChipSelect;
+    while (i) {
+      cm_Start();
+	    if (cm_Write(ucCmd) == 0) break;
+	    if (--i == 0) return FAIL_CMDSTART;
+    }
+
+    return SUCCESS;
+}

+ 123 - 0
app/bmc/AuthChip/CM_I2C.h

@@ -0,0 +1,123 @@
+// CryptoMemory I2C Header File
+//
+// This library is used in all of the low level hardware interface for I2C communications.
+//
+// Revision Date      Changes
+// -------- --------- -----------------------------------------------------------------
+//    0.1   26 Oct 04 First Release
+
+// Protect Library against multiple inclusion
+#ifndef CM_I2C_H
+#define CM_I2C_H
+
+#include "hal_interface_api.h"
+#include "com_gpio.h"
+
+// -------------------------------------------------------------------------------------------------
+// Other includes required by this header file
+// -------------------------------------------------------------------------------------------------
+
+#include "CM_LIB.h"
+
+// //Ô¬¿­À¬»ø³ÌÐò
+// #define CM_DETECT_PI  (*(volatile unsigned char *)(CM_PORT_CFG.ucCardSensePort+IO_PORT_IN))
+// #define CM_DETECT_PD  (*(volatile unsigned char *)(CM_PORT_CFG.ucCardSensePort+IO_PORT_DIR))
+// #define CM_DETECT_PIN (CM_PORT_CFG.ucCardSensePin)
+// #define CM_DETECT_POL (CM_PORT_CFG.ucCardSensePolarity)
+// #define CM_DETECT_IN  CM_DETECT_PD&=~(1<<CM_DETECT_PIN)
+// #define CM_DETECT_RD  CM_DETECT_PI&(1<<CM_DETECT_PIN)
+
+// #define CM_POWER_PD  (*(volatile unsigned char *)(CM_PORT_CFG.ucPowerPort+IO_PORT_DIR))
+// #define CM_POWER_PO  (*(volatile unsigned char *)(CM_PORT_CFG.ucPowerPort+IO_PORT_OUT))
+// #define CM_POWER_PIN (CM_PORT_CFG.ucPowerPin)
+// #define CM_POWER_POL (CM_PORT_CFG.ucPowerPolarity)
+// #define CM_POWER_OUT CM_POWER_PD|=(1<<CM_POWER_PIN)
+// #define CM_POWER_HI  CM_POWER_PO|=(1<<CM_POWER_PIN)
+// #define CM_POWER_LO  CM_POWER_PO&=~(1<<CM_POWER_PIN)
+// #define CM_DATA_BIT   ((CM_DATA_PI>>CM_DATA_PIN)&1)
+
+// #define CM_CLK_PD     (*(volatile unsigned char *)(CM_PORT_CFG.ucClockPort+IO_PORT_DIR))
+// #define CM_CLK_PO     (*(volatile unsigned char *)(CM_PORT_CFG.ucClockPort+IO_PORT_OUT)) 
+// #define CM_CLK_PIN    (CM_PORT_CFG.ucClockPin)
+
+// #define CM_DATA_PI    (*(volatile unsigned char *)(CM_PORT_CFG.ucDataPort+IO_PORT_IN))
+// #define CM_DATA_PD    (*(volatile unsigned char *)(CM_PORT_CFG.ucDataPort+IO_PORT_DIR))
+// #define CM_DATA_PO    (*(volatile unsigned char *)(CM_PORT_CFG.ucDataPort+IO_PORT_OUT))
+// #define CM_DATA_PIN   (CM_PORT_CFG.ucDataPin)
+
+// #define rPIOA_OER   (*(volatile unsigned *)0x40020000 + 0x14)
+// #define rPIOA_ODR   (*(volatile unsigned *)0x40020000 + 0x10)
+
+// #define rPIOA_SODR  (*(volatile unsigned *)0x40020000 + 0x18)
+// #define rPIOA_CODR  (*(volatile unsigned *)0x40020000 + 0x1A)
+
+// #define rPIOA_PDSR	(*(volatile unsigned *)0x40020000 + 0x10)
+
+// #define SDA ((rPIOA_PDSR&PIN25)?1:0)        
+// /*================================Àî=====================================*/
+
+// #define IO_PORT_DIR (-1)
+// #define IO_PORT_OUT (0)
+
+#define GIO_DIR_INPUT 0x00
+#define GIO_DIR_OUTPUT 0x01
+
+
+
+#define GPIO_CLK GPIO_PIN_6
+#define PORT_CLK GPIOE
+#define GPIO_DATA GPIO_PIN_5
+#define PORT_DATA GPIOE
+
+#define CM_CLK_OUT stm32_gpio_direct(PORT_CLK,GPIO_CLK,GIO_DIR_OUTPUT)
+#define CM_CLK_HI  stm32_gpio_write(PORT_CLK,GPIO_CLK,GPIO_PIN_SET)
+#define CM_CLK_LO   stm32_gpio_write(PORT_CLK,GPIO_CLK,GPIO_PIN_RESET)
+
+
+#define CM_DATA_OUT stm32_gpio_direct(PORT_DATA,GPIO_DATA,GIO_DIR_OUTPUT)
+#define CM_DATA_IN    stm32_gpio_direct(PORT_DATA,GPIO_DATA,GIO_DIR_INPUT)
+#define CM_DATA_HI stm32_gpio_write(PORT_DATA,GPIO_DATA,GPIO_PIN_SET)
+#define CM_DATA_LO stm32_gpio_write(PORT_DATA,GPIO_DATA,GPIO_PIN_RESET)
+#define CM_DATA_RD   stm32_gpio_read(PORT_DATA,GPIO_DATA)
+
+#define CM_START_TRIES 10	//(CM_PORT_CFG.ucStartTries)
+
+// -------------------------------------------------------------------------------------------------
+// Macros that replace small common function
+// -------------------------------------------------------------------------------------------------
+
+#define CM_CLOCKHIGH  cm_Delay(1);(CM_CLK_HI);cm_Delay(1)
+#define CM_CLOCKLOW   cm_Delay(1);(CM_CLK_LO);cm_Delay(1)
+#define CM_CLOCKCYCLE cm_Delay(1);(CM_CLK_LO);cm_Delay(2);(CM_CLK_HI);cm_Delay(1)
+
+// -------------------------------------------------------------------------------------------------
+// Low Level Function Prototypes
+// -------------------------------------------------------------------------------------------------
+
+// Placeholder function that always returns TRUE
+uint8_t cm_TRUE(void);
+
+void cm_PowerOn(void);   
+void cm_PowerOff(void);
+
+// Send Command
+uint8_t cm_SendCommand(uint8_t * pucCommandBuffer);
+
+// Receive Data
+uint8_t cm_ReceiveData(uint8_t * pucReceiveData, uint8_t ucLength);
+
+// Send Data 
+uint8_t cm_SendData(uint8_t * pucSendData, uint8_t ucLength);
+
+// Random
+void cm_RandGen(uint8_t * pucRandomData);
+
+// Wait Clock
+void cm_WaitClock(uint8_t ucLoop);
+
+// Send Command Byte
+uint8_t cm_SendCmdByte(uint8_t ucCommand);
+
+
+// end of multiple inclusion protection
+#endif

+ 49 - 0
app/bmc/AuthChip/CM_I2C_L.h

@@ -0,0 +1,49 @@
+// CryptoMemory I2C Very Low Level Header File
+//
+// This library is used in all of the low level hardware interface for I2C communications.
+//
+// Revision Date      Changes
+// -------- --------- -----------------------------------------------------------------
+//    0.1   07 Nov 04 First Release
+
+// Protect Library against multiple inclusion
+#ifndef CM_I2C_L_H
+#define CM_I2C_L_H
+
+// -------------------------------------------------------------------------------------------------
+// Other includes required by this header file
+// -------------------------------------------------------------------------------------------------
+
+
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include <unistd.h>
+#define CM_PWRON_CLKS (15)
+// Constants used in low level functions
+// Power on clocks (spec call for 5, but California Card uses 15)
+
+// Mid-Level Functions
+uint8_t cm_ReadCommand(uint8_t * pucInsBuff, uint8_t * pucRetVal, uint8_t ucLen);
+uint8_t cm_WriteCommand(uint8_t * pucInsBuff, uint8_t * pucSendVal, uint8_t ucLen);
+
+// Functions in CM_I2C.C used internally by other low level functions
+void cm_Clockhigh(void);
+void cm_Clocklow(void);
+void cm_ClockCycle(void);
+void cm_ClockCycles(uint8_t ucCount);
+void cm_Start(void);
+void cm_Stop(void);
+uint8_t cm_Write(uint8_t ucData);
+void cm_Ack(void);
+void cm_N_Ack(void);
+uint8_t cm_Read(void);
+void cm_WaitClock(uint8_t loop);
+uint8_t cm_SendCommand(uint8_t * pucInsBuff);
+uint8_t cm_ReceiveRet(uint8_t * pucRecBuf, uint8_t ucLen);
+uint8_t cm_SendDat(uint8_t * pucSendBuf, uint8_t ucLen);
+void cm_RandomGen(uint8_t * pucRanddat);
+
+void cm_Delay(uint8_t ucDelay);
+
+// end of multiple inclusion protection
+#endif

+ 190 - 0
app/bmc/AuthChip/CM_LIB.h

@@ -0,0 +1,190 @@
+// CryptoMemory Header File
+//
+// Detailed descriptions of all functions and structures in the header file can be found in
+// the "CryptoMemory Library User Manual".
+//
+// Revision Date      Changes
+// -------- --------- -----------------------------------------------------------------
+//    0.1   26 Oct 04 First Release
+//    0.2   19 Nov 04 Major additions and corrections
+
+// Protect Library against multiple inclusion
+#ifndef __CM_LIB_H__
+#define __CM_LIB_H__
+
+#include "com_IPMIDefs.h"
+// -------------------------------------------------------------------------------------------------
+// Definations
+// -------------------------------------------------------------------------------------------------
+
+// Basic Definations (if not available elsewhere)
+#ifndef FALSE
+#define FALSE (0)
+#define TRUE  (!FALSE)
+#endif
+#ifndef NULL
+#define NULL ((void *)0)
+#endif
+
+// Device Configuration Register
+#define DCR_ADDR      (0x18)
+#define DCR_SME       (0x80)
+#define DCR_UCR       (0x40)
+#define DCR_UAT       (0x20)
+#define DCR_ETA       (0x10)
+#define DCR_CS        (0x0F)
+
+// Cryptograms
+#define CM_Ci         (0x50)
+#define CM_Sk         (0x58)
+#define CM_G          (0x90)
+
+// Fuses
+#define CM_FAB        (0x06)
+#define CM_CMA        (0x04)
+#define CM_PER        (0x00)
+
+// Password
+#define CM_PSW        (0xB0)
+#define CM_PWREAD     (1)
+#define CM_PWWRITE    (0)
+
+// Return Code Defination
+#define SUCCESS       (0)
+#define FAILED        (1)
+#define FAIL_CMDSTART (2)
+#define FAIL_CMDSEND  (3)
+#define FAIL_WRDATA   (4)
+#define FAIL_RDDATA   (5)
+// note: additional specific error codes may be added in the future
+
+// -------------------------------------------------------------------------------------------------
+void cm_InitTwiPio(void);
+void cm_RestorPio(void);
+// High Level Function Prototypes
+
+// Select Chip
+uint8_t cm_SelectChip(uint8_t ucChipId);
+
+// Activate Security
+uint8_t cm_ActiveSecurity(uint8_t ucKeySet, uint8_t * pucKey, uint8_t * pucRandom, uint8_t ucEncrypt);
+
+// Deactivate Security
+uint8_t cm_DeactiveSecurity(void);
+
+// Verify Password
+uint8_t cm_VerifyPassword(uint8_t * pucPassword, uint8_t ucSet, uint8_t ucRW);
+
+// Reset Password
+uint8_t cm_ResetPassword(void);
+
+// Verify Secure Code
+//#define cm_VerifySecureCode(CM_PW) cm_VerifyPassword(CM_PWRON_CLKS, 7, CM_PWWRITE) 
+#define cm_VerifySecureCode(CM_PW) cm_VerifyPassword(CM_PW, 7, CM_PWWRITE) 
+
+// Read Configuration Zone
+uint8_t cm_ReadConfigZone(uint8_t ucCryptoAddr, uint8_t * pucBuffer, uint8_t ucCount);
+
+// Write Configuration Zone
+uint8_t cm_WriteConfigZone(uint8_t ucCryptoAddr, uint8_t * pucBuffer, uint8_t ucCount, uint8_t ucAntiTearing);
+
+// Set User Zone
+uint8_t cm_SetUserZone(uint8_t ucZoneNumber, uint8_t ucAntiTearing);
+
+// Read User Zone
+uint8_t cm_ReadLargeZone(uint32_t uiCryptoAddr, uint8_t * pucBuffer, uint8_t ucCount);
+
+// Read Small User Zone
+uint8_t cm_ReadSmallZone(uint8_t ucCryptoAddr, uint8_t * pucBuffer, uint8_t ucCount);
+
+// Write User Zone
+char cm_WriteLargeZone(uint32_t uiCryptoAddr, uint8_t * pucBuffer, uint8_t ucCount);
+
+// Write Small User Zone
+uint8_t cm_WriteSmallZone(uint8_t ucCryptoAddr, uint8_t * pucBuffer, uint8_t ucCount);
+
+// Send Checksum
+uint8_t cm_SendChecksum(uint8_t * pucChkSum);
+
+// Read Checksum
+uint8_t cm_ReadChecksum(uint8_t * pucChkSum);
+
+// Read Fuse Byte
+uint8_t cm_ReadFuse(uint8_t * pucFuze);
+
+// Burn Fuse
+uint8_t cm_BurnFuse(uint8_t ucFuze);
+
+void cm_InitTwiPio(void);
+
+void cm_RestorPio(void);
+
+void cm_InitCmVar(unsigned char Num);
+
+//加密访问API接口函数:用于认证加密
+int cm_Auth_Encrp(void);
+
+// -------------------------------------------------------------------------------------------------
+// Configuration Structures
+// -------------------------------------------------------------------------------------------------
+
+// CryptoMemory Low Level Linkage
+// 
+typedef struct{
+    uint8_t (*Carddetect)(void);
+    void (*PowerOff)(void);
+    void (*PowerOn)(void);
+    uint8_t (*SendCommand)(uint8_t * pucCommandBuffer);
+    uint8_t (*ReceiveRet)(uint8_t * pucReceiveData, uint8_t ucLength);
+    uint8_t (*SendData)(uint8_t * pucSendData, uint8_t ucLength);
+    void (*RandomGen)(uint8_t * pucRandomData);
+    void (*WaitClock)(uint8_t ucLoop);
+    uint8_t (*SendCmdByte)(uint8_t ucCommand);
+} cm_low_level;
+
+// CryptoMemory Low Level Configuration
+// 
+// If any of the supplied CryptoMemory low level library functions are used, this structure must be
+// present in the user code. For a detailed description of the elements in the structure, please
+// see the "CryptoMemory Library User Manual".
+// 
+typedef struct{
+    uint8_t ucChipSelect;
+    uint8_t ucClockPort;
+    uint8_t ucClockPin;
+    uint8_t ucDataPort;
+    uint8_t ucDataPin;
+    uint8_t ucCardSensePort;
+    uint8_t ucCardSensePin; 
+    uint8_t ucCardSensePolarity; 
+    uint8_t ucPowerPort;
+    uint8_t ucPowerPin;
+    uint8_t ucPowerPolarity;
+    uint8_t ucDelayCount;
+    uint8_t ucStartTries;
+} cm_port_cfg;
+
+// -------------------------------------------------------------------------------------------------
+// Externals for Configuration Structures
+// -------------------------------------------------------------------------------------------------
+
+extern cm_low_level CM_LOW_LEVEL;
+extern cm_port_cfg  CM_PORT_CFG;
+
+// -------------------------------------------------------------------------------------------------
+// Other Externals
+// -------------------------------------------------------------------------------------------------
+
+extern uint8_t ucCM_Encrypt;
+extern uint8_t ucCM_Authenticate;
+extern uint8_t ucCM_UserZone;
+extern uint8_t ucCM_AntiTearing;
+extern uint8_t ucCM_InsBuff[4];
+
+uint8_t cm_Auth_Encrp_Init(uint8_t authMode,uint8_t pswMode,uint8_t encryptFlag);
+uint8_t test_cryptomem(void);
+uint8_t cm_Auth_Encrp_Write(uint8_t userZone,uint8_t startInZone,uint8_t* writeData,uint8_t writeLen);
+uint8_t cm_Auth_Encrp_Read(uint8_t userZone,uint8_t startInZone,uint8_t* readData,uint8_t readLen);
+uint8_t cm_Auth_Encrp_Personal(uint8_t pswMode,uint8_t authMode);
+// end of multiple inclusion protection
+#endif

+ 35 - 0
app/bmc/AuthChip/CM_NOPOWER.c

@@ -0,0 +1,35 @@
+// Functions control the logical power on/off for the chip
+
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+#include "hal_interface_api.h"
+// Power On Chip  
+//
+// Returns 0 (SUCCESS) if no error
+//
+void cm_PowerOn(void)   
+{
+	// Reset chip data
+	cm_ResetCrypto();
+    ucCM_UserZone = ucCM_AntiTearing = 0;
+    
+    // Sequence for powering on secure memory according to ATMEL spec
+    CM_DATA_OUT;                              // SDA and SCL start as outputs
+	CM_CLK_OUT;
+    CM_CLK_LO;                                // Clock should start LOW
+    CM_DATA_HI;                               // Data high during reset
+    cm_ClockCycles(CM_PWRON_CLKS);            // Give chip some clocks cycles to get started
+
+    // Chip should now be in sync mode and ready to operate
+}
+
+// Shut down secure memory
+//
+void cm_PowerOff(void)
+{
+	cm_Delay(1);
+	CM_CLK_LO;
+	cm_Delay(6);
+}

+ 54 - 0
app/bmc/AuthChip/CM_PASSWORD.c

@@ -0,0 +1,54 @@
+// Verify Password
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+uint8_t ucCmdPassword[4] = {0xba, 0x00, 0x00, 0x03};
+uint8_t ucPSW[3];
+
+// Verify Password
+uint8_t cm_VerifyPassword(uint8_t * pucPassword, uint8_t ucSet, uint8_t ucRW)
+{
+	uint8_t i, j;
+    uint8_t ucReturn;
+	uint8_t ucAddr;
+	
+	// Build command and PAC address
+    ucAddr = CM_PSW + (ucSet<<3);
+	ucCmdPassword[1] = ucSet;// to choose which sets of passwords
+	if (ucRW != CM_PWWRITE) {
+	  	ucCmdPassword[1] |= 0x10;
+	  	ucAddr += 4;
+	}
+	  
+	// Deal with encryption if in authenticate mode
+	for (j = 0; j<3; j++) {
+	    // Encrypt the password
+	    if(ucCM_Authenticate) {
+    	    for(i = 0; i<5; i++) cm_GPAGen(pucPassword[j]);
+    		ucPSW[j] = Gpa_byte;
+	  	}
+	    // Else just copy it
+		else ucPSW[j] = pucPassword[j];
+    }
+	  
+	// Send the command
+	ucReturn = cm_WriteCommand(ucCmdPassword, ucPSW, 3);
+     
+    // Wait for chip to process password
+    CM_LOW_LEVEL.WaitClock(3);
+   
+    // Read Password attempts counter to determine if the password was accepted
+    if (ucReturn == SUCCESS) {
+        ucReturn = cm_ReadConfigZone(ucAddr, ucPSW, 1);
+	    if (ucPSW[0]!= 0xFF) ucReturn = FAILED;
+	}
+	if (ucCM_Authenticate && (ucReturn != SUCCESS)) cm_ResetCrypto();
+
+    // Done
+    return ucReturn;
+}

+ 34 - 0
app/bmc/AuthChip/CM_RDCFG.c

@@ -0,0 +1,34 @@
+// Read Configuration Zone
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// Read Configuration Zone
+uint8_t cm_ReadConfigZone(uint8_t ucCryptoAddr, uint8_t * pucBuffer, uint8_t ucCount)
+{
+    uint8_t ucReturn, ucEncrypt;
+
+    ucCM_InsBuff[0] = 0xb6;
+    ucCM_InsBuff[1] = 0x00;
+    ucCM_InsBuff[2] = ucCryptoAddr;
+    ucCM_InsBuff[3] = ucCount;
+    
+    // Three bytes of the command must be included in the polynominals
+    cm_GPAcmd2(ucCM_InsBuff);
+    
+    // Do the read
+    if ((ucReturn = cm_ReadCommand(ucCM_InsBuff, pucBuffer, ucCount)) != SUCCESS) return ucReturn;
+	
+    // Only password zone is ever encrypted
+    ucEncrypt = ((ucCryptoAddr>= CM_PSW) && ucCM_Encrypt);
+
+    // Include the data in the polynominals and decrypt if required
+    cm_GPAdecrypt(ucEncrypt, pucBuffer, ucCount); 
+
+    // Done
+    return SUCCESS;
+}

+ 29 - 0
app/bmc/AuthChip/CM_RDCKSUM.c

@@ -0,0 +1,29 @@
+// Read Checksum
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+uint8_t	ucCmdRdChk[4] = {0xb6, 0x02, 0x00, 0x02};
+
+// Read Checksum
+uint8_t cm_ReadChecksum(uint8_t * pucChkSum)
+{
+    uint8_t ucDCR[1];
+	uint8_t ucReturn;
+
+    // 20 0x00s (10 0x00s, ignore first byte, 5 0x00s, ignore second byte, 5 0x00s  
+    cm_GPAGenN(20);
+	  
+    // Read the checksum                  
+    if((ucReturn = cm_ReadCommand(ucCmdRdChk, pucChkSum, 2))!= SUCCESS) return ucReturn;
+	
+    // Check if unlimited reads allowed
+    if ((ucReturn = cm_ReadConfigZone(DCR_ADDR, ucDCR, 1)) != SUCCESS) return ucReturn;
+    if ((ucDCR[0]&DCR_UCR)) cm_ResetCrypto();
+	
+    return SUCCESS;
+}

+ 27 - 0
app/bmc/AuthChip/CM_RDFUZE.c

@@ -0,0 +1,27 @@
+// Read Fuze Byte
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+uint8_t	ucCmdRdFuze[4] = {0xb6, 0x01, 0x00, 0x01};
+
+// Read Fuse Byte
+uint8_t cm_ReadFuse(uint8_t * pucFuze)
+{
+	uint8_t ucReturn;
+	
+  // 5 0x00, A2 (0x00), 5 0x00, N (0x01)	
+	cm_GPAGenNF(11, 0x01);
+
+	if((ucReturn = cm_ReadCommand(ucCmdRdFuze,pucFuze,1)) != SUCCESS) return ucReturn;
+	
+	cm_GPAGen(*pucFuze);         // fuze byte
+  cm_GPAGenN(5);               // 5 0x00s
+  
+	return SUCCESS;
+	
+}

+ 33 - 0
app/bmc/AuthChip/CM_RDUSER.c

@@ -0,0 +1,33 @@
+// Read User Zone
+//
+// The Read Large User Zone function is used to read data from CryptoMemory devices
+// that have greater than 256 bytes in each user zone (AT88SC6416C, and larger)
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// Read User Zone
+uint8_t cm_ReadLargeZone(uint32_t uiCryptoAddr, uint8_t* pucBuffer, uint8_t ucCount)
+{
+    uint8_t ucReturn;
+
+    ucCM_InsBuff[0] = 0xb2;
+    ucCM_InsBuff[1] = (uint8_t)(uiCryptoAddr>>8);
+    ucCM_InsBuff[2] = (uint8_t)uiCryptoAddr;
+    ucCM_InsBuff[3] = ucCount;
+
+    // Three bytes of the command must be included in the polynominals
+    cm_GPAcmd3(ucCM_InsBuff);
+    
+    // Read the data
+    if ((ucReturn = cm_ReadCommand(ucCM_InsBuff, pucBuffer, ucCount)) != SUCCESS) return ucReturn;
+    
+    // Include the data in the polynominals and decrypt if required
+    cm_GPAdecrypt(ucCM_Encrypt, pucBuffer, ucCount); 
+
+    return SUCCESS;
+}
+

+ 16 - 0
app/bmc/AuthChip/CM_READ.c

@@ -0,0 +1,16 @@
+// Mid Level Utility Function: cm_ReadCommand()
+//
+// Note: this module must be after all low level functions in the library and
+//       before all high level user function to assure that any reference to
+//       this function in this library are satistified.
+
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+
+uint8_t cm_ReadCommand(uint8_t * pucInsBuff, uint8_t * pucRetVal, uint8_t ucLen)
+{ 
+    uint8_t ucReturn;
+    
+    if ((ucReturn = CM_LOW_LEVEL.SendCommand(pucInsBuff)) != SUCCESS) return ucReturn;
+    return CM_LOW_LEVEL.ReceiveRet(pucRetVal, ucLen);
+}

+ 13 - 0
app/bmc/AuthChip/CM_RESETPSW.c

@@ -0,0 +1,13 @@
+// Reset Password
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+
+// Reset Password
+uint8_t cm_ResetPassword(void)
+{
+	   return CM_LOW_LEVEL.SendCmdByte(0xba);
+}

+ 19 - 0
app/bmc/AuthChip/CM_RESETSEC.c

@@ -0,0 +1,19 @@
+// Deactivate Security
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// Deactivate Security
+uint8_t cm_DeactiveSecurity(void)
+{
+	uint8_t ucReturn;
+	 
+	if ((ucReturn = CM_LOW_LEVEL.SendCmdByte(0xb8)) != SUCCESS) return ucReturn;
+	cm_ResetCrypto();
+	
+	return SUCCESS;
+}

+ 22 - 0
app/bmc/AuthChip/CM_RND.c

@@ -0,0 +1,22 @@
+// Low quality random number generator
+
+#include <stdlib.h>
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "hal_interface_api.h"
+
+void cm_RandGen(uint8_t * pucRanddat)
+{
+	uint32_t random;
+	random = stm32_generate_random32bit();
+	pucRanddat[0] = (uint8_t) random;
+	pucRanddat[1] = (uint8_t) random>>8;
+	pucRanddat[2] = (uint8_t) random>>16;
+	pucRanddat[3] = (uint8_t) random>>24;
+	random = stm32_generate_random32bit();
+	pucRanddat[4] = (uint8_t) random;
+	pucRanddat[5] = (uint8_t) random>>8;
+	pucRanddat[6] = (uint8_t) random>>16;
+	pucRanddat[7] = (uint8_t) random>>24;
+}

+ 92 - 0
app/bmc/AuthChip/CM_SECURE.c

@@ -0,0 +1,92 @@
+// Activate Security
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// Local function prototypes
+static uint8_t cm_AuthenEncrypt(uint8_t ucCmd1, uint8_t ucAddrCi, uint8_t * pucCi, uint8_t * pucG_Sk, uint8_t * pucRandom);
+
+// Global Data
+uint8_t ucCM_Ci[8], ucCM_G_Sk[8];
+uint8_t ucCM_Q_Ch[16], ucCM_Ci2[8];
+
+// Activate Security
+//
+// When called the function:
+// ?reads the current cryptogram (Ci) of the key set, 
+// ?computes the next cryptogram (Ci+1) based on the secret key pucKey (GCi) and the random number selected,
+// ?sends the (Ci+1) and the random number to the CryptoMemory?device, 
+// ?computes (Ci+2) and compares its computed value the new cryptogram of the key set.
+// ?If (Ci+2) matches the new cryptogram of the key set, authentication was successful.
+// In addition, if ucEncrypt is TRUE the function:
+// ?computes the new session key (Ci+3) and a challenge, 
+// ?sends the new session key and the challenge to the CryptoMemory?device, 
+// ?If the new session key and the challenge are correctly related, encryption is activated.
+//
+uint8_t cm_ActiveSecurity(uint8_t ucKeySet, uint8_t * pucKey, uint8_t * pucRandom, uint8_t ucEncrypt)
+{
+    uint8_t i;
+    uint8_t ucAddrCi;
+	uint8_t ucReturn;
+    // Read Ci for selected key set
+    ucAddrCi = CM_Ci + (ucKeySet<<4);              // Ci blocks on 16 byte boundries
+    if ((ucReturn = cm_ReadConfigZone(ucAddrCi, ucCM_Ci, 8)) != SUCCESS)
+    	 return ucReturn;
+    // Try to activate authentication
+    for (i = 0; i < 8; ++i) ucCM_G_Sk[i] = pucKey[i];
+    {    if ((ucReturn = cm_AuthenEncrypt(ucKeySet, ucAddrCi, ucCM_Ci, ucCM_G_Sk, pucRandom)) != SUCCESS) 
+	    	return ucReturn;
+    }
+    ucCM_Authenticate = TRUE;
+        
+    // If Encryption required, try to activate that too
+    if (ucEncrypt) {
+        if (pucRandom) pucRandom += 8;
+        if ((ucReturn = cm_AuthenEncrypt(ucKeySet+0x10, ucAddrCi, ucCM_Ci, ucCM_G_Sk, pucRandom)) != SUCCESS) 
+        	return ucReturn;
+        ucCM_Encrypt = TRUE;
+    }
+    // Done
+    return SUCCESS;
+}
+
+// Common code for both activating authentication and encryption
+static uint8_t cm_AuthenEncrypt(uint8_t ucCmd1, uint8_t ucAddrCi, uint8_t * pucCi, uint8_t * pucG_Sk, uint8_t * pucRandom)
+{
+    uint8_t i;
+		uint8_t ucReturn;
+    
+    // Generate chalange data
+    if (pucRandom) 
+    	for (i = 0; i < 8; ++i) ucCM_Q_Ch[i] = pucRandom[i];
+    else           
+    	CM_LOW_LEVEL.RandomGen(ucCM_Q_Ch);
+
+    for (i = 0; i < 8; ++i) 
+    	ucCM_Q_Ch[i] = pucRandom[i];
+    cm_AuthenEncryptCal(pucCi, pucG_Sk, ucCM_Q_Ch, &ucCM_Q_Ch[8]);
+    
+    // Send chalange
+    ucCM_InsBuff[0] = 0xb8;
+    ucCM_InsBuff[1] = ucCmd1;
+    ucCM_InsBuff[2] = 0x00;
+    ucCM_InsBuff[3] = 0x10;
+    if ((ucReturn = cm_WriteCommand(ucCM_InsBuff, ucCM_Q_Ch, 16)) != SUCCESS) 
+    	return ucReturn;
+                    
+    // Give chips some clocks to do calculations
+    CM_LOW_LEVEL.WaitClock(3);
+                             
+    // Verify result
+    if ((ucReturn = cm_ReadConfigZone(ucAddrCi, ucCM_Ci2, 8)) != SUCCESS) 
+    	return ucReturn;
+    for(i=0; i<8; i++) if (pucCi[i]!=ucCM_Ci2[i]) 
+    	return FAILED;
+    
+    // Done
+    return SUCCESS;
+}

+ 70 - 0
app/bmc/AuthChip/CM_SELECT.c

@@ -0,0 +1,70 @@
+// Select Device
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// -------------------------------------------------------------------------------------------------
+// Data
+// -------------------------------------------------------------------------------------------------
+
+uint8_t ucCM_DevGpaRegisters[16][Gpa_Regs];
+uint8_t ucCM_DevEncrypt[16];
+uint8_t ucCM_DevAuthenticate[16];
+uint8_t ucCM_DevUserZone[16];
+uint8_t ucCM_DevAntiTearing[16];
+
+// -------------------------------------------------------------------------------------------------
+// Functions
+// -------------------------------------------------------------------------------------------------
+
+// Select Chip
+uint8_t cm_SelectChip(uint8_t ucChipNew)
+{
+	uint8_t ucChip, i;
+	  
+    if (ucChipNew == 0xFF) {
+    	// Clear All State
+    	for (ucChip = 0; ucChip < 16; ++ucChip) {
+    	    for (i = 0; i < 16; ++i) ucCM_DevGpaRegisters[ucChip][i] = 0;
+            ucCM_DevEncrypt[ucChip] = 0;
+            ucCM_DevAuthenticate[ucChip] = 0;
+            ucCM_DevUserZone[ucChip] = 0;
+            ucCM_DevAntiTearing[ucChip] = 0;
+        }
+    }
+    else {
+    	ucChip = CM_PORT_CFG.ucChipSelect;
+    	if (ucChip != ucChipNew) {
+		    // Set Chip Select
+            CM_PORT_CFG.ucChipSelect = ucChipNew;
+			
+			// Shift Addresses
+    	    ucChip = (ucChip>>4)&0xF0;
+    	    ucChipNew = (ucChipNew>>4)&0xF0;
+			
+    	    // Swap GPA Registers
+    	    for (i = 0; i < 16; ++i) {
+			    ucCM_DevGpaRegisters[ucChip][i] = ucGpaRegisters[i];
+				ucGpaRegisters[i] = ucCM_DevGpaRegisters[ucChipNew][i];
+			}
+			
+			//Save State 
+            ucCM_DevEncrypt[ucChip] = ucCM_Encrypt;
+            ucCM_DevAuthenticate[ucChip] = ucCM_Authenticate;
+            ucCM_DevUserZone[ucChip] = ucCM_UserZone;
+            ucCM_DevAntiTearing[ucChip] = ucCM_AntiTearing;
+			
+            // Restore Saved State
+    	    ucCM_Encrypt = ucCM_DevEncrypt[ucChipNew];
+            ucCM_Authenticate = ucCM_DevAuthenticate[ucChipNew];
+            ucCM_UserZone = ucCM_DevUserZone[ucChipNew];
+            ucCM_AntiTearing = ucCM_DevAntiTearing[ucChipNew];
+        }
+    }
+	
+	return SUCCESS;
+}    	

+ 30 - 0
app/bmc/AuthChip/CM_SETUSER.c

@@ -0,0 +1,30 @@
+// Set User Zone
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_GPA.h"
+
+// Set User Zone
+uint8_t cm_SetUserZone(uint8_t ucZoneNumber, uint8_t ucAntiTearing)
+{
+	uint8_t ucReturn;
+	
+	ucCM_InsBuff[0] = 0xb4;
+	if (ucAntiTearing) ucCM_InsBuff[1] = 0x0b;
+	else 	           ucCM_InsBuff[1] = 0x03;
+    ucCM_InsBuff[2] = ucZoneNumber;
+	ucCM_InsBuff[3] = 0x00;
+
+    // Only zone number is included in the polynomial
+	cm_GPAGen(ucZoneNumber);
+	
+	if ((ucReturn = CM_LOW_LEVEL.SendCommand(ucCM_InsBuff))!= SUCCESS) return ucReturn;
+	
+	// save zone number and anti-tearing state
+    ucCM_UserZone = ucZoneNumber;
+    ucCM_AntiTearing = ucAntiTearing;
+
+    // done	
+	return  SUCCESS;//CM_LOW_LEVEL.ReceiveRet(NULL,0);
+}

+ 36 - 0
app/bmc/AuthChip/CM_SRDUSER.c

@@ -0,0 +1,36 @@
+// Read Small User Zone
+//
+// The Read Small User Zone function is used to read data from CryptoMemory devices that
+// have 256 bytes or less in each user zone (AT88SC3216C, and smaller)
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// Read Small User Zone
+uint8_t cm_ReadSmallZone(uint8_t ucCryptoAddr, uint8_t* pucBuffer, uint8_t ucCount)
+{
+	uint8_t ucReturn;
+
+    ucCM_InsBuff[0] = 0xb2;
+    ucCM_InsBuff[1] = 0;
+    ucCM_InsBuff[2] = ucCryptoAddr;
+    ucCM_InsBuff[3] = ucCount;
+
+    // Two bytes of the command must be included in the polynominals
+    cm_GPAcmd2(ucCM_InsBuff);
+    
+    // Read the data
+    if ((ucReturn = cm_ReadCommand(ucCM_InsBuff, pucBuffer, ucCount)) != SUCCESS) return ucReturn;
+	
+    // Include the data in the polynominals and decrypt it required
+    cm_GPAdecrypt(ucCM_Encrypt, pucBuffer, ucCount); 
+
+    // Done
+    return SUCCESS;
+}
+
+
+

+ 35 - 0
app/bmc/AuthChip/CM_SWRUSER.c

@@ -0,0 +1,35 @@
+// Write Small User Zone
+//
+// The Write Small User Zone function is used to write data to CryptoMemory devices that have
+// 256 bytes or less in each user zone (AT88SC3216C, and smaller)
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// Write Small User Zone
+uint8_t cm_WriteSmallZone(uint8_t  ucCryptoAddr, uint8_t* pucBuffer, uint8_t ucCount)
+{
+	uint8_t ucReturn;
+	
+	ucCM_InsBuff[0] = 0xb0;
+    ucCM_InsBuff[1] = 0x00;
+    ucCM_InsBuff[2] = ucCryptoAddr;
+    ucCM_InsBuff[3] = ucCount;
+
+    // Two bytes of the command must be included in the polynominals
+    cm_GPAcmd2(ucCM_InsBuff);
+    
+    // Include the data in the polynominals and encrypt it required
+    cm_GPAencrypt(ucCM_Encrypt, pucBuffer, ucCount); 
+
+	// Write the data
+	ucReturn = cm_WriteCommand(ucCM_InsBuff, pucBuffer,ucCount);
+
+	// when anti-tearing, the host should send ACK should >= 20ms after write command
+	if (ucCM_AntiTearing) CM_LOW_LEVEL.WaitClock(10);
+
+	return ucReturn;
+}

+ 659 - 0
app/bmc/AuthChip/CM_TEST.c

@@ -0,0 +1,659 @@
+#include <stdio.h>
+
+#define CM_LIB_GLOBALES
+#define EXTERNMACRO 2
+
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include <string.h>
+
+uint8_t ucData[16], ucCi[8], ucSk[8];
+// Zone Data
+uint8_t ucCM_UserZone;
+uint8_t ucCM_AntiTearing;
+
+// Chip state
+uint8_t ucCM_Encrypt;
+uint8_t ucCM_Authenticate;
+
+// Global data
+uint8_t ucCM_InsBuff[4];
+
+
+uint8_t authenticationModeFlag = 0;
+uint8_t passwordModeFlag = 0;
+uint8_t encryptModeFlag = 0;
+
+uint8_t errorGlobalFlag = 0;
+
+//default : four user zone use Secret Seed G1 and password write/read 1(all use set 1)
+		 
+//Secret Seed : it's used by cm_ActiveSecurity
+uint8_t ucG[8] = {0x11,/*0x22,*/0x23,0x34,0x45,0x56,0x67,0x78,0x89};
+
+//passworkd for write : it's used by cm_VerifyPassword
+uint8_t psword_w[3] = {0x22,0x34,0x56};
+
+//passworkd for read : it's used by cm_VerifyPassword
+uint8_t psword_r[3] = {0x88,0x9a,0xbc};
+
+uint8_t cm_Auth_Encrp_Personal(uint8_t pswMode,uint8_t authMode)
+{
+
+	uint8_t ucReturn;
+	uint8_t pwData[8] = {0};
+	uint8_t seedData[8] = {0};
+	
+	uint8_t fab_id = 0x06;
+	uint8_t cma_id = 0x04;
+	uint8_t per_id = 0x00;	
+	uint8_t fuseData;	
+	int i;
+	uint8_t configAll[240] = {0};
+	
+	uint8_t pwwr7[3] = {0xDD, 0x42, 0x97};
+	ucReturn = cm_VerifySecureCode(pwwr7);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_VerifySecureCode 1 is error\n");		
+		errorGlobalFlag = 15;
+		return -1;
+	}
+	
+	// ----------------------------------------------write card mfg code 0x50 30 30 31
+	uint8_t cmc[4] = {0x50,0x30,0x30,0x31};
+
+	ucReturn = cm_WriteConfigZone(0x0C, cmc, 4, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x26 is error\n");	
+		errorGlobalFlag = 2;
+	}
+
+	
+	
+	// ----------------------------------------------Write Identification Number = 00000000012345
+	uint8_t idnum[7] = {0x00,0x00,0x00,0x00,0x01,0x23,0x45};
+
+	ucReturn = cm_WriteConfigZone(0x19, idnum, 7, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x26 is error\n");			
+		errorGlobalFlag = 3;
+	}
+	
+	
+	
+	// ----------------------------------------------Write Issuer Code = STATION 035
+	uint8_t issue[16] = {0x53,0x54,0x41,0x54,0x49,0x4F,0x4E,0x20,0x30,0x33,0x35,0x00,0x00,0x00,0x00,0x00};
+	ucReturn = cm_WriteConfigZone(0x40, issue, 16, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x26 is error\n");	
+		
+		errorGlobalFlag = 4;
+	}
+	
+	//---------------------------------------------config all user zone use the same password/seed of the set 1 
+	// ---------------------------------------------Write Control for user zone 0
+	ucData[0] = ((pswMode & 0x03) << 6) | ((authMode & 0x3) << 4) | 0x07; // AR[0-3] = 0101 0111 ---->
+																																	 //01 ----> after Authentication successful ,then write correct password
+																																	 //01 ----> the read and write need to Authentication
+																																	 //1  ----> the host access(read/write) user zone use encryption mode(set 0 lead to unlock config zone error,i dont know why?)
+																																	 //111----> the default data
+	ucData[1] = 0x51;//Authentication set 1, POM set 1, Key 1        //PR[0-3] = 0101 0001
+																																	 //01 ----> the secret seed select set 1(secret seed zone)
+																																	 //01 ----> the POK select set 1(secret seed zone)
+																																	 //0001 ----> the password select set 1(password zone)
+	
+	ucReturn = cm_WriteConfigZone(0x20, ucData, 2, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x20 is error\n");	
+		
+		errorGlobalFlag = 5;
+	}
+	
+	
+	// ---------------------------------------------Write Control for user zone 1
+	ucReturn = cm_WriteConfigZone(0x22, ucData, 2, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x22 is error\n");	
+		
+		errorGlobalFlag = 6;
+	}
+	
+	// ---------------------------------------------Write Control for user zone 2
+	ucReturn = cm_WriteConfigZone(0x24, ucData, 2, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x24 is error\n");	
+		
+		errorGlobalFlag = 7;
+	}
+	
+	
+	// ---------------------------------------------Write Control for user zone 3
+	ucReturn = cm_WriteConfigZone(0x26, ucData, 2, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x26 is error\n");	
+		
+		errorGlobalFlag = 8;
+	}
+	
+
+	//----------------------------------------------Set DCR to allow unlimited checksum reads
+	ucData[0] = 0xff;//after finish personal chip , must recover to the default 
+//	ucData[0] = 0xbf;//set unlimited checksum reads, Unlimited Authentication Trials,Eight Trials Allowed during debug for avoid the chip lock dead (why config 0x8f is error)
+	ucReturn = cm_WriteConfigZone(0x18, ucData, 1, FALSE);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_WriteConfigZone 0x18 is error\n");
+	
+		errorGlobalFlag = 9;
+	}
+	
+	
+	
+	//---------------------------------------------- Write Ci1
+	ucCi[0] = 0xFF;
+	ucCi[1] = 0x01;
+	ucCi[2] = 0x02;
+	ucCi[3] = 0x03;
+	ucCi[4] = 0x04;
+	ucCi[5] = 0x05;
+	ucCi[6] = 0x06;
+	ucCi[7] = 0x07;
+	ucReturn = cm_WriteConfigZone(0x60, ucCi, 8, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x60 is error\n");
+		
+		errorGlobalFlag = 10;
+	}
+	
+	
+	
+	// ------------------------------------------------Write G1
+	// user must set and remember this secret for Secret Seed,then must be same whih cm_Auth_Encrp_rw before access to user zone for write or read .
+	seedData[0] = ucG[0];
+	seedData[1] = ucG[1];
+	seedData[2] = ucG[2];
+	seedData[3] = ucG[3];
+	seedData[4] = ucG[4];
+	seedData[5] = ucG[5];
+	seedData[6] = ucG[6];
+	seedData[7] = ucG[7];
+	ucReturn = cm_WriteConfigZone(0x98, seedData, 8, FALSE);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_WriteConfigZone 0x98 is error\n");
+		
+		errorGlobalFlag = 11;
+	}
+	
+	
+	
+	//--------------------------------------------- Write PSW1 (both Write and Read)
+	// user must set and remember this secret for password for write/read.then must be same whih cm_Auth_Encrp_rw before access to user zone for write or read .
+	pwData[0] = 0xFF;
+	pwData[1] = psword_w[0];
+	pwData[2] = psword_w[1];
+	pwData[3] = psword_w[2];
+	pwData[4] = 0xFF;
+	pwData[5] = psword_r[0];
+	pwData[6] = psword_r[1];
+	pwData[7] = psword_r[2];
+	ucReturn = cm_WriteConfigZone(0xB8, pwData, 8, FALSE);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_WriteConfigZone 0xB8 is error\n");
+		
+		errorGlobalFlag = 12;
+	}
+	
+#if 0
+	//---------------------ATTENTION------------------------ change password write 7,then the config zone must input correct secret while not the default secret,in's effect same to burn fuse
+	// user must set and remember this secret for password for write/read.then must be same whih cm_Auth_Encrp_rw before access to user zone for write or read .
+	pwData[0] = 0xFF;
+	pwData[1] = 'S';
+	pwData[2] = 'T';
+	pwData[3] = 'R';
+	pwData[4] = 0xFF;
+	pwData[5] = 0xFF;
+	pwData[6] = 0xFF;
+	pwData[7] = 0xFF;
+	ucReturn = cm_WriteConfigZone(0xE8, pwData, 8, FALSE);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_WriteConfigZone 0xB8 is error\n");
+		
+		errorGlobalFlag = 12;
+	}
+#endif
+	
+	
+#if 0
+	ucReturn = cm_BurnFuse(fab_id);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_BurnFuse fab_id is error\n");
+		
+		errorGlobalFlag = 12;
+	}
+	
+	
+	ucReturn = cm_BurnFuse(cma_id);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_BurnFuse cma_id is error\n");
+		
+		errorGlobalFlag = 12;
+	}
+	
+	
+	ucReturn = cm_BurnFuse(per_id);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_BurnFuse per_id is error\n");
+		
+		errorGlobalFlag = 12;
+	}
+#endif	
+	//read fuse
+	cm_ReadFuse(&fuseData);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_ReadFuse is error\n");		
+		errorGlobalFlag = 12;
+	}
+	if(fuseData == 0x00)
+	{
+		printf("FAB,CMA,PER------three fuse are burnned successful\n");
+	}
+
+
+	
+	/************ Read all configs *******************/
+	memset(configAll, 0, 240);
+	ucReturn = cm_ReadConfigZone(0x00,configAll,240);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_ReadConfigZone all is error\n");
+		errorGlobalFlag = 13;
+	}
+	else
+	{
+		printf("======== Configure Memory =========");
+		for(i=0;i<240;i++)
+		{
+			if(i%8 == 0) printf("\n%04x:  ", i);
+			printf("%02X ", configAll[i]);
+		}
+		printf("\n");
+	}
+
+	if(errorGlobalFlag != 0)
+		return FAILED;
+	
+	return SUCCESS;		
+}
+
+/*
+*FUNC: To init the chip of AT88SCxxx
+*
+*PARAM:
+*		authMode : 
+*							3 : close Authentication mode;
+*							2 : write Authentication mode;
+*							1 : normal Authentication mode;
+*							0 : dual access mode;
+*
+*		pswMode : 
+*							3 : close password mode;
+*							2 : write password mode;
+*							0/1 : read and write password mode;
+*
+*		encryptFlag :
+*							TRUE  : enable encrypt mode
+*							FALSE : disable encrypt mode
+ *
+ */
+uint8_t cm_Auth_Encrp_Init(uint8_t authMode,uint8_t pswMode,uint8_t encryptFlag)
+{     
+	uint8_t ucReturn;
+	uint8_t fuseData;
+	int i;
+	uint8_t ucData[4] = {0};
+	uint8_t configAll[240] = {0};
+
+	//init I2C pin
+	GPIO_InitTypeDef GPIO_InitStruct;
+	GPIO_InitStruct.Pin = GPIO_PIN_6 | GPIO_PIN_5;
+	GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+	GPIO_InitStruct.Pull = GPIO_PULLUP;
+	GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+	stm32_gpio_init(GPIOE, &GPIO_InitStruct);
+
+	if(pswMode == 0x0 || pswMode == 0x1)
+		passwordModeFlag = 1;
+	else if(pswMode == 0x2)
+		passwordModeFlag = 2;
+	else
+		passwordModeFlag = 0;
+	
+	if(authMode == 0)
+		authenticationModeFlag = 0;
+	else if(authMode == 1)
+		authenticationModeFlag = 1;
+	else if(authMode == 2)
+		authenticationModeFlag = 2;
+	else if(authMode == 3)
+		authenticationModeFlag = 3;
+	
+	if(encryptFlag == TRUE)
+		encryptModeFlag = 1;
+	else
+		encryptModeFlag = 0;
+	
+	cm_PowerOn(); 				
+			
+	/**************** Check AT88SC0104C Present******************/
+	ucData[0] = 0x5A;
+	ucData[1] = 0xA5;
+	ucReturn = cm_WriteConfigZone(0x0A, ucData, 2, FALSE);
+	if (ucReturn != SUCCESS)
+	{
+		printf("cm_WriteConfigZone 0x0a is error\n");
+		errorGlobalFlag = 1;
+	}
+
+	usleep(1);
+	
+	// Read back data
+	ucData[0] = 0x00;
+	ucData[1] = 0x00;
+	ucReturn = cm_ReadConfigZone(0x0A, ucData, 2);
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_ReadConfigZone 0x0a is error\n");		
+		errorGlobalFlag = 1;
+	}
+	if ((ucData[0]!= 0x5A) || (ucData[1]!= 0xA5) )
+	{
+		printf("read back data is not same\n");
+		errorGlobalFlag = 1;
+	}
+	
+	if(errorGlobalFlag != 0)
+	{
+		printf("there is a error and the flag = %d,the poweroff\n",errorGlobalFlag);
+			
+		cm_PowerOff();
+		
+		return FAILED;
+	}
+
+	return ucReturn;
+}
+ 
+/*
+ *cm_WR: 
+ *				0 : read
+ *				1 : write
+ *userZone: 
+ *				select need to access the index of user zone in range of 0-3
+ *startInZone:
+ *				the start location in user zone for user operation of write/read,and the default data is 0
+ *pData:
+ *				the data buffer for store the write/read data
+ *dataLen:
+ *				the byte number of write/read
+ *
+*/
+uint8_t cm_Auth_Encrp_rw(uint8_t cm_WR,uint8_t userZone,uint8_t startInZone,uint8_t *pData,uint8_t dataLen)
+{  		
+	uint8_t ucReturn;
+	int i;
+	uint8_t userZoneTemp = userZone & 0x03;
+ 
+	uint8_t seedSet = 1;//which set of Secret Seed
+	uint8_t pwset = 1;//which set of password for write/read
+	
+	//if(authenticationModeFlag == 0 || authenticationModeFlag == 1 || authenticationModeFlag == 2 || authenticationModeFlag == 3)//all to authenticate
+	{
+		if(encryptModeFlag == 1)
+		{
+			ucReturn = cm_ActiveSecurity(seedSet, ucG, NULL, TRUE);
+		}
+		else
+		{
+			ucReturn = cm_ActiveSecurity(seedSet, ucG, NULL, FALSE);
+		}
+	}
+	
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_ActiveSecurity is error\n");		
+		return FAILED;
+	}
+
+	ucReturn = cm_SetUserZone(userZoneTemp, FALSE);
+	
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_SetUserZone is error\n");		
+		return FAILED;
+	}
+	
+	if(passwordModeFlag == 3)
+	{
+		if(cm_WR==0)
+		{
+			// Read back data
+			for (i = 0; i < dataLen; ++i) 
+				pData[i] = 0x00;  //clear pData
+			ucReturn = cm_ReadSmallZone(startInZone, pData, dataLen);
+			if (ucReturn != SUCCESS) 
+			{
+				printf("cm_ReadSmallZone is error\n");
+				
+				return FAILED;
+			}
+		}
+		else
+		{
+			// Write data to user zone
+			ucReturn = cm_WriteSmallZone(startInZone, pData, dataLen);
+			if (ucReturn != SUCCESS) 
+			{
+				printf("cm_WriteSmallZone is error\n");
+				
+				return FAILED;
+			}
+			// Send checksum
+			ucReturn = cm_SendChecksum(NULL);
+			if (ucReturn != SUCCESS) 
+			{
+				printf("cm_SendChecksum is error\n");
+				
+				return FAILED;
+			}
+		}
+	}
+	else  //(passwordModeFlag == 1 || passwordModeFlag == 2)
+	{  
+			ucCM_Authenticate = TRUE;
+		
+			if(cm_WR==0)
+			{
+				// Read back data, firstly verify the read password
+				ucReturn=cm_VerifyPassword(psword_r,pwset,CM_PWREAD);					
+				if (ucReturn != SUCCESS) 
+				{
+					printf("cm_VerifyPassword is error\n");
+					
+					return FAILED;
+				}
+				
+				for (i = 0; i < dataLen; ++i) 
+					pData[i] = 0x00;  //clear pData
+				
+				ucReturn = cm_ReadSmallZone(startInZone, pData, dataLen);
+				if (ucReturn != SUCCESS) 
+				{
+					printf("cm_ReadSmallZone is error\n");
+					
+					return FAILED;
+				}
+			
+				ucReturn =cm_ReadChecksum(NULL);
+				if (ucReturn != SUCCESS) 
+				{
+					printf("cm_ReadChecksum is error\n");
+					
+					return FAILED;
+				}
+			}
+		else
+		{
+			// Write data to user zone,firstly verify the write password
+			ucReturn=cm_VerifyPassword(psword_w,pwset,CM_PWWRITE);
+			if (ucReturn != SUCCESS) 
+			{
+				printf("cm_VerifyPassword is error\n");
+				
+				return FAILED;
+			}
+			
+			ucReturn = cm_WriteSmallZone(startInZone, pData, dataLen);
+			if (ucReturn != SUCCESS) 
+			{
+				printf("cm_WriteSmallZone is error\n");
+				
+				return FAILED;
+			}
+			
+			// Send checksum
+			ucReturn = cm_SendChecksum(NULL);
+			if (ucReturn != SUCCESS) 
+			{
+				printf("cm_SendChecksum is error\n");
+				
+				return FAILED;
+			}
+		 }
+	}
+		
+	ucReturn = cm_DeactiveSecurity();
+
+	if (ucReturn != SUCCESS) 
+	{
+		printf("cm_DeactiveSecurity is error\n");
+		
+		return FAILED;
+	}
+	
+  return SUCCESS;
+}
+
+
+
+uint8_t cm_Auth_Encrp_Read(uint8_t userZone,uint8_t startInZone,uint8_t* readData,uint8_t readLen)
+{
+	uint8_t returnData = 0;
+	
+	returnData = cm_Auth_Encrp_rw(0,userZone,startInZone,readData,readLen);
+	
+	if(returnData != SUCCESS)
+		return FAILED;
+	else
+		return SUCCESS;
+}
+
+
+uint8_t cm_Auth_Encrp_Write(uint8_t userZone,uint8_t startInZone,uint8_t* writeData,uint8_t writeLen)
+{
+	uint8_t returnData = 0;
+	
+	returnData = cm_Auth_Encrp_rw(1,userZone,startInZone,writeData,writeLen);
+	
+	if(returnData != SUCCESS)
+		return FAILED;
+	else
+		return SUCCESS;
+}
+
+
+
+uint8_t test_cryptomem(void)
+{
+	uint8_t readData[16] = {0};
+	uint8_t readLen = 16;
+	uint8_t writeData[16] = {0};
+	uint8_t writeLen = 16;
+	uint8_t i;
+	uint8_t returnData;
+	
+	uint8_t userZone = 1;//user need to access the index of user zone
+	uint8_t startInZone = 0;//the start location of x user zone for write/read
+
+	// returnData = cm_Auth_Encrp_Init(1,1,TRUE); 
+	// if(returnData != SUCCESS)
+	// {
+	// 	printf("cm_Auth_Encrp_Init is error\n");
+		
+	// 	return FAILED;
+	// }
+
+	printf("Write: \n");
+	for(i=0;i<writeLen;i++) 
+	{
+		writeData[i] = '6' + i;
+		printf("%#x \n", writeData[i]);
+	}
+	printf("\n");
+	
+	returnData = cm_Auth_Encrp_Write(userZone,startInZone,writeData,writeLen); 
+	if(returnData != SUCCESS)
+	{
+		printf("cm_Auth_Encrp_Read is error\n");
+		
+		return FAILED;
+	}
+		
+	returnData = cm_Auth_Encrp_Read(userZone,startInZone,readData,readLen); 
+	if(returnData != SUCCESS)
+	{
+		printf("cm_Auth_Encrp_Read is error\n");
+		
+		return FAILED;
+	}
+
+	printf("Read: \n");
+	for (i = 0; i < readLen; ++i)
+	{
+		printf("%#x \n", readData[i]);
+	}
+	printf("\n");
+
+	if(0 != memcmp(writeData, readData, writeLen))
+	{
+		printf("Read data isn't same as write data!\n");
+		return FAILED;
+	}
+
+	return SUCCESS;
+}
+
+
+
+
+
+
+
+
+

+ 10 - 0
app/bmc/AuthChip/CM_TRUE.c

@@ -0,0 +1,10 @@
+// Function return TRUE
+//
+
+#include "CM_LIB.h"
+
+uint8_t cm_TRUE(void)
+{
+	   return TRUE;
+}
+

+ 37 - 0
app/bmc/AuthChip/CM_WRCFG.c

@@ -0,0 +1,37 @@
+// Write Configuration Zone
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// Write Configuration Zone
+uint8_t cm_WriteConfigZone(uint8_t ucCryptoAddr, uint8_t* pucBuffer, uint8_t ucCount, uint8_t ucAntiTearing)
+{
+    uint8_t ucReturn, ucEncrypt;
+	
+    ucCM_InsBuff[0] = 0xb4;
+    if(ucAntiTearing) ucCM_InsBuff[1] = 0x08;
+    else              ucCM_InsBuff[1] = 0x00;
+    ucCM_InsBuff[2] = ucCryptoAddr;
+    ucCM_InsBuff[3] = ucCount;
+
+    // Three bytes of the command must be included in the polynominals
+    cm_GPAcmd2(ucCM_InsBuff);
+    
+    // Only password zone is ever encrypted
+    ucEncrypt = ((ucCryptoAddr>= CM_PSW) && ucCM_Encrypt);
+
+    // Include the data in the polynominals and encrypt if required
+    cm_GPAencrypt(ucEncrypt, pucBuffer, ucCount); 
+
+    // Do the write
+    ucReturn = cm_WriteCommand(ucCM_InsBuff, pucBuffer,ucCount);
+
+    // when anti-tearing, the host should send ACK should >= 20ms after write command
+    if (ucAntiTearing) CM_LOW_LEVEL.WaitClock(10);
+
+    return ucReturn;
+}

+ 33 - 0
app/bmc/AuthChip/CM_WRCKSUM.c

@@ -0,0 +1,33 @@
+// Write Checksum
+//
+
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+uint8_t	ucCmdWrChk[4] = {0xb4, 0x02, 0x00, 0x02};
+
+// Send Checksum
+uint8_t cm_SendChecksum(uint8_t* pucChkSum)
+{
+	uint8_t ucReturn;
+	uint8_t ucChkSum[2];
+
+    // Get Checksum if required
+	if(pucChkSum == NULL) cm_CalChecksum(ucChkSum);
+	else {
+	   ucChkSum[0] = *pucChkSum++; 
+	   ucChkSum[1] = *pucChkSum; 
+    } 
+	
+	// Send the command
+	ucReturn = cm_WriteCommand(ucCmdWrChk, ucChkSum, 2);
+
+    // Give the CyrptoMemory some processing time
+    CM_LOW_LEVEL.WaitClock(5);
+	
+	// Done
+    return ucReturn;
+}

+ 16 - 0
app/bmc/AuthChip/CM_WRITE.c

@@ -0,0 +1,16 @@
+// Mid Level Utility Function: cm_WriteCommand()
+//
+// Note: this module must be after all low level functions in the library and
+//       before all high level user function to assure that any reference to
+//       this function in this library are satistified.
+
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+
+uint8_t cm_WriteCommand(uint8_t* pucInsBuff, uint8_t* pucSendVal, uint8_t ucLen)
+{ 
+    uint8_t ucReturn;
+
+    if ((ucReturn = CM_LOW_LEVEL.SendCommand(pucInsBuff)) != SUCCESS) return ucReturn;
+    return CM_LOW_LEVEL.SendData(pucSendVal, ucLen);
+}

+ 35 - 0
app/bmc/AuthChip/CM_WRUSER.c

@@ -0,0 +1,35 @@
+// Write User Zone
+//
+// The Write Large User Zone function is used to write data to CryptoMemory devices that have
+// greater than 256 bytes in each user zone (AT88SC6416C, and larger).
+ 
+// CryptoMemory Library Include Files
+#include "CM_LIB.h"
+#include "CM_I2C.h"
+#include "CM_I2C_L.h"
+#include "CM_GPA.h"
+
+// Write User Zone
+char cm_WriteLargeZone(uint32_t uiCryptoAddr, uint8_t* pucBuffer, uint8_t ucCount)
+{
+    uint8_t ucReturn;
+	
+    ucCM_InsBuff[0] = 0xb0;
+    ucCM_InsBuff[1] = (uint8_t)(uiCryptoAddr>>8);
+    ucCM_InsBuff[2] = (uint8_t)uiCryptoAddr;
+    ucCM_InsBuff[3] = ucCount;
+
+    // Three bytes of the command must be included in the polynominals
+    cm_GPAcmd3(ucCM_InsBuff);
+    
+    // Include the data in the polynominals and encrypt it required
+    cm_GPAencrypt(ucCM_Encrypt, pucBuffer, ucCount); 
+
+    ucReturn = cm_WriteCommand(ucCM_InsBuff, pucBuffer, ucCount);
+
+	// when anti-tearing, the host should send ACK should >= 20ms after write command
+	if (ucCM_AntiTearing) CM_LOW_LEVEL.WaitClock(10);
+
+	// Done
+	return ucReturn;
+}

+ 39 - 1
app/bmc/Makefile

@@ -8,6 +8,7 @@ LDFLAGS		:= -mcpu=cortex-m3 -mthumb -L$(INSTALL_ROOT)/A2F/root/usr/lib
 CC	= $(CROSS_COMPILE_APPS)gcc
 
 #source
+
 SRC	= ./main.c
 SRC += ./message.c
 SRC	+= ./Session.c
@@ -60,6 +61,40 @@ SRC += ./msghndlr/Storage/SELDevice/SEL.c
 
 SRC += ./msghndlr/Storlead/Storlead.c
 
+SRC += ./AuthChip/CM_BURNFUZE.c
+SRC += ./AuthChip/CM_DATA.c
+SRC += ./AuthChip/CM_GPA.c
+SRC += ./AuthChip/CM_I2C.c
+SRC += ./AuthChip/CM_NOPOWER.c
+SRC += ./AuthChip/CM_PASSWORD.c
+SRC += ./AuthChip/CM_RDCFG.c
+SRC += ./AuthChip/CM_RDCKSUM.c
+SRC += ./AuthChip/CM_RDFUZE.c
+SRC += ./AuthChip/CM_RDUSER.c
+SRC += ./AuthChip/CM_READ.c
+SRC += ./AuthChip/CM_RESETPSW.c
+SRC += ./AuthChip/CM_RESETSEC.c
+SRC += ./AuthChip/CM_RND.c
+SRC += ./AuthChip/CM_SECURE.c
+SRC += ./AuthChip/CM_SELECT.c
+SRC += ./AuthChip/CM_SETUSER.c
+SRC += ./AuthChip/CM_SRDUSER.c
+SRC += ./AuthChip/CM_SWRUSER.c
+SRC += ./AuthChip/CM_TEST.c
+SRC += ./AuthChip/CM_TRUE.c
+SRC += ./AuthChip/CM_WRCFG.c
+SRC += ./AuthChip/CM_WRCKSUM.c
+SRC += ./AuthChip/CM_WRITE.c
+SRC += ./AuthChip/CM_WRUSER.c
+
+# SRC += ../driver/STM32F4xx_HAL_Driver/system_stm32f4xx.c
+# SRC += ../driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c
+# SRC += ../driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c
+# SRC += ../driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c
+# SRC += ../driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c
+# SRC += ../driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c
+# SRC += ../driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c
+
 # hal_api
 SRC += $(wildcard ../hal_api/*.c) 
 
@@ -69,7 +104,8 @@ CFLAGS	+= -I ../common_include
 CFLAGS	+= -I ../hal_api
 CFLAGS	+= -I ../driver
 CFLAGS	+= -I ../driver/STM32F4xx_HAL_Driver
-CFLAGS	+= -I ../driver/STM32F4xx_HAL_Driver/Inc 
+CFLAGS	+= -I ../driver/STM32F4xx_HAL_Driver/Inc
+CFLAGS	+= -I ../driver/STM32F4xx_HAL_Driver/Inc/Legacy
 
 CFLAGS	+= -I ./
 CFLAGS	+= -I ./uds
@@ -103,6 +139,8 @@ CFLAGS	+= -I ./msghndlr/Storage/SELDevice
 CFLAGS	+= -I ./msghndlr/Transport
 CFLAGS	+= -I ./msghndlr/Storlead
 
+CFLAGS 	+= -I ./AuthChip
+
 
 CFLAGS	+= -I ./encryption
 

+ 1 - 0
app/bmc/OemFRU.c

@@ -69,6 +69,7 @@ const OemFRUData_T Default_FRUData = {
 				' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',	//board fru file id
 				(0xc0 | 0x08),
 				' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',	//Extra info
+
 			},
 			{0,0,0,0},	//power on count
 			{0,0,0,0},	//Total work time

BIN
app/bmc/bmc_app


+ 31 - 0
app/bmc/main.c

@@ -25,6 +25,9 @@
 #include "MsgHndlrTask.h"
 #include "ChassisTimerTask.h"
 #include "TimerTask.h"
+#include "CM_LIB.h"
+#include "stm32f429xx.h"
+#include "com_gpio.h"
 
 
 /* gloabl varible */
@@ -35,6 +38,34 @@ uint8_t		gThreadIndex = 0;
 
 void main(void)
 {
+	printf("---> log1\n");
+	if(0 != cm_Auth_Encrp_Init(1, 1, TRUE))
+	{
+		printf("Initialize AT88SC0104C failed!\n");
+		sleep(1);
+		return;
+	}
+
+	printf("---> log2\n");
+	if(0 != cm_Auth_Encrp_Personal(1, 1))
+	{
+		printf("Personal AT88SC0104C failed!\n");
+		sleep(1);
+		return ;
+	}
+
+	printf("---> log3\n");
+	if(0 != test_cryptomem())
+	{
+		while(1)
+		{
+			printf("Illegal Board!\n");
+			sleep(3);
+		}
+	}
+
+	
+
 	PlatformInit();
 	Init_IPMI_FRU_SDR_SEL();
 	InitSdrConfig();

+ 3 - 0
app/common_include/com_gpio.h

@@ -10,6 +10,9 @@
 #ifndef uint32_t
   #define uint32_t unsigned long
 #endif
+#ifndef uint64_t
+  #define uint64_t unsigned long long int
+#endif
 
 
 /* Exported types ------------------------------------------------------------*/

+ 1 - 1
app/driver/GPIO/.gpio.mod.o.cmd

@@ -1,4 +1,4 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio.mod.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/.gpio.mod.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(gpio.mod)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio)"  -DMODULE -mlong-calls -fno-optimize-sibling-calls -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio.mod.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio.mod.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio.mod.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/.gpio.mod.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(gpio.mod)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio)"  -DMODULE -mlong-calls -fno-optimize-sibling-calls -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio.mod.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio.mod.c
 
 deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio.mod.o := \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio.mod.c \

+ 4 - 1
app/driver/GPIO/.gpio_main.o.cmd

@@ -1,4 +1,4 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/.gpio_main.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(gpio_main)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/.gpio_main.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(gpio_main)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.c
 
 deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.o := \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.c \
@@ -492,6 +492,9 @@ deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/g
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/driver.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/stm32f429xx.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \
+    $(wildcard include/config/disable.h) \
+    $(wildcard include/config/enable.h) \
 
 /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO/gpio_main.o)
 

+ 1 - 0
app/driver/GPIO/Makefile

@@ -17,6 +17,7 @@ APPDIR := $(INSTALL_ROOT)/projects/gd32450i-eval/app
 
 EXTRA_CFLAGS := -I$(APPDIR)/driver/STM32F4xx_HAL_Driver
 EXTRA_CFLAGS += -I$(APPDIR)/driver/STM32F4xx_HAL_Driver/Inc
+EXTRA_CFLAGS += -I$(APPDIR)/driver/STM32F4xx_HAL_Driver/Inc/Legacy
 EXTRA_CFLAGS += -I$(APPDIR)/common_include
 EXTRA_CFLAGS += -I$(APPDIR)/driver
 

BIN
app/driver/GPIO/gpio.ko


+ 35 - 0
app/driver/GPIO/gpio_main.c

@@ -14,6 +14,7 @@
 #include "stm32f4xx.h"
 #include "stm32f4xx_hal_gpio.h"
 #include "driver.h"
+#include "stm32_hal_legacy.h"
 
 
 
@@ -53,6 +54,10 @@ static int gpio_close(struct inode *inode, struct file *filep)
 
 static int gpio_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, unsigned long arg)
 {
+	uint32_t temp;
+	uint32_t ioposition;
+	uint32_t iocurrent;
+	uint32_t position;
 	gpio_t gpio_arg;
 	if ( copy_from_user(&gpio_arg, (void*)arg, sizeof(gpio_t)) )
 		return -EFAULT;
@@ -60,6 +65,18 @@ static int gpio_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
 	switch(cmd)
 	{
 		case GPIO_INIT:
+			switch((uint32_t)gpio_arg.GPIOx)
+			{
+			case (uint32_t)GPIOA: __GPIOA_CLK_ENABLE();	break;
+			case (uint32_t)GPIOB: __GPIOB_CLK_ENABLE();	break;
+			case (uint32_t)GPIOC: __GPIOC_CLK_ENABLE();	break;
+			case (uint32_t)GPIOD: __GPIOD_CLK_ENABLE();	break;
+			case (uint32_t)GPIOE: __GPIOE_CLK_ENABLE();	break;
+			case (uint32_t)GPIOF: __GPIOF_CLK_ENABLE();	break;
+			case (uint32_t)GPIOG: __GPIOG_CLK_ENABLE();	break;
+			case (uint32_t)GPIOH: __GPIOH_CLK_ENABLE();	break;
+			case (uint32_t)GPIOI: __GPIOI_CLK_ENABLE();	break;			
+			}
 			HAL_GPIO_Init(gpio_arg.GPIOx, &gpio_arg.GPIO_Init);
 			break;
 		case GPIO_WRITE_PIN:
@@ -70,6 +87,24 @@ static int gpio_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
 			if ( copy_to_user((void*)arg, (void*)&gpio_arg, sizeof(gpio_t)))
 				return -EFAULT;
 			break;
+		case GPIO_SET_DIR:
+			/* Configure the port pins */
+		  	for(position = 0U; position < 16; position++)
+		  	{
+		    	/* Get the IO position */
+		    	ioposition = 0x01U << position;
+		    	/* Get the current IO position */
+		    	iocurrent = (uint32_t)(gpio_arg.GPIO_pin) & ioposition;
+
+			    if(iocurrent == ioposition)
+			    {
+					temp = gpio_arg.GPIOx->MODER;
+			      	temp &= ~(GPIO_MODER_MODER0 << (position * 2U));
+			      	temp |= (gpio_arg.Direct << (position * 2U));
+			      	gpio_arg.GPIOx->MODER = temp;
+			    }
+		    }
+			break;
 	default:
 		printk("---> Invalid action\n");
 		return -EINVAL;

+ 1 - 0
app/driver/GPIO_I2C/.gpio_i2c.ko.cmd

@@ -0,0 +1 @@
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.ko := arm-uclinuxeabi-ld -EL -r  -T /gd32f450_prj/linux-cortexm-1.14.2/linux/scripts/module-common.lds  -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.ko /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.o

+ 296 - 0
app/driver/GPIO_I2C/.gpio_i2c.mod.o.cmd

@@ -0,0 +1,296 @@
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/.gpio_i2c.mod.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(gpio_i2c.mod)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio_i2c)"  -DMODULE -mlong-calls -fno-optimize-sibling-calls -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.c
+
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.c \
+    $(wildcard include/config/module/unload.h) \
+  include/linux/module.h \
+    $(wildcard include/config/symbol/prefix.h) \
+    $(wildcard include/config/modules.h) \
+    $(wildcard include/config/modversions.h) \
+    $(wildcard include/config/unused/symbols.h) \
+    $(wildcard include/config/generic/bug.h) \
+    $(wildcard include/config/kallsyms.h) \
+    $(wildcard include/config/tracepoints.h) \
+    $(wildcard include/config/tracing.h) \
+    $(wildcard include/config/event/tracing.h) \
+    $(wildcard include/config/ftrace/mcount/record.h) \
+    $(wildcard include/config/smp.h) \
+    $(wildcard include/config/constructors.h) \
+    $(wildcard include/config/sysfs.h) \
+  include/linux/list.h \
+    $(wildcard include/config/debug/list.h) \
+  include/linux/stddef.h \
+  include/linux/compiler.h \
+    $(wildcard include/config/trace/branch/profiling.h) \
+    $(wildcard include/config/profile/all/branches.h) \
+    $(wildcard include/config/enable/must/check.h) \
+    $(wildcard include/config/enable/warn/deprecated.h) \
+  include/linux/compiler-gcc.h \
+    $(wildcard include/config/arch/supports/optimized/inlining.h) \
+    $(wildcard include/config/optimize/inlining.h) \
+  include/linux/compiler-gcc4.h \
+  include/linux/poison.h \
+    $(wildcard include/config/illegal/pointer/value.h) \
+  include/linux/prefetch.h \
+  include/linux/types.h \
+    $(wildcard include/config/uid16.h) \
+    $(wildcard include/config/lbdaf.h) \
+    $(wildcard include/config/phys/addr/t/64bit.h) \
+    $(wildcard include/config/64bit.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/types.h \
+  include/asm-generic/int-ll64.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bitsperlong.h \
+  include/asm-generic/bitsperlong.h \
+  include/linux/posix_types.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/posix_types.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/processor.h \
+    $(wildcard include/config/mmu.h) \
+    $(wildcard include/config/cpu/v7m.h) \
+    $(wildcard include/config/mpu.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/ptrace.h \
+    $(wildcard include/config/cpu/endian/be8.h) \
+    $(wildcard include/config/arm/thumb.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/hwcap.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/cache.h \
+    $(wildcard include/config/arm/l1/cache/shift.h) \
+    $(wildcard include/config/aeabi.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/system.h \
+    $(wildcard include/config/cpu/xsc3.h) \
+    $(wildcard include/config/cpu/fa526.h) \
+    $(wildcard include/config/arch/has/barriers.h) \
+    $(wildcard include/config/cpu/sa1100.h) \
+    $(wildcard include/config/cpu/sa110.h) \
+    $(wildcard include/config/arch/a2f.h) \
+    $(wildcard include/config/cpu/32v6k.h) \
+  include/linux/linkage.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/linkage.h \
+  include/linux/irqflags.h \
+    $(wildcard include/config/trace/irqflags.h) \
+    $(wildcard include/config/irqsoff/tracer.h) \
+    $(wildcard include/config/preempt/tracer.h) \
+    $(wildcard include/config/trace/irqflags/support.h) \
+  include/linux/typecheck.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/irqflags.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/outercache.h \
+    $(wildcard include/config/outer/cache/sync.h) \
+    $(wildcard include/config/outer/cache.h) \
+  include/asm-generic/cmpxchg-local.h \
+  include/linux/stat.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/stat.h \
+  include/linux/time.h \
+    $(wildcard include/config/arch/uses/gettimeoffset.h) \
+  include/linux/cache.h \
+    $(wildcard include/config/arch/has/cache/line/size.h) \
+  include/linux/kernel.h \
+    $(wildcard include/config/preempt/voluntary.h) \
+    $(wildcard include/config/debug/spinlock/sleep.h) \
+    $(wildcard include/config/prove/locking.h) \
+    $(wildcard include/config/printk.h) \
+    $(wildcard include/config/dynamic/debug.h) \
+    $(wildcard include/config/ring/buffer.h) \
+    $(wildcard include/config/numa.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include/stdarg.h \
+  include/linux/bitops.h \
+    $(wildcard include/config/generic/find/first/bit.h) \
+    $(wildcard include/config/generic/find/last/bit.h) \
+    $(wildcard include/config/generic/find/next/bit.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bitops.h \
+  include/asm-generic/bitops/non-atomic.h \
+  include/asm-generic/bitops/fls64.h \
+  include/asm-generic/bitops/sched.h \
+  include/asm-generic/bitops/hweight.h \
+  include/asm-generic/bitops/lock.h \
+  include/linux/log2.h \
+    $(wildcard include/config/arch/has/ilog2/u32.h) \
+    $(wildcard include/config/arch/has/ilog2/u64.h) \
+  include/linux/dynamic_debug.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/byteorder.h \
+  include/linux/byteorder/little_endian.h \
+  include/linux/swab.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/swab.h \
+  include/linux/byteorder/generic.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bug.h \
+    $(wildcard include/config/bug.h) \
+    $(wildcard include/config/debug/bugverbose.h) \
+  include/asm-generic/bug.h \
+    $(wildcard include/config/generic/bug/relative/pointers.h) \
+  include/linux/seqlock.h \
+  include/linux/spinlock.h \
+    $(wildcard include/config/debug/spinlock.h) \
+    $(wildcard include/config/generic/lockbreak.h) \
+    $(wildcard include/config/preempt.h) \
+    $(wildcard include/config/debug/lock/alloc.h) \
+  include/linux/preempt.h \
+    $(wildcard include/config/debug/preempt.h) \
+    $(wildcard include/config/preempt/notifiers.h) \
+  include/linux/thread_info.h \
+    $(wildcard include/config/compat.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/thread_info.h \
+    $(wildcard include/config/arm/thumbee.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/fpstate.h \
+    $(wildcard include/config/vfpv3.h) \
+    $(wildcard include/config/vfpm.h) \
+    $(wildcard include/config/iwmmxt.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/domain.h \
+    $(wildcard include/config/io/36.h) \
+    $(wildcard include/config/cpu/use/domains.h) \
+  include/linux/stringify.h \
+  include/linux/bottom_half.h \
+  include/linux/spinlock_types.h \
+  include/linux/spinlock_types_up.h \
+  include/linux/lockdep.h \
+    $(wildcard include/config/lockdep.h) \
+    $(wildcard include/config/lock/stat.h) \
+    $(wildcard include/config/generic/hardirqs.h) \
+  include/linux/rwlock_types.h \
+  include/linux/spinlock_up.h \
+  include/linux/rwlock.h \
+  include/linux/spinlock_api_up.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/atomic.h \
+    $(wildcard include/config/generic/atomic64.h) \
+  include/asm-generic/atomic64.h \
+  include/asm-generic/atomic-long.h \
+  include/linux/math64.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/div64.h \
+  include/linux/kmod.h \
+  include/linux/gfp.h \
+    $(wildcard include/config/kmemcheck.h) \
+    $(wildcard include/config/highmem.h) \
+    $(wildcard include/config/zone/dma.h) \
+    $(wildcard include/config/zone/dma32.h) \
+    $(wildcard include/config/debug/vm.h) \
+  include/linux/mmzone.h \
+    $(wildcard include/config/force/max/zoneorder.h) \
+    $(wildcard include/config/memory/hotplug.h) \
+    $(wildcard include/config/sparsemem.h) \
+    $(wildcard include/config/arch/populates/node/map.h) \
+    $(wildcard include/config/discontigmem.h) \
+    $(wildcard include/config/flat/node/mem/map.h) \
+    $(wildcard include/config/cgroup/mem/res/ctlr.h) \
+    $(wildcard include/config/have/memory/present.h) \
+    $(wildcard include/config/need/node/memmap/size.h) \
+    $(wildcard include/config/need/multiple/nodes.h) \
+    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
+    $(wildcard include/config/flatmem.h) \
+    $(wildcard include/config/sparsemem/extreme.h) \
+    $(wildcard include/config/nodes/span/other/nodes.h) \
+    $(wildcard include/config/holes/in/zone.h) \
+    $(wildcard include/config/arch/has/holes/memorymodel.h) \
+  include/linux/wait.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/current.h \
+  include/linux/threads.h \
+    $(wildcard include/config/nr/cpus.h) \
+    $(wildcard include/config/base/small.h) \
+  include/linux/numa.h \
+    $(wildcard include/config/nodes/shift.h) \
+  include/linux/init.h \
+    $(wildcard include/config/hotplug.h) \
+  include/linux/nodemask.h \
+  include/linux/bitmap.h \
+  include/linux/string.h \
+    $(wildcard include/config/binary/printf.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/string.h \
+  include/linux/pageblock-flags.h \
+    $(wildcard include/config/hugetlb/page.h) \
+    $(wildcard include/config/hugetlb/page/size/variable.h) \
+  include/generated/bounds.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/page.h \
+    $(wildcard include/config/cpu/copy/v3.h) \
+    $(wildcard include/config/cpu/copy/v4wt.h) \
+    $(wildcard include/config/cpu/copy/v4wb.h) \
+    $(wildcard include/config/cpu/copy/feroceon.h) \
+    $(wildcard include/config/cpu/copy/fa.h) \
+    $(wildcard include/config/cpu/xscale.h) \
+    $(wildcard include/config/cpu/copy/v6.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/page-nommu.h \
+    $(wildcard include/config/small/tasks.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/memory.h \
+    $(wildcard include/config/page/offset.h) \
+    $(wildcard include/config/thumb2/kernel.h) \
+    $(wildcard include/config/dram/size.h) \
+    $(wildcard include/config/dram/base.h) \
+  include/linux/const.h \
+  arch/arm/mach-stm32/include/mach/memory.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/sizes.h \
+  include/asm-generic/memory_model.h \
+    $(wildcard include/config/sparsemem/vmemmap.h) \
+  include/asm-generic/getorder.h \
+  include/linux/memory_hotplug.h \
+    $(wildcard include/config/have/arch/nodedata/extension.h) \
+    $(wildcard include/config/memory/hotremove.h) \
+  include/linux/notifier.h \
+  include/linux/errno.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/errno.h \
+  include/asm-generic/errno.h \
+  include/asm-generic/errno-base.h \
+  include/linux/mutex.h \
+    $(wildcard include/config/debug/mutexes.h) \
+  include/linux/rwsem.h \
+    $(wildcard include/config/rwsem/generic/spinlock.h) \
+  include/linux/rwsem-spinlock.h \
+  include/linux/srcu.h \
+  include/linux/topology.h \
+    $(wildcard include/config/sched/smt.h) \
+    $(wildcard include/config/sched/mc.h) \
+  include/linux/cpumask.h \
+    $(wildcard include/config/cpumask/offstack.h) \
+    $(wildcard include/config/hotplug/cpu.h) \
+    $(wildcard include/config/debug/per/cpu/maps.h) \
+    $(wildcard include/config/disable/obsolete/cpumask/functions.h) \
+  include/linux/smp.h \
+    $(wildcard include/config/use/generic/smp/helpers.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/topology.h \
+  include/asm-generic/topology.h \
+  include/linux/mmdebug.h \
+    $(wildcard include/config/debug/virtual.h) \
+  include/linux/elf.h \
+  include/linux/elf-em.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/elf.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/user.h \
+  include/linux/kobject.h \
+  include/linux/sysfs.h \
+  include/linux/kref.h \
+  include/linux/moduleparam.h \
+    $(wildcard include/config/alpha.h) \
+    $(wildcard include/config/ia64.h) \
+    $(wildcard include/config/ppc64.h) \
+  include/linux/tracepoint.h \
+  include/linux/rcupdate.h \
+    $(wildcard include/config/tree/rcu.h) \
+    $(wildcard include/config/tree/preempt/rcu.h) \
+    $(wildcard include/config/tiny/rcu.h) \
+  include/linux/completion.h \
+  include/linux/rcutree.h \
+    $(wildcard include/config/no/hz.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/local.h \
+  include/asm-generic/local.h \
+  include/linux/percpu.h \
+    $(wildcard include/config/need/per/cpu/embed/first/chunk.h) \
+    $(wildcard include/config/need/per/cpu/page/first/chunk.h) \
+    $(wildcard include/config/have/setup/per/cpu/area.h) \
+  include/linux/slab.h \
+    $(wildcard include/config/slab/debug.h) \
+    $(wildcard include/config/debug/objects.h) \
+    $(wildcard include/config/slub.h) \
+    $(wildcard include/config/slob.h) \
+    $(wildcard include/config/debug/slab.h) \
+  include/linux/slab_def.h \
+  include/linux/kmemtrace.h \
+    $(wildcard include/config/kmemtrace.h) \
+  include/trace/events/kmem.h \
+  include/trace/define_trace.h \
+  include/linux/kmalloc_sizes.h \
+  include/linux/pfn.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/percpu.h \
+  include/asm-generic/percpu.h \
+  include/linux/percpu-defs.h \
+    $(wildcard include/config/debug/force/weak/per/cpu.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/module.h \
+    $(wildcard include/config/arm/unwind.h) \
+  include/trace/events/module.h \
+  include/linux/vermagic.h \
+  include/generated/utsrelease.h \
+
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.o)
+
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.mod.o):

+ 1 - 0
app/driver/GPIO_I2C/.gpio_i2c.o.cmd

@@ -0,0 +1 @@
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.o := arm-uclinuxeabi-ld -EL    -r -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.o 

+ 503 - 0
app/driver/GPIO_I2C/.gpio_i2c_main.o.cmd

@@ -0,0 +1,503 @@
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/.gpio_i2c_main.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(gpio_i2c_main)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio_i2c)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.c
+
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.c \
+  include/linux/module.h \
+    $(wildcard include/config/symbol/prefix.h) \
+    $(wildcard include/config/modules.h) \
+    $(wildcard include/config/modversions.h) \
+    $(wildcard include/config/unused/symbols.h) \
+    $(wildcard include/config/generic/bug.h) \
+    $(wildcard include/config/kallsyms.h) \
+    $(wildcard include/config/tracepoints.h) \
+    $(wildcard include/config/tracing.h) \
+    $(wildcard include/config/event/tracing.h) \
+    $(wildcard include/config/ftrace/mcount/record.h) \
+    $(wildcard include/config/module/unload.h) \
+    $(wildcard include/config/smp.h) \
+    $(wildcard include/config/constructors.h) \
+    $(wildcard include/config/sysfs.h) \
+  include/linux/list.h \
+    $(wildcard include/config/debug/list.h) \
+  include/linux/stddef.h \
+  include/linux/compiler.h \
+    $(wildcard include/config/trace/branch/profiling.h) \
+    $(wildcard include/config/profile/all/branches.h) \
+    $(wildcard include/config/enable/must/check.h) \
+    $(wildcard include/config/enable/warn/deprecated.h) \
+  include/linux/compiler-gcc.h \
+    $(wildcard include/config/arch/supports/optimized/inlining.h) \
+    $(wildcard include/config/optimize/inlining.h) \
+  include/linux/compiler-gcc4.h \
+  include/linux/poison.h \
+    $(wildcard include/config/illegal/pointer/value.h) \
+  include/linux/prefetch.h \
+  include/linux/types.h \
+    $(wildcard include/config/uid16.h) \
+    $(wildcard include/config/lbdaf.h) \
+    $(wildcard include/config/phys/addr/t/64bit.h) \
+    $(wildcard include/config/64bit.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/types.h \
+  include/asm-generic/int-ll64.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bitsperlong.h \
+  include/asm-generic/bitsperlong.h \
+  include/linux/posix_types.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/posix_types.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/processor.h \
+    $(wildcard include/config/mmu.h) \
+    $(wildcard include/config/cpu/v7m.h) \
+    $(wildcard include/config/mpu.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/ptrace.h \
+    $(wildcard include/config/cpu/endian/be8.h) \
+    $(wildcard include/config/arm/thumb.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/hwcap.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/cache.h \
+    $(wildcard include/config/arm/l1/cache/shift.h) \
+    $(wildcard include/config/aeabi.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/system.h \
+    $(wildcard include/config/cpu/xsc3.h) \
+    $(wildcard include/config/cpu/fa526.h) \
+    $(wildcard include/config/arch/has/barriers.h) \
+    $(wildcard include/config/cpu/sa1100.h) \
+    $(wildcard include/config/cpu/sa110.h) \
+    $(wildcard include/config/arch/a2f.h) \
+    $(wildcard include/config/cpu/32v6k.h) \
+  include/linux/linkage.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/linkage.h \
+  include/linux/irqflags.h \
+    $(wildcard include/config/trace/irqflags.h) \
+    $(wildcard include/config/irqsoff/tracer.h) \
+    $(wildcard include/config/preempt/tracer.h) \
+    $(wildcard include/config/trace/irqflags/support.h) \
+  include/linux/typecheck.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/irqflags.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/outercache.h \
+    $(wildcard include/config/outer/cache/sync.h) \
+    $(wildcard include/config/outer/cache.h) \
+  include/asm-generic/cmpxchg-local.h \
+  include/linux/stat.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/stat.h \
+  include/linux/time.h \
+    $(wildcard include/config/arch/uses/gettimeoffset.h) \
+  include/linux/cache.h \
+    $(wildcard include/config/arch/has/cache/line/size.h) \
+  include/linux/kernel.h \
+    $(wildcard include/config/preempt/voluntary.h) \
+    $(wildcard include/config/debug/spinlock/sleep.h) \
+    $(wildcard include/config/prove/locking.h) \
+    $(wildcard include/config/printk.h) \
+    $(wildcard include/config/dynamic/debug.h) \
+    $(wildcard include/config/ring/buffer.h) \
+    $(wildcard include/config/numa.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include/stdarg.h \
+  include/linux/bitops.h \
+    $(wildcard include/config/generic/find/first/bit.h) \
+    $(wildcard include/config/generic/find/last/bit.h) \
+    $(wildcard include/config/generic/find/next/bit.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bitops.h \
+  include/asm-generic/bitops/non-atomic.h \
+  include/asm-generic/bitops/fls64.h \
+  include/asm-generic/bitops/sched.h \
+  include/asm-generic/bitops/hweight.h \
+  include/asm-generic/bitops/lock.h \
+  include/linux/log2.h \
+    $(wildcard include/config/arch/has/ilog2/u32.h) \
+    $(wildcard include/config/arch/has/ilog2/u64.h) \
+  include/linux/dynamic_debug.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/byteorder.h \
+  include/linux/byteorder/little_endian.h \
+  include/linux/swab.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/swab.h \
+  include/linux/byteorder/generic.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/bug.h \
+    $(wildcard include/config/bug.h) \
+    $(wildcard include/config/debug/bugverbose.h) \
+  include/asm-generic/bug.h \
+    $(wildcard include/config/generic/bug/relative/pointers.h) \
+  include/linux/seqlock.h \
+  include/linux/spinlock.h \
+    $(wildcard include/config/debug/spinlock.h) \
+    $(wildcard include/config/generic/lockbreak.h) \
+    $(wildcard include/config/preempt.h) \
+    $(wildcard include/config/debug/lock/alloc.h) \
+  include/linux/preempt.h \
+    $(wildcard include/config/debug/preempt.h) \
+    $(wildcard include/config/preempt/notifiers.h) \
+  include/linux/thread_info.h \
+    $(wildcard include/config/compat.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/thread_info.h \
+    $(wildcard include/config/arm/thumbee.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/fpstate.h \
+    $(wildcard include/config/vfpv3.h) \
+    $(wildcard include/config/vfpm.h) \
+    $(wildcard include/config/iwmmxt.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/domain.h \
+    $(wildcard include/config/io/36.h) \
+    $(wildcard include/config/cpu/use/domains.h) \
+  include/linux/stringify.h \
+  include/linux/bottom_half.h \
+  include/linux/spinlock_types.h \
+  include/linux/spinlock_types_up.h \
+  include/linux/lockdep.h \
+    $(wildcard include/config/lockdep.h) \
+    $(wildcard include/config/lock/stat.h) \
+    $(wildcard include/config/generic/hardirqs.h) \
+  include/linux/rwlock_types.h \
+  include/linux/spinlock_up.h \
+  include/linux/rwlock.h \
+  include/linux/spinlock_api_up.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/atomic.h \
+    $(wildcard include/config/generic/atomic64.h) \
+  include/asm-generic/atomic64.h \
+  include/asm-generic/atomic-long.h \
+  include/linux/math64.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/div64.h \
+  include/linux/kmod.h \
+  include/linux/gfp.h \
+    $(wildcard include/config/kmemcheck.h) \
+    $(wildcard include/config/highmem.h) \
+    $(wildcard include/config/zone/dma.h) \
+    $(wildcard include/config/zone/dma32.h) \
+    $(wildcard include/config/debug/vm.h) \
+  include/linux/mmzone.h \
+    $(wildcard include/config/force/max/zoneorder.h) \
+    $(wildcard include/config/memory/hotplug.h) \
+    $(wildcard include/config/sparsemem.h) \
+    $(wildcard include/config/arch/populates/node/map.h) \
+    $(wildcard include/config/discontigmem.h) \
+    $(wildcard include/config/flat/node/mem/map.h) \
+    $(wildcard include/config/cgroup/mem/res/ctlr.h) \
+    $(wildcard include/config/have/memory/present.h) \
+    $(wildcard include/config/need/node/memmap/size.h) \
+    $(wildcard include/config/need/multiple/nodes.h) \
+    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
+    $(wildcard include/config/flatmem.h) \
+    $(wildcard include/config/sparsemem/extreme.h) \
+    $(wildcard include/config/nodes/span/other/nodes.h) \
+    $(wildcard include/config/holes/in/zone.h) \
+    $(wildcard include/config/arch/has/holes/memorymodel.h) \
+  include/linux/wait.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/current.h \
+  include/linux/threads.h \
+    $(wildcard include/config/nr/cpus.h) \
+    $(wildcard include/config/base/small.h) \
+  include/linux/numa.h \
+    $(wildcard include/config/nodes/shift.h) \
+  include/linux/init.h \
+    $(wildcard include/config/hotplug.h) \
+  include/linux/nodemask.h \
+  include/linux/bitmap.h \
+  include/linux/string.h \
+    $(wildcard include/config/binary/printf.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/string.h \
+  include/linux/pageblock-flags.h \
+    $(wildcard include/config/hugetlb/page.h) \
+    $(wildcard include/config/hugetlb/page/size/variable.h) \
+  include/generated/bounds.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/page.h \
+    $(wildcard include/config/cpu/copy/v3.h) \
+    $(wildcard include/config/cpu/copy/v4wt.h) \
+    $(wildcard include/config/cpu/copy/v4wb.h) \
+    $(wildcard include/config/cpu/copy/feroceon.h) \
+    $(wildcard include/config/cpu/copy/fa.h) \
+    $(wildcard include/config/cpu/xscale.h) \
+    $(wildcard include/config/cpu/copy/v6.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/page-nommu.h \
+    $(wildcard include/config/small/tasks.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/memory.h \
+    $(wildcard include/config/page/offset.h) \
+    $(wildcard include/config/thumb2/kernel.h) \
+    $(wildcard include/config/dram/size.h) \
+    $(wildcard include/config/dram/base.h) \
+  include/linux/const.h \
+  arch/arm/mach-stm32/include/mach/memory.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/sizes.h \
+  include/asm-generic/memory_model.h \
+    $(wildcard include/config/sparsemem/vmemmap.h) \
+  include/asm-generic/getorder.h \
+  include/linux/memory_hotplug.h \
+    $(wildcard include/config/have/arch/nodedata/extension.h) \
+    $(wildcard include/config/memory/hotremove.h) \
+  include/linux/notifier.h \
+  include/linux/errno.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/errno.h \
+  include/asm-generic/errno.h \
+  include/asm-generic/errno-base.h \
+  include/linux/mutex.h \
+    $(wildcard include/config/debug/mutexes.h) \
+  include/linux/rwsem.h \
+    $(wildcard include/config/rwsem/generic/spinlock.h) \
+  include/linux/rwsem-spinlock.h \
+  include/linux/srcu.h \
+  include/linux/topology.h \
+    $(wildcard include/config/sched/smt.h) \
+    $(wildcard include/config/sched/mc.h) \
+  include/linux/cpumask.h \
+    $(wildcard include/config/cpumask/offstack.h) \
+    $(wildcard include/config/hotplug/cpu.h) \
+    $(wildcard include/config/debug/per/cpu/maps.h) \
+    $(wildcard include/config/disable/obsolete/cpumask/functions.h) \
+  include/linux/smp.h \
+    $(wildcard include/config/use/generic/smp/helpers.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/topology.h \
+  include/asm-generic/topology.h \
+  include/linux/mmdebug.h \
+    $(wildcard include/config/debug/virtual.h) \
+  include/linux/elf.h \
+  include/linux/elf-em.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/elf.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/user.h \
+  include/linux/kobject.h \
+  include/linux/sysfs.h \
+  include/linux/kref.h \
+  include/linux/moduleparam.h \
+    $(wildcard include/config/alpha.h) \
+    $(wildcard include/config/ia64.h) \
+    $(wildcard include/config/ppc64.h) \
+  include/linux/tracepoint.h \
+  include/linux/rcupdate.h \
+    $(wildcard include/config/tree/rcu.h) \
+    $(wildcard include/config/tree/preempt/rcu.h) \
+    $(wildcard include/config/tiny/rcu.h) \
+  include/linux/completion.h \
+  include/linux/rcutree.h \
+    $(wildcard include/config/no/hz.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/local.h \
+  include/asm-generic/local.h \
+  include/linux/percpu.h \
+    $(wildcard include/config/need/per/cpu/embed/first/chunk.h) \
+    $(wildcard include/config/need/per/cpu/page/first/chunk.h) \
+    $(wildcard include/config/have/setup/per/cpu/area.h) \
+  include/linux/slab.h \
+    $(wildcard include/config/slab/debug.h) \
+    $(wildcard include/config/debug/objects.h) \
+    $(wildcard include/config/slub.h) \
+    $(wildcard include/config/slob.h) \
+    $(wildcard include/config/debug/slab.h) \
+  include/linux/slab_def.h \
+  include/linux/kmemtrace.h \
+    $(wildcard include/config/kmemtrace.h) \
+  include/trace/events/kmem.h \
+  include/trace/define_trace.h \
+  include/linux/kmalloc_sizes.h \
+  include/linux/pfn.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/percpu.h \
+  include/asm-generic/percpu.h \
+  include/linux/percpu-defs.h \
+    $(wildcard include/config/debug/force/weak/per/cpu.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/module.h \
+    $(wildcard include/config/arm/unwind.h) \
+  include/trace/events/module.h \
+  include/linux/cdev.h \
+  include/linux/kdev_t.h \
+  include/linux/fs.h \
+    $(wildcard include/config/dnotify.h) \
+    $(wildcard include/config/quota.h) \
+    $(wildcard include/config/fsnotify.h) \
+    $(wildcard include/config/inotify.h) \
+    $(wildcard include/config/security.h) \
+    $(wildcard include/config/fs/posix/acl.h) \
+    $(wildcard include/config/epoll.h) \
+    $(wildcard include/config/debug/writecount.h) \
+    $(wildcard include/config/file/locking.h) \
+    $(wildcard include/config/auditsyscall.h) \
+    $(wildcard include/config/block.h) \
+    $(wildcard include/config/fs/xip.h) \
+    $(wildcard include/config/migration.h) \
+  include/linux/limits.h \
+  include/linux/ioctl.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/ioctl.h \
+  include/asm-generic/ioctl.h \
+  include/linux/dcache.h \
+  include/linux/rculist.h \
+  include/linux/path.h \
+  include/linux/radix-tree.h \
+  include/linux/prio_tree.h \
+  include/linux/pid.h \
+  include/linux/capability.h \
+  include/linux/semaphore.h \
+  include/linux/fiemap.h \
+  include/linux/quota.h \
+    $(wildcard include/config/quota/netlink/interface.h) \
+  include/linux/dqblk_xfs.h \
+  include/linux/dqblk_v1.h \
+  include/linux/dqblk_v2.h \
+  include/linux/dqblk_qtree.h \
+  include/linux/nfs_fs_i.h \
+  include/linux/nfs.h \
+  include/linux/sunrpc/msg_prot.h \
+  include/linux/inet.h \
+  include/linux/fcntl.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/fcntl.h \
+  include/asm-generic/fcntl.h \
+  include/linux/err.h \
+  include/linux/sched.h \
+    $(wildcard include/config/sched/debug.h) \
+    $(wildcard include/config/detect/softlockup.h) \
+    $(wildcard include/config/detect/hung/task.h) \
+    $(wildcard include/config/core/dump/default/elf/headers.h) \
+    $(wildcard include/config/virt/cpu/accounting.h) \
+    $(wildcard include/config/bsd/process/acct.h) \
+    $(wildcard include/config/taskstats.h) \
+    $(wildcard include/config/audit.h) \
+    $(wildcard include/config/inotify/user.h) \
+    $(wildcard include/config/posix/mqueue.h) \
+    $(wildcard include/config/keys.h) \
+    $(wildcard include/config/user/sched.h) \
+    $(wildcard include/config/perf/events.h) \
+    $(wildcard include/config/schedstats.h) \
+    $(wildcard include/config/task/delay/acct.h) \
+    $(wildcard include/config/fair/group/sched.h) \
+    $(wildcard include/config/rt/group/sched.h) \
+    $(wildcard include/config/blk/dev/io/trace.h) \
+    $(wildcard include/config/cc/stackprotector.h) \
+    $(wildcard include/config/sysvipc.h) \
+    $(wildcard include/config/rt/mutexes.h) \
+    $(wildcard include/config/task/xacct.h) \
+    $(wildcard include/config/cpusets.h) \
+    $(wildcard include/config/cgroups.h) \
+    $(wildcard include/config/futex.h) \
+    $(wildcard include/config/fault/injection.h) \
+    $(wildcard include/config/latencytop.h) \
+    $(wildcard include/config/function/graph/tracer.h) \
+    $(wildcard include/config/have/unstable/sched/clock.h) \
+    $(wildcard include/config/stack/growsup.h) \
+    $(wildcard include/config/debug/stack/usage.h) \
+    $(wildcard include/config/group/sched.h) \
+    $(wildcard include/config/mm/owner.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/param.h \
+    $(wildcard include/config/hz.h) \
+  include/linux/timex.h \
+  include/linux/param.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/timex.h \
+  arch/arm/mach-stm32/include/mach/timex.h \
+  include/linux/jiffies.h \
+  include/linux/rbtree.h \
+  include/linux/mm_types.h \
+    $(wildcard include/config/split/ptlock/cpus.h) \
+    $(wildcard include/config/want/page/debug/flags.h) \
+    $(wildcard include/config/aio.h) \
+    $(wildcard include/config/proc/fs.h) \
+    $(wildcard include/config/mmu/notifier.h) \
+  include/linux/auxvec.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/auxvec.h \
+  include/linux/page-debug-flags.h \
+    $(wildcard include/config/page/poisoning.h) \
+    $(wildcard include/config/page/debug/something/else.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/mmu.h \
+    $(wildcard include/config/cpu/has/asid.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/cputime.h \
+  include/asm-generic/cputime.h \
+  include/linux/sem.h \
+  include/linux/ipc.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/ipcbuf.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/sembuf.h \
+  include/linux/signal.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/signal.h \
+  include/asm-generic/signal-defs.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/sigcontext.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/siginfo.h \
+  include/asm-generic/siginfo.h \
+  include/linux/proportions.h \
+  include/linux/percpu_counter.h \
+  include/linux/seccomp.h \
+    $(wildcard include/config/seccomp.h) \
+  include/linux/rtmutex.h \
+    $(wildcard include/config/debug/rt/mutexes.h) \
+  include/linux/plist.h \
+    $(wildcard include/config/debug/pi/list.h) \
+  include/linux/resource.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/resource.h \
+  include/asm-generic/resource.h \
+  include/linux/timer.h \
+    $(wildcard include/config/timer/stats.h) \
+    $(wildcard include/config/debug/objects/timers.h) \
+  include/linux/ktime.h \
+    $(wildcard include/config/ktime/scalar.h) \
+  include/linux/debugobjects.h \
+    $(wildcard include/config/debug/objects/free.h) \
+  include/linux/hrtimer.h \
+    $(wildcard include/config/high/res/timers.h) \
+  include/linux/task_io_accounting.h \
+    $(wildcard include/config/task/io/accounting.h) \
+  include/linux/latencytop.h \
+  include/linux/cred.h \
+    $(wildcard include/config/debug/credentials.h) \
+  include/linux/key.h \
+    $(wildcard include/config/sysctl.h) \
+  include/linux/sysctl.h \
+  include/linux/selinux.h \
+    $(wildcard include/config/security/selinux.h) \
+  include/linux/aio.h \
+  include/linux/workqueue.h \
+    $(wildcard include/config/debug/objects/work.h) \
+  include/linux/aio_abi.h \
+  include/linux/uio.h \
+  include/linux/device.h \
+    $(wildcard include/config/debug/devres.h) \
+    $(wildcard include/config/devtmpfs.h) \
+  include/linux/ioport.h \
+  include/linux/klist.h \
+  include/linux/pm.h \
+    $(wildcard include/config/pm/sleep.h) \
+    $(wildcard include/config/pm/runtime.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/device.h \
+    $(wildcard include/config/dmabounce.h) \
+  include/linux/pm_wakeup.h \
+    $(wildcard include/config/pm.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/uaccess.h \
+    $(wildcard include/config/mpu/user/access.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/unified.h \
+    $(wildcard include/config/arm/asm/unified.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/mpu.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/stm32f4xx.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/stm32f429xx.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/core_cm4.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/system_stm32f4xx.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_conf.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include/com_gpio.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dac.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dac_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_fmc.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_nor.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_nand.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pccard.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rng.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rtc.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rtc_ex.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_usart.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_wwdg.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_qspi.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \
+    $(wildcard include/config/disable.h) \
+    $(wildcard include/config/enable.h) \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/driver.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/stm32f429xx.h \
+  include/linux/delay.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/delay.h \
+
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.o)
+
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.o):

+ 2 - 0
app/driver/GPIO_I2C/.tmp_versions/gpio_i2c.mod

@@ -0,0 +1,2 @@
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.ko
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c_main.o

+ 1 - 0
app/driver/GPIO_I2C/Makefile

@@ -17,6 +17,7 @@ APPDIR := $(INSTALL_ROOT)/projects/gd32450i-eval/app
 
 EXTRA_CFLAGS := -I$(APPDIR)/driver/STM32F4xx_HAL_Driver
 EXTRA_CFLAGS += -I$(APPDIR)/driver/STM32F4xx_HAL_Driver/Inc
+EXTRA_CFLAGS += -I$(APPDIR)/driver/STM32F4xx_HAL_Driver/Inc/Legacy
 EXTRA_CFLAGS += -I$(APPDIR)/common_include
 EXTRA_CFLAGS += -I$(APPDIR)/driver
 

+ 0 - 0
app/driver/GPIO_I2C/Module.symvers


BIN
app/driver/GPIO_I2C/gpio_i2c.ko


+ 21 - 0
app/driver/GPIO_I2C/gpio_i2c.mod.c

@@ -0,0 +1,21 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+ .arch = MODULE_ARCH_INIT,
+};
+
+static const char __module_depends[]
+__used
+__attribute__((section(".modinfo"))) =
+"depends=";
+

+ 171 - 23
app/driver/GPIO_I2C/gpio_i2c_main.c

@@ -13,7 +13,9 @@
 //#include <stdint.h>
 #include "stm32f4xx.h"
 #include "stm32f4xx_hal_gpio.h"
+#include "stm32_hal_legacy.h"
 #include "driver.h"
+#include <linux/delay.h>
 
 
 
@@ -28,10 +30,8 @@ static int count = 1;
 static int gpio_i2c_open(struct inode *inode, struct file *filep);
 static int gpio_i2c_close(struct inode *inode, struct file *filep);
 static ssize_t gpio_i2c_read(struct file *filep, char __user *buf, size_t size, loff_t *offset);
-static ssize_t gpio__i2c_write(struct file *filep, const char __user *buf, size_t size, loff_t *offset);
+static ssize_t gpio_i2c_write(struct file *filep, const char __user *buf, size_t size, loff_t *offset);
 static int gpio_i2c_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, unsigned long arg);
-static int gpio_i2c_transfer(gpio_i2c_t *pArg);
-static int gpio_i2c_receive(gpio_i2c_t *pArg);
 static struct file_operations gpio_i2c_ops = 
 {
 	.owner = THIS_MODULE,
@@ -43,6 +43,161 @@ static struct file_operations gpio_i2c_ops =
 	
 };
 
+#define SCL_PORT	GPIOC
+#define SCL_PIN 	GPIO_PIN_9
+#define SDA_PORT 	GPIOA
+#define SDA_PIN 	GPIO_PIN_8
+
+#define SCLK_Set() HAL_GPIO_WritePin(SCL_PORT, SCL_PIN, 1);
+#define SCLK_Clr() HAL_GPIO_WritePin(SCL_PORT, SCL_PIN, 0);
+#define SDIN_Set() HAL_GPIO_WritePin(SDA_PORT, SDA_PIN, 1);
+#define SDIN_Clr() HAL_GPIO_WritePin(SDA_PORT, SDA_PIN, 0);
+
+void IIC_Start(void)
+{
+	SCLK_Set();
+	SDIN_Set();
+	udelay(1);
+	SDIN_Clr();
+}
+
+/**********************************************
+//IIC Stop
+**********************************************/
+void IIC_Stop(void)
+{
+	SCLK_Clr();
+	SDIN_Clr();
+	SCLK_Set();
+	udelay(1);
+	SDIN_Set();
+}
+
+void IIC_Ack(void)
+{
+	SCLK_Clr();
+	SDIN_Clr();
+	udelay(1); 
+	SCLK_Set();
+	udelay(1);
+	SCLK_Clr();	
+	SDIN_Set();	//release SDA
+}
+
+void IIC_NoAck(void)
+{
+	SCLK_Clr();
+	SDIN_Set();
+	udelay(1); 
+	SCLK_Set();
+	udelay(1);
+	SCLK_Clr();
+	SDIN_Set();	//release SDA
+}
+
+void IIC_Wait_Ack(void)
+{
+	SCLK_Clr();
+	SDIN_Set();	//release SDA
+	udelay(1);
+	SCLK_Set() ;
+	udelay(1);
+	SCLK_Clr();
+}
+
+void Write_IIC_Byte(unsigned char IIC_Byte)
+{
+	unsigned char i;
+	unsigned char m,da;
+	da=IIC_Byte;
+	SCLK_Clr();
+	for(i=0;i<8;i++)		
+	{
+		m=da;
+		m=m&0x80;
+		if(m==0x80)
+		{
+			SDIN_Set();
+		}
+		else 
+		{
+			SDIN_Clr(); 
+		}
+		
+		da=da<<1;
+		udelay(1);
+		SCLK_Set();
+		udelay(1);
+		SCLK_Clr();
+	}
+}
+
+unsigned char Read_IIC_Byte(void)
+{
+	unsigned char i;
+	unsigned int da = 0;
+
+	SCLK_Clr();
+	SDIN_Set();	//release SDA
+
+	for(i=0;i<8;i++)	//8	
+	{
+		da=da<<1 ;
+		udelay(1);
+		SCLK_Set();
+		if(HAL_GPIO_ReadPin(SDA_PORT, SDA_PIN) == 1)
+		{da++;}
+		udelay(1);
+		SCLK_Clr();
+	}
+
+	return da;
+}
+
+static int master_write(uint8_t slave_addr, uint8_t *buf, uint32_t size)
+{
+	int i;
+	IIC_Start();  		 
+	Write_IIC_Byte(slave_addr);            //Slave address,SA0=0	   90
+	IIC_Wait_Ack();	
+
+	for(i=0;i<size;i++)
+	{
+		Write_IIC_Byte(buf[i]);			//write command
+		IIC_Wait_Ack();
+	}
+
+	IIC_Stop();	
+	return 0;
+}
+
+static int master_read(uint8_t slave_addr, uint8_t *buf, uint32_t size)
+{
+	int i;
+	IIC_Start();
+	Write_IIC_Byte(slave_addr+1);            //Slave address
+	IIC_Wait_Ack();
+	for(i=0;i<size-1;i++)
+	{
+		udelay(1);
+		buf[i] = Read_IIC_Byte();	
+		IIC_Ack();	
+		printk("Rcv: %#x\n", buf[i]);
+	}				
+
+	udelay(1);
+	buf[i] = Read_IIC_Byte();	
+	IIC_NoAck();
+	IIC_Stop();
+	printk("Rcv last: %#x\n", buf[i]);
+	
+	return 0;
+}
+
+
+
+
+
 static int gpio_i2c_open(struct inode *inode, struct file *filep)
 {
 	//__HAL_RCC_GPIOC_CLK_ENABLE();
@@ -63,13 +218,12 @@ static int gpio_i2c_ioctl(struct inode *inode, struct file *filep, unsigned int
 	switch(cmd)
 	{
 		case GPIO_I2C_MASTER_TRANSFER:
-			HAL_GPIO_Init(gpio_arg.GPIOx, &gpio_arg.GPIO_Init);
+			master_write(gpio_i2c_arg.DevAddress&0xFE, gpio_i2c_arg.buf, gpio_i2c_arg.Size );
 			break;
 		case GPIO_I2C_MASTER_RECEIVE:
-			HAL_GPIO_WritePin(gpio_arg.GPIOx, gpio_arg.GPIO_pin, gpio_arg.Data);
+			master_read(gpio_i2c_arg.DevAddress&0xFE, gpio_i2c_arg.buf, gpio_i2c_arg.Size );
 		
-			gpio_arg.Data = HAL_GPIO_ReadPin(gpio_arg.GPIOx, gpio_arg.GPIO_pin);
-			if ( copy_to_user((void*)arg, (void*)&gpio_arg, sizeof(gpio_t)))
+			if ( copy_to_user((void*)arg, (void*)&gpio_i2c_arg, sizeof(gpio_i2c_t)))
 				return -EFAULT;
 			break;
 	default:
@@ -91,19 +245,6 @@ static ssize_t gpio_i2c_write(struct file *filep, const char __user *buf, size_t
 	return 0;
 }
 
-static int gpio_i2c_transfer(gpio_i2c_t *pArg)
-{
-	//TODO:
-	return 0;
-}
-
-static int gpio_i2c_receive(gpio_i2c_t *pArg)
-{
-	//TODO:
-	return 0;
-}
-
-
 static void gpio_i2c_hw_init(void)
 {
 	GPIO_InitTypeDef  GPIO_InitStruct;
@@ -111,9 +252,14 @@ static void gpio_i2c_hw_init(void)
 	GPIO_InitStruct.Mode	= GPIO_MODE_OUTPUT_OD;
 	GPIO_InitStruct.Pull    = GPIO_PULLUP;
 	GPIO_InitStruct.Speed   = GPIO_SPEED_FAST;
-	//GPIO_I2C
-	GPIO_InitStruct.Pin		= GPIO_PIN_6 | GPIO_PIN_7;	//SCL | SDA
-	//HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+	
+	//SCL
+	GPIO_InitStruct.Pin		= SCL_PIN;
+	HAL_GPIO_Init(SCL_PORT, &GPIO_InitStruct);
+	//SDA
+	GPIO_InitStruct.Pin		= SDA_PIN;
+	HAL_GPIO_Init(SDA_PORT, &GPIO_InitStruct);
+
 }
 
 static int __init gpio_i2c_init(void)
@@ -137,6 +283,8 @@ static int __init gpio_i2c_init(void)
 	}
 
 	gpio_i2c_hw_init();
+
+	printk("GPIO_I2C module start...");
 	return 0;
 
 ERR_STEP1:

+ 1 - 0
app/driver/GPIO_I2C/modules.order

@@ -0,0 +1 @@
+kernel//gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/gpio_i2c.ko

BIN
app/driver/I2C/i2c.ko


+ 3 - 1
app/driver/I2C/i2c_main.c

@@ -96,6 +96,7 @@ static int i2c_open(struct inode *inode, struct file *filep)
 		HAL_NVIC_EnableIRQ(I2C3_EV_IRQn);
 		HAL_NVIC_EnableIRQ(I2C3_ER_IRQn);
 		hi2c.Instance = I2C3;
+		printk("i2c3 open\n");
 		break;
 	default:
 		printk("Error:%s %d Invalid minor %d",__FILE__,__LINE__,iminor);
@@ -141,6 +142,7 @@ static int i2c_close(struct inode *inode, struct file *filep)
 		HAL_NVIC_DisableIRQ(I2C3_EV_IRQn);
 		HAL_NVIC_DisableIRQ(I2C3_ER_IRQn);
 		hi2c.Instance	= I2C3;
+		printk("i2c3 close\n");
 		break;
 	default:
 		printk("Error:%s %d Invalid minor %d",__FILE__,__LINE__,iminor);
@@ -448,7 +450,7 @@ void i2c_hw_init(void)
 	
 	//config I2C controller
 	I2cHandle.Init.AddressingMode  = I2C_ADDRESSINGMODE_7BIT;
-	I2cHandle.Init.ClockSpeed      = 100000;
+	I2cHandle.Init.ClockSpeed      = 200000;
 	I2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
 	I2cHandle.Init.DutyCycle       = I2C_DUTYCYCLE_16_9;
 	I2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;

+ 9 - 9
app/driver/STM32F4xx_HAL_Driver/.system_stm32f4xx.o.cmd

@@ -1,10 +1,10 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/.system_stm32f4xx.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(system_stm32f4xx)"  -D"KBUILD_MODNAME=KBUILD_STR(spi)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/.system_stm32f4xx.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(system_stm32f4xx)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio_i2c)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.c
 
-deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.o := \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.c \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/stm32f4xx.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/stm32f429xx.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/core_cm4.h \
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.c \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/stm32f4xx.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/stm32f429xx.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/core_cm4.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
     $(wildcard include/config/lbdaf.h) \
@@ -26,7 +26,7 @@ deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/..
     $(wildcard include/config/optimize/inlining.h) \
   include/linux/compiler-gcc4.h \
   /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/posix_types.h \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.h \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/stm32f4xx.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_conf.h \
@@ -127,6 +127,6 @@ deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/..
     $(wildcard include/config/generic/bug.h) \
     $(wildcard include/config/generic/bug/relative/pointers.h) \
 
-/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.o)
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.o)
 
-$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/system_stm32f4xx.o):
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/system_stm32f4xx.o):

+ 5 - 5
app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal.o.cmd

@@ -1,7 +1,7 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_hal)"  -D"KBUILD_MODNAME=KBUILD_STR(spi)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_hal)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio_i2c)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c
 
-deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o := \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
@@ -186,6 +186,6 @@ deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/..
   /gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include/asm/timex.h \
   arch/arm/mach-stm32/include/mach/timex.h \
 
-/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o)
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o)
 
-$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o):
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o):

+ 5 - 5
app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_dma.o.cmd

@@ -1,7 +1,7 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_dma.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_hal_dma)"  -D"KBUILD_MODNAME=KBUILD_STR(spi)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_dma.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_hal_dma)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio_i2c)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c
 
-deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o := \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
@@ -63,6 +63,6 @@ deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/..
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_wwdg.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_qspi.h \
 
-/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o)
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o)
 
-$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o):
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o):

+ 5 - 5
app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_gpio.o.cmd

@@ -1,7 +1,7 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_gpio.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_hal_gpio)"  -D"KBUILD_MODNAME=KBUILD_STR(spi)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_gpio.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_hal_gpio)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio_i2c)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c
 
-deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o := \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
@@ -63,6 +63,6 @@ deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/..
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_wwdg.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_qspi.h \
 
-/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o)
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o)
 
-$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/SPI/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o):
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o):

+ 5 - 5
app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_sram.o.cmd

@@ -1,7 +1,7 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_sram.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_hal_sram)"  -D"KBUILD_MODNAME=KBUILD_STR(fmc)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_hal_sram.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_hal_sram)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio_i2c)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c
 
-deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o := \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c \
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
@@ -63,6 +63,6 @@ deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/..
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_wwdg.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_qspi.h \
 
-/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o)
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o)
 
-$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o):
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.o):

+ 5 - 5
app/driver/STM32F4xx_HAL_Driver/Src/.stm32f4xx_ll_fmc.o.cmd

@@ -1,7 +1,7 @@
-cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_ll_fmc.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_ll_fmc)"  -D"KBUILD_MODNAME=KBUILD_STR(fmc)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c
+cmd_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o := arm-uclinuxeabi-gcc -Wp,-MD,/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/.stm32f4xx_ll_fmc.o.d  -nostdinc -isystem /gd32f450_prj/linux-cortexm-1.14.2/tools/arm-2010q1/bin/../lib/gcc/arm-uclinuxeabi/4.4.1/include -I/gd32f450_prj/linux-cortexm-1.14.2/linux/arch/arm/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-stm32/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -mabi=aapcs-linux -mno-thumb-interwork -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-m3 -Wa,-mcpu=cortex-m3 -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/Legacy -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/common_include -I/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver  -DMODULE -mlong-calls -fno-optimize-sibling-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stm32f4xx_ll_fmc)"  -D"KBUILD_MODNAME=KBUILD_STR(gpio_i2c)"  -c -o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c
 
-deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o := \
-  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c \
+deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o := \
+  /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h \
   include/linux/types.h \
     $(wildcard include/config/uid16.h) \
@@ -63,6 +63,6 @@ deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/..
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_wwdg.h \
   /gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_qspi.h \
 
-/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o)
+/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o: $(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o)
 
-$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/FMC/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o):
+$(deps_/gd32f450_prj/linux-cortexm-1.14.2/projects/gd32450i-eval/app/driver/GPIO_I2C/../STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.o):

+ 2 - 0
app/driver/driver.h

@@ -45,6 +45,7 @@
 #define GPIO_INIT				GENERATE_CMD(IOCTL_MAGIC, MAJOR_GPIO, 0)
 #define GPIO_WRITE_PIN			GENERATE_CMD(IOCTL_MAGIC, MAJOR_GPIO, 1)
 #define GPIO_READ_PIN			GENERATE_CMD(IOCTL_MAGIC, MAJOR_GPIO, 2)
+#define GPIO_SET_DIR 			GENERATE_CMD(IOCTL_MAGIC, MAJOR_GPIO, 3)
 
 /* ADC command */
 #define ADC_GET_RESULT			GENERATE_CMD(IOCTL_MAGIC, MAJOR_ADC, 0)
@@ -69,6 +70,7 @@ typedef struct {
 typedef struct {
 	GPIO_TypeDef* 		GPIOx;
 	uint16_t 			GPIO_pin;
+	uint8_t 			Direct;
 	GPIO_PinState		Data;
 	GPIO_InitTypeDef	GPIO_Init;
 } gpio_t;

+ 12 - 8
app/goahead-3.6.5/src/web_interface/src/sel.c

@@ -66,7 +66,11 @@ void GetAllSELEntriesSorted(Webs *wp)
 	uint16 nMaxEntries = 0;
 	IPMI20_UDS_SESSION_T    UDSSession;
 
-	
+	char *pStr;
+    int code = 200;
+    cJSON * root =  cJSON_CreateObject();
+    cJSON  *pJsonArry,*pJsonsub;
+    pJsonArry=cJSON_CreateArray();   /*创建数组*/
 
 	//Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
@@ -112,13 +116,12 @@ void GetAllSELEntriesSorted(Webs *wp)
 		printf("before get all sel entried\n");
 		/* Now pass this buffer pointer to the function to get all SEL entries */
 		wRet = LIBIPMI_HL_GetAllSelEntriesWithSensorNames(&UDSSession, pSELBuff, DEFAULT_TIMEOUT);
+		//Close session
+    	LIBIPMI_CloseSession(&UDSSession );
+
 		if(wRet == 0)
 		{
-			char *pStr;
-		    int code = 200;
-		    cJSON * root =  cJSON_CreateObject();
-		    cJSON  *pJsonArry,*pJsonsub;
-		    pJsonArry=cJSON_CreateArray();   /*创建数组*/
+			
 			/* Write entries here */
 			while(nEntries)
 			{
@@ -163,12 +166,13 @@ void GetAllSELEntriesSorted(Webs *wp)
 		wfree(pStartBuff);
 	}
 
-	//Close session
-    LIBIPMI_CloseSession(&UDSSession );
+	
 
 	return;
 
 error_out:
+	//Close session
+    LIBIPMI_CloseSession(&UDSSession );
 	websError(wp, 404, "Get SEL error!");
 
 }

BIN
app/goahead-5.1.0.tar.gz


+ 47 - 0
app/hal_api/hal_gpio_i2c_interface.c

@@ -0,0 +1,47 @@
+
+#include "driver.h"
+#include <linux/types.h>
+#include <stdio.h>
+#include <string.h>
+#include "com_gpio.h"
+#include "hal_interface_api.h"
+#include "linux/fcntl.h"
+
+/*
+bus: 		1,2,3
+address: 	8bit
+*/
+int stm32_gpio_i2c_master_write(int fd, uint8_t address, uint8_t *pBuf, uint16_t size)
+{
+	int ret = 0;
+	gpio_i2c_t i2c_arg;
+	
+	i2c_arg.DevAddress = address;
+	i2c_arg.Size = size;
+	memcpy(i2c_arg.buf, pBuf, size);
+	ret = ioctl(fd, GPIO_I2C_MASTER_TRANSFER, &i2c_arg);
+	if(ret != 0)
+	{
+		printf("Write i2c failed! ADDR: %#x\n", address);
+	}
+
+	return ret;
+}
+
+int stm32_gpio_i2c_master_read(int fd, uint8_t address, uint8_t *pBuf, uint16_t size)
+{
+	int ret;
+	gpio_i2c_t i2c_arg;
+
+	i2c_arg.DevAddress = address;
+	i2c_arg.Size = size;
+	ret = ioctl(fd, GPIO_I2C_MASTER_RECEIVE, &i2c_arg);
+	if(ret != 0)
+	{
+		printf("Read i2c failed! ADDR: %#x\n", address);
+	}
+	memcpy(pBuf, i2c_arg.buf, size);
+
+	return 0;
+}
+

+ 103 - 28
app/hal_api/hal_gpio_interface.c

@@ -6,6 +6,9 @@
 #include "com_gpio.h"
 #include "hal_interface_api.h"
 #include "linux/fcntl.h"
+#include <stdint.h>
+#include "stm32f429xx.h"
+#include "stm32_hal_legacy.h"
 
 #define DEV_NAME	"/dev/gpio"
 
@@ -58,46 +61,118 @@ void  stm32_gpio_init(GPIO_TypeDef  *GPIOx, GPIO_InitTypeDef *GPIO_Init)
 
 void stm32_gpio_write(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
 {
-	int fd;
-	int ret;
-	gpio_t gpio_arg;
-	fd = open(DEV_NAME, O_RDWR);
-	if(fd == -1)
+	if(PinState != GPIO_PIN_RESET)
 	{
-		printf("Open %s failed!\n", DEV_NAME);
+	GPIOx->BSRR = GPIO_Pin;
 	}
-
-	gpio_arg.GPIOx = GPIOx;
-	gpio_arg.GPIO_pin = GPIO_Pin;
-	gpio_arg.Data	= PinState;
-	ret = ioctl(fd, GPIO_WRITE_PIN, &gpio_arg);
-	if(ret == -1)
+	else
 	{
-		printf("Write gpio failed!\n");
+	GPIOx->BSRR = (uint32_t)GPIO_Pin << 16U;
 	}
+	// int fd;
+	// int ret;
+	// gpio_t gpio_arg;
+	// fd = open(DEV_NAME, O_RDWR);
+	// if(fd == -1)
+	// {
+	// 	printf("Open %s failed!\n", DEV_NAME);
+	// }
 
-	close(fd);
+	// gpio_arg.GPIOx = GPIOx;
+	// gpio_arg.GPIO_pin = GPIO_Pin;
+	// gpio_arg.Data	= PinState;
+	// ret = ioctl(fd, GPIO_WRITE_PIN, &gpio_arg);
+	// if(ret == -1)
+	// {
+	// 	printf("Write gpio failed!\n");
+	// }
+
+	// close(fd);
 }
 
 GPIO_PinState stm32_gpio_read(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
 {
-	int fd;
-	int ret;
-	gpio_t gpio_arg;
-	fd = open(DEV_NAME, O_RDWR);
-	if(fd == -1)
+	GPIO_PinState bitstatus;
+
+	/* Check the parameters */
+	//assert_param(IS_GPIO_PIN(GPIO_Pin));
+
+	if((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET)
 	{
-		printf("Open %s failed!\n", DEV_NAME);
+		bitstatus = GPIO_PIN_SET;
 	}
-
-	gpio_arg.GPIOx = GPIOx;
-	gpio_arg.GPIO_pin = GPIO_Pin;
-	ret = ioctl(fd, GPIO_READ_PIN, &gpio_arg);
-	if(ret == -1)
+	else
 	{
-		printf("Write gpio failed!\n");
+		bitstatus = GPIO_PIN_RESET;
 	}
-	close(fd);
+	return bitstatus;
+	// int fd;
+	// int ret;
+	// gpio_t gpio_arg;
+	// fd = open(DEV_NAME, O_RDWR);
+	// if(fd == -1)
+	// {
+	// 	printf("Open %s failed!\n", DEV_NAME);
+	// }
+
+	// gpio_arg.GPIOx = GPIOx;
+	// gpio_arg.GPIO_pin = GPIO_Pin;
+	// ret = ioctl(fd, GPIO_READ_PIN, &gpio_arg);
+	// if(ret == -1)
+	// {
+	// 	printf("Write gpio failed!\n");
+	// }
+	// close(fd);
+
+	// return gpio_arg.Data;
+}
+
+//direct = 0: input
+//direct = 1: output
+int stm32_gpio_direct(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, uint8_t direct)
+{
+	uint32_t temp;
+	uint32_t ioposition;
+	uint32_t iocurrent;
+	uint32_t position;
+	/* Configure the port pins */
+  	for(position = 0U; position < 16; position++)
+  	{
+    	/* Get the IO position */
+    	ioposition = 0x01U << position;
+    	/* Get the current IO position */
+    	iocurrent = (uint32_t)(GPIO_Pin) & ioposition;
+
+	    if(iocurrent == ioposition)
+	    {
+			temp = GPIOx->MODER;
+	      	temp &= ~(GPIO_MODER_MODER0 << (position * 2U));
+	      	temp |= (direct << (position * 2U));
+	      	GPIOx->MODER = temp;
+	    }
+    }
+	// int fd;
+	// int ret;
+	// gpio_t gpio_arg;
+	// if((direct != 0) && (direct != 1))
+	// {
+	// 	printf("Invalid direct! %d\n", direct);
+	// 	return -1;
+	// }
+	// fd = open(DEV_NAME, O_RDWR);
+	// if(fd == -1)
+	// {
+	// 	printf("Open %s failed!\n", DEV_NAME);
+	// }
+
+	// gpio_arg.GPIOx = GPIOx;
+	// gpio_arg.GPIO_pin = GPIO_Pin;
+	// gpio_arg.Direct = direct;
+	// ret = ioctl(fd, GPIO_SET_DIR, &gpio_arg);
+	// if(ret == -1)
+	// {
+	// 	printf("Set gpio direct failed!\n");
+	// }
+	// close(fd);
 
-	return gpio_arg.Data;
 }

+ 5 - 0
app/hal_api/hal_interface_api.h

@@ -43,4 +43,9 @@ int stm32_adc_get_value(uint8_t channel, uint16_t *value);
 int stm32_reset_mcu(void);
 uint32_t stm32_generate_random32bit(void);
 
+/* gpio i2c */
+int stm32_gpio_i2c_master_write(int fd, uint8_t address, uint8_t *pBuf, uint16_t size);
+int stm32_gpio_i2c_master_read(int fd, uint8_t address, uint8_t *pBuf, uint16_t size);
+
+
 #endif /* __HAL_INTERFACE_API_H__ */

BIN
app/ipmitool-1.8.18.tar.bz2


BIN
app/ipmitool-1.8.18/ipmitool


+ 1 - 1
app/test_app/Makefile

@@ -9,7 +9,7 @@ LDFLAGS		:= -mcpu=cortex-m3 -mthumb -L$(INSTALL_ROOT)/A2F/root/usr/lib
 CC	= $(CROSS_COMPILE_APPS)gcc
 
 #source
-SRC	= netspeed.c
+SRC	= test.c
 
 # hal_api
 SRC += $(wildcard ../hal_api/*.c) 

+ 13 - 20
app/test_app/test.c

@@ -20,26 +20,19 @@
 
 int main()
 {
+	int i;
+	uint8_t buf[2] = {0};
 	int fd;
-	struct sockaddr_in servaddr;
-	printf("test_app\n");
-
-	fd = socket(AF_INET, SOCK_DGRAM, 0);
-	if (fd == -1) {
-		printf("---> create socket error!\n");
-	}
-
-	bzero(&servaddr, sizeof(servaddr));
-	servaddr.sin_family = AF_INET;
-	servaddr.sin_port = htons(623);					
-	servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
-	if (connect(fd, &servaddr, sizeof(servaddr)) == -1) {
-		printf("---> connect error!\n");
-		return -1;
+	while(1)
+	{
+		fd = open("/dev/gpio_i2c", O_RDWR);
+		buf[0] = 0;
+		//stm32_gpio_i2c_master_write(fd, 0x90, buf, 1);
+		stm32_gpio_i2c_master_read(fd, 0x90, buf, 1);
+		printf("---> buf: %#x %#x\n", buf[0], buf[1]);
+		close(fd);
+		sleep(3);
 	}
-
-	printf("---> connect ok, port: %d\n", \
-		servaddr.sin_port );
-	uint8_t buf[] = {1,2,3,4,5,6,7,8,9};
-	send(fd, buf, 9, 0);
+	close(fd);
+	
 }

BIN
app/test_app/test_app


+ 340 - 0
app/test_app/usart.c

@@ -0,0 +1,340 @@
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <linux/types.h>
+//#include <linux/jiffies.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <netdb.h>        /* getaddrinfo(3) et al.                       */
+#include <netinet/in.h>   /* sockaddr_in & sockaddr_in6 definition.      */
+#include  <net/if.h>
+#include <sys/prctl.h>
+#include "driver.h"
+#include "hal_interface_api.h"
+ 
+#include <termios.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h> 
+#include <linux/kernel.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+ 
+char rev_buf[256];
+char databuf[] = {1,2,0x33,0x34,0x35,6,7,11,12,89};
+int uart_fd;
+ 
+#define DEV_NAME "/dev/ttyS2"
+ 
+int Set_Com_Config(int fd, int baud_rate, int data_bits, char parity, int stop_bits)
+{
+       struct termios new_cfg, old_cfg;
+	   
+       int speed;
+	   
+       /*保存并测试现有串口参数设置,在这里如果串口号等出错,会有相关出错信息*/
+       if(tcgetattr(fd, &old_cfg) != 0)       /*该函数得到fd指向的终端配置参数,并将它们保存到old_cfg变量中,成功返回0,否则-1*/
+	{
+	
+              perror("tcgetttr");
+			  
+              return -1;
+			  
+       }
+ 
+        /*设置字符大小*/
+       new_cfg = old_cfg;   
+		
+       cfmakeraw(&new_cfg); /*配置为原始模式*/ 
+	   
+       new_cfg.c_cflag &= ~CSIZE; /*用位掩码清空数据位的设置*/  
+ 
+      /*设置波特率*/
+       switch(baud_rate)
+	   	
+       {
+		case 2400:
+			speed = B2400;			
+			break;
+ 
+		case 4800:			
+			speed = B4800;			
+			break;
+ 
+		case 9600:
+			speed = B9600;			
+			break;
+ 
+		case 19200:			
+			speed = B19200;			
+			break;
+ 
+		case 38400:			
+			speed = B38400;			
+			break;
+ 
+		default:			
+		case 115200:			
+			speed = B115200;			
+			break;
+		
+       }
+ 
+       cfsetispeed(&new_cfg, speed); //设置输入波特率
+	   
+       cfsetospeed(&new_cfg, speed); //设置输出波特率
+ 
+       /*设置数据长度*/
+       switch(data_bits)
+	   	
+       {
+		case 5:
+			new_cfg.c_cflag &= ~CSIZE;//屏蔽其它标志位
+			new_cfg.c_cflag |= CS5;
+			break;
+		
+		case 6:
+			new_cfg.c_cflag &= ~CSIZE;//屏蔽其它标志位
+			new_cfg.c_cflag |= CS6;
+	   		break;
+		
+		case 7:
+			new_cfg.c_cflag &= ~CSIZE;//屏蔽其它标志位
+			new_cfg.c_cflag |= CS7;
+			break;
+ 
+		default:			
+		case 8:
+			new_cfg.c_cflag &= ~CSIZE;//屏蔽其它标志位
+			new_cfg.c_cflag |= CS8;
+			break;
+		
+       }
+ 
+	/*设置奇偶校验位*/
+	switch(parity)
+	{
+		default:
+			
+		case 'n':
+			
+		case 'N': //无校验
+			
+		{
+			new_cfg.c_cflag &= ~PARENB;
+			
+			new_cfg.c_iflag &= ~INPCK;
+		}	
+		break;
+ 
+		case 'o': //奇校验
+			
+		case 'O':
+			
+		{
+			new_cfg.c_cflag |= (PARODD | PARENB);
+			
+			new_cfg.c_iflag |= INPCK;
+		}		
+		break;
+ 
+		case 'e': //偶校验
+ 
+		case 'E':
+ 
+		{
+ 
+			new_cfg.c_cflag |=  PARENB;
+ 
+			new_cfg.c_cflag &= ~PARODD;
+ 
+			new_cfg.c_iflag |= INPCK;
+ 
+		}
+		break;
+		
+	}
+ 
+       /*设置停止位*/
+       switch(stop_bits)
+ 
+       {
+ 
+		default:
+		case 1:
+			new_cfg.c_cflag &= ~CSTOPB;
+			break;
+ 
+		case 2:
+			new_cfg.c_cflag |= CSTOPB;
+			break;
+		
+       }
+ 
+ 
+ 
+      /*设置等待时间和最小接收字符*/
+       new_cfg.c_cc[VTIME] = 1; /* 读取一个字符等待1*(1/10)s */
+ 
+       new_cfg.c_cc[VMIN] = 1; /* 读取字符的最少个数为1 */
+ 
+ 
+	/*处理未接收字符*/
+	tcflush(fd, TCIFLUSH); //溢出数据可以接收,但不读
+ 
+ 
+ 
+       /* 激活配置 (将修改后的termios数据设置到串口中)
+         * TCSANOW:所有改变立即生效
+         */
+       if((tcsetattr(fd, TCSANOW, &new_cfg))!= 0)
+ 
+       {
+       
+              perror("tcsetattr");
+ 
+              return -1;
+			  
+       }
+ 
+       return 0;
+	   
+}
+ 
+int Uart_Send(int fd, char *data, int data_len)  
+{  
+	int len = 0;  
+   	len = write(fd, data, data_len);
+	
+    	if(len == data_len) {  
+        	return len;  
+    	} else {  
+        	tcflush(fd, TCOFLUSH); //TCOFLUSH刷新写入的数据但不传送  
+        	return -1;  
+    	}  
+} 
+ 
+int Uart_Recv(int fd, char *rev_buf, int data_len)
+{
+	int len, fs_sel;  
+	fd_set fs_read;  
+ 
+	struct timeval tv_timeout;  
+ 
+	FD_ZERO(&fs_read); //清空集合
+	FD_SET(fd,&fs_read); // 将一个给定的文件描述符加入集合之中 
+ 
+	tv_timeout.tv_sec = 5;  
+	tv_timeout.tv_usec = 0;  
+     
+	//使用select实现串口的多路通信  
+	fs_sel = select(fd + 1, &fs_read, NULL, NULL, &tv_timeout); //如果select返回值大于0,说明文件描述符发生了变化
+	//printf("fs_sel = %d\n",fs_sel);  //如果返回0,代表在描述符状态改变前已超过timeout时间,错误返回-1  
+	
+	if(fs_sel)  
+	{  
+		len = read(fd, rev_buf, data_len);  
+		printf("len = %d, fs_sel = %d\n", len, fs_sel);  
+		return len;  
+	}  
+    else  
+	{  
+		return 0;  
+	}       
+}  
+ 
+int Uart_Init(int fd, int speed, int databits, int parity, int stopbits)
+{
+    	//设置串口数据帧格式  
+   	 if (Set_Com_Config(fd, speed, databits, parity, stopbits) == 0)  
+	{                                                           
+		return 0;  
+	}  
+    else  
+	{  
+		return  -1;  
+	}  
+}
+ 
+int Uart_Receive_thread(void)
+{
+	int r_count;
+	int i;
+	while(1)
+	{
+		r_count = Uart_Recv(uart_fd, rev_buf, sizeof(rev_buf));	
+		if(r_count)
+		{
+			for(i = 0; i < r_count; i++)
+			{
+				printf("rev_buf[%d] = 0x%x\n", i, rev_buf[i]);		
+			}
+		}
+	}
+}
+ 
+void Uart_Send_thread(void)
+{
+	int s_count;
+	
+	while(1)
+	{
+		sleep(1);
+		printf("This is Uart_Send_thread.\n");
+		s_count = Uart_Send(uart_fd, databuf, strlen(databuf));
+		if(s_count == -1)	
+			printf("Uart_Send Error!\n");
+		else
+			printf("Send %d data successfully!\n", s_count);
+	}	
+}
+ 
+int main(int argc, char *argv[]) 
+{  
+	pthread_t id_Uart_Receive, id_Uart_Send;
+	int ret1, ret2;
+	
+	uart_fd = open(DEV_NAME, O_RDWR | O_NOCTTY);
+	if(uart_fd == -1)
+	{
+    	printf("Uart Open Failed!\n");
+    	exit(EXIT_FAILURE);
+	}
+		
+	if(Uart_Init(uart_fd, 115200, 8, 'N', 1) == -1)
+	{
+		printf("Uart_Init Failed!\n");
+		exit(EXIT_FAILURE);
+	}
+	
+	ret1 = pthread_create(&id_Uart_Receive, NULL, (void *) Uart_Receive_thread, NULL);
+	ret2 = pthread_create(&id_Uart_Send, NULL, (void *) Uart_Send_thread, NULL);
+	
+	if(ret1!=0){
+		printf ("Create Uart_Receive_thread error!\n");
+		close(uart_fd);
+		exit (1);
+	}
+	if(ret2!=0){
+		printf ("Create Uart_Send_thread error!\n");
+		close(uart_fd);
+		exit (1);
+	}
+	while(1)
+	{
+		printf("This is the main process.\n");
+		usleep(1000000);
+	}
+	pthread_join(id_Uart_Receive, NULL);
+	pthread_join(id_Uart_Send, NULL);
+	
+	return 0;
+}

+ 71 - 70
gd32450i-eval.initramfs

@@ -112,78 +112,79 @@ slink /usr/bin/[[ ../../bin/busybox 777 0 0
 
 file /usr/bin/gpio.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/GPIO/gpio.ko 755 0 0
 file /usr/bin/i2c.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/I2C/i2c.ko 755 0 0
-file /usr/bin/fmc.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/FMC/fmc.ko 755 0 0
-file /usr/bin/test_module.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/test/test_module.ko 755 0 0
+#file /usr/bin/gpio_i2c.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/GPIO_I2C/gpio_i2c.ko 755 0 0
+#file /usr/bin/fmc.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/FMC/fmc.ko 755 0 0
+#file /usr/bin/test_module.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/test/test_module.ko 755 0 0
 file /usr/bin/platform.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/Platform/platform.ko 755 0 0
 file /usr/bin/adc.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/ADC/adc.ko 755 0 0
 file /usr/bin/spi.ko ${INSTALL_ROOT}/projects/${SAMPLE}/app/driver/SPI/spi.ko 755 0 0
-
-
-
-
-
+#
+#
+#
+#
+#
 file /usr/bin/test_app ${INSTALL_ROOT}/projects/${SAMPLE}/app/test_app/test_app 755 0 0
 file /usr/bin/bmc_app ${INSTALL_ROOT}/projects/${SAMPLE}/app/bmc/bmc_app 755 0 0
-file /usr/bin/ipmitool ${INSTALL_ROOT}/projects/${SAMPLE}/app/ipmitool-1.8.18/ipmitool 755 0 0
-file /usr/bin/goahead-3.6.5 ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/build/linux-arm-static/bin/goahead 755 0 0
-
-dir /etc/goahead 755 0 0 
-dir /var/www 755 0 0
-dir /var/www/goahead 755 0 0
-dir /var/www/goahead/static 755 0 0
-dir /var/www/goahead/static/css 755 0 0
-dir /var/www/goahead/static/img 755 0 0
-dir /var/www/goahead/static/js 755 0 0 
-dir /var/www/goahead/static/fonts 755 0 0
-file /etc/goahead/self.crt ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/self.crt 755 0 0
-file /etc/goahead/self.key ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/self.key 755 0 0
-file /etc/goahead/auth.txt ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/auth.txt 755 0 0
-file /etc/goahead/route.txt ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/route.txt 755 0 0
-file /var/www/goahead/favicon.ico ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/favicon.ico 755 0 0
-file /var/www/goahead/index.html ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/index.html 755 0 0
-
-
-
-file /var/www/goahead/favicon.ico ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/favicon.ico 755 0 0
-file /var/www/goahead/index.html ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/index.html 755 0 0
-file /var/www/goahead/static/css/app.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/app.css 755 0 0
-file /var/www/goahead/static/css/chunk-vendors.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/chunk-vendors.css 755 0 0
-file /var/www/goahead/static/css/dashbord.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/dashbord.css 755 0 0
-file /var/www/goahead/static/css/fan.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/fan.css 755 0 0
-file /var/www/goahead/static/css/index.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/index.css 755 0 0
-file /var/www/goahead/static/css/login.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/login.css 755 0 0
-file /var/www/goahead/static/css/sensor_history.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/sensor_history.css 755 0 0
-file /var/www/goahead/static/css/set_proctrol.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/set_proctrol.css 755 0 0
-file /var/www/goahead/static/css/system_logs.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/system_logs.css 755 0 0
-file /var/www/goahead/static/fonts/ionicons.ttf ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.ttf 755 0 0
-file /var/www/goahead/static/fonts/ionicons.woff ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.woff 755 0 0
-file /var/www/goahead/static/fonts/ionicons.woff2 ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.woff2 755 0 0
-file /var/www/goahead/static/img/active.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/active.png 755 0 0
-file /var/www/goahead/static/img/bg1.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/bg1.png 755 0 0
-file /var/www/goahead/static/img/cart.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/cart.png 755 0 0
-file /var/www/goahead/static/img/cart_active.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/cart_active.png 755 0 0
-file /var/www/goahead/static/img/checked-card.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/checked-card.png 755 0 0
-file /var/www/goahead/static/img/crit.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/crit.png 755 0 0
-file /var/www/goahead/static/img/helpicon.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/helpicon.png 755 0 0
-file /var/www/goahead/static/img/icon_right.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/icon_right.png 755 0 0
-file /var/www/goahead/static/img/ionicons.svg ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/ionicons.svg 755 0 0
-file /var/www/goahead/static/img/logo.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/logo.png 755 0 0
-file /var/www/goahead/static/img/logout_1.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/logout_1.png 755 0 0
-file /var/www/goahead/static/img/ok.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/ok.png 755 0 0
-file /var/www/goahead/static/img/print_1.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/print_1.png 755 0 0
-file /var/www/goahead/static/img/refresh.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/refresh.png 755 0 0
-file /var/www/goahead/static/img/sortup.gif ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/sortup.gif 755 0 0
-file /var/www/goahead/static/img/status_critical.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/status_critical.png 755 0 0
-file /var/www/goahead/static/img/user.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/user.png 755 0 0
-file /var/www/goahead/static/img/view.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/view.png 755 0 0
-file /var/www/goahead/static/js/app.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/app.js 755 0 0
-file /var/www/goahead/static/js/BSODScreen.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/BSODScreen.js 755 0 0
-file /var/www/goahead/static/js/chunk-vendors.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/chunk-vendors.js 755 0 0
-file /var/www/goahead/static/js/dashbord.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/dashbord.js 755 0 0
-file /var/www/goahead/static/js/event_logs.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/event_logs.js 755 0 0
-file /var/www/goahead/static/js/fan.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/fan.js 755 0 0
-file /var/www/goahead/static/js/index.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/index.js 755 0 0
-file /var/www/goahead/static/js/login.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/login.js 755 0 0
-file /var/www/goahead/static/js/sensor_history.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/sensor_history.js 755 0 0
-file /var/www/goahead/static/js/set_proctrol.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/set_proctrol.js 755 0 0
-file /var/www/goahead/static/js/system_logs.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/system_logs.js 755 0 0
+#file /usr/bin/ipmitool ${INSTALL_ROOT}/projects/${SAMPLE}/app/ipmitool-1.8.18/ipmitool 755 0 0
+#file /usr/bin/goahead-3.6.5 ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/build/linux-arm-static/bin/goahead 755 0 0
+#
+#dir /etc/goahead 755 0 0 
+#dir /var/www 755 0 0
+#dir /var/www/goahead 755 0 0
+#dir /var/www/goahead/static 755 0 0
+#dir /var/www/goahead/static/css 755 0 0
+#dir /var/www/goahead/static/img 755 0 0
+#dir /var/www/goahead/static/js 755 0 0 
+#dir /var/www/goahead/static/fonts 755 0 0
+#file /etc/goahead/self.crt ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/self.crt 755 0 0
+#file /etc/goahead/self.key ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/self.key 755 0 0
+#file /etc/goahead/auth.txt ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/auth.txt 755 0 0
+#file /etc/goahead/route.txt ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/route.txt 755 0 0
+#file /var/www/goahead/favicon.ico ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/favicon.ico 755 0 0
+#file /var/www/goahead/index.html ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/index.html 755 0 0
+#
+#
+#
+#file /var/www/goahead/favicon.ico ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/favicon.ico 755 0 0
+#file /var/www/goahead/index.html ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/index.html 755 0 0
+#file /var/www/goahead/static/css/app.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/app.css 755 0 0
+#file /var/www/goahead/static/css/chunk-vendors.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/chunk-vendors.css 755 0 0
+#file /var/www/goahead/static/css/dashbord.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/dashbord.css 755 0 0
+#file /var/www/goahead/static/css/fan.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/fan.css 755 0 0
+#file /var/www/goahead/static/css/index.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/index.css 755 0 0
+#file /var/www/goahead/static/css/login.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/login.css 755 0 0
+#file /var/www/goahead/static/css/sensor_history.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/sensor_history.css 755 0 0
+#file /var/www/goahead/static/css/set_proctrol.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/set_proctrol.css 755 0 0
+#file /var/www/goahead/static/css/system_logs.css ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/css/system_logs.css 755 0 0
+#file /var/www/goahead/static/fonts/ionicons.ttf ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.ttf 755 0 0
+#file /var/www/goahead/static/fonts/ionicons.woff ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.woff 755 0 0
+#file /var/www/goahead/static/fonts/ionicons.woff2 ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/fonts/ionicons.woff2 755 0 0
+#file /var/www/goahead/static/img/active.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/active.png 755 0 0
+#file /var/www/goahead/static/img/bg1.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/bg1.png 755 0 0
+#file /var/www/goahead/static/img/cart.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/cart.png 755 0 0
+#file /var/www/goahead/static/img/cart_active.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/cart_active.png 755 0 0
+#file /var/www/goahead/static/img/checked-card.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/checked-card.png 755 0 0
+#file /var/www/goahead/static/img/crit.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/crit.png 755 0 0
+#file /var/www/goahead/static/img/helpicon.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/helpicon.png 755 0 0
+#file /var/www/goahead/static/img/icon_right.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/icon_right.png 755 0 0
+#file /var/www/goahead/static/img/ionicons.svg ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/ionicons.svg 755 0 0
+#file /var/www/goahead/static/img/logo.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/logo.png 755 0 0
+#file /var/www/goahead/static/img/logout_1.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/logout_1.png 755 0 0
+#file /var/www/goahead/static/img/ok.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/ok.png 755 0 0
+#file /var/www/goahead/static/img/print_1.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/print_1.png 755 0 0
+#file /var/www/goahead/static/img/refresh.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/refresh.png 755 0 0
+#file /var/www/goahead/static/img/sortup.gif ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/sortup.gif 755 0 0
+#file /var/www/goahead/static/img/status_critical.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/status_critical.png 755 0 0
+#file /var/www/goahead/static/img/user.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/user.png 755 0 0
+#file /var/www/goahead/static/img/view.png ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/img/view.png 755 0 0
+#file /var/www/goahead/static/js/app.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/app.js 755 0 0
+#file /var/www/goahead/static/js/BSODScreen.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/BSODScreen.js 755 0 0
+#file /var/www/goahead/static/js/chunk-vendors.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/chunk-vendors.js 755 0 0
+#file /var/www/goahead/static/js/dashbord.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/dashbord.js 755 0 0
+#file /var/www/goahead/static/js/event_logs.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/event_logs.js 755 0 0
+#file /var/www/goahead/static/js/fan.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/fan.js 755 0 0
+#file /var/www/goahead/static/js/index.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/index.js 755 0 0
+#file /var/www/goahead/static/js/login.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/login.js 755 0 0
+#file /var/www/goahead/static/js/sensor_history.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/sensor_history.js 755 0 0
+#file /var/www/goahead/static/js/set_proctrol.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/set_proctrol.js 755 0 0
+#file /var/www/goahead/static/js/system_logs.js ${INSTALL_ROOT}/projects/${SAMPLE}/app/goahead-3.6.5/src/web/static/js/system_logs.js 755 0 0

+ 5 - 4
local/rc

@@ -16,6 +16,7 @@ insmod /usr/bin/gpio.ko
 insmod /usr/bin/platform.ko
 #insmod /usr/bin/adc.ko
 #insmod /usr/bin/spi.ko
+#insmod /usr/bin/gpio_i2c.ko
 
 #################### create node ########################
 #mknod /dev/test_module c 99 0
@@ -30,10 +31,10 @@ mknod /dev/gpio c 103 0
 #mknod /dev/adc3 c 105 2
 #mknod /dev/spi2 c 104 1
 #mknod /dev/spi5 c 104 4
-
+#mknod /dev/gpio_i2c c 106 0
 ################### run app ####################
 #/bin/telnetd
-/usr/bin/bmc_app & 
-sleep 3
+#/usr/bin/bmc_app & 
+#sleep 3
 #/usr/bin/test_app 
-/usr/bin/goahead-3.6.5 -v --home /etc/goahead &
+#/usr/bin/goahead-3.6.5 -v --home /etc/goahead &