Util.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 "Types.h"
  25. #include "Platform.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. extern INT8U GetBits (INT8U Val, INT8U Mask);
  40. /**
  41. * @brief Sets the bits corresponding to the mask according to the value.
  42. **/
  43. extern INT8U SetBits (INT8U Mask, INT8U Val);
  44. /**
  45. * @brief Find the checksum
  46. **/
  47. extern INT8U CalculateCheckSum (INT8U* Data, INT16U Len);
  48. /**
  49. *@ brief Retrieves the value from sysctl
  50. */
  51. int GetJiffySysCtlvalue (const char *TagName, long long *SysVal);
  52. #endif /* UTIL_H */