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/spruce_verif/native/register/include/HALcomdef.h#2 $ 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 * Assembly wrapper 44 */ 45 #ifndef _ARM_ASM_ 46 47 /* 48 * C++ wrapper 49 */ 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 #include "com_dtypes.h" 55 56 /* ----------------------------------------------------------------------- 57 ** Types 58 ** ----------------------------------------------------------------------- */ 59 60 /* 61 * Standard integer types. 62 * 63 * bool32 - boolean, 32 bit (TRUE or FALSE) 64 */ 65 #ifndef _BOOL32_DEFINED 66 typedef unsigned long int bool32; 67 #define _BOOL32_DEFINED 68 #endif 69 70 /* 71 * Macro to allow forcing an enum to 32 bits. The argument should be 72 * an identifier in the namespace of the enumeration in question, i.e. 73 * for the clk HAL we might use HAL_ENUM_32BITS(CLK_xxx). 74 */ 75 #define HAL_ENUM_32BITS(x) HAL_##x##_FORCE32BITS = 0x7FFFFFFF 76 77 /*=========================================================================== 78 79 FUNCTION inp, outp, inpw, outpw, inpdw, outpdw 80 81 DESCRIPTION 82 IN/OUT port macros for byte and word ports, typically inlined by compilers 83 which support these routines 84 85 PARAMETERS 86 inp( xx_addr ) 87 inpw( xx_addr ) 88 inpdw( xx_addr ) 89 outp( xx_addr, xx_byte_val ) 90 outpw( xx_addr, xx_word_val ) 91 outpdw( xx_addr, xx_dword_val ) 92 xx_addr - Address of port to read or write (may be memory mapped) 93 xx_byte_val - 8 bit value to write 94 xx_word_val - 16 bit value to write 95 xx_dword_val - 32 bit value to write 96 97 DEPENDENCIES 98 None 99 100 RETURN VALUE 101 inp/inpw/inpdw: the byte, word or dword read from the given address 102 outp/outpw/outpdw: the byte, word or dword written to the given address 103 104 SIDE EFFECTS 105 None. 106 107 ===========================================================================*/ 108 109 /* ARM based targets use memory mapped i/o, so the inp/outp calls are 110 ** macroized to access memory directly 111 */ 112 113 #if defined(VV_FEATURE_COMPILING_64BIT) 114 #define inp(port) (*((volatile dword *) (port))) 115 #define inpw(port) (*((volatile word *) (port))) 116 #define inpdw(port) (*((volatile dword *)(port))) 117 118 #define outp(port, val) (*((volatile dword *) (port)) = ((dword) (val))) 119 #define outpw(port, val) (*((volatile word *) (port)) = ((word) (val))) 120 #define outpdw(port, val) (*((volatile dword *) (port)) = ((dword) (val))) 121 #endif 122 123 #ifdef __cplusplus 124 } 125 #endif 126 127 #endif /* !_ARM_ASM_ */ 128 129 #endif /* HAL_COMDEF_H */ 130 131