The attached code is used for data transfer using SPI peripheral. Any of the SPI instances can be used as master or slave with each SPI being a Tx or Rx. There are macros to select between the various configuration options. The same code can used for core mode or DMA mode data transfer.