* * $Log: at45db.h,v $ * Revision 1.2 2006/10/08 16:48:09 haraldkipp * Documentation fixed * * Revision 1.1 2006/09/29 12:41:55 haraldkipp * Added support for AT45 serial DataFlash memory chips. Currently limited * to AT91 builds. * * *
Definition in file at45db.h.
Go to the source code of this file.
Functions | |
int | At45dbSendCmd (int dd, u_char op, u_long parm, int len, CONST void *tdata, void *rdata, int datalen) |
Send DataFlash command. | |
u_char | At45dbGetStatus (int dd) |
int | At45dbWaitReady (int dd, u_long tmo, int poll) |
Wait until flash memory cycle finished. | |
int | At45dbInit (u_int spibas, u_int spipcs) |
Initialize dataflash at specified interface and chip select. | |
int | At45dbPageErase (int dd, u_int off) |
Erase sector at the specified offset. | |
int | At45dbChipErase (void) |
Erase entire flash memory chip. | |
int | At45dbPageRead (int dd, u_long pgn, void *data, u_int len) |
Read data from flash memory. | |
int | At45dbPageWrite (int dd, u_int off, CONST void *data, u_int len) |
Write data into flash memory. | |
int | At45dbParamRead (u_int pos, void *data, u_int len) |
Load configuration parameters from flash memory. | |
int | At45dbParamWrite (u_int pos, CONST void *data, u_int len) |
Store configuration parameters in flash memory. |
int At45dbSendCmd | ( | int | dd, | |
u_char | op, | |||
u_long | parm, | |||
int | len, | |||
CONST void * | tdata, | |||
void * | rdata, | |||
int | datalen | |||
) |
Send DataFlash command.
dd | Device descriptor. | |
op | Command operation code. | |
parm | Command parameter. | |
len | Command length. | |
tdata | Transmit data. | |
rdata | Receive data buffer. | |
datalen | Data length. |
Definition at line 278 of file at45db.c.
References At91SpiTransfer2(), MAX_AT45_CMDLEN, and memset().
Referenced by At45dbPageErase(), At45dbPageRead(), and At45dbPageWrite().
u_char At45dbGetStatus | ( | int | dd | ) |
Definition at line 295 of file at45db.c.
References At91SpiTransfer2(), and DFCMD_READ_STATUS.
Referenced by At45dbInit(), and At45dbWaitReady().
int At45dbWaitReady | ( | int | dd, | |
u_long | tmo, | |||
int | poll | |||
) |
Wait until flash memory cycle finished.
Definition at line 310 of file at45db.c.
References At45dbGetStatus(), and NutSleep().
Referenced by At45dbPageWrite().
Initialize dataflash at specified interface and chip select.
spibas | Interface base address. For ARM MCUs this may be the I/O base address of the hardware SPI. | |
spipcs | Device chip select. |
Definition at line 334 of file at45db.c.
References _BV, at45_devt, At45dbGetStatus(), At91SpiInit(), At91SpiInitChipSelects(), At91SpiReset(), At91SpiSetModeFlags(), At91SpiSetRate(), MAX_AT45_DEVICES, SPIMF_CAPRISE, SPIMF_MASTER, and SPIMF_SCKIAHI.
Referenced by At45dbParamSize().
int At45dbPageErase | ( | int | dd, | |
u_int | off | |||
) |
Erase sector at the specified offset.
Definition at line 376 of file at45db.c.
References At45dbSendCmd(), and DFCMD_PAGE_ERASE.
int At45dbChipErase | ( | void | ) |
Read data from flash memory.
dd | Device descriptor. | |
pgn | Page number to read, starting at 0. | |
data | Points to a buffer that receives the data. | |
len | Number of bytes to read. |
Definition at line 399 of file at45db.c.
References At45dbSendCmd(), and DFCMD_CONT_READ.
Referenced by At45dbParamRead(), and At45dbParamWrite().
Write data into flash memory.
The related sector must have been erased before calling this function.
dd | Device descriptor. | |
pgn | Start location within the chip, starting at 0. | |
data | Points to a buffer that contains the bytes to be written. | |
len | Number of bytes to write. |
Definition at line 417 of file at45db.c.
References AT45_WRITE_POLLS, At45dbSendCmd(), At45dbWaitReady(), DFCMD_BUF1_FLASH, DFCMD_BUF1_WRITE, free, and malloc.
Referenced by At45dbParamWrite().
Load configuration parameters from flash memory.
pos | Start location within configuration sector. | |
data | Points to a buffer that receives the contents. | |
len | Number of bytes to read. |
Definition at line 480 of file at45db.c.
References At45dbPageRead(), At45dbParamPage(), At45dbParamSize(), free, malloc, and memcpy().
Referenced by NutNvMemLoad().
Store configuration parameters in flash memory.
pos | Start location within configuration sector. | |
data | Points to a buffer that contains the bytes to store. | |
len | Number of bytes to store. |
Definition at line 506 of file at45db.c.
References At45dbPageRead(), At45dbPageWrite(), At45dbParamPage(), At45dbParamSize(), free, malloc, memcmp(), and memcpy().
Referenced by NutNvMemSave().