Fix test of NULL pointer in the SAM3/4 SPI driver

This commit is contained in:
Gregory Nutt 2013-06-18 12:16:52 -06:00
parent 177a8c0e9b
commit 69fc11bb71
4 changed files with 19 additions and 12 deletions

View File

@ -5004,3 +5004,6 @@
definitions from Alan Carvalho de Assis (2013-6-18).
* configs/freedom-kl25z/src/kl_tsi.c: Example TSI driver for the
Freedom KL25Z board from Alan Carvalho de Assis (2013-6-18).
* arch/arm/src/sam34/sam_spi.c: Correct an incorrect pointer test.
Was checking if the wrong pointer was NULL (2013-6-18).

View File

@ -758,7 +758,7 @@ static void spi_exchange(FAR struct spi_dev_s *dev,
{
/* Get the data to send (0xff if there is no data source) */
if (rxptr)
if (txptr)
{
data = (uint32_t)*txptr++;
}
@ -790,11 +790,16 @@ static void spi_exchange(FAR struct spi_dev_s *dev,
putreg32(data, SAM_SPI_TDR);
/* Wait for the read data to be available in the RDR */
/* Wait for the read data to be available in the RDR.
* TODO: Data transfer rates would be improved using the RX FIFO
* (and also DMA)
*/
while ((getreg32(SAM_SPI_SR) & SPI_INT_RDRF) == 0);
/* Read the received data from the SPI Data Register */
/* Read the received data from the SPI Data Register..
* TODO: The following only works if nbits <= 8.
*/
data = getreg32(SAM_SPI_RDR);
if (rxptr)

View File

@ -583,8 +583,8 @@ Configuration sub-directories
CONFIG_ADS7843E_SPIDEV=2 : Use SPI CS 2 for communication
CONFIG_ADS7843E_SPIMODE=0 : Use SPI mode 0
CONFIG_ADS7843E_FREQUENCY=1000000 : SPI BAUD 1MHz
CONFIG_ADS7843E_THRESHX=39 : These will probably need to be tuned
CONFIG_ADS7843E_THRESHY=51
CONFIG_ADS7843E_THRESHX=51 : These will probably need to be tuned
CONFIG_ADS7843E_THRESHY=39
System Type -> Peripherals:
CONFIG_SAM34_SPI=y : Enable support for SPI

View File

@ -739,18 +739,17 @@ Configuration sub-directories
an 'unsigned long int'. If this error occurs, then you may need to
toggle the value of CONFIG_CXX_NEWLONG.
STATUS: As of 2013-6-18, the microSD slot on the I/O1 is marginally
functional but needs more TLC. It seems to behave poorly when
debug output is enabled -- know idea why. And writing to the SD card
does not work. Here is some example of the bad write behavior:
STATUS: As of 2013-6-18, this configuration appears completely
functional. Testing, however, has been very light. Example:
NuttShell (NSH) NuttX-6.28
nsh> mount -t vfat /dev/mmcsd0 /mnt/stuff
nsh> ls /mnt/stuff
/mnt/stuff:
sharmanto.txt
nsh> cat /mnt/stuff/sharmanto.txt
Hi, from Sharmanto
nsh> echo "This is a test" >/mnt/stuff/atest.txt
nsh> ls /mnt/stuff
/mnt/stuff:
atest.txt
nsh> cat /mnt/stuff/atest.txt
This is a test
nsh>