Nut/OS  4.10.3
API Reference
XgSpiNodeAt45d

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_INFOAt45dNodeProbe (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 Documentation

#define SPI_RATE_AT45D0   33000000

Definition at line 267 of file spi_node_at45d.c.

#define SPI_MODE_AT45D0   SPI_MODE_3

Definition at line 275 of file spi_node_at45d.c.

#define SPI_RATE_AT45D1   33000000

Definition at line 308 of file spi_node_at45d.c.

#define SPI_MODE_AT45D1   SPI_MODE_3

Definition at line 316 of file spi_node_at45d.c.

#define SPI_RATE_AT45D2   33000000

Definition at line 346 of file spi_node_at45d.c.

#define SPI_MODE_AT45D2   SPI_MODE_3

Definition at line 354 of file spi_node_at45d.c.

#define SPI_RATE_AT45D3   33000000

Definition at line 384 of file spi_node_at45d.c.

#define SPI_MODE_AT45D3   SPI_MODE_3

Definition at line 392 of file spi_node_at45d.c.


Typedef Documentation

typedef struct _AT45D_DCB AT45D_DCB

Function Documentation

int At45dNodeLock ( NUTSPINODE node)

Definition at line 80 of file spi_node_at45d.c.

References _AT45D_DCB::dcb_lock, _NUTSPINODE::node_dcb, NUT_WAIT_INFINITE, and NutEventWait().

Here is the call graph for this function:

void At45dNodeUnlock ( NUTSPINODE node)

Definition at line 87 of file spi_node_at45d.c.

References _AT45D_DCB::dcb_lock, _NUTSPINODE::node_dcb, and NutEventPost().

Here is the call graph for this function:

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.

Parameters:
nodeSpecifies the SPI node.
opCommand code.
parmCommand parameter.
oplenCommand length.
txbufPointer to the transmit data buffer, may be set to NULL.
rxbufPointer to the receive data buffer, may be set to NULL.
xlenNumber of byte to receive and/or transmit.
Returns:
0 on success, -1 on errors.

Definition at line 132 of file spi_node_at45d.c.

References _NUTSPIBUS::bus_alloc, _NUTSPIBUS::bus_release, _NUTSPIBUS::bus_transfer, _NUTSPINODE::node_bus, and NUTASSERT.

Referenced by At45dNodeCommand().

int At45dNodeCommand ( NUTSPINODE node,
uint8_t  op,
uint32_t  parm,
uint_fast8_t  oplen 
)

Execute DataFlash command without data.

Parameters:
nodeSpecifies the SPI node.
opCommand operation code.
parmOptional command parameter.
oplenCommand length.
Returns:
0 on success, -1 on errors.

Definition at line 167 of file spi_node_at45d.c.

References At45dNodeTransfer().

Here is the call graph for this function:

uint8_t At45dNodeStatus ( NUTSPINODE node)

Query the status of the serial flash.

Parameters:
nodeSpecifies the SPI node.
Returns:
0 on success or -1 in case of an error.

Definition at line 179 of file spi_node_at45d.c.

References _NUTSPIBUS::bus_alloc, _NUTSPIBUS::bus_release, _NUTSPIBUS::bus_transfer, _NUTSPIBUS::bus_wait, DFCMD_READ_STATUS, _NUTSPINODE::node_bus, NUT_WAIT_INFINITE, and NUTASSERT.

Referenced by At45dNodeProbe(), and At45dNodeWaitReady().

int At45dNodeWaitReady ( NUTSPINODE node,
uint32_t  tmo,
int  poll 
)

Wait until DataFlash memory cycle finished.

Parameters:
nodeSpecifies the SPI node.
tmoNumber of loops (or milliseconds) to wait at max.
pollIf 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.
Returns:
0 on success or -1 in case of an error.

Definition at line 219 of file spi_node_at45d.c.

References At45dNodeStatus(), and NutSleep().

Referenced by At45dNodeProbe().

Here is the call graph for this function:

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.

Parameters:
nodeSpecifies the SPI node.
Returns:
Pointer to a AT45D_INFO structure, which contains the relevant DataFlash parameters. If no known DataFlash is available, then NULL is returned.

Definition at line 247 of file spi_node_at45d.c.

References at45d_info, at45d_known_types, AT45D_STATUS_DENSITY, AT45D_STATUS_PAGE_SIZE, At45dNodeStatus(), and At45dNodeWaitReady().

Here is the call graph for this function:


Variable Documentation

Initial value:
 {
    NULL,                       
    NULL,                       
    SPI_RATE_AT45D0,            
    SPI_MODE_AT45D0,            
    8,                          
    0,                          
    &dcbAt45d0                  
}

First AT45D DataFlash SPI node implementation structure.

Definition at line 297 of file spi_node_at45d.c.

Initial value:
 {
    NULL,                       
    NULL,                       
    SPI_RATE_AT45D1,            
    SPI_MODE_AT45D1,            
    8,                          
    0,                          
    &dcbAt45d1                  
}

Second AT45D DataFlash SPI node implementation structure.

Definition at line 335 of file spi_node_at45d.c.

Initial value:
 {
    NULL,                       
    NULL,                       
    SPI_RATE_AT45D2,            
    SPI_MODE_AT45D2,            
    8,                          
    0,                          
    &dcbAt45d2                  
}

Third AT45D DataFlash SPI node implementation structure.

Definition at line 373 of file spi_node_at45d.c.

Initial value:
 {
    NULL,                       
    NULL,                       
    SPI_RATE_AT45D3,            
    SPI_MODE_AT45D3,            
    8,                          
    0,                          
    &dcbAt45d3                  
}

Forth AT45D DataFlash SPI node implementation structure.

Definition at line 411 of file spi_node_at45d.c.