Data Structures | |
struct | _AT45D_DCB |
Defines | |
#define | SPI_RATE_AT45D0 33000000 |
#define | SPI_MODE_AT45D0 SPI_MODE_3 |
#define | SPI_RATE_AT45D1 33000000 |
#define | SPI_MODE_AT45D1 SPI_MODE_3 |
#define | SPI_RATE_AT45D2 33000000 |
#define | SPI_MODE_AT45D2 SPI_MODE_3 |
#define | SPI_RATE_AT45D3 33000000 |
#define | SPI_MODE_AT45D3 SPI_MODE_3 |
Typedefs | |
typedef struct _AT45D_DCB | AT45D_DCB |
Functions | |
int | At45dNodeLock (NUTSPINODE *node) |
void | At45dNodeUnlock (NUTSPINODE *node) |
int | At45dNodeTransfer (NUTSPINODE *node, uint8_t op, uint32_t parm, uint_fast8_t oplen, const void *txbuf, void *rxbuf, int xlen) |
Execute DataFlash command with data transfer. | |
int | At45dNodeCommand (NUTSPINODE *node, uint8_t op, uint32_t parm, uint_fast8_t oplen) |
Execute DataFlash command without data. | |
uint8_t | At45dNodeStatus (NUTSPINODE *node) |
Query the status of the serial flash. | |
int | At45dNodeWaitReady (NUTSPINODE *node, uint32_t tmo, int poll) |
Wait until DataFlash memory cycle finished. | |
AT45D_INFO * | At45dNodeProbe (NUTSPINODE *node) |
Determine the DataFlash type. | |
Variables | |
NUTSPINODE | nodeAt45d0 |
First AT45D DataFlash SPI node implementation structure. | |
NUTSPINODE | nodeAt45d1 |
Second AT45D DataFlash SPI node implementation structure. | |
NUTSPINODE | nodeAt45d2 |
Third AT45D DataFlash SPI node implementation structure. | |
NUTSPINODE | nodeAt45d3 |
Forth AT45D DataFlash SPI node implementation structure. |
#define SPI_RATE_AT45D0 33000000 |
#define SPI_MODE_AT45D0 SPI_MODE_3 |
#define SPI_RATE_AT45D1 33000000 |
#define SPI_MODE_AT45D1 SPI_MODE_3 |
#define SPI_RATE_AT45D2 33000000 |
#define SPI_MODE_AT45D2 SPI_MODE_3 |
#define SPI_RATE_AT45D3 33000000 |
#define SPI_MODE_AT45D3 SPI_MODE_3 |
typedef struct _AT45D_DCB AT45D_DCB |
int At45dNodeLock | ( | NUTSPINODE * | node | ) |
References _AT45D_DCB::dcb_lock, _NUTSPINODE::node_dcb, NUT_WAIT_INFINITE, and NutEventWait().
void At45dNodeUnlock | ( | NUTSPINODE * | node | ) |
References _AT45D_DCB::dcb_lock, _NUTSPINODE::node_dcb, and NutEventPost().
int At45dNodeTransfer | ( | NUTSPINODE * | node, |
uint8_t | op, | ||
uint32_t | parm, | ||
uint_fast8_t | oplen, | ||
const void * | txbuf, | ||
void * | rxbuf, | ||
int | xlen | ||
) |
Execute DataFlash command with data transfer.
node | Specifies the SPI node. |
op | Command code. |
parm | 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 _NUTSPIBUS::bus_alloc, _NUTSPIBUS::bus_release, _NUTSPIBUS::bus_transfer, _NUTSPINODE::node_bus, NULL, NUTASSERT, and rc.
Referenced by At45dNodeCommand().
int At45dNodeCommand | ( | NUTSPINODE * | node, |
uint8_t | op, | ||
uint32_t | parm, | ||
uint_fast8_t | oplen | ||
) |
Execute DataFlash command without data.
node | Specifies the SPI node. |
op | Command operation code. |
parm | Optional command parameter. |
oplen | Command length. |
References At45dNodeTransfer(), and NULL.
uint8_t At45dNodeStatus | ( | NUTSPINODE * | node | ) |
Query the status of the serial flash.
node | Specifies the SPI node. |
References _NUTSPIBUS::bus_alloc, _NUTSPIBUS::bus_release, _NUTSPIBUS::bus_transfer, _NUTSPIBUS::bus_wait, DFCMD_READ_STATUS, _NUTSPINODE::node_bus, NULL, NUT_WAIT_INFINITE, NUTASSERT, and rc.
Referenced by At45dNodeProbe(), and At45dNodeWaitReady().
int At45dNodeWaitReady | ( | NUTSPINODE * | node, |
uint32_t | tmo, | ||
int | poll | ||
) |
Wait until DataFlash memory cycle finished.
node | Specifies the SPI node. |
tmo | Number of loops (or milliseconds) to wait at max. |
poll | If 0, the current thread will be suspended for 1 millisecond between each retry. Otherwise the polling loop will not sleep, but may be still suspended by the lower level SPI bus driver. |
References At45dNodeStatus(), and NutSleep().
Referenced by At45dNodeProbe().
AT45D_INFO* At45dNodeProbe | ( | NUTSPINODE * | node | ) |
Determine the DataFlash type.
If the board contains a known DataFlash chip, but couldn't be determined by this routine, then most probably the chip select configuration is wrong.
node | Specifies the SPI node. |
References at45d_info, at45d_known_types, AT45D_STATUS_DENSITY, AT45D_STATUS_PAGE_SIZE, At45dNodeStatus(), At45dNodeWaitReady(), and NULL.
{ NULL, NULL, SPI_RATE_AT45D0, SPI_MODE_AT45D0, 8, 0, &dcbAt45d0 }
First AT45D DataFlash SPI node implementation structure.
{ NULL, NULL, SPI_RATE_AT45D1, SPI_MODE_AT45D1, 8, 0, &dcbAt45d1 }
Second AT45D DataFlash SPI node implementation structure.
{ NULL, NULL, SPI_RATE_AT45D2, SPI_MODE_AT45D2, 8, 0, &dcbAt45d2 }
Third AT45D DataFlash SPI node implementation structure.
{ NULL, NULL, SPI_RATE_AT45D3, SPI_MODE_AT45D3, 8, 0, &dcbAt45d3 }
Forth AT45D DataFlash SPI node implementation structure.