SimpleKernel 1.17.0
Loading...
Searching...
No Matches
DeviceNode Struct Reference

单个设备的硬件资源描述。 More...

#include <device_node.hpp>

Collaboration diagram for DeviceNode:
Collaboration graph

Public Attributes

char name [32] {}
 可读的设备名称(来自 FDT 节点名)
 
BusType bus_type {BusType::kPlatform}
 
DeviceType type {DeviceType::kPlatform}
 
uint64_t mmio_base {0}
 第一个 MMIO 区域(需要多 BAR 支持时扩展为数组)
 
size_t mmio_size {0}
 
uint32_t irq {0}
 第一条中断线(需要多 IRQ 支持时扩展)
 
char compatible [128] {}
 FDT compatible 字符串列表(以 '\0' 分隔,如 "ns16550a\0ns16550\0")
 
size_t compatible_len {0}
 
uint32_t dev_id {0}
 DeviceManager 分配的全局设备 ID
 
bool bound {false}
 由 ProbeAll() 在 DeviceManager::lock_ 保护下设置 — 无需每节点锁。
 
vfs::BlockDeviceblock_device {nullptr}
 

Detailed Description

单个设备的硬件资源描述。

纯数据结构 — 无生命周期管理、无 DMA 缓冲区、 无并发原语。boundDeviceManager::lock_ 保护 (在整个 ProbeAll() 循环期间持有)。

Definition at line 39 of file device_node.hpp.

Member Data Documentation

◆ block_device

vfs::BlockDevice* DeviceNode::block_device {nullptr}

由驱动 Probe() 设置 — 指向内核生命周期的适配器。 若不是块设备或尚未探测则为 nullptr。

Definition at line 65 of file device_node.hpp.

65{nullptr};

◆ bound

bool DeviceNode::bound {false}

由 ProbeAll() 在 DeviceManager::lock_ 保护下设置 — 无需每节点锁。

Definition at line 61 of file device_node.hpp.

61{false};

◆ bus_type

BusType DeviceNode::bus_type {BusType::kPlatform}

Definition at line 43 of file device_node.hpp.

◆ compatible

char DeviceNode::compatible[128] {}

FDT compatible 字符串列表(以 '\0' 分隔,如 "ns16550a\0ns16550\0")

Definition at line 54 of file device_node.hpp.

54{};

◆ compatible_len

size_t DeviceNode::compatible_len {0}

Definition at line 55 of file device_node.hpp.

55{0};

◆ dev_id

uint32_t DeviceNode::dev_id {0}

DeviceManager 分配的全局设备 ID

Definition at line 58 of file device_node.hpp.

58{0};

◆ irq

uint32_t DeviceNode::irq {0}

第一条中断线(需要多 IRQ 支持时扩展)

Definition at line 51 of file device_node.hpp.

51{0};

◆ mmio_base

uint64_t DeviceNode::mmio_base {0}

第一个 MMIO 区域(需要多 BAR 支持时扩展为数组)

Definition at line 47 of file device_node.hpp.

47{0};

◆ mmio_size

size_t DeviceNode::mmio_size {0}

Definition at line 48 of file device_node.hpp.

48{0};

◆ name

char DeviceNode::name[32] {}

可读的设备名称(来自 FDT 节点名)

Definition at line 41 of file device_node.hpp.

41{};

◆ type

DeviceType DeviceNode::type {DeviceType::kPlatform}

Definition at line 44 of file device_node.hpp.

@ kPlatform
平台设备(中断控制器、定时器等)

The documentation for this struct was generated from the following file: