scsi_to_host.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*****************************************************************
  2. *****************************************************************
  3. *** **
  4. *** (C)Copyright 2002-2003, 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. * $Header: $
  16. *
  17. * $Revision: $
  18. *
  19. * $Date: $
  20. *
  21. ******************************************************************
  22. ******************************************************************
  23. *
  24. * scsi_to_host.h
  25. *
  26. * Author: Rama Rao Bisa <RamaB@ami.com>
  27. ******************************************************************/
  28. #ifndef SCSI_TO_HOST_H
  29. #define SCSI_TO_HOST_H
  30. #include "Types.h"
  31. /**
  32. * @def htoipmi_u32
  33. * @brief Converts unsigned 32 bit data from Host format to scsi format.
  34. * @param Val 32bit value to be converted.
  35. **/
  36. #define htoscsi_u32(Val) ((INT32U)(((Val & 0xff) << 24) + \
  37. ((Val & 0xff00) << 8) + \
  38. ((Val & 0xff0000) >> 8) + \
  39. ((Val & 0xff000000) >> 24)))
  40. /**
  41. * @def ipmitoh_u32
  42. * @brief Converts unsigned 32 bit data from scsi format to Host format.
  43. * @param Val 32bit value to be converted.
  44. **/
  45. #define scsitoh_u32(Val) ((INT32U)(((Val & 0xff) << 24) + \
  46. ((Val & 0xff00) << 8) + \
  47. ((Val & 0xff0000) >> 8) + \
  48. ((Val & 0xff000000) >> 24)))
  49. /**
  50. * @def htoipmi_u16
  51. * @brief Converts unsigned 16 bit data from Host format to scsi format.
  52. * @param Val 16bit value to be converted.
  53. **/
  54. #define htoscsi_u16(Val) ((INT16U)(((Val & 0xff) << 8) + (Val >> 8)))
  55. /**
  56. * @def htoipmi_u16
  57. * @brief Converts unsigned 16 bit data from scsi format to Host format.
  58. * @param Val 16bit value to be converted.
  59. **/
  60. #define scsitoh_u16(Val) ((INT16U)(((Val & 0xff) << 8) + (Val >> 8)))
  61. #endif /* SCSI_TO_HOST_H */