fixed mistake with casting channel to a usize
This commit is contained in:
parent
8c733c29cc
commit
3ba73b5ff4
1 changed files with 14 additions and 14 deletions
|
@ -59,94 +59,94 @@ impl<'d> Ipcc<'d> {
|
|||
let regs = IPCC::regs();
|
||||
|
||||
// If bit is set to 1 then interrupt is disabled
|
||||
unsafe { regs.cpu(0).mr().modify(|w| w.set_chom(channel.into(), !enabled)) }
|
||||
unsafe { regs.cpu(0).mr().modify(|w| w.set_chom(channel as usize, !enabled)) }
|
||||
}
|
||||
|
||||
pub fn c1_get_rx_channel(&self, channel: IpccChannel) -> bool {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
// If bit is set to 1 then interrupt is disabled
|
||||
unsafe { !regs.cpu(0).mr().read().chom(channel.into()) }
|
||||
unsafe { !regs.cpu(0).mr().read().chom(channel as usize) }
|
||||
}
|
||||
|
||||
pub fn c2_set_rx_channel(&mut self, channel: IpccChannel, enabled: bool) {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
// If bit is set to 1 then interrupt is disabled
|
||||
unsafe { regs.cpu(1).mr().modify(|w| w.set_chom(channel.into(), !enabled)) }
|
||||
unsafe { regs.cpu(1).mr().modify(|w| w.set_chom(channel as usize, !enabled)) }
|
||||
}
|
||||
|
||||
pub fn c2_get_rx_channel(&self, channel: IpccChannel) -> bool {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
// If bit is set to 1 then interrupt is disabled
|
||||
unsafe { !regs.cpu(1).mr().read().chom(channel.into()) }
|
||||
unsafe { !regs.cpu(1).mr().read().chom(channel as usize) }
|
||||
}
|
||||
|
||||
pub fn c1_set_tx_channel(&mut self, channel: IpccChannel, enabled: bool) {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
// If bit is set to 1 then interrupt is disabled
|
||||
unsafe { regs.cpu(0).mr().modify(|w| w.set_chfm(channel.into(), !enabled)) }
|
||||
unsafe { regs.cpu(0).mr().modify(|w| w.set_chfm(channel as usize, !enabled)) }
|
||||
}
|
||||
|
||||
pub fn c1_get_tx_channel(&self, channel: IpccChannel) -> bool {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
// If bit is set to 1 then interrupt is disabled
|
||||
unsafe { !regs.cpu(0).mr().read().chfm(channel.into()) }
|
||||
unsafe { !regs.cpu(0).mr().read().chfm(channel as usize) }
|
||||
}
|
||||
|
||||
pub fn c2_set_tx_channel(&mut self, channel: IpccChannel, enabled: bool) {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
// If bit is set to 1 then interrupt is disabled
|
||||
unsafe { regs.cpu(1).mr().modify(|w| w.set_chfm(channel.into(), !enabled)) }
|
||||
unsafe { regs.cpu(1).mr().modify(|w| w.set_chfm(channel as usize, !enabled)) }
|
||||
}
|
||||
|
||||
pub fn c2_get_tx_channel(&self, channel: IpccChannel) -> bool {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
// If bit is set to 1 then interrupt is disabled
|
||||
unsafe { !regs.cpu(1).mr().read().chfm(channel.into()) }
|
||||
unsafe { !regs.cpu(1).mr().read().chfm(channel as usize) }
|
||||
}
|
||||
|
||||
/// clears IPCC receive channel status for CPU1
|
||||
pub fn c1_clear_flag_channel(&mut self, channel: IpccChannel) {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
unsafe { regs.cpu(0).scr().write(|w| w.set_chc(channel.into(), true)) }
|
||||
unsafe { regs.cpu(0).scr().write(|w| w.set_chc(channel as usize, true)) }
|
||||
}
|
||||
|
||||
/// clears IPCC receive channel status for CPU2
|
||||
pub fn c2_clear_flag_channel(&mut self, channel: IpccChannel) {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
unsafe { regs.cpu(1).scr().write(|w| w.set_chc(channel.into(), true)) }
|
||||
unsafe { regs.cpu(1).scr().write(|w| w.set_chc(channel as usize, true)) }
|
||||
}
|
||||
|
||||
pub fn c1_set_flag_channel(&mut self, channel: IpccChannel) {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
unsafe { regs.cpu(0).scr().write(|w| w.set_chs(channel.into(), true)) }
|
||||
unsafe { regs.cpu(0).scr().write(|w| w.set_chs(channel as usize, true)) }
|
||||
}
|
||||
|
||||
pub fn c2_set_flag_channel(&mut self, channel: IpccChannel) {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
unsafe { regs.cpu(1).scr().write(|w| w.set_chs(channel.into(), true)) }
|
||||
unsafe { regs.cpu(1).scr().write(|w| w.set_chs(channel as usize, true)) }
|
||||
}
|
||||
|
||||
pub fn c1_is_active_flag(&self, channel: IpccChannel) -> bool {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
unsafe { regs.cpu(0).sr().read().chf(channel.into()) }
|
||||
unsafe { regs.cpu(0).sr().read().chf(channel as usize) }
|
||||
}
|
||||
|
||||
pub fn c2_is_active_flag(&self, channel: IpccChannel) -> bool {
|
||||
let regs = IPCC::regs();
|
||||
|
||||
unsafe { regs.cpu(1).sr().read().chf(channel.into()) }
|
||||
unsafe { regs.cpu(1).sr().read().chf(channel as usize) }
|
||||
}
|
||||
|
||||
pub fn is_tx_pending(&self, channel: IpccChannel) -> bool {
|
||||
|
|
Loading…
Reference in a new issue