dma: implement overflow checking
This commit is contained in:
parent
63716111df
commit
c5a2704c41
|
@ -810,7 +810,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stm32h7xx-hal"
|
name = "stm32h7xx-hal"
|
||||||
version = "0.9.0"
|
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 = [
|
dependencies = [
|
||||||
"bare-metal 1.0.0",
|
"bare-metal 1.0.0",
|
||||||
"cast",
|
"cast",
|
||||||
|
|
|
@ -52,11 +52,12 @@ mcp23017 = "1.0"
|
||||||
git = "https://github.com/quartiq/rtt-logger.git"
|
git = "https://github.com/quartiq/rtt-logger.git"
|
||||||
rev = "70b0eb5"
|
rev = "70b0eb5"
|
||||||
|
|
||||||
|
# fast double buffered DMA without poisoning and buffer swapping
|
||||||
[dependencies.stm32h7xx-hal]
|
[dependencies.stm32h7xx-hal]
|
||||||
features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"]
|
features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"]
|
||||||
# version = "0.9.0"
|
# version = "0.9.0"
|
||||||
git = "https://github.com/quartiq/stm32h7xx-hal.git"
|
git = "https://github.com/quartiq/stm32h7xx-hal.git"
|
||||||
rev = "cca4ecc"
|
rev = "b0b8a93"
|
||||||
|
|
||||||
# link.x section start/end
|
# link.x section start/end
|
||||||
[patch.crates-io.cortex-m-rt]
|
[patch.crates-io.cortex-m-rt]
|
||||||
|
|
|
@ -54,10 +54,10 @@ impl Default for Settings {
|
||||||
|
|
||||||
macro_rules! flatten_closures {
|
macro_rules! flatten_closures {
|
||||||
($fn:ident, $e:ident, $fun:block) => {
|
($fn:ident, $e:ident, $fun:block) => {
|
||||||
$e.$fn(|$e| $fun )
|
$e.$fn(|$e| $fun ).unwrap()
|
||||||
};
|
};
|
||||||
($fn:ident, $e:ident, $($es:ident),+, $fun:block) => {
|
($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()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ use hal::dma::{
|
||||||
config::Priority,
|
config::Priority,
|
||||||
dma::{DMAReq, DmaConfig},
|
dma::{DMAReq, DmaConfig},
|
||||||
traits::TargetAddress,
|
traits::TargetAddress,
|
||||||
MemoryToPeripheral, PeripheralToMemory, Transfer,
|
DMAError, MemoryToPeripheral, PeripheralToMemory, Transfer,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A type representing an ADC sample.
|
/// A type representing an ADC sample.
|
||||||
|
@ -359,7 +359,7 @@ macro_rules! adc_input {
|
||||||
///
|
///
|
||||||
/// NOTE(unsafe): Memory safety and access ordering is not guaranteed
|
/// NOTE(unsafe): Memory safety and access ordering is not guaranteed
|
||||||
/// (see the HAL DMA docs).
|
/// (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
|
where
|
||||||
F: FnOnce(&mut SampleBuffer) -> R,
|
F: FnOnce(&mut SampleBuffer) -> R,
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,7 @@ use super::timers;
|
||||||
use hal::dma::{
|
use hal::dma::{
|
||||||
dma::{DMAReq, DmaConfig},
|
dma::{DMAReq, DmaConfig},
|
||||||
traits::TargetAddress,
|
traits::TargetAddress,
|
||||||
MemoryToPeripheral, Transfer,
|
DMAError, MemoryToPeripheral, Transfer,
|
||||||
};
|
};
|
||||||
|
|
||||||
// The following global buffers are used for the DAC code DMA transfers. Two buffers are used for
|
// 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
|
/// NOTE(unsafe): Memory safety and access ordering is not guaranteed
|
||||||
/// (see the HAL DMA docs).
|
/// (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
|
where
|
||||||
F: FnOnce(&mut SampleBuffer) -> R,
|
F: FnOnce(&mut SampleBuffer) -> R,
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,9 +52,11 @@
|
||||||
///! compile-time-known register update sequence needed for the application, the serialization
|
///! 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
|
///! 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.
|
///! 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 super::{hrtimer::HighResTimerE, QspiInterface};
|
||||||
use ad9959::{Channel, DdsConfig, ProfileSerializer};
|
use ad9959::{Channel, DdsConfig, ProfileSerializer};
|
||||||
use stm32h7xx_hal as hal;
|
|
||||||
|
|
||||||
/// The DDS profile update stream.
|
/// The DDS profile update stream.
|
||||||
pub struct DdsOutput {
|
pub struct DdsOutput {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
///! Respones to settings updates are sent without quality-of-service guarantees, so there's no
|
///! 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.
|
///! guarantee that the requestee will be informed that settings have been applied.
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
|
use log::info;
|
||||||
|
|
||||||
use super::{MqttMessage, NetworkReference, SettingsResponse, UpdateState};
|
use super::{MqttMessage, NetworkReference, SettingsResponse, UpdateState};
|
||||||
use crate::hardware::design_parameters::MQTT_BROKER;
|
use crate::hardware::design_parameters::MQTT_BROKER;
|
||||||
|
|
Loading…
Reference in New Issue