Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update the GDMA driver to support the ESP32-H2
  • Loading branch information
jessebraham authored and JurajSadel committed May 31, 2023
commit 8b57dc9a8e7624a679cd7c52cda62964998ad45c
9 changes: 5 additions & 4 deletions esp-hal-common/devices/esp32h2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ peripherals = [
"aes",
"apb_saradc",
"assist_debug",
"dma",
# "ds",
# "ecc",
"efuse",
# "gdma",
"gpio",
# "hmac",
# "hp_apm",
Expand Down Expand Up @@ -44,9 +44,9 @@ peripherals = [
"rsa",
"sha",
# "soc_etm",
# "spi0",
# "spi1",
# "spi2",
"spi0",
"spi1",
"spi2",
"systimer",
# "tee",
"timg0",
Expand All @@ -62,5 +62,6 @@ peripherals = [
"adc",
"assist_debug_sp_monitor",
"assist_debug_region_monitor",
"gdma",
"plic",
]
44 changes: 22 additions & 22 deletions esp-hal-common/src/dma/gdma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ macro_rules! impl_channel {
fn clear_out_interrupts() {
let dma = unsafe { &*crate::peripherals::DMA::PTR };

#[cfg(not(any(esp32c6, esp32s3)))]
#[cfg(not(any(esp32c6, esp32h2, esp32s3)))]
dma.[<int_clr_ch $num>].write(|w| {
w.out_eof()
.set_bit()
Expand All @@ -52,7 +52,7 @@ macro_rules! impl_channel {
.set_bit()
});

#[cfg(esp32c6)]
#[cfg(any(esp32c6, esp32h2))]
dma.[<out_int_clr_ch $num>].write(|w| {
w.out_eof()
.set_bit()
Expand Down Expand Up @@ -105,9 +105,9 @@ macro_rules! impl_channel {
fn has_out_descriptor_error() -> bool {
let dma = unsafe { &*crate::peripherals::DMA::PTR };

#[cfg(not(any(esp32c6, esp32s3)))]
#[cfg(not(any(esp32c6, esp32h2, esp32s3)))]
let ret = dma.[<int_raw_ch $num>].read().out_dscr_err().bit();
#[cfg(any(esp32c6, esp32s3))]
#[cfg(any(esp32c6, esp32h2, esp32s3))]
let ret = dma.[<out_int_raw_ch $num>].read().out_dscr_err().bit();

ret
Expand All @@ -128,9 +128,9 @@ macro_rules! impl_channel {
fn is_out_done() -> bool {
let dma = unsafe { &*crate::peripherals::DMA::PTR };

#[cfg(not(any(esp32c6, esp32s3)))]
#[cfg(not(any(esp32c6, esp32h2, esp32s3)))]
let ret = dma.[<int_raw_ch $num>].read().out_total_eof().bit();
#[cfg(any(esp32c6, esp32s3))]
#[cfg(any(esp32c6, esp32h2, esp32s3))]
let ret = dma.[<out_int_raw_ch $num>].read().out_total_eof().bit();

ret
Expand All @@ -144,9 +144,9 @@ macro_rules! impl_channel {
fn is_out_eof_interrupt_set() -> bool {
let dma = unsafe { &*crate::peripherals::DMA::PTR };

#[cfg(not(any(esp32c6, esp32s3)))]
#[cfg(not(any(esp32c6, esp32h2, esp32s3)))]
let ret = dma.[<int_raw_ch $num>].read().out_eof().bit();
#[cfg(any(esp32c6, esp32s3))]
#[cfg(any(esp32c6, esp32h2, esp32s3))]
let ret = dma.[<out_int_raw_ch $num>].read().out_eof().bit();

ret
Expand All @@ -155,13 +155,13 @@ macro_rules! impl_channel {
fn reset_out_eof_interrupt() {
let dma = unsafe { &*crate::peripherals::DMA::PTR };

#[cfg(not(any(esp32c6, esp32s3)))]
#[cfg(not(any(esp32c6, esp32h2, esp32s3)))]
dma.[<int_clr_ch $num>].write(|w| {
w.out_eof()
.set_bit()
});

#[cfg(any(esp32c6, esp32s3))]
#[cfg(any(esp32c6, esp32h2, esp32s3))]
dma.[<out_int_clr_ch $num>].write(|w| {
w.out_eof()
.set_bit()
Expand All @@ -187,7 +187,7 @@ macro_rules! impl_channel {
fn clear_in_interrupts() {
let dma = unsafe { &*crate::peripherals::DMA::PTR };

#[cfg(not(any(esp32c6, esp32s3)))]
#[cfg(not(any(esp32c6, esp32h2, esp32s3)))]
dma.[<int_clr_ch $num>].write(|w| {
w.in_suc_eof()
.set_bit()
Expand All @@ -205,7 +205,7 @@ macro_rules! impl_channel {
.set_bit()
});

#[cfg(esp32c6)]
#[cfg(any(esp32c6, esp32h2, esp32h2))]
dma.[<in_int_clr_ch $num>].write(|w| {
w.in_suc_eof()
.set_bit()
Expand Down Expand Up @@ -262,9 +262,9 @@ macro_rules! impl_channel {
fn has_in_descriptor_error() -> bool {
let dma = unsafe { &*crate::peripherals::DMA::PTR };

#[cfg(not(any(esp32c6, esp32s3)))]
#[cfg(not(any(esp32c6, esp32h2, esp32s3)))]
let ret = dma.[<int_raw_ch $num>].read().in_dscr_err().bit();
#[cfg(any(esp32c6, esp32s3))]
#[cfg(any(esp32c6, esp32h2, esp32s3))]
let ret = dma.[<in_int_raw_ch $num>].read().in_dscr_err().bit();

ret
Expand All @@ -285,9 +285,9 @@ macro_rules! impl_channel {
fn is_in_done() -> bool {
let dma = unsafe { &*crate::peripherals::DMA::PTR };

#[cfg(not(any(esp32c6, esp32s3)))]
#[cfg(not(any(esp32c6, esp32h2, esp32s3)))]
let ret = dma.[<int_raw_ch $num>].read().in_suc_eof().bit();
#[cfg(any(esp32c6, esp32s3))]
#[cfg(any(esp32c6, esp32h2, esp32s3))]
let ret = dma.[<in_int_raw_ch $num>].read().in_suc_eof().bit();

ret
Expand All @@ -301,7 +301,7 @@ macro_rules! impl_channel {
fn is_listening_in_eof() -> bool {
let dma = unsafe { &*crate::peripherals::DMA::PTR };
cfg_if::cfg_if! {
if #[cfg(any(esp32c6, esp32s3))] {
if #[cfg(any(esp32c6, esp32h2, esp32s3))] {
dma.[<in_int_ena_ch $num>].read().in_suc_eof().bit_is_set()
} else {
dma.[<int_ena_ch $num>].read().in_suc_eof().bit_is_set()
Expand All @@ -312,7 +312,7 @@ macro_rules! impl_channel {
fn is_listening_out_eof() -> bool {
let dma = unsafe { &*crate::peripherals::DMA::PTR };
cfg_if::cfg_if! {
if #[cfg(any(esp32c6, esp32s3))] {
if #[cfg(any(esp32c6, esp32h2, esp32s3))] {
dma.[<out_int_ena_ch $num>].read().out_total_eof().bit_is_set()
} else {
dma.[<int_ena_ch $num>].read().out_total_eof().bit_is_set()
Expand All @@ -323,7 +323,7 @@ macro_rules! impl_channel {
fn listen_in_eof() {
let dma = unsafe { &*crate::peripherals::DMA::PTR };
cfg_if::cfg_if! {
if #[cfg(any(esp32c6, esp32s3))] {
if #[cfg(any(esp32c6, esp32h2, esp32s3))] {
dma.[<in_int_ena_ch $num>].modify(|_, w| w.in_suc_eof().set_bit())
} else {
dma.[<int_ena_ch $num>].modify(|_, w| w.in_suc_eof().set_bit())
Expand All @@ -334,7 +334,7 @@ macro_rules! impl_channel {
fn listen_out_eof() {
let dma = unsafe { &*crate::peripherals::DMA::PTR };
cfg_if::cfg_if! {
if #[cfg(any(esp32c6, esp32s3))] {
if #[cfg(any(esp32c6, esp32h2, esp32s3))] {
dma.[<out_int_ena_ch $num>].modify(|_, w| w.out_total_eof().set_bit())
} else {
dma.[<int_ena_ch $num>].modify(|_, w| w.out_total_eof().set_bit())
Expand All @@ -345,7 +345,7 @@ macro_rules! impl_channel {
fn unlisten_in_eof() {
let dma = unsafe { &*crate::peripherals::DMA::PTR };
cfg_if::cfg_if! {
if #[cfg(any(esp32c6, esp32s3))] {
if #[cfg(any(esp32c6, esp32h2, esp32s3))] {
dma.[<in_int_ena_ch $num>].modify(|_, w| w.in_suc_eof().clear_bit())
} else {
dma.[<int_ena_ch $num>].modify(|_, w| w.in_suc_eof().clear_bit())
Expand All @@ -356,7 +356,7 @@ macro_rules! impl_channel {
fn unlisten_out_eof() {
let dma = unsafe { &*crate::peripherals::DMA::PTR };
cfg_if::cfg_if! {
if #[cfg(any(esp32c6, esp32s3))] {
if #[cfg(any(esp32c6, esp32h2, esp32s3))] {
dma.[<out_int_ena_ch $num>].modify(|_, w| w.out_total_eof().clear_bit())
} else {
dma.[<int_ena_ch $num>].modify(|_, w| w.out_total_eof().clear_bit())
Expand Down
2 changes: 1 addition & 1 deletion esp-hal-common/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ pub(crate) mod asynch {
}
}

#[cfg(esp32c6)]
#[cfg(any(esp32c6, esp32h2))]
mod interrupt {
use super::*;

Expand Down
8 changes: 4 additions & 4 deletions esp-hal-common/src/soc/esp32h2/peripherals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ crate::peripherals! {
AES => true,
APB_SARADC => true,
ASSIST_DEBUG => true,
DMA => true,
// DS => true,
// ECC => true,
EFUSE => true,
// GDMA => true,
GPIO => true,
// HMAC => true,
// HP_APM => true,
Expand Down Expand Up @@ -46,9 +46,9 @@ crate::peripherals! {
RSA => true,
SHA => true,
// SOC_ETM => true,
// SPI0 => true,
// SPI1 => true,
// SPI2 => true,
SPI0 => true,
SPI1 => true,
SPI2 => true,
SYSTIMER => true,
// TEE => true,
TIMG0 => true,
Expand Down