Struct capsules_extra::ieee802154::RadioDriver
source · pub struct RadioDriver<'a, M: MacDevice<'a>> { /* private fields */ }
Implementations§
source§impl<'a, M: MacDevice<'a>> RadioDriver<'a, M>
impl<'a, M: MacDevice<'a>> RadioDriver<'a, M>
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
pub fn set_key_procedure(&self, key_procedure: &'a dyn KeyProcedure)
pub fn set_device_procedure(&self, device_procedure: &'a dyn DeviceProcedure)
Trait Implementations§
source§impl<'a, M: MacDevice<'a>> DeferredCallClient for RadioDriver<'a, M>
impl<'a, M: MacDevice<'a>> DeferredCallClient for RadioDriver<'a, M>
source§impl<'a, M: MacDevice<'a>> DeviceProcedure for RadioDriver<'a, M>
impl<'a, M: MacDevice<'a>> DeviceProcedure for RadioDriver<'a, M>
source§fn lookup_addr_long(&self, addr: MacAddress) -> Option<[u8; 8]>
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>
impl<'a, M: MacDevice<'a>> KeyProcedure for RadioDriver<'a, M>
source§fn lookup_key(&self, level: SecurityLevel, key_id: KeyId) -> Option<[u8; 16]>
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>
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,
)
fn receive<'b>( &self, buf: &'b [u8], header: Header<'b>, lqi: u8, data_offset: usize, data_len: usize, )
source§impl<'a, M: MacDevice<'a>> SyscallDriver for RadioDriver<'a, M>
impl<'a, M: MacDevice<'a>> SyscallDriver for RadioDriver<'a, M>
source§fn command(
&self,
command_number: usize,
arg1: usize,
arg2: usize,
processid: ProcessId,
) -> CommandReturn
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>
fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>
source§fn allow_userspace_readable(
&self,
app: ProcessId,
which: usize,
slice: ReadWriteProcessBuffer,
) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>
fn allow_userspace_readable( &self, app: ProcessId, which: usize, slice: ReadWriteProcessBuffer, ) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>
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