1.5 更好的 UART 驱动程序

更好的 UART 驱动程序 — Comprehensive Rust

译文 · 基于 Comprehensive Rust

原文链接: https://google.github.io/comprehensive-rust/bare-metal/aps/better-uart.html

1.5 更好的 UART 驱动程序

PL011实际上有更多寄存器,并添加偏移量来构造 访问它们的指针容易出错且难以阅读。此外,一些 它们是位字段,可以很好地以结构化方式访问。

偏移注册名称宽度
0x000x00博士12
0x040x04 RSR4
0x180x18法国9
0x200x20 ILPR8
0x240x24国际复兴开发银行16
0x280x28 FBRD6
0x2c0x2c LCR_H8
0x300x30 CR16
0x340x34国际生命安全研究所6
0x380x38 IMSC11
0x3c0x3c RIS11
0x400x40管理信息系统11
0x440x44 ICR11
0x480x48 DMACR3
  • 为了简洁起见,还省略了一些 ID 寄存器。

1.5.1 位标志

01-位标志 — Comprehensive Rust

1.5.2 多个寄存器

02-多个寄存器 — Comprehensive Rust

1.5.3 司机

03-司机 — Comprehensive Rust

最后修改 August 11, 2026: 更新 (70a5af133)