diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-09-12 16:38:02 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-09-12 16:38:02 +0000 |
commit | a6e1246c64f2ae761fb7ee0454bd7f4ff38cfa1a (patch) | |
tree | 59ced97c5a10676e36a0a01d48fe7a5025f6ff45 /nuttx/arch/arm/src | |
parent | bcce5d2a1a51cafc0dad764e0f84781eee930a5d (diff) | |
download | px4-nuttx-a6e1246c64f2ae761fb7ee0454bd7f4ff38cfa1a.tar.gz px4-nuttx-a6e1246c64f2ae761fb7ee0454bd7f4ff38cfa1a.tar.bz2 px4-nuttx-a6e1246c64f2ae761fb7ee0454bd7f4ff38cfa1a.zip |
Still debugging AT45DB and SPI
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2944 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src')
-rw-r--r-- | nuttx/arch/arm/src/lpc313x/lpc313x_spi.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/nuttx/arch/arm/src/lpc313x/lpc313x_spi.c b/nuttx/arch/arm/src/lpc313x/lpc313x_spi.c index 98c3dc64d..0d17be301 100644 --- a/nuttx/arch/arm/src/lpc313x/lpc313x_spi.c +++ b/nuttx/arch/arm/src/lpc313x/lpc313x_spi.c @@ -2,7 +2,8 @@ * arm/arm/src/lpc313x/lpc313x_spi.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Author: David Hewson, deriving in part from other SPI drivers originally by + * Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -241,10 +242,12 @@ static inline void spi_select_slave(FAR struct lpc313x_spidev_s *priv, uint8_t s static inline uint16_t spi_readword(FAR struct lpc313x_spidev_s *priv) { /* Wait until the receive buffer is not empty */ + while ((getreg32 (LPC313X_SPI_STATUS) & SPI_STATUS_RXFIFOEMPTY) != 0) ; /* Then return the received byte */ + uint32_t val = getreg32 (LPC313X_SPI_FIFODATA); return val; @@ -267,9 +270,9 @@ static inline uint16_t spi_readword(FAR struct lpc313x_spidev_s *priv) static inline void spi_writeword(FAR struct lpc313x_spidev_s *priv, uint16_t word) { - /* Wait until the transmit buffer is empty */ + /* Wait until the transmit buffer is not full */ - while ((getreg32 (LPC313X_SPI_STATUS) & SPI_STATUS_TXFIFOFULL) != 0) + while ((getreg32 (LPC313X_SPI_STATUS) & SPI_STATUS_TXFIFOFULL) != 0) ; /* Then send the byte */ |