Util.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. * util.h
  17. * Utility functions.
  18. *
  19. * Author: Govind Kothandapani <govindk@ami.com>
  20. *
  21. *****************************************************************/
  22. #ifndef UTIL_H
  23. #define UTIL_H
  24. #include "com_IPMIDefs.h"
  25. #include <stdio.h>
  26. /**
  27. * Returns the maximum of two values
  28. **/
  29. #define UTIL_MAX(val1, val2) \
  30. ((val1 > val2) ? val1 : val2)
  31. /**
  32. * Returns the minimum of two values
  33. **/
  34. #define UTIL_MIN(val1, val2) \
  35. ((val1 < val2) ? val1 : val2)
  36. /**
  37. * @brief Extracts the contents of the bits corresponding to the mask.
  38. **/
  39. uint8_t GetBits (uint8_t Val, uint8_t Mask);
  40. /**
  41. * @brief Sets the bits corresponding to the mask according to the value.
  42. **/
  43. uint8_t SetBits (uint8_t Mask, uint8_t Val);
  44. /**
  45. * @brief Find the checksum
  46. **/
  47. uint8_t CalculateCheckSum (uint8_t* Data, uint16_t Len);
  48. // *
  49. // *@ brief Retrieves the value from sysctl
  50. // int GetJiffySysCtlvalue (const char *TagName, long long *SysVal);
  51. int FlushUserInfo(void);
  52. int FlushFRU(void);
  53. int FlushSDR(void);
  54. int FlushIpmiConfig(void);
  55. int FlushSEL(void);
  56. #endif /* UTIL_H */