4 * Defines XIo functions for Xilinx OCP in terms of Linux primitives
6 * Author: MontaVista Software, Inc.
9 * 2002 (c) MontaVista, Software, Inc. This file is licensed under the terms
10 * of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
17 #include "xbasic_types.h"
20 typedef u32 XIo_Address;
23 XIo_In8(XIo_Address InAddress)
25 return (u8) in_8((volatile unsigned char *) InAddress);
28 XIo_In16(XIo_Address InAddress)
30 return (u16) in_be16((volatile unsigned short *) InAddress);
33 XIo_In32(XIo_Address InAddress)
35 return (u32) in_be32((volatile unsigned *) InAddress);
38 XIo_Out8(XIo_Address OutAddress, u8 Value)
40 out_8((volatile unsigned char *) OutAddress, Value);
43 XIo_Out16(XIo_Address OutAddress, u16 Value)
45 out_be16((volatile unsigned short *) OutAddress, Value);
48 XIo_Out32(XIo_Address OutAddress, u32 Value)
50 out_be32((volatile unsigned *) OutAddress, Value);
53 #define XIo_ToLittleEndian16(s,d) (*(u16*)(d) = cpu_to_le16((u16)(s)))
54 #define XIo_ToLittleEndian32(s,d) (*(u32*)(d) = cpu_to_le32((u32)(s)))
55 #define XIo_ToBigEndian16(s,d) (*(u16*)(d) = cpu_to_be16((u16)(s)))
56 #define XIo_ToBigEndian32(s,d) (*(u32*)(d) = cpu_to_be32((u32)(s)))
58 #define XIo_FromLittleEndian16(s,d) (*(u16*)(d) = le16_to_cpu((u16)(s)))
59 #define XIo_FromLittleEndian32(s,d) (*(u32*)(d) = le32_to_cpu((u32)(s)))
60 #define XIo_FromBigEndian16(s,d) (*(u16*)(d) = be16_to_cpu((u16)(s)))
61 #define XIo_FromBigEndian32(s,d) (*(u32*)(d) = be32_to_cpu((u32)(s)))