Skip to content

Commit c9f751f

Browse files
committed
xous: add api support for scalar5
With the addition of scalar5, existing api calls must be updated to take advantage of it. This will allow `send_message()` to return a `scalar5`. Signed-off-by: Sean Cross <[email protected]>
1 parent da56475 commit c9f751f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

xous-rs/src/syscall.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ pub enum SysCall {
327327
/// * **Ok**: The Scalar / Send message was successfully sent, or the Borrow has finished
328328
/// * **Scalar1**: The Server returned a `Scalar1` value
329329
/// * **Scalar2**: The Server returned a `Scalar2` value
330+
/// * **Scalar5**: The Server returned a `Scalar5` value
330331
/// * **BlockedProcess**: In Hosted mode, the target process is now blocked
331332
///
332333
/// # Errors
@@ -342,6 +343,7 @@ pub enum SysCall {
342343
/// * **Ok**: The Scalar / Send message was successfully sent, or the Borrow has finished
343344
/// * **Scalar1**: The Server returned a `Scalar1` value
344345
/// * **Scalar2**: The Server returned a `Scalar2` value
346+
/// * **Scalar5**: The Server returned a `Scalar5` value
345347
/// * **BlockedProcess**: In Hosted mode, the target process is now blocked
346348
///
347349
/// # Errors
@@ -1210,6 +1212,7 @@ impl SysCall {
12101212
SysCall::TryConnect(_)
12111213
| SysCall::TryReceiveMessage(_)
12121214
| SysCall::ReturnToParent(_, _)
1215+
| SysCall::ReturnScalar5(_, _, _, _, _, _)
12131216
| SysCall::ReturnScalar2(_, _, _)
12141217
| SysCall::ReturnScalar1(_, _)
12151218
| SysCall::ReturnMemory(_, _, _, _)
@@ -1352,6 +1355,25 @@ pub fn return_scalar2(
13521355
}
13531356
}
13541357

1358+
/// Return 5 scalars to the provided message.
1359+
pub fn return_scalar5(
1360+
sender: MessageSender,
1361+
val1: usize,
1362+
val2: usize,
1363+
val3: usize,
1364+
val4: usize,
1365+
val5: usize,
1366+
) -> core::result::Result<(), Error> {
1367+
let result = rsyscall(SysCall::ReturnScalar5(sender, val1, val2, val3, val4, val5))?;
1368+
if let crate::Result::Ok = result {
1369+
Ok(())
1370+
} else if let Result::Error(e) = result {
1371+
Err(e)
1372+
} else {
1373+
Err(Error::InternalError)
1374+
}
1375+
}
1376+
13551377
/// Claim a hardware interrupt for this process.
13561378
pub fn claim_interrupt(
13571379
irq_no: usize,
@@ -1539,6 +1561,7 @@ pub fn try_send_message(connection: CID, message: Message) -> core::result::Resu
15391561
Ok(Result::Ok) => Ok(Result::Ok),
15401562
Ok(Result::Scalar1(a)) => Ok(Result::Scalar1(a)),
15411563
Ok(Result::Scalar2(a, b)) => Ok(Result::Scalar2(a, b)),
1564+
Ok(Result::Scalar5(a, b, c, d, e)) => Ok(Result::Scalar5(a, b, c, d, e)),
15421565
Ok(Result::MemoryReturned(offset, valid)) => Ok(Result::MemoryReturned(offset, valid)),
15431566
Err(e) => Err(e),
15441567
v => panic!("Unexpected return value: {:?}", v),
@@ -1581,6 +1604,7 @@ pub fn send_message(connection: CID, message: Message) -> core::result::Result<R
15811604
Ok(Result::Ok) => Ok(Result::Ok),
15821605
Ok(Result::Scalar1(a)) => Ok(Result::Scalar1(a)),
15831606
Ok(Result::Scalar2(a, b)) => Ok(Result::Scalar2(a, b)),
1607+
Ok(Result::Scalar5(a, b, c, d, e)) => Ok(Result::Scalar5(a, b, c, d, e)),
15841608
Ok(Result::MemoryReturned(offset, valid)) => Ok(Result::MemoryReturned(offset, valid)),
15851609
Err(e) => Err(e),
15861610
v => panic!("Unexpected return value: {:?}", v),

0 commit comments

Comments
 (0)