AT45D. More...
Go to the source code of this file.
Functions | |
int | SpiAt45dInit (NUTDEVICE *dev) |
Initialize the DataFlash device. | |
int | SpiAt45dCommand (NUTDEVICE *dev, uint8_t op, uint32_t parm, int len, const void *tdata, void *rdata, int datalen) |
Send DataFlash command. | |
uint8_t | SpiAt45dStatus (NUTDEVICE *dev) |
Query the status of the DataFlash. | |
int | SpiAt45dWaitReady (NUTDEVICE *dev, uint32_t tmo, int poll) |
Wait until DataFlash memory cycle finished. | |
int | SpiAt45dPageErase (NUTDEVICE *dev, uint32_t pgn) |
Erase specified DataFlash page. | |
int | SpiAt45dChipErase (NUTDEVICE *dev) |
Erase all DataFlash pages. | |
int | SpiAt45dPageRead (NUTDEVICE *dev, uint32_t pgn, void *data, int len) |
Read data from DataFlash memory. | |
int | SpiAt45dPageWrite (NUTDEVICE *dev, uint32_t pgn, const void *data, int len) |
Write data to DataFlash memory. | |
uint32_t | SpiAt45dPages (NUTDEVICE *dev) |
Return the number of pages. | |
int | SpiAt45dPageSize (NUTDEVICE *dev) |
Return the page size. | |
int | SpiAt45dPageWrite_P (NUTDEVICE *dev, uint32_t pgn, PGM_P data, int len) |
int | SpiAt45dIOCtl (NUTDEVICE *dev, int req, void *conf) |
Perform block I/O device control functions. | |
Variables | |
NUTSPINODE | nodeSpiAt45d0 |
AT45D DataFlash SPI node implementation structure. | |
NUTDEVICE | devSpiAt45d0 |
AT45D DataFlash device implementation structure. | |
NUTSPINODE | nodeSpiAt45d1 |
AT45D DataFlash SPI node implementation structure. | |
NUTDEVICE | devSpiAt45d1 |
AT45D DataFlash device implementation structure. | |
NUTSPINODE | nodeSpiAt45d2 |
AT45D DataFlash SPI node implementation structure. | |
NUTDEVICE | devSpiAt45d2 |
AT45D DataFlash device implementation structure. | |
NUTSPINODE | nodeSpiAt45d3 |
AT45D DataFlash SPI node implementation structure. | |
NUTDEVICE | devSpiAt45d3 |
AT45D DataFlash device implementation structure. |
AT45D.
* $Id: nvmem_at45d.h 4473 2012-08-20 15:12:45Z haraldkipp $ *
* $Id: spi_at45d.h 4473 2012-08-20 15:12:45Z haraldkipp $ *
int SpiAt45dInit | ( | NUTDEVICE * | dev | ) |
Initialize the DataFlash device.
This routine determines the DataFlash type. It is internally called by Nut/OS during device registration.
The driver framework may call this function more than once.
dev | Specifies the DataFlash device. |
References at45d_known_types, _AT45D_INFO::at45d_pages, _AT45D_INFO::at45d_psize, AT45D_STATUS_DENSITY, AT45D_STATUS_PAGE_SIZE, _NUTBLOCKIO::blkio_blk_cnt, _NUTBLOCKIO::blkio_blk_siz, _NUTBLOCKIO::blkio_info, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, NULL, and NUTASSERT.
int SpiAt45dCommand | ( | NUTDEVICE * | dev, |
uint8_t | op, | ||
uint32_t | parm, | ||
int | oplen, | ||
const void * | txbuf, | ||
void * | rxbuf, | ||
int | xlen | ||
) |
Send DataFlash command.
dev | Specifies the DataFlash device. |
op | Command operation code. |
parm | Optional command parameter. |
oplen | Command length. |
txbuf | Pointer to the transmit data buffer, may be set to NULL. |
rxbuf | Pointer to the receive data buffer, may be set to NULL. |
xlen | Number of byte to receive and/or transmit. |
References _NUTDEVICE::dev_icb, NULL, and NUTASSERT.
Query the status of the DataFlash.
dev | Specifies the Flash device. |
References _NUTDEVICE::dev_icb, NULL, and NUTASSERT.
Wait until DataFlash memory cycle finished.
dev | Specifies the DataFlash device. |
References _NUTDEVICE::dev_icb, NULL, and NUTASSERT.
Erase specified DataFlash page.
dev | Specifies the registered DataFlash device. |
pgn | Page number to erase, starting at 0. |
References _AT45D_INFO::at45d_pages, _AT45D_INFO::at45d_pshft, _NUTBLOCKIO::blkio_info, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, DFCMD_PAGE_ERASE, NULL, and NUTASSERT.
int SpiAt45dChipErase | ( | NUTDEVICE * | dev | ) |
Erase all DataFlash pages.
Read data from DataFlash memory.
dev | Specifies the registered DataFlash device. |
pgn | Page number to read, starting at 0. |
data | Points to a buffer that receives the data. |
len | Number of bytes to read. |
References _AT45D_INFO::at45d_pages, _AT45D_INFO::at45d_pshft, _NUTBLOCKIO::blkio_info, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, DFCMD_CONT_READ, NULL, and NUTASSERT.
Referenced by SpiAt45dConfigRead(), and SpiAt45dConfigWrite().
Write data to DataFlash memory.
Each page will be automatically erased before writing the data. If the last page is not completely filled with new data, the contents of remaining bytes at the end of the page is undetermined.
dev | Specifies the registered DataFlash device. |
pgn | The page number. |
data | Points to the buffer that contains the bytes to be written. |
len | Number of bytes available in the buffer. This may be less than the page size, in which case the remaining bytes of the page will be set to 0xff. |
References AT45_WRITE_POLLS, _NUTBLOCKIO::blkio_info, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, DFCMD_BUF1_FLASH, DFCMD_BUF1_WRITE, NULL, NUTASSERT, and rc.
Referenced by SpiAt45dConfigWrite().
Return the number of pages.
dev | Specifies the registered DataFlash device. |
References _NUTBLOCKIO::blkio_info, _NUTDEVICE::dev_dcb, NULL, and NUTASSERT.
int SpiAt45dPageSize | ( | NUTDEVICE * | dev | ) |
Return the page size.
dev | Specifies the registered DataFlash device. |
References _NUTBLOCKIO::blkio_info, _NUTDEVICE::dev_dcb, NULL, and NUTASSERT.
Referenced by SpiAt45dConfigSize(), and SpiAt45dConfigWrite().
int SpiAt45dIOCtl | ( | NUTDEVICE * | dev, |
int | req, | ||
void * | conf | ||
) |
Perform block I/O device control functions.
This function is called by the ioctl() function of the C runtime library. Applications should not directly call this function.
dev | Identifies the device that receives the control command. |
req | Requested control command. May be set to one of the following constants: |
conf | Points to a buffer that contains any data required for the given control function or receives data from that function. |
References NULL, NUTASSERT, NUTBLKDEV_MEDIAAVAIL, NUTBLKDEV_MEDIACHANGE, and rc.
AT45D DataFlash SPI node implementation structure.
AT45D DataFlash device implementation structure.
AT45D DataFlash SPI node implementation structure.
AT45D DataFlash device implementation structure.
AT45D DataFlash SPI node implementation structure.
AT45D DataFlash device implementation structure.
AT45D DataFlash SPI node implementation structure.
AT45D DataFlash device implementation structure.