dma: implement overflow checking

master
Robert Jördens 2021-06-01 13:11:16 +02:00
parent 63716111df
commit c5a2704c41
7 changed files with 13 additions and 9 deletions

2
Cargo.lock generated
View File

@ -810,7 +810,7 @@ dependencies = [
[[package]]
name = "stm32h7xx-hal"
version = "0.9.0"
source = "git+https://github.com/quartiq/stm32h7xx-hal.git?rev=cca4ecc#cca4ecc3e0cc8cb2f7a9652c4099d50b44977493"
source = "git+https://github.com/quartiq/stm32h7xx-hal.git?rev=b0b8a93#b0b8a930b2c3bc5fcebc2e905b4c5e13360111a5"
dependencies = [
"bare-metal 1.0.0",
"cast",

View File

@ -52,11 +52,12 @@ mcp23017 = "1.0"
git = "https://github.com/quartiq/rtt-logger.git"
rev = "70b0eb5"
# fast double buffered DMA without poisoning and buffer swapping
[dependencies.stm32h7xx-hal]
features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"]
# version = "0.9.0"
git = "https://github.com/quartiq/stm32h7xx-hal.git"
rev = "cca4ecc"
rev = "b0b8a93"
# link.x section start/end
[patch.crates-io.cortex-m-rt]

View File

@ -54,10 +54,10 @@ impl Default for Settings {
macro_rules! flatten_closures {
($fn:ident, $e:ident, $fun:block) => {
$e.$fn(|$e| $fun )
$e.$fn(|$e| $fun ).unwrap()
};
($fn:ident, $e:ident, $($es:ident),+, $fun:block) => {
$e.$fn(|$e| flatten_closures!($fn, $($es),*, $fun))
$e.$fn(|$e| flatten_closures!($fn, $($es),*, $fun)).unwrap()
};
}

View File

@ -74,7 +74,7 @@ use hal::dma::{
config::Priority,
dma::{DMAReq, DmaConfig},
traits::TargetAddress,
MemoryToPeripheral, PeripheralToMemory, Transfer,
DMAError, MemoryToPeripheral, PeripheralToMemory, Transfer,
};
/// A type representing an ADC sample.
@ -359,7 +359,7 @@ macro_rules! adc_input {
///
/// NOTE(unsafe): Memory safety and access ordering is not guaranteed
/// (see the HAL DMA docs).
pub fn with_buffer<F, R>(&mut self, f: F) -> R
pub fn with_buffer<F, R>(&mut self, f: F) -> Result<R, DMAError>
where
F: FnOnce(&mut SampleBuffer) -> R,
{

View File

@ -58,7 +58,7 @@ use super::timers;
use hal::dma::{
dma::{DMAReq, DmaConfig},
traits::TargetAddress,
MemoryToPeripheral, Transfer,
DMAError, MemoryToPeripheral, Transfer,
};
// The following global buffers are used for the DAC code DMA transfers. Two buffers are used for
@ -209,7 +209,7 @@ macro_rules! dac_output {
///
/// NOTE(unsafe): Memory safety and access ordering is not guaranteed
/// (see the HAL DMA docs).
pub fn with_buffer<F, R>(&mut self, f: F) -> R
pub fn with_buffer<F, R>(&mut self, f: F) -> Result<R, DMAError>
where
F: FnOnce(&mut SampleBuffer) -> R,
{

View File

@ -52,9 +52,11 @@
///! compile-time-known register update sequence needed for the application, the serialization
///! process can be done once and then register values can be written into a pre-computed serialized
///! buffer to avoid the software overhead of much of the serialization process.
use log::warn;
use stm32h7xx_hal as hal;
use super::{hrtimer::HighResTimerE, QspiInterface};
use ad9959::{Channel, DdsConfig, ProfileSerializer};
use stm32h7xx_hal as hal;
/// The DDS profile update stream.
pub struct DdsOutput {

View File

@ -11,6 +11,7 @@
///! Respones to settings updates are sent without quality-of-service guarantees, so there's no
///! guarantee that the requestee will be informed that settings have been applied.
use heapless::String;
use log::info;
use super::{MqttMessage, NetworkReference, SettingsResponse, UpdateState};
use crate::hardware::design_parameters::MQTT_BROKER;