Skip to content

Commit

Permalink
refactor: dma handling
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Jun 26, 2024
1 parent 1aaddc7 commit b6553b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hpm-data-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,21 @@ fn main() -> anyhow::Result<()> {
for ch in 0..hdma_chs {
core.dma_channels
.push(hpm_data_serde::chip::core::DmaChannels {
name: format!("HDMA_MUX{}", ch),
name: format!("HDMA_CH{}", ch),
dma: "HDMA".to_string(),
channel: ch as _,
dmamux_channel: ch as _,
});
}

if let Some(&xdma_ch) = gen.get("XDMA") {
for ch in 0..xdma_ch {
core.dma_channels
.push(hpm_data_serde::chip::core::DmaChannels {
name: format!("XDMA_MUX{}", ch),
name: format!("XDMA_CH{}", ch),
dma: "XDMA".to_string(),
channel: (hdma_chs + ch) as _, // xdma starts after hdma
channel: ch as _,
dmamux_channel: (hdma_chs + ch) as _, // xdma starts after hdma
});
}
}
Expand Down
1 change: 1 addition & 0 deletions hpm-data-serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ pub mod chip {
pub dma: String,
// DMAMUX output channel
pub channel: u8,
pub dmamux_channel: u8,
}

#[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
Expand Down
1 change: 1 addition & 0 deletions hpm-metapac-gen/res/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ pub struct DmaChannel {
pub name: &'static str,
pub dma: &'static str,
pub channel: u32,
pub dmamux_channel: u32,
}

#[derive(Debug, Eq, PartialEq, Clone)]
Expand Down
1 change: 1 addition & 0 deletions hpm-metapac-gen/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ pub struct DmaChannel {
pub name: String,
pub dma: String,
pub channel: u32, // channel in DMAMUX
pub dmamux_channel: u32
}

#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Hash)]
Expand Down

0 comments on commit b6553b5

Please sign in to comment.