Skip to main content

ta_invoke_command

Attribute Macro ta_invoke_command 

Source
#[ta_invoke_command]
Expand description

Attribute to declare the entry point of invoking commands.

The params argument may be any type that implements optee_utee::FromRawParameters (optee_utee::ParametersAny, a 4-tuple of typed wrappers, optee_utee::Parameters, etc.)

A session context &mut T can be defined as an optional first parameter (before cmd_id).

§Examples

ⓘ
// Old deprecated Parameters (no session context)
#[ta_invoke_command]
fn invoke_command(cmd_id: u32, params: &mut Parameters) -> Result<()> { }

// New typed parameters
use optee_utee::prelude::*;

// 4-tuple of typed wrappers
#[ta_invoke_command]
fn invoke_command(
    cmd_id: u32,
    params: &mut (
        ParameterNone,
        ParameterMemrefInput<'_>,
        ParameterValueOutput<'_>,
        ParameterMemrefOutput<'_>,
    ),
) -> Result<()> { }
// use ParametersAny and check types with match later.
#[ta_invoke_command]
fn invoke_command(
    cmd_id: u32,
    params: &mut ParametersAny,
) -> Result<()> { }
// With session context
#[ta_invoke_command]
fn invoke_command(
    sess_ctx: &mut T,
    cmd_id: u32,
    params: &mut Parameters,
) -> Result<()> { }