capsules_extra::ieee802154

Struct RadioDriver

Source
pub struct RadioDriver<'a, M: MacDevice<'a>> { /* private fields */ }

Implementations§

Source§

impl<'a, M: MacDevice<'a>> RadioDriver<'a, M>

Source

pub fn new( mac: &'a M, grant: Grant<App, UpcallCount<{ upcall::COUNT }>, AllowRoCount<{ ro_allow::COUNT }>, AllowRwCount<{ rw_allow::COUNT }>>, kernel_tx: &'static mut [u8], ) -> Self

Source

pub fn set_key_procedure(&self, key_procedure: &'a dyn KeyProcedure)

Source

pub fn set_device_procedure(&self, device_procedure: &'a dyn DeviceProcedure)

Trait Implementations§

Source§

impl<'a, M: MacDevice<'a>> DeferredCallClient for RadioDriver<'a, M>

Source§

fn handle_deferred_call(&self)

Software interrupt function that is called when the deferred call is triggered.
Source§

fn register(&'static self)

Source§

impl<'a, M: MacDevice<'a>> DeviceProcedure for RadioDriver<'a, M>

Source§

fn lookup_addr_long(&self, addr: MacAddress) -> Option<[u8; 8]>

Gets the long address corresponding to the neighbor that matches the given MAC address. If no such neighbor exists, returns None.

Source§

impl<'a, M: MacDevice<'a>> KeyProcedure for RadioDriver<'a, M>

Source§

fn lookup_key(&self, level: SecurityLevel, key_id: KeyId) -> Option<[u8; 16]>

Gets the key corresponding to the key that matches the given security level level and key ID key_id. If no such key matches, returns None.

Source§

impl<'a, M: MacDevice<'a>> RxClient for RadioDriver<'a, M>

Source§

fn receive<'b>( &self, buf: &'b [u8], header: Header<'b>, lqi: u8, data_offset: usize, data_len: usize, )

When a frame is received, this callback is triggered. The client only receives an immutable borrow of the buffer. Only completely valid, unsecured frames that have passed the incoming security procedure are exposed to the client. Read more
Source§

impl<'a, M: MacDevice<'a>> SyscallDriver for RadioDriver<'a, M>

Source§

fn command( &self, command_number: usize, arg1: usize, arg2: usize, processid: ProcessId, ) -> CommandReturn

IEEE 802.15.4 MAC device control.

For some of the below commands, one 32-bit argument is not enough to contain the desired input parameters or output data. For those commands, the config slice app_cfg (RW allow num 1) is used as a channel to shuffle information between kernel space and user space. The expected size of the slice varies by command, and acts essentially like a custom FFI. That is, the userspace library MUST allow() a buffer of the correct size, otherwise the call is INVAL. When used, the expected format is described below.

§command_num
  • 0: Driver existence check.
  • 1: Return radio status. Ok(())/OFF = on/off.
  • 2: Set short MAC address.
  • 3: Set long MAC address. app_cfg (in): 8 bytes: the long MAC address.
  • 4: Set PAN ID.
  • 5: Set channel.
  • 6: Set transmission power.
  • 7: Commit any configuration changes.
  • 8: Get the short MAC address.
  • 9: Get the long MAC address. app_cfg (out): 8 bytes: the long MAC address.
  • 10: Get the PAN ID.
  • 11: Get the channel.
  • 12: Get the transmission power.
  • 13: Get the maximum number of neighbors.
  • 14: Get the current number of neighbors.
  • 15: Get the short address of the neighbor at an index.
  • 16: Get the long address of the neighbor at an index. app_cfg (out): 8 bytes: the long MAC address.
  • 17: Add a new neighbor with the given short and long address. app_cfg (in): 8 bytes: the long MAC address.
  • 18: Remove the neighbor at an index.
  • 19: Get the maximum number of keys.
  • 20: Get the current number of keys.
  • 21: Get the security level of the key at an index.
  • 22: Get the key id of the key at an index. app_cfg (out): 1 byte: the key ID mode + up to 9 bytes: the key ID.
  • 23: Get the key at an index. app_cfg (out): 16 bytes: the key.
  • 24: Add a new key with the given description. app_cfg (in): 1 byte: the security level + 1 byte: the key ID mode + 9 bytes: the key ID (might not use all bytes) + 16 bytes: the key.
  • 25: Remove the key at an index.
  • 26: Transmit a frame (parse required). Take the provided payload and parameters to encrypt, form headers, and transmit the frame.
  • 28: Set long address.
  • 29: Get the long MAC address.
Source§

fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>

Request to allocate a capsule’s grant for a specific process. Read more
Source§

fn allow_userspace_readable( &self, app: ProcessId, which: usize, slice: ReadWriteProcessBuffer, ) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>

System call for a process to pass a buffer (a UserspaceReadableProcessBuffer) to the kernel that the kernel can either read or write. The kernel calls this method only after it checks that the entire buffer is within memory the process can both read and write. Read more
Source§

impl<'a, M: MacDevice<'a>> TxClient for RadioDriver<'a, M>

Source§

fn send_done( &self, spi_buf: &'static mut [u8], acked: bool, result: Result<(), ErrorCode>, )

When transmission is complete or fails, return the buffer used for transmission to the client. result indicates whether or not the transmission was successful. Read more

Auto Trait Implementations§

§

impl<'a, M> !Freeze for RadioDriver<'a, M>

§

impl<'a, M> !RefUnwindSafe for RadioDriver<'a, M>

§

impl<'a, M> !Send for RadioDriver<'a, M>

§

impl<'a, M> !Sync for RadioDriver<'a, M>

§

impl<'a, M> Unpin for RadioDriver<'a, M>

§

impl<'a, M> !UnwindSafe for RadioDriver<'a, M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.