#include "lisoc_test.h"
#include "spi.h"
#include "spi_test.h"

/*!
    \brief      spi test
    \param[in]  none
    \param[out] none
    \retval     none
*/
void spi_test(void)
{
  uint32_t i;
  uint32_t recv_len;
  uint8_t txbuff[512] = {0x5a,0x01, 0x02, 0x03, 0x04, 0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11, 0x12, 0x13, 0x14, 0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F};
  uint8_t rxbuff[512] = {0};

  spi_master_init();
  spi_slave_init();

  spi_master_send(txbuff, 10);
  recv_len = spi_slave_recv(rxbuff, 10);
    
    if(txbuff[i] != rxbuff[i])
    {
      debug("%d,%x\n",i,rxbuff[i]);
      debug("spi test                                   NG.%d\n",recv_len);
      //return;
    }

  debug("spi test                                   OK.\n");

}
