main.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * bmc_app application main code.
  3. */
  4. #include <stdio.h>
  5. #include <stdint.h>
  6. #include <sys/prctl.h>
  7. #include <semaphore.h>
  8. #include <pthread.h>
  9. #include "com_BmcType.h"
  10. #include "com_IPMIDefs.h"
  11. #include "com_Message.h"
  12. #include "BmcType.h"
  13. #include "main.h"
  14. #include "Session.h"
  15. #include "LANIfc.h"
  16. #include "UDSIfc.h"
  17. #include "IPMBIfc.h"
  18. #include "MsgHndlrTask.h"
  19. #include "ChassisTimerTask.h"
  20. #include "TimerTask.h"
  21. /* gloabl varible */
  22. BMCInfo_t g_BMCInfo;
  23. pthread_t gThreadIDs[256];
  24. uint8_t gThreadIndex = 0;
  25. void main(void)
  26. {
  27. PlatformInit();
  28. Init_IPMI_FRU_SDR_SEL();
  29. InitSdrConfig();
  30. InitSelConfig();
  31. Init_SessionTbl();
  32. InitTimerTaskTbl();
  33. Init_UserInfoTbl();
  34. printf("\tChassisID %#02x, SlotID %#02x\r\n", g_BMCInfo.ChassisID, g_BMCInfo.SlotID);
  35. if(g_BMCInfo.IpmiConfig.PrimaryIPMBSupport)
  36. {
  37. printf("\tPrimaryIPMBBus: %d, channel %d, Addr %#02x\n", g_BMCInfo.IpmiConfig.PrimaryIPMBBus,
  38. PRIMARY_IPMB_CHANNEL, g_BMCInfo.IpmiConfig.PrimaryIPMBAddr);
  39. }
  40. if(g_BMCInfo.IpmiConfig.SecondaryIPMBSupport)
  41. {
  42. printf("\tSecondaryIPMBBus %d, Channel %d, Addr %#02x\n", g_BMCInfo.IpmiConfig.SecondaryIPMBBus,
  43. SECONDARY_IPMB_CHANNEL, g_BMCInfo.IpmiConfig.SecondaryIPMBAddr);
  44. }
  45. /* Create TimerTask */
  46. gThreadIndex = 0;
  47. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,TimerTask,NULL))
  48. {
  49. printf("%s: Create TimerTask thread failed!\n", __FUNCTION__);
  50. }
  51. /* Create MsgHndlr Task */
  52. gThreadIndex++;
  53. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,MsgHndlrTask,NULL))
  54. {
  55. printf("%s: Create MsgHndlrTask thread failed!\n", __FUNCTION__);
  56. }
  57. /* Create ChassisTimerTask */
  58. gThreadIndex++;
  59. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,ChassisTimerTask,NULL))
  60. {
  61. printf("%s: Create ChassisTimerTask thread failed!\n", __FUNCTION__);
  62. }
  63. /* Create SensorMonitorTask */
  64. gThreadIndex++;
  65. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,SensorMonitorTask,NULL))
  66. {
  67. printf("%s: Create SensorMonitorTask thread failed!\n", __FUNCTION__);
  68. }
  69. /* Create UDS interface */
  70. gThreadIndex++;
  71. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,UDSIfcTask,NULL))
  72. {
  73. printf("%s: Create UDSIfcTask thread failed!\n", __FUNCTION__);
  74. }
  75. /* Create LAN interface */
  76. gThreadIndex++;
  77. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,LANIfcTask,NULL))
  78. {
  79. printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
  80. }
  81. // /* Create IPMB interface */
  82. // uint8_t primaryIpmbSelect = 0; //primary
  83. // gThreadIndex++;
  84. // if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,IPMBIfcTask,&primaryIpmbSelect))
  85. // {
  86. // printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
  87. // }
  88. // uint8_t secondaryIpmbSelect = 1; //secondary
  89. // gThreadIndex++;
  90. // if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,IPMBIfcTask,&secondaryIpmbSelect))
  91. // {
  92. // printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
  93. // }
  94. /* Create Update FPGA thread */
  95. /* Create UDS interface */
  96. /* Create UDS interface */
  97. /* Create UDS interface */
  98. while(1)
  99. {
  100. sleep(100);
  101. //printf("Hello...\n");
  102. }
  103. }