diff --git a/Cargo.toml b/Cargo.toml index 156cd29..1384f02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,5 +15,5 @@ panic_handler = [ "dep:log" ] [dependencies] cty = "*" -a653rs = { version = "0.3", features = ["strum"] } +a653rs = { version = "0.4", features = ["strum", "bindings"] } log = { version = "0.4", optional = true } diff --git a/src/apex/error.rs b/src/apex/error.rs index 1aa6499..7152301 100644 --- a/src/apex/error.rs +++ b/src/apex/error.rs @@ -6,7 +6,7 @@ use super::XngHypervisor; use crate::bindings::*; impl ApexErrorP4 for XngHypervisor { - fn report_application_message(message: &[ApexByte]) -> Result<(), ErrorReturnCode> { + fn report_application_message(message: &[ApexByte]) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { REPORT_APPLICATION_MESSAGE( @@ -18,7 +18,7 @@ impl ApexErrorP4 for XngHypervisor { } } - fn raise_application_error( + fn raise_application_error( error_code: ErrorCode, message: &[ApexByte], ) -> Result<(), ErrorReturnCode> { @@ -36,7 +36,7 @@ impl ApexErrorP4 for XngHypervisor { } impl ApexErrorP1 for XngHypervisor { - fn create_error_handler( + fn create_error_handler( entry_point: SystemAddress, stack_size: StackSize, ) -> Result<(), ErrorReturnCode> { @@ -51,11 +51,11 @@ impl ApexErrorP1 for XngHypervisor { } } - fn get_error_status() -> Result { + fn get_error_status() -> Result { todo!() } - fn configure_error_handler( + fn configure_error_handler( _concurrency_control: ErrorHandlerConcurrencyControl, _processor_core_id: ProcessorCoreId, ) -> Result<(), ErrorReturnCode> { diff --git a/src/apex/partition.rs b/src/apex/partition.rs index 7bf253b..c0760a2 100644 --- a/src/apex/partition.rs +++ b/src/apex/partition.rs @@ -6,7 +6,7 @@ use super::XngHypervisor; use crate::bindings::*; impl ApexPartitionP4 for XngHypervisor { - fn get_partition_status() -> ApexPartitionStatus { + fn get_partition_status() -> ApexPartitionStatus { let mut status = MaybeUninit::uninit(); unsafe { GET_PARTITION_STATUS(status.as_mut_ptr(), MaybeUninit::uninit().as_mut_ptr()); @@ -28,9 +28,7 @@ impl ApexPartitionP4 for XngHypervisor { } } - fn set_partition_mode( - operating_mode: OperatingMode, - ) -> Result<(), ErrorReturnCode> { + fn set_partition_mode(operating_mode: OperatingMode) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { SET_PARTITION_MODE( diff --git a/src/apex/process.rs b/src/apex/process.rs index 798363b..5ed045d 100644 --- a/src/apex/process.rs +++ b/src/apex/process.rs @@ -6,9 +6,7 @@ use super::XngHypervisor; use crate::bindings::*; impl ApexProcessP4 for XngHypervisor { - fn create_process( - attributes: &ApexProcessAttribute, - ) -> Result { + fn create_process(attributes: &ApexProcessAttribute) -> Result { let mut return_code = MaybeUninit::uninit(); let mut process_id = MaybeUninit::uninit(); // Ensure that the last two characters of the name are not used. @@ -40,7 +38,7 @@ impl ApexProcessP4 for XngHypervisor { } } - fn start(process_id: ProcessId) -> Result<(), ErrorReturnCode> { + fn start(process_id: ProcessId) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { START(process_id as PROCESS_ID_TYPE, return_code.as_mut_ptr()); @@ -50,10 +48,7 @@ impl ApexProcessP4 for XngHypervisor { } impl ApexProcessP1 for XngHypervisor { - fn set_priority( - process_id: ProcessId, - priority: Priority, - ) -> Result<(), ErrorReturnCode> { + fn set_priority(process_id: ProcessId, priority: Priority) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { SET_PRIORITY( @@ -65,7 +60,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn suspend_self(time_out: ApexSystemTime) -> Result<(), ErrorReturnCode> { + fn suspend_self(time_out: ApexSystemTime) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { SUSPEND_SELF(time_out, return_code.as_mut_ptr()); @@ -73,7 +68,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn suspend(process_id: ProcessId) -> Result<(), ErrorReturnCode> { + fn suspend(process_id: ProcessId) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { SUSPEND(process_id as PROCESS_ID_TYPE, return_code.as_mut_ptr()); @@ -81,7 +76,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn resume(process_id: ProcessId) -> Result<(), ErrorReturnCode> { + fn resume(process_id: ProcessId) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { RESUME(process_id as PROCESS_ID_TYPE, return_code.as_mut_ptr()); @@ -89,13 +84,13 @@ impl ApexProcessP1 for XngHypervisor { } } - fn stop_self() { + fn stop_self() { unsafe { STOP_SELF(); } } - fn stop(process_id: ProcessId) -> Result<(), ErrorReturnCode> { + fn stop(process_id: ProcessId) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { STOP(process_id as PROCESS_ID_TYPE, return_code.as_mut_ptr()); @@ -103,7 +98,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn delayed_start( + fn delayed_start( process_id: ProcessId, delay_time: ApexSystemTime, ) -> Result<(), ErrorReturnCode> { @@ -118,7 +113,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn lock_preemption() -> Result { + fn lock_preemption() -> Result { let mut return_code = MaybeUninit::uninit(); let mut lock_level = MaybeUninit::uninit(); unsafe { @@ -128,7 +123,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn unlock_preemption() -> Result { + fn unlock_preemption() -> Result { let mut return_code = MaybeUninit::uninit(); let mut lock_level = MaybeUninit::uninit(); unsafe { @@ -138,7 +133,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn get_my_id() -> Result { + fn get_my_id() -> Result { let mut return_code = MaybeUninit::uninit(); let mut process_id = MaybeUninit::uninit(); unsafe { @@ -148,7 +143,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn get_process_id(process_name: ProcessName) -> Result { + fn get_process_id(process_name: ProcessName) -> Result { let mut return_code = MaybeUninit::uninit(); let mut process_id = MaybeUninit::uninit(); unsafe { @@ -162,9 +157,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn get_process_status( - process_id: ProcessId, - ) -> Result { + fn get_process_status(process_id: ProcessId) -> Result { let mut return_code = MaybeUninit::uninit(); let mut status = MaybeUninit::uninit(); unsafe { @@ -197,7 +190,7 @@ impl ApexProcessP1 for XngHypervisor { } } - fn initialize_process_core_affinity( + fn initialize_process_core_affinity( _process_id: ProcessId, _processor_core_id: ProcessorCoreId, ) -> Result<(), ErrorReturnCode> { @@ -216,12 +209,12 @@ impl ApexProcessP1 for XngHypervisor { Err(ErrorReturnCode::NotAvailable) } - fn get_my_processor_core_id() -> ProcessorCoreId { + fn get_my_processor_core_id() -> ProcessorCoreId { // TODO check whether this is good 0 } - fn get_my_index() -> Result { + fn get_my_index() -> Result { // TODO check whether this is good /* let mut return_code = MaybeUninit::uninit(); diff --git a/src/apex/queuing.rs b/src/apex/queuing.rs index 69af6ad..a555be8 100644 --- a/src/apex/queuing.rs +++ b/src/apex/queuing.rs @@ -6,7 +6,7 @@ use super::XngHypervisor; use crate::bindings::*; impl ApexQueuingPortP4 for XngHypervisor { - fn create_queuing_port( + fn create_queuing_port( queuing_port_name: QueuingPortName, max_message_size: MessageSize, max_nb_message: MessageRange, @@ -30,7 +30,7 @@ impl ApexQueuingPortP4 for XngHypervisor { } } - fn send_queuing_message( + fn send_queuing_message( queuing_port_id: QueuingPortId, message: &[ApexByte], time_out: ApexSystemTime, @@ -48,7 +48,7 @@ impl ApexQueuingPortP4 for XngHypervisor { } } - unsafe fn receive_queuing_message( + unsafe fn receive_queuing_message( queuing_port_id: QueuingPortId, time_out: ApexSystemTime, message: &mut [ApexByte], @@ -66,7 +66,7 @@ impl ApexQueuingPortP4 for XngHypervisor { Ok(msg_len.assume_init() as MessageSize) } - fn get_queuing_port_status( + fn get_queuing_port_status( queuing_port_id: QueuingPortId, ) -> Result { let mut return_code = MaybeUninit::uninit(); @@ -89,9 +89,7 @@ impl ApexQueuingPortP4 for XngHypervisor { } } - fn clear_queuing_port( - queuing_port_id: QueuingPortId, - ) -> Result<(), ErrorReturnCode> { + fn clear_queuing_port(queuing_port_id: QueuingPortId) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { CLEAR_QUEUING_PORT( @@ -104,7 +102,7 @@ impl ApexQueuingPortP4 for XngHypervisor { } impl ApexQueuingPortP1 for XngHypervisor { - fn get_queuing_port_id( + fn get_queuing_port_id( queuing_port_name: QueuingPortName, ) -> Result { let mut return_code = MaybeUninit::uninit(); diff --git a/src/apex/sampling.rs b/src/apex/sampling.rs index 6966fe1..1ceff9d 100644 --- a/src/apex/sampling.rs +++ b/src/apex/sampling.rs @@ -6,7 +6,7 @@ use super::XngHypervisor; use crate::bindings::*; impl ApexSamplingPortP4 for XngHypervisor { - fn create_sampling_port( + fn create_sampling_port( sampling_port_name: SamplingPortName, max_message_size: MessageSize, port_direction: PortDirection, @@ -34,7 +34,7 @@ impl ApexSamplingPortP4 for XngHypervisor { } } - fn write_sampling_message( + fn write_sampling_message( sampling_port_id: SamplingPortId, message: &[ApexByte], ) -> Result<(), ErrorReturnCode> { @@ -50,7 +50,7 @@ impl ApexSamplingPortP4 for XngHypervisor { } } - unsafe fn read_sampling_message( + unsafe fn read_sampling_message( sampling_port_id: SamplingPortId, message: &mut [ApexByte], ) -> Result<(Validity, MessageSize), ErrorReturnCode> { @@ -73,7 +73,7 @@ impl ApexSamplingPortP4 for XngHypervisor { } impl ApexSamplingPortP1 for XngHypervisor { - fn get_sampling_port_id( + fn get_sampling_port_id( sampling_port_name: SamplingPortName, ) -> Result { let mut return_code = MaybeUninit::uninit(); @@ -89,7 +89,7 @@ impl ApexSamplingPortP1 for XngHypervisor { } } - fn get_sampling_port_status( + fn get_sampling_port_status( sampling_port_id: SamplingPortId, ) -> Result { let mut return_code = MaybeUninit::uninit(); diff --git a/src/apex/schedules.rs b/src/apex/schedules.rs index 6dc4e24..a5cbc24 100644 --- a/src/apex/schedules.rs +++ b/src/apex/schedules.rs @@ -6,7 +6,7 @@ use super::XngHypervisor; use crate::bindings::*; impl ApexScheduleP2 for XngHypervisor { - fn set_module_schedule(schedule_id: ScheduleId) -> Result<(), ErrorReturnCode> { + fn set_module_schedule(schedule_id: ScheduleId) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { SET_MODULE_SCHEDULE(schedule_id as SCHEDULE_ID_TYPE, return_code.as_mut_ptr()); @@ -14,7 +14,7 @@ impl ApexScheduleP2 for XngHypervisor { } } - fn get_module_schedule_status() -> Result { + fn get_module_schedule_status() -> Result { let mut return_code = MaybeUninit::uninit(); let mut status = MaybeUninit::uninit(); unsafe { @@ -29,9 +29,7 @@ impl ApexScheduleP2 for XngHypervisor { } } - fn get_module_schedule_id( - schedule_name: ScheduleName, - ) -> Result { + fn get_module_schedule_id(schedule_name: ScheduleName) -> Result { let mut return_code = MaybeUninit::uninit(); let mut schedule_id = MaybeUninit::uninit(); unsafe { diff --git a/src/apex/time.rs b/src/apex/time.rs index d73f5df..e5d8681 100644 --- a/src/apex/time.rs +++ b/src/apex/time.rs @@ -24,7 +24,7 @@ impl ApexTimeP4 for XngHypervisor { } impl ApexTimeP1 for XngHypervisor { - fn timed_wait(delay_time: ApexSystemTime) -> Result<(), ErrorReturnCode> { + fn timed_wait(delay_time: ApexSystemTime) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { TIMED_WAIT(delay_time, return_code.as_mut_ptr()); @@ -32,7 +32,7 @@ impl ApexTimeP1 for XngHypervisor { } } - fn replenish(budget_time: ApexSystemTime) -> Result<(), ErrorReturnCode> { + fn replenish(budget_time: ApexSystemTime) -> Result<(), ErrorReturnCode> { let mut return_code = MaybeUninit::uninit(); unsafe { REPLENISH(budget_time, return_code.as_mut_ptr());