MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / DeviceNode

Class DeviceNode

src/device/include/device_node.hpp:39–66  ·  view source on GitHub ↗

* @brief 单个设备的硬件资源描述。 * * 纯数据结构 — 无生命周期管理、无 DMA 缓冲区、 * 无并发原语。`bound` 受 DeviceManager::lock_ 保护 *(在整个 ProbeAll() 循环期间持有)。 */

Source from the content-addressed store, hash-verified

37 *(在整个 ProbeAll() 循环期间持有)。
38 */
39struct DeviceNode {
40 /// 可读的设备名称(来自 FDT 节点名)
41 char name[32]{};
42
43 BusType bus_type{BusType::kPlatform};
44 DeviceType type{DeviceType::kPlatform};
45
46 /// 第一个 MMIO 区域(需要多 BAR 支持时扩展为数组)
47 uint64_t mmio_base{0};
48 size_t mmio_size{0};
49
50 /// 第一条中断线(需要多 IRQ 支持时扩展)
51 uint32_t irq{0};
52
53 /// FDT compatible 字符串列表(以 '\0' 分隔,如 "ns16550a\0ns16550\0"
54 char compatible[128]{};
55 size_t compatible_len{0};
56
57 /// 由 DeviceManager 分配的全局设备 ID
58 uint32_t dev_id{0};
59
60 /// 由 ProbeAll() 在 DeviceManager::lock_ 保护下设置 — 无需每节点锁。
61 bool bound{false};
62
63 /// 由驱动 Probe() 设置 — 指向内核生命周期的适配器。
64 /// 若不是块设备或尚未探测则为 nullptr。
65 vfs::BlockDevice* block_device{nullptr};
66};
67
68/// 总线 concept — 每种总线负责枚举自己管辖范围内的设备
69template <typename B>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected