aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Salzedo <[email protected]>2021-09-28 19:35:07 -0700
committerDario Nieuwenhuis <[email protected]>2021-12-07 21:43:47 +0100
commit93e047ede28c387d7eb539dbc06b8a660ac527db (patch)
treef17d7180cfb6df7df7a1e6f4b8786ceadc0f13cc
parent3411039cb9ff832b7db5a750854167831fd8f120 (diff)
cargo fmt
-rw-r--r--embassy-stm32/src/dma/bdma.rs11
-rw-r--r--embassy-stm32/src/dma/dma.rs8
2 files changed, 8 insertions, 11 deletions
diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs
index d6941f335..c86999bea 100644
--- a/embassy-stm32/src/dma/bdma.rs
+++ b/embassy-stm32/src/dma/bdma.rs
@@ -58,7 +58,7 @@ pub(crate) unsafe fn do_transfer(
58 }); 58 });
59 59
60 let on_drop = OnDrop::new(move || unsafe { 60 let on_drop = OnDrop::new(move || unsafe {
61 _stop(dma , channel_number); 61 _stop(dma, channel_number);
62 }); 62 });
63 63
64 #[cfg(dmamux)] 64 #[cfg(dmamux)]
@@ -111,7 +111,7 @@ pub(crate) unsafe fn do_transfer(
111 } 111 }
112} 112}
113 113
114unsafe fn _stop(dma:pac::bdma::Dma, ch: u8) { 114unsafe fn _stop(dma: pac::bdma::Dma, ch: u8) {
115 let ch = dma.ch(ch as _); 115 let ch = dma.ch(ch as _);
116 116
117 // Disable the channel and interrupts with the default value. 117 // Disable the channel and interrupts with the default value.
@@ -124,14 +124,14 @@ unsafe fn _stop(dma:pac::bdma::Dma, ch: u8) {
124 fence(Ordering::Acquire); 124 fence(Ordering::Acquire);
125} 125}
126 126
127unsafe fn _is_stopped(dma:pac::bdma::Dma, ch: u8) -> bool { 127unsafe fn _is_stopped(dma: pac::bdma::Dma, ch: u8) -> bool {
128 let ch = dma.ch(ch as _); 128 let ch = dma.ch(ch as _);
129 ch.cr().read().en() 129 ch.cr().read().en()
130} 130}
131 131
132/// Gets the total remaining transfers for the channel 132/// Gets the total remaining transfers for the channel
133/// Note: this will be zero for transfers that completed without cancellation. 133/// Note: this will be zero for transfers that completed without cancellation.
134unsafe fn _get_remaining_transfers(dma: pac::bdma::Dma, ch: u8) -> u16{ 134unsafe fn _get_remaining_transfers(dma: pac::bdma::Dma, ch: u8) -> u16 {
135 // get a handle on the channel itself 135 // get a handle on the channel itself
136 let ch = dma.ch(ch as _); 136 let ch = dma.ch(ch as _);
137 // read the remaining transfer count. If this is zero, the transfer completed fully. 137 // read the remaining transfer count. If this is zero, the transfer completed fully.
@@ -139,10 +139,9 @@ unsafe fn _get_remaining_transfers(dma: pac::bdma::Dma, ch: u8) -> u16{
139} 139}
140 140
141/// Sets the waker for the specified DMA channel 141/// Sets the waker for the specified DMA channel
142unsafe fn _set_waker(dma: pac::bdma::Dma, state_number: u8, waker: &Waker){ 142unsafe fn _set_waker(dma: pac::bdma::Dma, state_number: u8, waker: &Waker) {
143 let n = state_number as usize; 143 let n = state_number as usize;
144 STATE.ch_wakers[n].register(waker); 144 STATE.ch_wakers[n].register(waker);
145
146} 145}
147 146
148macro_rules! dma_num { 147macro_rules! dma_num {
diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs
index 754685c24..672e632f8 100644
--- a/embassy-stm32/src/dma/dma.rs
+++ b/embassy-stm32/src/dma/dma.rs
@@ -134,7 +134,7 @@ unsafe fn _stop(dma: &pac::dma::Dma, ch: u8) {
134} 134}
135 135
136/// Gets the running status of the channel 136/// Gets the running status of the channel
137unsafe fn _is_stopped(dma: &pac::dma::Dma, ch: u8) -> bool{ 137unsafe fn _is_stopped(dma: &pac::dma::Dma, ch: u8) -> bool {
138 // get a handle on the channel itself 138 // get a handle on the channel itself
139 let ch = dma.st(ch as _); 139 let ch = dma.st(ch as _);
140 140
@@ -144,7 +144,7 @@ unsafe fn _is_stopped(dma: &pac::dma::Dma, ch: u8) -> bool{
144 144
145/// Gets the total remaining transfers for the channel 145/// Gets the total remaining transfers for the channel
146/// Note: this will be zero for transfers that completed without cancellation. 146/// Note: this will be zero for transfers that completed without cancellation.
147unsafe fn _get_remaining_transfers(dma: &pac::dma::Dma, ch: u8) -> u16{ 147unsafe fn _get_remaining_transfers(dma: &pac::dma::Dma, ch: u8) -> u16 {
148 // get a handle on the channel itself 148 // get a handle on the channel itself
149 let ch = dma.st(ch as _); 149 let ch = dma.st(ch as _);
150 // read the remaining transfer count. If this is zero, the transfer completed fully. 150 // read the remaining transfer count. If this is zero, the transfer completed fully.
@@ -152,13 +152,11 @@ unsafe fn _get_remaining_transfers(dma: &pac::dma::Dma, ch: u8) -> u16{
152} 152}
153 153
154/// Sets the waker for the specified DMA channel 154/// Sets the waker for the specified DMA channel
155unsafe fn _set_waker(dma: &pac::dma::Dma, state_number: u8, waker: &Waker){ 155unsafe fn _set_waker(dma: &pac::dma::Dma, state_number: u8, waker: &Waker) {
156 let n = state_number as usize; 156 let n = state_number as usize;
157 STATE.ch_wakers[n].register(waker); 157 STATE.ch_wakers[n].register(waker);
158
159} 158}
160 159
161
162macro_rules! dma_num { 160macro_rules! dma_num {
163 (DMA1) => { 161 (DMA1) => {
164 0 162 0