Need help converting lib that uses SPI to use UART in MSPI mode

Specifically, at the moment, I am trying to make the WaveHC lib work properly with the SD card on USART0, but I am having trouble figuring out which registers and bits correspond to one another.

Here’s the code I’m currently stuck on:

inline void spiSend(uint8_t b) 
SPDR = b; // Writing to the register initiates data transmission. 
while(!(SPSR & (1 << SPIF))); // Checks SPIF bit in SPSR.  When a serial transfer is complete, the SPIF Flag is set.

inline uint8_t spiRec(void) 
spiSend(0XFF); // Transmit 0xFF. I guess this tells the SPI card to send a byte?
return SPDR; // Read byte returned.

And here’s some notes I copied from the datasheet:

SPDR - Pg 173:
The SPI Data Register is a read/write register used for data transfer between the Register File
and the SPI Shift Register. Writing to the register initiates data transmission. Reading the register
causes the Shift Register Receive buffer to be read.

SPSR contains: (Pg 172)

• Bit 7 – SPIF: SPI Interrupt Flag
When a serial transfer is complete, the SPIF Flag is set. An interrupt is generated if SPIE in
SPCR is set and global interrupts are enabled. If SS is an input and is driven low when the SPI is
in Master mode, this will also set the SPIF Flag. SPIF is cleared by hardware when executing the
corresponding interrupt handling vector. Alternatively, the SPIF bit is cleared by first reading the
SPI Status Register with SPIF set, then accessing the SPI Data Register (SPDR).

The datasheet is here:

And I found this document on using the USART in SPI mode, but it doesn’t give a 1:1 mapping for registers:

This is what I’ve got so far:

SPIF → TXC0 // TRansmit complete flag
SPDR → UDR0 // Data register

But I’m confused about TXC0. It is a flag, and SPIF is a flag, but SPIF is a bit in register SPSR. I can’t figure out if TXC0 is a bit in some register.

I also am wondering if it is necessary to do this:
while(!(SPSR & (1 << SPIF)));

Or if it is possible to just access SPIF directly like how is seems TXC0 is supposed to be used.
My gut tells me SPIF is just a bit number seeing how it is used there, but is TXC0 also a bit number? And if so in what register? I have no clue.

Well, I found TXC0. It’s in register UCSR0A. I assume it is accessed in the same manner as the SPIF flag, so the equivalent to:

while(!(SPSR & (1 << SPIF)));

Would be:

while(!(UCSR0A & (1 << TXC0)));

Though the docs seem to indicate that it is not necessary to wait for the byte to be transmitted with the UART because it has a buffer.

That’s another reason I recall now that I put the SD card on the UART. I thought I would be receiving more data from the SD card than I would be transmitting to the DAC and my LEDs, so I thought the buffer might improve performance. Now however I’m not so sure. I’m not sure that the buffer applies to receiving data or that if it does there is any benefit. It may have been more beneficial to use it for transmitting data to the DAC and TLC5947’s I have hooked up.