寄存器使用结构体进行空间地址的映射
来源:互联网 发布:网络运维管理论坛 编辑:程序博客网 时间:2024/05/21 14:45
方式一:
typedef struct
{
union {
__I uint8_t RBR; //RBR THR DLL 三个寄存器都占用空间 0x4001 0000
__O uint8_t THR;
__IO uint8_t DLL;
uint32_t RESERVED0;
};
union {
__IO uint8_t DLM; //DLM IER 都占用空间 0x4001 0004
__IO uint32_t IER;
};
union {
__I uint32_t IIR; //IIR FCR 都占用空间 0x4001 0008
__O uint8_t FCR;
};
__IO uint8_t LCR; //0x4001 000C
uint8_t RESERVED1[3];
__IO uint8_t MCR; //0x4001 0010
uint8_t RESERVED2[3];
__I uint8_t LSR; // 0x4001 0014
uint8_t RESERVED3[3];
__I uint8_t MSR; //0x4001 0018
uint8_t RESERVED4[3];
__IO uint8_t SCR; //0x4001 001C
uint8_t RESERVED5[3];
__IO uint32_t ACR; //0x4001 0020
uint32_t RESERVED6;
__IO uint32_t FDR; //0x4001 0028
uint32_t RESERVED7;
__IO uint8_t TER; //0x4001 0030
uint8_t RESERVED8[27];
__IO uint8_t RS485CTRL; //0x4001 004C
uint8_t RESERVED9[3];
__IO uint8_t ADRMATCH; //0x4001 0050
uint8_t RESERVED10[3];
__IO uint8_t RS485DLY; //0x4001 0054
uint8_t RESERVED11[3];
__I uint8_t FIFOLVL; //0x4001 0058
} LPC_UART1_TypeDef;
#define LPC_APB0_BASE (0x40000000UL)
#define LPC_UART1_BASE (LPC_APB0_BASE + 0x10000)
#define LPC_UART1 ((LPC_UART1_TypeDef *) LPC_UART1_BASE )
方式二:
/*********************************************************************************************************
** UART1
*********************************************************************************************************/
#define U1RBRTHR (*(volatile unsigned long *)0x40010000) /* U1DLL, U1RBR and U1THR */
#define U1DLL U1RBRTHR /* share the same address */
#define U1RBR U1RBRTHR
#define U1THR U1RBRTHR
#define U1IER (*(volatile unsigned long *)0x40010004) /* U1DLM and U1IER */
#define U1DLM U1IER /* share the same address */
#define U1FCR (*(volatile unsigned long *)0x40010008) /* U1FCR and U1IIR */
#define U1IIR U1FCR /* share the same address */
#define U1LCR (*(volatile unsigned long *)0x4001000C)
#define U1MCR (*(volatile unsigned long *)0x40010010)
#define U1LSR (*(volatile unsigned long *)0x40010014)
#define U1MSR (*(volatile unsigned long *)0x40010018)
#define U1SCR (*(volatile unsigned long *)0x4001001C)
#define U1ACR (*(volatile unsigned long *)0x40010020)
#define U1FDR (*(volatile unsigned long *)0x40010028)
#define U1TER (*(volatile unsigned long *)0x40010030)
#define U1RS485CTRL (*(volatile unsigned long *)0x4001004C)
#define U1ADRMATCH (*(volatile unsigned long *)0x40010050)
#define U1RS485DLY (*(volatile unsigned long *)0x40010054)
#define U1FIFOLVL (*(volatile unsigned long *)0x40010058)
- 寄存器使用结构体进行空间地址的映射
- 寄存器名称和地址的映射分析
- 寄存器名称和地址的映射分析
- 【记录】寄存器地址映射
- DM642 的地址空间映射
- STM32 寄存器地址名称映射
- stm32寄存器地址名称映射
- WinCE下的地址映射以及寄存器访问
- 2410下寄存器地址虚实映射的实现
- 2410下寄存器地址虚实映射的实现
- 2410下寄存器地址虚实映射的实现
- S3C2410下寄存器地址虚实映射的实现(转)
- S3C2410下寄存器地址虚实映射的实现
- 程序的用户地址空间映射
- 进程地址空间映射
- IA32地址空间映射
- IA32地址空间映射
- 动态映射之结构体方式操作寄存器
- 9-2 个人所得税计算器
- 城市新56个漂泊族 你是哪漂泊一族?
- 设置SharePoint2010列表的项目级权限
- Android:进程UID定义
- Safe Alert Request Error step 的解决办法
- 寄存器使用结构体进行空间地址的映射
- Activity LaunchMode & TaskAffinity
- 控件(CMSComm)进行串口编程
- asp.net 数组
- 10-25带条件查询
- iPhone应用程序编程指南---事件处理
- cout格式控制
- IOS CoreData 多表查询(上)
- iPhone应用程序编程指南---图形和描画