Util.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. /*
  52. index = 0,1,2,3,4,5
  53. */
  54. uint8_t mac2hex(const char *strMac, uint8_t index);
  55. /*
  56. index = 0,1,2,3
  57. */
  58. uint8_t ip2dec(const char *strIp, uint8_t index);
  59. int FlushUserInfo(void);
  60. int FlushFRU(void);
  61. int FlushSDR(void);
  62. int FlushIpmiConfig(void);
  63. int FlushSEL(void);
  64. #endif /* UTIL_H */