kernel/device/platform/resource.rs
1//! Platform device resource management module.
2//!
3//! This module defines the `PlatformDeviceResource` struct and the `PlatformDeviceResourceType` enum,
4//! which represent the resources associated with platform devices.
5//!
6
7/// PlatformDeviceResource struct
8///
9/// This struct represents a resource associated with a platform device.
10/// It contains the resource type (memory, I/O, IRQ, or DMA),
11/// the starting address, and the ending address of the resource.
12#[derive(Debug)]
13pub struct PlatformDeviceResource {
14 pub res_type: PlatformDeviceResourceType,
15 pub start: usize,
16 pub end: usize,
17}
18
19/// PlatformDeviceResourceType enum
20///
21/// This enum defines the types of resources that can be associated with a platform device.
22/// The types include memory (MEM), I/O (IO), interrupt request (IRQ), and direct memory access (DMA).
23/// Each type is represented as a variant of the enum.
24#[derive(PartialEq, Eq, Debug)]
25pub enum PlatformDeviceResourceType {
26 MEM,
27 IO,
28 IRQ,
29 DMA,
30}