aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-06-18 10:10:05 -0500
committerxoviat <[email protected]>2023-06-18 10:10:05 -0500
commit748d1ea89da160df927ea3dd597704ba236e0fb6 (patch)
tree614a9f495a69ce6a4914f1584aafe4f6157e8682
parent39334f72804ad83c90cde53d328be779af9f1b92 (diff)
stm32/ipcc: minor cleanup
-rw-r--r--embassy-stm32/src/ipcc.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/embassy-stm32/src/ipcc.rs b/embassy-stm32/src/ipcc.rs
index 609c4d2c3..f481a5955 100644
--- a/embassy-stm32/src/ipcc.rs
+++ b/embassy-stm32/src/ipcc.rs
@@ -122,7 +122,6 @@ impl Ipcc {
122 let regs = IPCC::regs(); 122 let regs = IPCC::regs();
123 123
124 Self::flush(channel).await; 124 Self::flush(channel).await;
125 compiler_fence(Ordering::SeqCst);
126 125
127 f(); 126 f();
128 127
@@ -138,7 +137,7 @@ impl Ipcc {
138 137
139 // This is a race, but is nice for debugging 138 // This is a race, but is nice for debugging
140 if unsafe { regs.cpu(0).sr().read() }.chf(channel as usize) { 139 if unsafe { regs.cpu(0).sr().read() }.chf(channel as usize) {
141 trace!("ipcc: ch {}: wait for tx free", channel as u8); 140 trace!("ipcc: ch {}: wait for tx free", channel as u8);
142 } 141 }
143 142
144 poll_fn(|cx| { 143 poll_fn(|cx| {
@@ -167,7 +166,7 @@ impl Ipcc {
167 loop { 166 loop {
168 // This is a race, but is nice for debugging 167 // This is a race, but is nice for debugging
169 if !unsafe { regs.cpu(1).sr().read() }.chf(channel as usize) { 168 if !unsafe { regs.cpu(1).sr().read() }.chf(channel as usize) {
170 trace!("ipcc: ch {}: wait for rx occupied", channel as u8); 169 trace!("ipcc: ch {}: wait for rx occupied", channel as u8);
171 } 170 }
172 171
173 poll_fn(|cx| { 172 poll_fn(|cx| {
@@ -188,8 +187,7 @@ impl Ipcc {
188 }) 187 })
189 .await; 188 .await;
190 189
191 trace!("ipcc: ch {}: read data", channel as u8); 190 trace!("ipcc: ch {}: read data", channel as u8);
192 compiler_fence(Ordering::SeqCst);
193 191
194 match f() { 192 match f() {
195 Some(ret) => return ret, 193 Some(ret) => return ret,
@@ -239,7 +237,7 @@ pub(crate) mod sealed {
239 } 237 }
240 } 238 }
241 239
242 pub fn rx_waker_for(&self, channel: IpccChannel) -> &AtomicWaker { 240 pub const fn rx_waker_for(&self, channel: IpccChannel) -> &AtomicWaker {
243 match channel { 241 match channel {
244 IpccChannel::Channel1 => &self.rx_wakers[0], 242 IpccChannel::Channel1 => &self.rx_wakers[0],
245 IpccChannel::Channel2 => &self.rx_wakers[1], 243 IpccChannel::Channel2 => &self.rx_wakers[1],
@@ -250,7 +248,7 @@ pub(crate) mod sealed {
250 } 248 }
251 } 249 }
252 250
253 pub fn tx_waker_for(&self, channel: IpccChannel) -> &AtomicWaker { 251 pub const fn tx_waker_for(&self, channel: IpccChannel) -> &AtomicWaker {
254 match channel { 252 match channel {
255 IpccChannel::Channel1 => &self.tx_wakers[0], 253 IpccChannel::Channel1 => &self.tx_wakers[0],
256 IpccChannel::Channel2 => &self.tx_wakers[1], 254 IpccChannel::Channel2 => &self.tx_wakers[1],