HALcomdef.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef HAL_COMDEF_H
  17. #define HAL_COMDEF_H
  18. /*
  19. ==============================================================================
  20. FILE: HALcomdef.h
  21. DESCRIPTION:
  22. ==============================================================================
  23. Edit History
  24. $Header: //depot/prj/qca/lithium3/wcss/maple_verif/native/register/include/HALcomdef.h#1 $
  25. when who what, where, why
  26. -------- --- -----------------------------------------------------------
  27. 06/17/10 sc Included com_dtypes.h and cleaned up typedefs
  28. 05/15/08 gfr Added HAL_ENUM_32BITS macro.
  29. 02/14/08 gfr Added bool32 type.
  30. 11/13/07 gfr Removed dependency on comdef.h
  31. 01/08/07 hxw Created
  32. ==============================================================================
  33. */
  34. /*
  35. * Assembly wrapper
  36. */
  37. #ifndef _ARM_ASM_
  38. /*
  39. * C++ wrapper
  40. */
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. #include "com_dtypes.h"
  45. /* -----------------------------------------------------------------------
  46. ** Types
  47. ** ----------------------------------------------------------------------- */
  48. /*
  49. * Standard integer types.
  50. *
  51. * bool32 - boolean, 32 bit (TRUE or FALSE)
  52. */
  53. #ifndef _BOOL32_DEFINED
  54. typedef unsigned long int bool32;
  55. #define _BOOL32_DEFINED
  56. #endif
  57. /*
  58. * Macro to allow forcing an enum to 32 bits. The argument should be
  59. * an identifier in the namespace of the enumeration in question, i.e.
  60. * for the clk HAL we might use HAL_ENUM_32BITS(CLK_xxx).
  61. */
  62. #define HAL_ENUM_32BITS(x) HAL_##x##_FORCE32BITS = 0x7FFFFFFF
  63. /*===========================================================================
  64. FUNCTION inp, outp, inpw, outpw, inpdw, outpdw
  65. DESCRIPTION
  66. IN/OUT port macros for byte and word ports, typically inlined by compilers
  67. which support these routines
  68. PARAMETERS
  69. inp( xx_addr )
  70. inpw( xx_addr )
  71. inpdw( xx_addr )
  72. outp( xx_addr, xx_byte_val )
  73. outpw( xx_addr, xx_word_val )
  74. outpdw( xx_addr, xx_dword_val )
  75. xx_addr - Address of port to read or write (may be memory mapped)
  76. xx_byte_val - 8 bit value to write
  77. xx_word_val - 16 bit value to write
  78. xx_dword_val - 32 bit value to write
  79. DEPENDENCIES
  80. None
  81. RETURN VALUE
  82. inp/inpw/inpdw: the byte, word or dword read from the given address
  83. outp/outpw/outpdw: the byte, word or dword written to the given address
  84. SIDE EFFECTS
  85. None.
  86. ===========================================================================*/
  87. /* ARM based targets use memory mapped i/o, so the inp/outp calls are
  88. ** macroized to access memory directly
  89. */
  90. #if defined(VV_FEATURE_COMPILING_64BIT)
  91. #define inp(port) (*((volatile dword *) (port)))
  92. #define inpw(port) (*((volatile word *) (port)))
  93. #define inpdw(port) (*((volatile dword *)(port)))
  94. #define outp(port, val) (*((volatile dword *) (port)) = ((dword) (val)))
  95. #define outpw(port, val) (*((volatile word *) (port)) = ((word) (val)))
  96. #define outpdw(port, val) (*((volatile dword *) (port)) = ((dword) (val)))
  97. #endif
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #endif /* !_ARM_ASM_ */
  102. #endif /* HAL_COMDEF_H */