Still debugging AT45DB and SPI

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2944 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-09-12 16:38:02 +00:00
parent 978559a55c
commit 687d4d5c16
2 changed files with 7 additions and 5 deletions

View File

@ -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 */

View File

@ -261,7 +261,7 @@ static void at45db_lock(struct at45db_dev_s *priv)
* state.
*/
SPI_SETMODE(priv->spi, SPIDEV_MODE3);
SPI_SETMODE(priv->spi, SPIDEV_MODE0);
SPI_SETBITS(priv->spi, 8);
(void)SPI_SETFREQUENCY(priv->spi, CONFIG_AT45DB_FREQUENCY);
}
@ -275,7 +275,6 @@ static inline void at45db_unlock(struct at45db_dev_s *priv)
(void)SPI_LOCK(priv->spi, false);
}
/************************************************************************************
* Name: at45db_pwrdown
************************************************************************************/