Module abi::bbqueue_ipc

source ·
Expand description

§BBQueue

BBQueue, short for “BipBuffer Queue”, is a Single Producer Single Consumer, lockless, no_std, thread safe, queue, based on BipBuffers. For more info on the design of the lock-free algorithm used by bbqueue, see this blog post.

For a 90 minute guided tour of BBQueue, you can also view this guide on YouTube.

BBQueue is designed (primarily) to be a First-In, First-Out queue for use with DMA on embedded systems.

While Circular/Ring Buffers allow you to send data between two threads (or from an interrupt to main code), you must push the data one piece at a time. With BBQueue, you instead are granted a block of contiguous memory, which can be filled (or emptied) by a DMA engine.

§Features

By default BBQueue uses atomic operations which are available on most platforms. However on some (mostly embedded) platforms atomic support is limited and with the default features you will get a compiler error about missing atomic methods.

This crate contains special support for Cortex-M0(+) targets with the thumbv6 feature. By enabling the feature, unsupported atomic operations will be replaced with critical sections implemented by disabling interrupts. The critical sections are very short, a few instructions at most, so they should make no difference to most applications.

Modules§

  • bbbuffer 🔒
  • A Framed flavor of BBQueue, useful for variable length packets

Structs§

  • A backing structure for a BBQueue. Can be used to create either a BBQueue or a split Producer/Consumer pair
  • Consumer is the primary interface for reading data from a BBBuffer.
  • A structure representing a contiguous region of memory that may be read from, and potentially “released” (or cleared) from the queue
  • A structure representing a contiguous region of memory that may be written to, and potentially “committed” to the queue.
  • Producer is the primary interface for pushing data into a BBBuffer. There are various methods for obtaining a grant to write to the buffer, with different potential tradeoffs. As all grants are required to be a contiguous range of data, different strategies are sometimes useful when making the decision between maximizing usage of the buffer, and ensuring a given grant is successful.
  • A structure representing up to two contiguous regions of memory that may be read from, and potentially “released” (or cleared) from the queue

Enums§

  • Error type used by the BBQueue interfaces

Type Aliases§

  • Result type used by the BBQueue interfaces