📄 io.h
字号:
/* * linux/include/asm-armnommu/arch-samsung/SMDK2510/io.h * * Copyright (C) 1997-1999 Russell King * * Modifications: * 06-12-1997 RMK Created. * 07-04-1999 RMK Major cleanup * 02-19-2001 gjm Leveraged for armnommu/dsc21 * 09-15-2002 Roh you-chang adding code for supporting SMDK2510 */#ifndef __ASM_ARM_ARCH_IO_H#define __ASM_ARM_ARCH_IO_H/* * kernel/resource.c uses this to initialize the global ioport_resource struct * which is used in all calls to request_resource(), allocate_resource(), etc. * --gmcnutt */#define IO_SPACE_LIMIT 0xffffffff/* * If we define __io then asm/io.h will take care of most of the inb & friends * macros. It still leaves us some 16bit macros to deal with ourselves, though. * We don't have PCI or ISA on the dsc21 so I dropped __mem_pci & __mem_isa. * --gmcnutt */#define PCIO_BASE 0#define __io(a) (PCIO_BASE + (a))#define __mem_pci(a) ((unsigned long)(a)) //ryc++#ifdef CONFIG_PCI#include <asm/arch/pci.h>/* * ryc redefined for PCI memory/io IO * */#define _MapIOAddress(a) ((u32)PCIIO_ADDR+ (u32)(a & 0x03ffffff))#define _MapMemAddress(a) ((u32)PCIMEM_ADDR+ (u32)(a & 0x0fffffff))/* pci I/O space access macros */static inline u8 PCIIORead8(unsigned long offset){ rPCIBATAPI = offset&0xfc000000; return *(volatile u8 *)(_MapIOAddress(offset));}static inline u16 PCIIORead16(unsigned long offset){ rPCIBATAPI = offset&0xfc000000; return *(volatile u16 *)(_MapIOAddress(offset));}static inline u32 PCIIORead32(unsigned long offset){ rPCIBATAPI = offset&0xfc000000; return *(volatile u32 *)(_MapIOAddress(offset));}#define PCIIOWrite32(offset,data) ( \{ \ rPCIBATAPI = offset&0xfc000000; \ *(volatile u32 *)(_MapIOAddress(offset)) = (data); \})#define PCIIOWrite16(offset,data) ( \{ \ rPCIBATAPI = offset&0xfc000000; \ *(volatile u16 *)(_MapIOAddress(offset)) = ((u16)data); \})#define PCIIOWrite8(offset,data) ( \{ \ rPCIBATAPI = offset&0xfc000000; \ *(volatile u8 *)(_MapIOAddress(offset)) = ((u8)data); \}) /* pci memory space access macros */static inline u8 PCIMemRead8(unsigned long offset){ rPCIBATAPM = offset&0xf0000000; return *(volatile u8 *)(_MapMemAddress(offset));}static inline u16 PCIMemRead16(unsigned long offset){ rPCIBATAPM = offset&0xf0000000; return *(volatile u16 *)(_MapMemAddress(offset));}static inline u32 PCIMemRead32(unsigned long offset){ rPCIBATAPM = offset&0xf0000000; return *(volatile u32 *)(_MapMemAddress(offset));}#define PCIMemWrite32(offset,data) ( \{ \ rPCIBATAPM = offset&0xf0000000; \ *(volatile u32 *)(_MapMemAddress(offset)) = (data); \})#define PCIMemWrite16(offset,data) ( \{ \ /*printk("PCIMemWrite\n");*/ \ rPCIBATAPM = offset&0xf0000000; \ *(volatile u16 *)(_MapMemAddress(offset)) = ((u16)data);\})#define PCIMemWrite8(offset,data) ( \{ \ rPCIBATAPM = offset&0xf0000000; \ *(volatile u8 *)(_MapMemAddress(offset)) = ((u8)data); \})#endif /* CONFIG_PCI */#define __arch_getw(a) (*(volatile unsigned short *)(a))#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))/* * Defining these two gives us ioremap for free. See asm/io.h. * --gmcnutt */#define iomem_valid_addr(iomem,sz) (1)#define iomem_to_phys(iomem) (iomem)#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -