Jelajahi Sumber

reslove merge

lusa 5 tahun lalu
induk
melakukan
d73e58e1e6

TEMPAT SAMPAH
app/bmc/bmc_app


TEMPAT SAMPAH
app/bmc/bmc_app.gdb


+ 17 - 17
app/bmc/msghndlr/MsgHndlrTask.c

@@ -132,11 +132,11 @@ void *MsgHndlrTask( void *pArg )
 	while(1)
 	{
 		while(GetMsg(gFd_MsgHndlrIfc, &reqMsgPkt, WAIT_INFINITE) != 0);
-		printf("Mrx: ");
-		int i;
-		for(i=0;i<reqMsgPkt.Size;i++)
-			printf("%#x ", reqMsgPkt.Data[i]);
-		printf("\n");
+		// printf("Mrx: ");
+		// int i;
+		// for(i=0;i<reqMsgPkt.Size;i++)
+		// 	printf("%#x ", reqMsgPkt.Data[i]);
+		// printf("\n");
 
 		pthread_setspecific(g_tls.CurChannel,&reqMsgPkt.Channel);
 		pthread_setspecific(g_tls.CurPrivLevel,&reqMsgPkt.Privilege);
@@ -167,11 +167,11 @@ void *MsgHndlrTask( void *pArg )
 			
 			resMsgPkt.SessionID = reqMsgPkt.SessionID;
 		}
-		printf("Mtx: ");
-		for(i=0;i<resMsgPkt.Size;i++)
-			printf("%#x ", resMsgPkt.Data[i]);
-		printf("\n");
-		
+		// printf("Mtx: ");
+		// for(i=0;i<resMsgPkt.Size;i++)
+		// 	printf("%#x ", resMsgPkt.Data[i]);
+		// printf("\n");
+
 		//send response pkt to source queue.
 		PostMsg(resMsgPkt.SrcQ, &resMsgPkt);
 		
@@ -204,15 +204,15 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	/* Normal IPMI Command response */
 	pRes->Param 	= 	PARAM_NORMAL_RESPONSE;
 	
-	if ((SYS_IFC_CHANNEL != pReq->Channel) && (USB_CHANNEL != pReq->Channel) && (pReq->SrcQ != gFdUdsRes))
+	if ((SYS_IFC_CHANNEL != pReq->Channel) && (USB_CHANNEL != pReq->Channel) && (UDS_CHANNEL != pReq->Channel))
 	{
-		printf("log 1, pReq->Channel: %#x\n", pReq->Channel);
+		//printf("log 1, pReq->Channel: %#x\n", pReq->Channel);
 		HdrOffset = sizeof (IPMIMsgHdr_T);
 		pReq->Size  = pReq->Size - HdrOffset - 1;
 	}
-	if(pReq->SrcQ == gFdUdsRes)
+	if(UDS_CHANNEL == pReq->Channel)
 	{
-		printf("log 2, pReq->Channel: %#x\n", pReq->Channel);
+		//printf("log 2, pReq->Channel: %#x\n", pReq->Channel);
 		HdrOffset = sizeof(IPMIUDSMsg_T);
 		pReq->Size = pReq->Size -HdrOffset - 1;
 	}
@@ -264,7 +264,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 		{
 			pRes->Data [HdrOffset] = CC_INV_CMD;
 			pRes->Size	+= 2;
-			printf("log 3\n");
+			//printf("log 3\n");
 			return;
 		}
    }
@@ -294,7 +294,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	//send message command
 	if( (CMD_SEND_MSG == pReq->Cmd) && (NETFN_APP == pReq->NetFnLUN >> 2))
 	{
-		printf("log 4\n");
+		//printf("log 4\n");
 		int Offset = 0;
 		uint8_t SeqNum = g_BMCInfo.SendMsgSeqNum;
 		if ((0 == pRes->Size) &&
@@ -329,7 +329,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 		}
 	}
 
-	printf("log 5\n");
+	//printf("log 5\n");
 	
 	return;
 }

TEMPAT SAMPAH
app/goahead-5.1.0/build/linux-arm-static/bin/goahead


TEMPAT SAMPAH
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test


TEMPAT SAMPAH
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test.gdb


TEMPAT SAMPAH
app/goahead-5.1.0/build/linux-arm-static/bin/goahead.gdb


TEMPAT SAMPAH
app/goahead-5.1.0/build/linux-arm-static/bin/gopass


TEMPAT SAMPAH
app/goahead-5.1.0/build/linux-arm-static/bin/gopass.gdb


TEMPAT SAMPAH
app/goahead-5.1.0/build/linux-arm-static/bin/libgo.a


+ 10 - 16
app/goahead-5.1.0/src/goahead.c

@@ -17,6 +17,10 @@
 /********************************* Includes ***********************************/
 
 #include    "goahead.h"
+#include    "libipmi_struct.h"
+#include    "com_IPMI_App.h"
+#include    "libipmi_IPM.h"
+#include    "com_IPMIDefs.h"
 
 /********************************* Defines ************************************/
 
@@ -90,7 +94,7 @@ MAIN(goahead, int argc, char **argv, char **envp)
    
     char    *argp, *home, *documents, *endpoints, *endpoint, *route, *auth, *tok, *lspec;
     int     argind;
-	logmsg(2, "---> log1111111111111111111111111\n");
+	logmsg(2, "---> log1\n");
 	error("---> log1\n");
 #if WINDOWS
     if (windowsInit() < 0) {
@@ -100,25 +104,14 @@ MAIN(goahead, int argc, char **argv, char **envp)
     route = "route.txt";
     auth = "auth.txt";
 
-    /********************* jimbo test code **************************/
-    Webs wp;
-    IPMI20_SESSION_T TestSession;
-    uint8_t resBuf[100];
-    uint32_t resLen;
 
-    LIBIPMI_CreateSession(&wp.ipmi_session, 10);
+/********************* jimbo test code **************************/
+    Webs wp;
 
     getDeviceInfo(&wp);
-    // LIBIPMI_Send_RAW_IPMI2_0_Command(&wp.ipmi_session,
-    //     0x2e<<2, 0x01,
-    //     NULL, 0,
-    //     resBuf, &resLen,
-    //         10);
-
-    LIBIPMI_CloseSession( &wp.ipmi_session );
-
-/********************* jimbo test end **************************/
+    
 
+/********************* jimbo test end **************************/    
 
 	error("---> main enter, argc = %d\n", argc);
     for (argind = 1; argind < argc; argind++) {
@@ -445,3 +438,4 @@ static void sigHandler(int signo)
     by the terms of either license. Consult the LICENSE.md distributed with
     this software for full details and other copyrights.
  */
+

+ 1 - 1
app/goahead-5.1.0/src/libipmi/src/libipmi_IPM.c

@@ -86,7 +86,7 @@ uint16_t	IPMICMD_GetDeviceGUID( IPMI20_SESSION_T *pSession, GetDevGUIDRes_T *pGe
 uint16_t LIBIPMI_HL_GetDeviceID( IPMI20_SESSION_T *pSession, char *pszDeviceID, int timeout )
 {
 	uint8_t	i;
-	uint16_t	wRet;
+	uint16_t	wRet = LIBIPMI_E_SUCCESS;
 	char	szTemp[10];
 	GetDevIDRes_T	DeviceID;
 

+ 20 - 4
app/goahead-5.1.0/src/route.c

@@ -86,10 +86,26 @@ void personInfoAction(Webs *wp)
 
 /*获取设备信息*/
 void getDeviceInfo(Webs *wp){
-    char DeviceID[16] = {0};
-    LIBIPMI_HL_GetDeviceID(&wp->ipmi_session, DeviceID, DEFAULT_TIMEOUT);
-    printf("DeviceID: %s\n", DeviceID);
-    
+    uint16_t    wRet = LIBIPMI_E_SUCCESS;
+    GetDevIDRes_T   DeviceID;
+    char BuildTime[30] = {0};
+    char FwVersion[10] = {0};
+
+    //Create session
+    LIBIPMI_CreateSession(&wp->ipmi_session, 10);
+
+    sprintf(BuildTime, "%s %s", __DATE__, __TIME__);
+    wRet = IPMICMD_GetDeviceID( &wp->ipmi_session, &DeviceID, DEFAULT_TIMEOUT);
+    if (wRet == LIBIPMI_E_SUCCESS)
+    {
+        sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
+    }
+
+    printf("BuildTime: %s\n", BuildTime);
+    printf("FwVersion: %s\n", FwVersion);
+
+    //Close session
+    LIBIPMI_CloseSession(&wp->ipmi_session );
 }
 
 

+ 3 - 1
app/test_app/Makefile

@@ -2,13 +2,14 @@ EXEC		= test_app
 
 CFLAGS		:= -Os -mcpu=cortex-m3 -mthumb
 LDFLAGS		:= -mcpu=cortex-m3 -mthumb -L$(INSTALL_ROOT)/A2F/root/usr/lib
+#BUILD_TIME 	= $(shell date +"%Y-%m-%d %H:%M:%S")
 
 
 
 CC	= $(CROSS_COMPILE_APPS)gcc
 
 #source
-SRC	= UDSIfc.c
+SRC	= test.c
 
 # hal_api
 SRC += $(wildcard ../hal_api/*.c) 
@@ -39,6 +40,7 @@ CFLAGS	+= -I ../driver/STM32F4xx_HAL_Driver/Inc/Legacy
 OBJS	= $(SRC:%.o=%.c)
 
 $(EXEC): $(OBJS)
+	#echo $(BUILD_TIME)
 	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBS) -lpthread
 	rm -f *.o
 	rm -rf *.gdb

+ 3 - 152
app/test_app/test.c

@@ -1,121 +1,4 @@
 
-
-<<<<<<< HEAD
-// /* include path: ..../A2F/root/usr/include */
-
-// #include <stdio.h>
-// #include <fcntl.h>
-// #include <linux/types.h>
-// //#include <linux/jiffies.h>
-// #include <unistd.h>
-
-// typedef unsigned char uint8_t;
-// typedef unsigned long uint32_t;
-
-// typedef struct {
-// 	uint32_t address;
-// 	uint8_t	 data;
-// } cpld_t;
-
-// typedef struct {
-// 	uint32_t	clockspeed;
-// 	uint32_t	ownAddr;
-// 	uint8_t DevAddr;
-// 	uint8_t buf[100];
-// 	uint8_t Size;	
-// } i2c_arg_t;
-
-
-// #define  GENERATE_CMD(__MAGIC__, __MAJOR__, __CMD__) \
-// 	((0x3<<30) | (__MAJOR__<<16) | (__MAGIC__<<8) | __CMD__)
-
-// #define SET_ADDR GENERATE_CMD('x', 101, 2)
-// #define TRANSFER GENERATE_CMD('x', 101, 4)
-// #define MASTER_RCV GENERATE_CMD('x', 101, 5)
-// #define SLAVE_RCV GENERATE_CMD('x', 101, 6)
-// int main()
-// {
-// /*	//FMC test app
-// 	cpld_t cpld_arg;
-// 	printf("This is test app!\n");
-// 	int fd;
-// 	fd = open("/dev/fmc_cpld", O_RDWR);
-// 	if(fd == NULL)
-// 		printf("Open failed\n");
-
-// 	cpld_arg.address = 0x64000000;
-// 	cpld_arg.data = 0x55;
-// 	ioctl(fd, 0, &cpld_arg);
-// 	cpld_arg.data = 0;
-// 	ioctl(fd, 1, &cpld_arg);
-// 	printf("Read from cpld: %#x\n", cpld_arg.data);
-
-// 	close(fd);
-// */
-	
-// /*	//gpio interrup test app
-// 	int fd;
-// 	uint8_t buf;
-// 	int ret = 0;
-// 	fd = open("/dev/test_module", O_RDWR);
-// 	if(fd == NULL)
-// 		printf("open failed\n");
-// 	while(1)
-// 	{
-// 		ret = read(fd, &buf, 1);
-// 		printf("test app read %#x\n", buf);
-// 	}
-
-// 	close(fd);*/
-
-// 	int fd;
-// 	int i;
-// 	i2c_arg_t i2c_arg;
-// 	fd = open("/dev/i2c1", O_RDWR);
-// 	if(fd == NULL)
-// 		printf("open failed\n");
-
-// 	i2c_arg.ownAddr = 0;
-// 	i2c_arg.DevAddr = 0x92;
-// 	i2c_arg.buf[0] = 1;
-// 	i2c_arg.buf[1] = 2;
-// 	i2c_arg.buf[2] = 3;
-// 	i2c_arg.Size	= 0;
-// 	while(1)
-// 	{
-// 	//	ioctl(fd, 1, &i2c_arg);	//get speed
-// 	//	printf("speed: %d\n", i2c_arg.clockspeed);
-// 	//	sleep(1);
-// 	//	
-// 	//	i2c_arg.clockspeed = 400000;
-// 	//	ioctl(fd, 0, &i2c_arg);	//set speed
-// 	//	sleep(1);
-// 	//	
-// //		ioctl(fd, 3, &i2c_arg);	//get addr
-// //		printf("addr: %#x\n", i2c_arg.ownAddr);
-// //		sleep(1);
-		
-// //		i2c_arg.ownAddr = 0x42;
-// //		ioctl(fd, SET_ADDR, &i2c_arg);	//set addr
-// //		sleep(1);
-
-// //		ioctl(fd, MASTER_RCV, &i2c_arg);
-// //		printf("Read: %#x, %#x\n", i2c_arg.buf[0], i2c_arg.buf[1]);
-// 		//	sleep(1);
-		
-// 		ioctl(fd, SLAVE_RCV, &i2c_arg);
-// 		printf("\ni2c1 rec: ");
-// 		for(i=0;i<i2c_arg.Size;i++)
-// 			printf("%#x ", i2c_arg.buf[i]);
-// 		printf("\n");
-
-// 	}
-	
-// 	close(fd);
-	
-=======
-/* include path: ..../A2F/root/usr/include */
-
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
@@ -128,40 +11,8 @@
 
 int main()
 {
+	printf("test_app\n");
+	printf("Build time: %s %s\n", __DATE__, __TIME__);
 
-	int fd;
-	uint8_t buf[7] = {0x40, 0xb8, 0x08, 0x20, 0x0, 0x1,0xdf};
-
-	fd = open("/dev/i2c1", O_RDWR);
-	if(fd < 0)
-		printf("error1!\n");
-
-	while(1)
-	{
-		stm32_i2c_master_write(fd, buf[0], &buf[1], 6);
-		sleep(5);
-	}
-
-	close(fd);
-
-
-
-
-	// int i;
-	// uint8_t id[500] = {0};
-	// for(i=0;i<500;i++)
-	// 	id[i] = i;
->>>>>>> master
-	
-	// sf_sector_erase(2, 0x1000);
-	// sf_write(2, 0x1000, id, 500);
-	// sf_read(2, 0x1000, id, 1000);
 
-	// for(i=0;i<500;i++)
-	// 	id[i] = 1;
-	// sf_sector_erase(2, 0x1000);
-	// sf_write(2, 0x1000, id, 500);
-	// sf_read(2, 0x1000, id, 1000);
-	
-// 	return 0;
-// }
+}

TEMPAT SAMPAH
app/test_app/test_app


TEMPAT SAMPAH
gd32450i-eval.uImage