Hi, Gabriel,
I am sorry for the delay.
Regarding your question, pls refer to the example in SDK2.0.
D:\Freescale\KSDK2.0_KL27\boards\frdmkl27z\driver_examples\spi
Regarding the driver of SDK, I think this is the software architecture. The SPI uses interrupt mechanism to transfer data, user calls the high level api function to transfer data via the large buffer instead of the direct module register, the SPI interrupt service routine writes the data from the buffer to SPI transmitter register, or read the SPI receiver register to buffer. user is required to call high level api function to write data to the buffer or read data from the buffer.
If you use RTOS, a semaphore is established, in the ISR, sem_post() is called. In the transfer function, sem_wait() is called, at the same time, the chip is blocked at the sem_wait() function.
If you do not use RTOS, you can call the SPI_MasterTransferNonBlocking(), "NonBlocking" means that the api function returns immediately after writting the transmitted data to the buffer. You can call the SPI_MasterTransferBlocking(), "Blocking" means that the function has a while() loop, which polls if the predefined number of data has been been transferred, after all data have been transferred, the api function can return. In both SPI_MasterTransferNonBlocking() and SPI_MasterTransferBlocking(), callback function is supported, after the number of data has been transferred, the callbacl function is called automatically.
Hope it can help you.
BR
XiangJun Rong