main.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. /* Create TimerTask */
  32. gThreadIndex = 0;
  33. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,TimerTask,NULL))
  34. {
  35. printf("%s: Create TimerTask thread failed!\n", __FUNCTION__);
  36. }
  37. /* Create MsgHndlr Task */
  38. gThreadIndex++;
  39. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,MsgHndlrTask,NULL))
  40. {
  41. printf("%s: Create MsgHndlrTask thread failed!\n", __FUNCTION__);
  42. }
  43. /* Create ChassisTimerTask */
  44. gThreadIndex++;
  45. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,ChassisTimerTask,NULL))
  46. {
  47. printf("%s: Create ChassisTimerTask thread failed!\n", __FUNCTION__);
  48. }
  49. /* Create SensorMonitorTask */
  50. gThreadIndex++;
  51. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,SensorMonitorTask,NULL))
  52. {
  53. printf("%s: Create SensorMonitorTask thread failed!\n", __FUNCTION__);
  54. }
  55. /* Create UDS interface */
  56. gThreadIndex++;
  57. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,UDSIfcTask,NULL))
  58. {
  59. printf("%s: Create UDSIfcTask thread failed!\n", __FUNCTION__);
  60. }
  61. /* Create LAN interface */
  62. gThreadIndex++;
  63. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,LANIfcTask,NULL))
  64. {
  65. printf("%s: Create LANIfcTask thread failed!\n", __FUNCTION__);
  66. }
  67. /* Create IPMB interface */
  68. /* Create Update FPGA thread */
  69. /* Create ChassisTimer */
  70. gThreadIndex++;
  71. if(0 != pthread_create(&gThreadIDs[gThreadIndex],NULL,ChassisTimerTask,NULL))
  72. {
  73. printf("%s: Create ChassisTimerTask thread failed!\n", __FUNCTION__);
  74. }
  75. /* Create UDS interface */
  76. /* Create UDS interface */
  77. /* Create UDS interface */
  78. UpdateUserInfoTable();
  79. while(1)
  80. {
  81. sleep(100);
  82. //printf("Hello...\n");
  83. }
  84. }