mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
update to use new api opcode name
This commit is contained in:
parent
83cc5e5a6a
commit
8cd43cab20
1 changed files with 16 additions and 15 deletions
|
|
@ -79,7 +79,7 @@ fn iox_irq_handler(_irq_no: usize, arg: *mut usize) {
|
|||
xous::try_send_message(
|
||||
handler.cid,
|
||||
xous::Message::Scalar(ScalarMessage::from_usize(
|
||||
Opcode::IrqLocalHandler.to_usize().unwrap(),
|
||||
HalOpcode::IrqLocalHandler.to_usize().unwrap(),
|
||||
pending as usize,
|
||||
0,
|
||||
0,
|
||||
|
|
@ -312,10 +312,11 @@ fn main() {
|
|||
loop {
|
||||
xous::reply_and_receive_next(sid, &mut msg_opt).unwrap();
|
||||
let msg = msg_opt.as_mut().unwrap();
|
||||
let opcode = num_traits::FromPrimitive::from_usize(msg.body.id()).unwrap_or(api::Opcode::InvalidCall);
|
||||
let opcode =
|
||||
num_traits::FromPrimitive::from_usize(msg.body.id()).unwrap_or(api::HalOpcode::InvalidCall);
|
||||
log::debug!("{:?}", opcode);
|
||||
match opcode {
|
||||
Opcode::MapIfram => {
|
||||
HalOpcode::MapIfram => {
|
||||
if let Some(scalar) = msg.body.scalar_message_mut() {
|
||||
let requested_size = scalar.arg1; // requested size
|
||||
let requested_bank = scalar.arg2; // Specifies bank 0, 1, or don't care (any number but 0 or 1)
|
||||
|
|
@ -360,7 +361,7 @@ fn main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
Opcode::UnmapIfram => {
|
||||
HalOpcode::UnmapIfram => {
|
||||
if let Some(scalar) = msg.body.scalar_message() {
|
||||
let mapped_size = scalar.arg1;
|
||||
let phys_addr = scalar.arg2;
|
||||
|
|
@ -391,7 +392,7 @@ fn main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
Opcode::ConfigureIox => {
|
||||
HalOpcode::ConfigureIox => {
|
||||
let buf =
|
||||
unsafe { xous_ipc::Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
||||
let config = buf.to_original::<IoxConfigMessage, _>().unwrap();
|
||||
|
|
@ -414,7 +415,7 @@ fn main() {
|
|||
iox.set_drive_strength(config.port, config.pin, s);
|
||||
}
|
||||
}
|
||||
Opcode::ConfigureIoxIrq => {
|
||||
HalOpcode::ConfigureIoxIrq => {
|
||||
let buf =
|
||||
unsafe { xous_ipc::Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
||||
let registration = buf.to_original::<IoxIrqRegistration, _>().unwrap();
|
||||
|
|
@ -464,7 +465,7 @@ fn main() {
|
|||
panic!("Ran out of Iox interrupt slots: maximum 8 available");
|
||||
}
|
||||
}
|
||||
Opcode::IrqLocalHandler => {
|
||||
HalOpcode::IrqLocalHandler => {
|
||||
// Figure out which port(s) caused the IRQ
|
||||
let irq_flag = iox.csr.r(utralib::utra::iox::SFR_INTFR);
|
||||
// clear the set bit by writing it back
|
||||
|
|
@ -497,7 +498,7 @@ fn main() {
|
|||
);
|
||||
}
|
||||
}
|
||||
Opcode::SetGpioBank => {
|
||||
HalOpcode::SetGpioBank => {
|
||||
if let Some(scalar) = msg.body.scalar_message() {
|
||||
let port: IoxPort = num_traits::FromPrimitive::from_usize(scalar.arg1).unwrap();
|
||||
let value = scalar.arg2 as u16;
|
||||
|
|
@ -505,13 +506,13 @@ fn main() {
|
|||
iox.set_gpio_bank(port, value, bitmask);
|
||||
}
|
||||
}
|
||||
Opcode::GetGpioBank => {
|
||||
HalOpcode::GetGpioBank => {
|
||||
if let Some(scalar) = msg.body.scalar_message_mut() {
|
||||
let port: IoxPort = num_traits::FromPrimitive::from_usize(scalar.arg1).unwrap();
|
||||
scalar.arg1 = iox.get_gpio_bank(port) as usize;
|
||||
}
|
||||
}
|
||||
Opcode::ConfigureUdmaClock => {
|
||||
HalOpcode::ConfigureUdmaClock => {
|
||||
if let Some(scalar) = msg.body.scalar_message() {
|
||||
let periph: PeriphId = num_traits::FromPrimitive::from_usize(scalar.arg1).unwrap();
|
||||
let enable = if scalar.arg2 != 0 { true } else { false };
|
||||
|
|
@ -522,7 +523,7 @@ fn main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
Opcode::ConfigureUdmaEvent => {
|
||||
HalOpcode::ConfigureUdmaEvent => {
|
||||
if let Some(scalar) = msg.body.scalar_message() {
|
||||
let periph: PeriphId = num_traits::FromPrimitive::from_usize(scalar.arg1).unwrap();
|
||||
let event_offset = scalar.arg2 as u32;
|
||||
|
|
@ -534,13 +535,13 @@ fn main() {
|
|||
udma_global.map_event_with_offset(periph, event_offset, to_channel);
|
||||
}
|
||||
}
|
||||
Opcode::PeriphReset => {
|
||||
HalOpcode::PeriphReset => {
|
||||
if let Some(scalar) = msg.body.scalar_message() {
|
||||
let periph: PeriphId = num_traits::FromPrimitive::from_usize(scalar.arg1).unwrap();
|
||||
udma_global.reset(periph);
|
||||
}
|
||||
}
|
||||
Opcode::I2c => {
|
||||
HalOpcode::I2c => {
|
||||
let mut buf = unsafe {
|
||||
xous_ipc::Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap())
|
||||
};
|
||||
|
|
@ -568,10 +569,10 @@ fn main() {
|
|||
}
|
||||
buf.replace(list).expect("I2c message format error");
|
||||
}
|
||||
Opcode::InvalidCall => {
|
||||
HalOpcode::InvalidCall => {
|
||||
log::error!("Invalid opcode received: {:?}", msg);
|
||||
}
|
||||
Opcode::Quit => {
|
||||
HalOpcode::Quit => {
|
||||
log::info!("Received quit opcode, exiting.");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue