Module capsules_extra::ieee802154::phy_driver
source · Expand description
IEEE 802.15.4 userspace interface for configuration and transmit/receive.
Implements a userspace interface for sending and receiving raw IEEE 802.15.4 frames.
Sending - Userspace fully forms the 15.4 frame and passes it to the driver.
Receiving - The driver receives 15.4 frames and passes them to the process.
To accomplish this, the process must first allow
a read/write ring buffer
to the kernel. The kernel will then fill this buffer with received frames
and schedule an upcall upon receipt of the first packet.
The ring buffer provided by the process must be of the form:
| read index | write index | user_frame 0 | user_frame 1 | ... | user_frame n |
user_frame
denotes the 15.4 frame in addition to the relevant 3 bytes of
metadata (offset to data payload, length of data payload, and the MIC len).
The capsule assumes that this is the form of the buffer. Errors or deviation
in the form of the provided buffer will likely result in incomplete or
dropped packets.
Because the scheduled receive upcall must be handled by the process, there is no guarantee as to when this will occur and if additional packets will be received prior to the upcall being handled. Without a ring buffer (or some equivalent data structure), the original packet will be lost. The ring buffer allows for the upcall to be scheduled and for all received packets to be passed to the process. The ring buffer is designed to overwrite old packets if the buffer becomes full. If the process notices a high number of “dropped” packets, this may be the cause. The process can mitigate this issue by increasing the size of the ring buffer provided to the capsule.