Generate dma-related macro tables.
This commit is contained in:
parent
d49adc98be
commit
1732551db4
@ -1 +1 @@
|
||||
Subproject commit eb76ee900ac67b51497196572250323e82666b4c
|
||||
Subproject commit 9856b11172ae27ffa60d339ac271d2d06c190756
|
@ -27,6 +27,7 @@ pub struct Core {
|
||||
pub name: String,
|
||||
pub peripherals: HashMap<String, Peripheral>,
|
||||
pub interrupts: HashMap<String, u32>,
|
||||
pub dma_channels: HashMap<String, DmaChannel>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
|
||||
@ -46,6 +47,10 @@ pub struct Peripheral {
|
||||
pub clock: Option<String>,
|
||||
#[serde(default)]
|
||||
pub pins: Vec<Pin>,
|
||||
#[serde(default)]
|
||||
pub dma_channels: HashMap<String, Vec<String>>,
|
||||
#[serde(default)]
|
||||
pub dma_requests: HashMap<String, u32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
|
||||
@ -55,6 +60,12 @@ pub struct Pin {
|
||||
pub af: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
|
||||
pub struct DmaChannel {
|
||||
pub dma: String,
|
||||
pub channel: u32,
|
||||
}
|
||||
|
||||
struct BlockInfo {
|
||||
/// usart_v1/USART -> usart
|
||||
module: String,
|
||||
@ -220,6 +231,9 @@ pub fn gen(options: Options) {
|
||||
let mut peripherals_table: Vec<Vec<String>> = Vec::new();
|
||||
let mut peripheral_pins_table: Vec<Vec<String>> = Vec::new();
|
||||
let mut peripheral_rcc_table: Vec<Vec<String>> = Vec::new();
|
||||
let mut dma_channels_table: Vec<Vec<String>> = Vec::new();
|
||||
let mut dma_requests_table: Vec<Vec<String>> = Vec::new();
|
||||
let mut peripheral_dma_channels_table: Vec<Vec<String>> = Vec::new();
|
||||
|
||||
let dma_base = core
|
||||
.peripherals
|
||||
@ -231,6 +245,14 @@ pub fn gen(options: Options) {
|
||||
let gpio_base = core.peripherals.get(&"GPIOA".to_string()).unwrap().address;
|
||||
let gpio_stride = 0x400;
|
||||
|
||||
for (id, channel_info) in &core.dma_channels {
|
||||
let mut row = Vec::new();
|
||||
row.push(id.clone());
|
||||
row.push(channel_info.dma.clone() );
|
||||
row.push(channel_info.channel.to_string());
|
||||
dma_channels_table.push(row);
|
||||
}
|
||||
|
||||
for (name, p) in &core.peripherals {
|
||||
let mut ir_peri = ir::Peripheral {
|
||||
name: name.clone(),
|
||||
@ -257,6 +279,28 @@ pub fn gen(options: Options) {
|
||||
peripheral_pins_table.push(row);
|
||||
}
|
||||
|
||||
for dma_request in &p.dma_requests {
|
||||
let mut row = Vec::new();
|
||||
row.push(name.clone());
|
||||
row.push(dma_request.0.clone());
|
||||
row.push(dma_request.1.to_string());
|
||||
dma_requests_table.push(row);
|
||||
}
|
||||
|
||||
for (event, dma_channels) in &p.dma_channels {
|
||||
for channel in dma_channels.iter() {
|
||||
let mut row = Vec::new();
|
||||
row.push(name.clone());
|
||||
row.push( bi.module.clone() );
|
||||
row.push( bi.block.clone() );
|
||||
row.push(event.clone());
|
||||
row.push( channel.clone() );
|
||||
row.push( core.dma_channels[channel].dma.clone() );
|
||||
row.push( core.dma_channels[channel].channel.to_string() );
|
||||
peripheral_dma_channels_table.push(row);
|
||||
}
|
||||
}
|
||||
|
||||
let mut peripheral_row = Vec::new();
|
||||
peripheral_row.push(bi.module.clone());
|
||||
peripheral_row.push(name.clone());
|
||||
@ -402,7 +446,10 @@ pub fn gen(options: Options) {
|
||||
make_table(&mut extra, "peripherals", &peripherals_table);
|
||||
make_table(&mut extra, "peripheral_versions", &peripheral_version_table);
|
||||
make_table(&mut extra, "peripheral_pins", &peripheral_pins_table);
|
||||
make_table(&mut extra, "peripheral_dma_channels", &peripheral_dma_channels_table);
|
||||
make_table(&mut extra, "peripheral_rcc", &peripheral_rcc_table);
|
||||
make_table(&mut extra, "dma_channels", &dma_channels_table);
|
||||
make_table(&mut extra, "dma_requests", &dma_requests_table);
|
||||
|
||||
for (module, version) in peripheral_versions {
|
||||
all_peripheral_versions.insert((module.clone(), version.clone()));
|
||||
|
Loading…
Reference in New Issue
Block a user