Module capsules_extra::ieee802154::virtual_mac

source ·
Expand description

Virtual IEEE 802.15.4 MAC device

MuxMac provides multiplexed access to an 802.15.4 MAC device. This enables a single underlying 802.15.4 radio to be shared transparently by multiple users. For example, the kernel might want to send raw 802.15.4 frames and subsequently 6LoWPAN-encoded and fragmented IP packets. This capsule allows that to happen by providing a mechanism for sequencing transmission attempts, Every radio frame received is provided to all listening clients so that each client can perform its own frame filtering logic.

§Usage


// Create the mux.
let mux_mac = static_init!(
    capsules::ieee802154::virtual_mac::MuxMac<'static>,
    capsules::ieee802154::virtual_mac::MuxMac::new(&'static mac_device));
mac_device.set_transmit_client(mux_mac);
mac_device.set_receive_client(mux_mac);

// Everything that uses the virtualized MAC device must create one of these.
let virtual_mac = static_init!(
    capsules::ieee802154::virtual_mac::MacUser<'static>,
    capsules::ieee802154::virtual_mac::MacUser::new(mux_mac));
mux_mac.add_user(virtual_mac);

Structs§

  • Keep state for each Mac user. All users of the virtualized MAC interface need to create one of these and register it with the MAC device muxer MuxMac by calling MuxMac#add_user. Then, each MacUser behaves exactly like an independent MAC device, except MAC device state is shared between all MacUsers because there is only one MAC device. For example, the MAC device address is shared, so calling set_address on one MacUser sets the MAC address for all MacUsers.
  • IEE 802.15.4 MAC device muxer that keeps a list of MAC users and sequences any pending transmission requests. Any received frames from the underlying MAC device are sent to all users.