123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- /*
- * bmc_app application main code.
- */
- #include <stdio.h>
- #include <stdint.h>
- #include <sys/prctl.h>
- #include <semaphore.h>
- #include <pthread.h>
- #include "com_BmcType.h"
- #include "com_IPMIDefs.h"
- #include "com_Message.h"
- #include "BmcType.h"
- #include "main.h"
- #include "Session.h"
- #include "LANIfc.h"
- #include "UDSIfc.h"
- #include "IPMBIfc.h"
- #include "MsgHndlrTask.h"
- #include "ChassisTimerTask.h"
- #include "TimerTask.h"
- /* gloabl varible */
- BMCInfo_t g_BMCInfo;
- pthread_t gThreadIDs[256];
- uint8_t gThreadIndex = 0;
- void main(void)
- {
- PlatformInit();
- Init_IPMI_FRU_SDR_SEL();
- InitSdrConfig();
- InitSelConfig();
- printf("\tChassisID %#02x, SlotID %#02x\r\n", g_BMCInfo.chassisID, g_BMCInfo.SlotID);
- if(g_BMCInfo.IpmiConfig.PrimaryIPMBSupport)
- {
- printf("\tPrimaryIPMBBus: %d, channel %d, Addr %#02x\n", g_BMCInfo.IpmiConfig.PrimaryIPMBBus,
- PRIMARY_IPMB_CHANNEL, g_BMCInfo.IpmiConfig.PrimaryIPMBAddr);
- }
- if(g_BMCInfo.IpmiConfig.SecondaryIPMBSupport)
- {
- printf("\tSecondaryIPMBBus %d, Channel %d, Addr %#02x\n", g_BMCInfo.IpmiConfig.SecondaryIPMBBus,
- SECONDARY_IPMB_CHANNEL, g_BMCInfo.IpmiConfig.SecondaryIPMBAddr);
- }
- /* Create TimerTask */
- gThreadIndex = 0;
- if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,TimerTask,NULL))
- {
- printf("%s: Create TimerTask thread failed!\n", __FUNCTION__);
- }
- /* Create MsgHndlr Task */
- gThreadIndex++;
- if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,MsgHndlrTask,NULL))
- {
- printf("%s: Create MsgHndlrTask thread failed!\n", __FUNCTION__);
- }
- /* Create ChassisTimerTask */
- gThreadIndex++;
- if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,ChassisTimerTask,NULL))
- {
- printf("%s: Create ChassisTimerTask thread failed!\n", __FUNCTION__);
- }
- /* Create SensorMonitorTask */
- gThreadIndex++;
- if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,SensorMonitorTask,NULL))
- {
- printf("%s: Create SensorMonitorTask thread failed!\n", __FUNCTION__);
- }
- /* Create UDS interface */
- gThreadIndex++;
- if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,UDSIfcTask,NULL))
- {
- printf("%s: Create UDSIfcTask thread failed!\n", __FUNCTION__);
- }
- /* Create LAN interface */
- gThreadIndex++;
- if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,LANIfcTask,NULL))
- {
- printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
- }
- /* Create IPMB interface */
- uint8_t primaryIpmbSelect = 0; //primary
- gThreadIndex++;
- if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,IPMBIfcTask,&primaryIpmbSelect))
- {
- printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
- }
- uint8_t secondaryIpmbSelect = 1; //secondary
- gThreadIndex++;
- if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,IPMBIfcTask,&secondaryIpmbSelect))
- {
- printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
- }
- /* Create Update FPGA thread */
- /* Create UDS interface */
- /* Create UDS interface */
- /* Create UDS interface */
- UpdateUserInfoTable();
- while(1)
- {
- sleep(100);
- //printf("Hello...\n");
- }
- }
|