Added Doxygen documentation
This commit is contained in:
parent
ca6abb286b
commit
b51977a693
1 changed files with 42 additions and 38 deletions
|
@ -26,11 +26,14 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: xmem.c,v 1.2 2006/08/10 16:42:11 bg- Exp $
|
* @(#)$Id: xmem.c,v 1.3 2007/11/10 20:45:29 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* \file
|
||||||
* Device driver for the ST M25P80 40MHz 1Mbyte external memory.
|
* Device driver for the ST M25P80 40MHz 1Mbyte external memory.
|
||||||
|
* \author
|
||||||
|
* Björn Grönvall <bg@sics.se>
|
||||||
*
|
*
|
||||||
* Data is written bit inverted (~-operator) to flash so that
|
* Data is written bit inverted (~-operator) to flash so that
|
||||||
* unwritten data will read as zeros (UNIX style).
|
* unwritten data will read as zeros (UNIX style).
|
||||||
|
@ -64,13 +67,13 @@
|
||||||
#define SPI_FLASH_INS_BE 0xc7
|
#define SPI_FLASH_INS_BE 0xc7
|
||||||
#define SPI_FLASH_INS_DP 0xb9
|
#define SPI_FLASH_INS_DP 0xb9
|
||||||
#define SPI_FLASH_INS_RES 0xab
|
#define SPI_FLASH_INS_RES 0xab
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
spi_tx(unsigned byte)
|
spi_tx(unsigned byte)
|
||||||
{
|
{
|
||||||
FASTSPI_TX(byte);
|
FASTSPI_TX(byte);
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
write_enable(void)
|
write_enable(void)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +87,7 @@ write_enable(void)
|
||||||
SPI_FLASH_DISABLE();
|
SPI_FLASH_DISABLE();
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
static unsigned
|
static unsigned
|
||||||
read_status_register(void)
|
read_status_register(void)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +108,7 @@ read_status_register(void)
|
||||||
|
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
* Wait for a write/erase operation to finish.
|
* Wait for a write/erase operation to finish.
|
||||||
*/
|
*/
|
||||||
|
@ -118,7 +121,7 @@ wait_ready(void)
|
||||||
} while(u & 0x01); /* WIP=1, write in progress */
|
} while(u & 0x01); /* WIP=1, write in progress */
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
* Erase 64k bytes of data. It takes about 1s before WIP goes low!
|
* Erase 64k bytes of data. It takes about 1s before WIP goes low!
|
||||||
*/
|
*/
|
||||||
|
@ -142,7 +145,7 @@ erase_sector(off_t offset)
|
||||||
SPI_FLASH_DISABLE();
|
SPI_FLASH_DISABLE();
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
* Initialize external flash *and* SPI bus!
|
* Initialize external flash *and* SPI bus!
|
||||||
*/
|
*/
|
||||||
|
@ -157,7 +160,7 @@ xmem_init(void)
|
||||||
SPI_FLASH_DISABLE(); /* Unselect flash. */
|
SPI_FLASH_DISABLE(); /* Unselect flash. */
|
||||||
SPI_FLASH_UNHOLD();
|
SPI_FLASH_UNHOLD();
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
xmem_pread(void *_p, int size, off_t offset)
|
xmem_pread(void *_p, int size, off_t offset)
|
||||||
{
|
{
|
||||||
|
@ -186,7 +189,7 @@ xmem_pread(void *_p, int size, off_t offset)
|
||||||
splx(s);
|
splx(s);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
static const char *
|
static const char *
|
||||||
program_page(off_t offset, const unsigned char *p, int nbytes)
|
program_page(off_t offset, const unsigned char *p, int nbytes)
|
||||||
{
|
{
|
||||||
|
@ -214,7 +217,7 @@ program_page(off_t offset, const unsigned char *p, int nbytes)
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
xmem_pwrite(const void *_buf, int size, off_t addr)
|
xmem_pwrite(const void *_buf, int size, off_t addr)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +234,7 @@ xmem_pwrite(const void *_buf, int size, off_t addr)
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
xmem_erase(long size, off_t addr)
|
xmem_erase(long size, off_t addr)
|
||||||
{
|
{
|
||||||
|
@ -252,3 +255,4 @@ xmem_erase(long size, off_t addr)
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue