SensorAPI.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*****************************************************************
  2. *****************************************************************
  3. *** **
  4. *** (C)Copyright 2005-2006, American Megatrends Inc. **
  5. *** **
  6. *** All Rights Reserved. **
  7. *** **
  8. *** 6145-F, Northbelt Parkway, Norcross, **
  9. *** **
  10. *** Georgia - 30071, USA. Phone-(770)-246-8600. **
  11. *** **
  12. *****************************************************************
  13. *****************************************************************
  14. ******************************************************************
  15. *
  16. * SensorAPI.h
  17. * Sensor Access API.
  18. *
  19. * Author: Vinoth kumar <vinothkumars@ami.com>
  20. *
  21. ******************************************************************/
  22. #ifndef SENSORAPI_H
  23. #define SENSORAPI_H
  24. #include "Types.h"
  25. //#include "SensorMonitor.h"
  26. #include "IPMI_Sensor.h"
  27. /*-----------------------------------------------------------------
  28. * @fn API_ReInitSensor
  29. * @brief Reinitialize sensor.
  30. * @param u8SensorNum - Sensor number.
  31. * @return 0 if Success
  32. * -1 if reinit failed.
  33. *-----------------------------------------------------------------*/
  34. extern int API_ReInitSensor (INT8U u8SensorNum,int BMCInst);
  35. /*-----------------------------------------------------------------
  36. * @fn API_SetScanningInterval
  37. * @brief Set the scanning interval for a sensor.
  38. * @param u8SensorNum - Sensor number.
  39. * @param ScanningInt - Scanning interval.
  40. * @return 0 if Success
  41. * -1 if set failed.
  42. *-----------------------------------------------------------------*/
  43. extern int API_SetSensorScanning (INT8U u8SensorNum, INT8U EnableFlag,int BMCInst);
  44. /*-----------------------------------------------------------------
  45. * @fn API_SetScanningInterval
  46. * @brief Set the internal scanning enable/disable for a sensor.
  47. * @param u8SensorNum - Sensor number.
  48. * @param Enable / Disable flag.
  49. * @return 0 if Success
  50. * -1 if set failed.
  51. *-----------------------------------------------------------------*/
  52. extern int API_SetSensorInternalScanning (INT8U u8SensorNum, INT8U EnableFlag,int BMCInst);
  53. /*-----------------------------------------------------------------
  54. * @fn API_SetSensorState
  55. * @brief Sets the following sensor state.
  56. * @param u8SensorNum - Sensor number.
  57. * @param State - Sensor states with the following bit descriptions.
  58. Bit 0 - Initialization Done
  59. Bit 1 - Update in Progress
  60. Bit 2 - reserved
  61. Bit 3 - reserved
  62. Bit 4 - reserved
  63. Bit 5 - Unable to read
  64. Bit 6 - Sensor Scanning disabled
  65. Bit 7 - Event Message Disabled
  66. * @return 0 if Success
  67. * -1 if set failed.
  68. *-----------------------------------------------------------------*/
  69. extern int API_SetSensorState (INT8U u8SensorNum, INT8U State,int BMCInst);
  70. /*-----------------------------------------------------------------
  71. * @fn API_GetSensorInfo
  72. * @brief Provides all the sensor information.
  73. * @param u8SensorNum - Sensor number.
  74. * @return pSensorInfo - Sensor Information.
  75. * 0 if Success
  76. * -1 if set failed.
  77. *-----------------------------------------------------------------*/
  78. extern SensorInfo_T* API_GetSensorInfo (INT8U SensorNum, INT8U OwnerLUN, int BMCInst);
  79. /*-----------------------------------------------------------------
  80. * @fn API_GlobalSensorScanningEnable
  81. * @brief Controls the the sensor scanning.
  82. * @param bEnable - TRUE to enable and FALSE to disable.
  83. * @return 0 if success
  84. * -1 if failed.
  85. *-----------------------------------------------------------------*/
  86. extern int API_GlobalSensorScanningEnable (BOOL bEnable,int BMCInst);
  87. /*-----------------------------------------------------------------
  88. * @fn API_GlobalSensorScanningEnable
  89. * @brief Returns the status of the sensor scanning.
  90. * @param
  91. * @return bool - TRUE : Enabled FALSE : disabled
  92. *
  93. *-----------------------------------------------------------------*/
  94. extern int API_GetGlobalSensorScanningEnable (int BMCInst);
  95. /*-----------------------------------------------------------------
  96. * @fn API_RegSensorCB
  97. * @brief Registers the callback function for sensor.
  98. * @param pCB - callback function
  99. * @param Hooktype - this can be PRE_MONITOR or POST_MONITOR.
  100. * @return 0 if success
  101. * -1 if failed.
  102. *-----------------------------------------------------------------*/
  103. extern int API_RegSensorCB (INT8U SensorNum, void *pCB, HookType_e HookType,int BMCInst);
  104. void API_SensorAverage(INT8U SensorNum, INT8U OwnerLUN, INT16U* SensorReading, int BMCInst);
  105. #define N0_OF_READINGS_TO_BE_AVERAGED 4
  106. typedef struct
  107. {
  108. INT16U Cnt;
  109. INT16U Reading;
  110. INT16U Average;
  111. } Average_T;
  112. extern int API_ReArmSensor (ReArmSensorRes_T* pReArmSensorRes, int BMCInst);
  113. /*------------------------------------------------------------------
  114. * @fn API_InitPowerOnTick
  115. * @brief Initialize the power on tick counter
  116. * should be invoked when ever power on occurs.
  117. *------------------------------------------------------------------*/
  118. extern void API_InitPowerOnTick (int BMCInst);
  119. /*------------------------------------------------------------------
  120. * @fn API_InitSysResetTick
  121. * @brief Initialize the System Reset tick counter
  122. * should be invoked when ever power reset occurs.
  123. *------------------------------------------------------------------*/
  124. extern void API_InitSysResetTick (int BMCInst);
  125. /*-----------------------------------------------------------------
  126. * @fn API_SetSensorReadingOffset
  127. * @brief Set the sensor Reading Offset
  128. * @param - SensorLUN - Owner's LUN INT8U SensorNo - Sensor Number
  129. * Offset - Sendor Reading Offset
  130. * @return bool - -1 failed to set the Offset 0 - Reading is set
  131. *
  132. *-----------------------------------------------------------------*/
  133. extern int API_SetSensorReadingOffset ( INT8U SensorLUN , INT8U SensorNo , INT8S Offset, int BMCInst );
  134. /*-----------------------------------------------------------------
  135. * @fn API_GetSensorReadingOffset
  136. * @brief Get the sensor Reading Offset
  137. * @param - SensorLUN - Owner's LUN INT8U SensorNo - Sensor Number
  138. * Offset - Sendor Reading Offset
  139. * @return bool - -1 No match for the SensorNum and Lun is present
  140. *
  141. *-----------------------------------------------------------------*/
  142. extern int API_GetSensorReadingOffset ( INT8U SensorLUN , INT8U SensorNo , INT8S * pOffset ,int BMCInst);
  143. #endif //SENSORAPI_H