Added Doxygen documentation

This commit is contained in:
adamdunkels 2007-11-10 20:45:29 +00:00
parent ca6abb286b
commit b51977a693

View file

@ -26,14 +26,17 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* 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 $
*/
/*
* Device driver for the ST M25P80 40MHz 1Mbyte external memory.
/**
* \file
* 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
* unwritten data will read as zeros (UNIX style).
* Data is written bit inverted (~-operator) to flash so that
* unwritten data will read as zeros (UNIX style).
*/
#include <stdio.h>
@ -64,13 +67,13 @@
#define SPI_FLASH_INS_BE 0xc7
#define SPI_FLASH_INS_DP 0xb9
#define SPI_FLASH_INS_RES 0xab
/*---------------------------------------------------------------------------*/
static void
spi_tx(unsigned byte)
{
FASTSPI_TX(byte);
}
/*---------------------------------------------------------------------------*/
static void
write_enable(void)
{
@ -84,7 +87,7 @@ write_enable(void)
SPI_FLASH_DISABLE();
splx(s);
}
/*---------------------------------------------------------------------------*/
static unsigned
read_status_register(void)
{
@ -105,7 +108,7 @@ read_status_register(void)
return u;
}
/*---------------------------------------------------------------------------*/
/*
* Wait for a write/erase operation to finish.
*/
@ -118,7 +121,7 @@ wait_ready(void)
} while(u & 0x01); /* WIP=1, write in progress */
return u;
}
/*---------------------------------------------------------------------------*/
/*
* 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();
splx(s);
}
/*---------------------------------------------------------------------------*/
/*
* Initialize external flash *and* SPI bus!
*/
@ -157,7 +160,7 @@ xmem_init(void)
SPI_FLASH_DISABLE(); /* Unselect flash. */
SPI_FLASH_UNHOLD();
}
/*---------------------------------------------------------------------------*/
int
xmem_pread(void *_p, int size, off_t offset)
{
@ -186,7 +189,7 @@ xmem_pread(void *_p, int size, off_t offset)
splx(s);
return size;
}
/*---------------------------------------------------------------------------*/
static const char *
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;
}
/*---------------------------------------------------------------------------*/
int
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;
}
/*---------------------------------------------------------------------------*/
int
xmem_erase(long size, off_t addr)
{
@ -252,3 +255,4 @@ xmem_erase(long size, off_t addr)
return size;
}
/*---------------------------------------------------------------------------*/