capsules_extra::ieee802154

Module 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.
  • 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.