STRUCT BCM2835_SPI(9)
π struct bcm2835_spi β BCM2835 SPI controller π
okay so bestie, this is the kernel API manual page for struct bcm2835_spi(9), and it's lowkey one of those pages that looks like a giant struct but is actually just the BCM2835 SPI controller's whole personality in C form. no cap. β¨
πΈ NAME πΈ
struct bcm2835_spi β BCM2835 SPI controller. that's it, that's the vibe. π
π¦ SYNOPSIS π¦
struct bcm2835_spi {
void __iomem *regs;
struct clk *clk;
struct gpio_desc *cs_gpio;
unsigned long clk_hz;
int irq;
struct spi_transfer *tfr;
struct spi_controller *ctlr;
const u8 *tx_buf;
u8 *rx_buf;
int tx_len;
int rx_len;
int tx_prologue;
int rx_prologue;
unsigned int tx_spillover;
struct dentry *debugfs_dir;
u64 count_transfer_polling;
u64 count_transfer_irq;
u64 count_transfer_irq_after_polling;
u64 count_transfer_dma;
struct bcm2835_spidev *target;
unsigned int tx_dma_active;
unsigned int rx_dma_active;
struct dma_async_tx_descriptor *fill_tx_desc;
dma_addr_t fill_tx_addr;
};
she's giving "struct with lore" and honestly? obsessed. π
π Members π
regsβ base address of the register map. the home base, the main character location. πΊοΈclkβ the core clock, divided to calculate the serial clock. math but make it sparkly. β¨cs_gpioβ chip-select GPIO descriptor. it's the little handle that says "this one, bestie." π«Άclk_hzβ the core clock's cached speed. cached, so we don't have to keep asking. πirqβ the interrupt; it signals when TX FIFO is empty or RX FIFO is ΒΎ full. yes, exactly ΒΎ, not 3/4 casually β the manual said ΒΎ and we respect it. πtfrβ the SPI transfer currently being processed. current hyperfixation, basically. π₯ctlrβ SPI controller reverse lookup. like finding the controller's insta from its @ handle. πtx_bufβ pointer where the next transmitted byte is read from. the outgoing mail slot. π€rx_bufβ pointer where the next received byte is written. the incoming mail slot. π₯tx_lenβ remaining bytes to transmit. how much yapping is left, in bytes. π£οΈrx_lenβ remaining bytes to receive. how much listening is left, in bytes. πtx_prologueβ bytes transmitted without DMA if the first TX sglist entry's length is not a multiple of 4 (to overcome a hardware limitation). not me fixing the hardware's little quirk with a prologue. π§rx_prologueβ bytes received without DMA if the first RX sglist entry's length is not a multiple of 4 (to overcome a hardware limitation). same energy, receive edition. π¦tx_spilloverβ whethertx_prologuespills over into the second TX sglist entry. spill the tea, but like, into the next sglist entry. πdebugfs_dirβ the debugfs directory β neede to remove debugfs when unloading the module. yes bestie, "neede" is literally what the source says, and honestly? relatable typo. πcount_transfer_pollingβ count of how often polling mode is used. keeping receipts on polling. π§Ύcount_transfer_irqβ count of how often interrupt mode is used. keeping receipts on interrupts too. π₯count_transfer_irq_after_pollingβ count of how often we fall back to interrupt mode after starting in polling mode. and these are counted as well incount_transfer_pollingandcount_transfer_irqβ yes, double-counted, it's giving "counted twice because the vibes require it." πcount_transfer_dmaβ count how often DMA mode is used. DMA receipt-keeping: activated. πtargetβ SPI target currently selected (used bybcm2835_spi_dma_tx_doneto writeclear_rx_cs). the chosen one, iykyk. πtx_dma_activeβ whether a TX DMA descriptor is in progress. is TX DMA active? the field says yes/no. iconic. πrx_dma_activeβ whether a RX DMA descriptor is in progress (used bybcm2835_spi_dma_tx_doneto handle a race). yes, there's a race, and this field is the little referee. πfill_tx_descβ a preallocated TX DMA descriptor used for RX-only transfers (it cyclically copies from zero page to TX FIFO). zero page to TX FIFO on loop, like a playlist you put on repeat. πfill_tx_addrβ bus address of zero page. the address of the zero page, bestie. that's the fact. π«Ά
π« SEE ALSO π«
- Kernel file
./drivers/spi/spi-bcm2835.c struct bcm2835_spidev(9)bcm2835_rd_fifo_count(9)bcm2835_wr_fifo_count(9)bcm2835_wait_tx_fifo_empty(9)bcm2835_rd_fifo_blind(9)bcm2835_wr_fifo_blind(9)bcm2835_spi_transfer_prologue(9)bcm2835_spi_undo_prologue(9)bcm2835_spi_dma_rx_done(9)bcm2835_spi_dma_tx_done(9)bcm2835_spi_prepare_sg(9)bcm2835_spi_transfer_one_dma(9)
and that's the page, bestie. this little baddie lives at source ./drivers/spi and is dated October 2026 β screenshot it, cite it, slay it. πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms