When "SPIM_WriteTxData( )" function is called one after the other, it wont be executed until the previous data byte is transmitted. Hence it acts as a Blocking statement, except for the last "SPIM_WriteTxData( )" statement which requires polling method to check if the data is completely transmitted.
The "GetTxBufferSize( )" function returning 0 indicates that the transmission is completed and there are no remainiing bytes waiting to be transmitted.
Can you please let us know the frequency of operation of the SPI? That is, the Sclk output Frequency?
As you have mentioned, the ISR is running in the background during transmission when the size of the Tx Buffer is greater than 4. Same is the case with the Receive Buffer when its size is greater than 4. This results in an overhead and the Bus clock Frequency too comes into picture, which determines whether the ISR is being handled when required.
Here are a few suggestions which you can incorporate in your design:
1) Always ensure that the number of bytes written to the Tx Buffer is not greater than the size of the Tx Buffer allocated.
2) Set the Bus Clock to higher Frequency, which is an integral multiple of your SPI Frequency. Example- Set Bus Clock frequency to 48MHz, if your SPI Sclk is 2MHz or 4MHz.
3) If you are using SPI Slave on PSoC, then make sure that the MOSI and SCLK pins are unsynchronized (By unchecking the "Input Synchronized" option in the Configuration Box of the pin.
Let us know if this helped.