0X_ARMv8_指令集_基于汇编的UART驱动
https://gist.github.com/carloscn/dec6fe9743b9cbbdc58a44e048ab5598
1. 初始化
1.1 配置GPIO
#define U_BASE (PBASE+0x00201000)
#define GPFSEL1 (PBASE+0x00200004)
#define GPSET0 (PBASE+0x0020001C)
#define GPCLR0 (PBASE+0x00200028)
#define GPPUD (PBASE+0x00200094)
#define GPPUDCLK0 (PBASE+0x00200098)
#define GPIO_PUP_PDN_CNTRL_REG0 (PBASE+0x002000E4)
#define U_DATA_REG (U_BASE)
#define U_FR_REG (U_BASE+0x18)
#define U_IBRD_REG (U_BASE+0x24)
#define U_FBRD_REG (U_BASE+0x28)
#define U_LCRH_REG (U_BASE+0x2C)
#define U_CR_REG (U_BASE+0x30)
#define U_IMSC_REG (U_BASE+0x38)
ldr w15, =GPIO_SEL1
ldr w15, [x15]
mov w16, #1, lsl #17
orr w16, w16, #1, lsl #14
orr w16, w15, w16
ldr w15, =GPIO_SEL1
str w16, [w15]1.2 UART配置
2. 发送和接收
Ref
最后更新于