# dmac.rs - source
Source of the Rust file `/home/runner/.cargo/git/checkouts/k210-hal-1069b16e3180bc3a/795ac3f/src/dmac.rs`.
Keywords: rust, rustlang, rust-lang

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34

    //! (TODO) Direct Memory Access Controller (DMAC)
    use crate::{pac, sysctl};

    pub fn dmac_id() -> u64 {
        unsafe { (*pac::DMAC::ptr()).id.read().bits() }
    }

    pub fn dmac_version() -> u64 {
        unsafe { (*pac::DMAC::ptr()).compver.read().bits() }
    }

    pub trait DmacExt {
        fn configure(self, /* sysctl ACLK clock */) -> Dmac;
    }

    impl DmacExt for pac::DMAC {
        fn configure(self, /* sysctl ACLK clock */) -> Dmac {
            // enable
            sysctl::clk_en_peri().modify(|_, w| w.dma_clk_en().set_bit());
            // todo: reset
            Dmac {} // todo
        }
    }

    pub struct Dmac {

    }

    // pub struct C0 {
    //     // todo
    //     pub async fn poll() {

    //     }
    // }