strat9_kernel/dma/
direction.rs1use core::fmt::Debug;
2
3pub trait DmaDirection: Debug + sealed::Sealed {
14 const CAN_READ: bool;
16 const CAN_WRITE: bool;
18}
19
20mod sealed {
21 pub trait Sealed {}
22}
23
24#[derive(Debug, Clone, Copy)]
26pub struct DmaToDevice;
27
28impl sealed::Sealed for DmaToDevice {}
29impl DmaDirection for DmaToDevice {
30 const CAN_READ: bool = false;
31 const CAN_WRITE: bool = true;
32}
33
34#[derive(Debug, Clone, Copy)]
36pub struct DmaFromDevice;
37
38impl sealed::Sealed for DmaFromDevice {}
39impl DmaDirection for DmaFromDevice {
40 const CAN_READ: bool = true;
41 const CAN_WRITE: bool = false;
42}
43
44#[derive(Debug, Clone, Copy)]
46pub struct DmaBidirectional;
47
48impl sealed::Sealed for DmaBidirectional {}
49impl DmaDirection for DmaBidirectional {
50 const CAN_READ: bool = true;
51 const CAN_WRITE: bool = true;
52}