stm32: can: fd: on_interrupt: simplify, rm redundant code
PED, PEA are never enabled in the interrupt enable code in peripheral.rs; no need to process the flags here
This commit is contained in:
parent
bab4affe7c
commit
901bdfc7b8
1 changed files with 27 additions and 37 deletions
|
@ -44,50 +44,40 @@ impl<T: Instance> interrupt::typelevel::Handler<T::IT0Interrupt> for IT0Interrup
|
||||||
|
|
||||||
let ir = regs.ir().read();
|
let ir = regs.ir().read();
|
||||||
|
|
||||||
{
|
if ir.tc() {
|
||||||
if ir.tc() {
|
regs.ir().write(|w| w.set_tc(true));
|
||||||
regs.ir().write(|w| w.set_tc(true));
|
}
|
||||||
}
|
if ir.tefn() {
|
||||||
if ir.tefn() {
|
regs.ir().write(|w| w.set_tefn(true));
|
||||||
regs.ir().write(|w| w.set_tefn(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
match &T::state().tx_mode {
|
|
||||||
TxMode::NonBuffered(waker) => waker.wake(),
|
|
||||||
TxMode::ClassicBuffered(buf) => {
|
|
||||||
if !T::registers().tx_queue_is_full() {
|
|
||||||
match buf.tx_receiver.try_receive() {
|
|
||||||
Ok(frame) => {
|
|
||||||
_ = T::registers().write(&frame);
|
|
||||||
}
|
|
||||||
Err(_) => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TxMode::FdBuffered(buf) => {
|
|
||||||
if !T::registers().tx_queue_is_full() {
|
|
||||||
match buf.tx_receiver.try_receive() {
|
|
||||||
Ok(frame) => {
|
|
||||||
_ = T::registers().write(&frame);
|
|
||||||
}
|
|
||||||
Err(_) => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ir.ped() || ir.pea() {
|
match &T::state().tx_mode {
|
||||||
regs.ir().write(|w| {
|
TxMode::NonBuffered(waker) => waker.wake(),
|
||||||
w.set_ped(true);
|
TxMode::ClassicBuffered(buf) => {
|
||||||
w.set_pea(true);
|
if !T::registers().tx_queue_is_full() {
|
||||||
});
|
match buf.tx_receiver.try_receive() {
|
||||||
|
Ok(frame) => {
|
||||||
|
_ = T::registers().write(&frame);
|
||||||
|
}
|
||||||
|
Err(_) => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TxMode::FdBuffered(buf) => {
|
||||||
|
if !T::registers().tx_queue_is_full() {
|
||||||
|
match buf.tx_receiver.try_receive() {
|
||||||
|
Ok(frame) => {
|
||||||
|
_ = T::registers().write(&frame);
|
||||||
|
}
|
||||||
|
Err(_) => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ir.rfn(0) {
|
if ir.rfn(0) {
|
||||||
T::state().rx_mode.on_interrupt::<T>(0);
|
T::state().rx_mode.on_interrupt::<T>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ir.rfn(1) {
|
if ir.rfn(1) {
|
||||||
T::state().rx_mode.on_interrupt::<T>(1);
|
T::state().rx_mode.on_interrupt::<T>(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue