TT Zephyr Platforms 18.11.99
Tenstorrent Firmware
|
In-memory ring buffer descriptor for Tenstorrent virtual UART. More...
#include <uart_tt_virt.h>
Data Fields | |
uint32_t | magic |
uint32_t | rx_cap |
uint32_t | rx_head |
uint32_t | rx_tail |
uint32_t | tx_cap |
uint32_t | tx_head |
uint32_t | tx_oflow |
uint32_t | tx_tail |
uint32_t | version |
uint8_t | buf [] |
In-memory ring buffer descriptor for Tenstorrent virtual UART.
This in-memory ring buffer descriptor describes two ring buffers in a contiguous section of uncached memory. Following the descriptor, there are tx_cap bytes of space for the transmit buffer, followed by rx_cap bytes of space for the receive buffer.
The tx_head, tx_tail, rx_head, and rx_tail variables are all up-counters (which may wrap around the 2^32 limit). Therefore, the transmit buffer should be read at an offset of zero added to the appropriate counter modulo tx_cap, and the receive buffer should be read at an offset of tx_cap added to the appropriate counter modulo rx_cap.
This convention mitigates ambiguity between empty and full buffers. A buffer is empty when the head and tail indices are equal. A buffer is full when the tail index is equal to the head index plus the buffer capacity.
Since this descriptor is intended to be shared between both a device, it is important to clarify that the transmit (tx) and receive (rx) directions are from the perspective of the device and should be reversed when viewed from the host. See also tt_vuart_role.
TODO: add a nice ascii-art diagram.
uint8_t tt_vuart::buf[] |
uint32_t tt_vuart::magic |
Magic number used to identify the virtual uart in memory
uint32_t tt_vuart::rx_cap |
Receive buffer capacity, in bytes
uint32_t tt_vuart::rx_head |
uint32_t tt_vuart::rx_tail |
Receive head counter
uint32_t tt_vuart::tx_cap |
Receive tail counter Transmit buffer capacity, in bytes
uint32_t tt_vuart::tx_head |
uint32_t tt_vuart::tx_oflow |
Transmit head counter
uint32_t tt_vuart::tx_tail |
Number of transmit overflows (device to host)
uint32_t tt_vuart::version |
Transmit tail counter Version info MS-Byte to LS-Byte [INST.MAJOR.MINOR.PATCH]