一个头文件IOMACROS.H,希望有硬件开发大神过来看看
/** DESCRIPTION for iomacros.h
* Read/Write macros for memory mapped I/O
*/
#ifndef _IOMACROS_H
#define _IOMACROS_H
#include "type.h"
/****************************************************************************
Constants Definitions
****************************************************************************/
#define IO_READ8(p) (Uint8)(*(volatile Uint8 *)(p))
#define IO_WRITE8(p,c) (*((volatile Uint8 *)(p)) = ((Uint8)(c)))
#define IO_READ16(p) (Uint16)(*(volatile Uint16 *)(p))
#define IO_WRITE16(p,v) (*((volatile Uint16 *)(p)) = (Uint16)(v))
#define IO_READ32(p) (Uint32)(*(volatile Uint32 *)(p))
#define IO_WRITE32(p,v) (*((volatile Uint32 *)(p)) = (Uint32)(v))
//#define R32(p) (Uint32)(*(volatile Uint32 *)(p))
//#define WR32(p,v) (*((volatile Uint32 *)(p)) = (Uint32)(v))
#define W8(p,c) (*((volatile Uint8 *)(p)) = ((Uint8)(c)))
#define W16(p,v) (*((volatile Uint16 *)(p)) = (Uint16)(v))
#define W32(p,v) (*((volatile Uint32 *)(p)) = (Uint32)(v))
#define R8(p,data) (Uint8)(data = *(volatile Uint8 *)(p))
#define R16(p,data) (Uint16)(data = *(volatile Uint16 *)(p))
#define R32(p,data) (Uint32)(data = *(volatile Uint32 *)(p))
#endif