xref: /wlan-driver/fw-api/hw/qca5018/HALcomdef.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
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 
17 #ifndef HAL_COMDEF_H
18 #define HAL_COMDEF_H
19 /*
20 ==============================================================================
21 
22 FILE:         HALcomdef.h
23 
24 DESCRIPTION:
25 
26 ==============================================================================
27 
28                              Edit History
29 
30 $Header: //depot/prj/qca/lithium3/wcss/maple_verif/native/register/include/HALcomdef.h#1 $
31 
32 when       who     what, where, why
33 --------   ---     -----------------------------------------------------------
34 06/17/10   sc      Included com_dtypes.h and cleaned up typedefs
35 05/15/08   gfr     Added HAL_ENUM_32BITS macro.
36 02/14/08   gfr     Added bool32 type.
37 11/13/07   gfr     Removed dependency on comdef.h
38 01/08/07   hxw     Created
39 
40 ==============================================================================
41 */
42 
43 
44 /*
45  * Assembly wrapper
46  */
47 #ifndef _ARM_ASM_
48 
49 /*
50  * C++ wrapper
51  */
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 #include "com_dtypes.h"
57 
58 /* -----------------------------------------------------------------------
59 ** Types
60 ** ----------------------------------------------------------------------- */
61 
62 /*
63  * Standard integer types.
64  *
65  * bool32  - boolean, 32 bit (TRUE or FALSE)
66  */
67 #ifndef _BOOL32_DEFINED
68 typedef  unsigned long int  bool32;
69 #define _BOOL32_DEFINED
70 #endif
71 
72 /*
73  * Macro to allow forcing an enum to 32 bits.  The argument should be
74  * an identifier in the namespace of the enumeration in question, i.e.
75  * for the clk HAL we might use HAL_ENUM_32BITS(CLK_xxx).
76  */
77 #define HAL_ENUM_32BITS(x) HAL_##x##_FORCE32BITS = 0x7FFFFFFF
78 
79 /*===========================================================================
80 
81 FUNCTION inp, outp, inpw, outpw, inpdw, outpdw
82 
83 DESCRIPTION
84   IN/OUT port macros for byte and word ports, typically inlined by compilers
85   which support these routines
86 
87 PARAMETERS
88   inp(   xx_addr )
89   inpw(  xx_addr )
90   inpdw( xx_addr )
91   outp(   xx_addr, xx_byte_val  )
92   outpw(  xx_addr, xx_word_val  )
93   outpdw( xx_addr, xx_dword_val )
94       xx_addr      - Address of port to read or write (may be memory mapped)
95       xx_byte_val  - 8 bit value to write
96       xx_word_val  - 16 bit value to write
97       xx_dword_val - 32 bit value to write
98 
99 DEPENDENCIES
100   None
101 
102 RETURN VALUE
103   inp/inpw/inpdw: the byte, word or dword read from the given address
104   outp/outpw/outpdw: the byte, word or dword written to the given address
105 
106 SIDE EFFECTS
107   None.
108 
109 ===========================================================================*/
110 
111   /* ARM based targets use memory mapped i/o, so the inp/outp calls are
112   ** macroized to access memory directly
113   */
114 
115 #if defined(VV_FEATURE_COMPILING_64BIT)
116   #define inp(port)         (*((volatile dword *) (port)))
117   #define inpw(port)        (*((volatile word *) (port)))
118   #define inpdw(port)       (*((volatile dword *)(port)))
119 
120   #define outp(port, val)   (*((volatile dword *) (port)) = ((dword) (val)))
121   #define outpw(port, val)  (*((volatile word *) (port)) = ((word) (val)))
122   #define outpdw(port, val) (*((volatile dword *) (port)) = ((dword) (val)))
123 #endif
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif /* !_ARM_ASM_ */
129 
130 #endif /* HAL_COMDEF_H */
131 
132