Skip to content

Commit

Permalink
Register SPI Test Driver at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Nov 30, 2021
1 parent 61070a0 commit 4cae367
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions boards/risc-v/bl602/bl602evb/src/bl602_bringup.c
Expand Up @@ -75,6 +75,10 @@
- BL602_XIP_OFFSET)
#endif /* CONFIG_FS_ROMFS */

#ifdef CONFIG_RF_SPI_TEST_DRIVER
#include <nuttx/rf/spi_test_driver.h>
#endif /* CONFIG_RF_SPI_TEST_DRIVER */

#include "chip.h"

/****************************************************************************
Expand Down Expand Up @@ -592,5 +596,25 @@ int bl602_bringup(void)
}
#endif /* CONFIG_FS_ROMFS */

#ifdef CONFIG_RF_SPI_TEST_DRIVER

/* Init SPI bus again */

struct spi_dev_s *spitest = bl602_spibus_initialize(0);
if (!spitest)
{
_err("ERROR: Failed to initialize SPI %d bus\n", 0);
}

/* Register the SPI Test Driver */

ret = spi_test_driver_register("/dev/spitest0", spitest, 0);
if (ret < 0)
{
_err("ERROR: Failed to register SPI Test Driver\n");
}

#endif /* CONFIG_RF_SPI_TEST_DRIVER */

return ret;
}

0 comments on commit 4cae367

Please sign in to comment.