File nut/dev/at45db.c


Included Files


Preprocessor definitions

#define MAX_AT45_DEVICES 1

#define MAX_AT45_CMDLEN 8

#define AT45_CONF_DFSPI SPI0_BASE

#define AT45_CONF_DFPCS 1

#define AT45_ERASE_WAIT 3000

#define AT45_CHIP_ERASE_WAIT 50000

#define AT45_WRITE_POLLS 1000

#define DFCMD_READ_PAGE 0xD2

#define DFCMD_READ_STATUS 0xD7

#define DFCMD_CONT_READ 0xE8

#define DFCMD_PAGE_ERASE 0x81

#define DFCMD_BUF1_WRITE 0x84

#define DFCMD_BUF1_FLASH 0x83


Typedef AT45_DEVTAB

typedef struct _AT45_DEVTAB AT45_DEVTAB
struct _AT45_DEVTAB  
   {  
      u_long devt_pages;  
      u_int devt_pagsiz;  
      u_int devt_offs;  
      u_char devt_srmsk;  
      u_char devt_srval;  
   }  

Typedef AT45DB_DCB

typedef struct _AT45DB_DCB AT45DB_DCB
struct _AT45DB_DCB  
   {  
      AT45_DEVTAB* dcb_devt;  
      u_int dcb_spibas;  
      u_int dcb_spipcs;  
      u_char dcb_cmdbuf[8];  
   }  

Global Variable at45_devt

AT45_DEVTAB at45_devt[]
Visible in:   nut/dev/at45db.c
Used in: At45dbInit() nut/dev/at45db.c

Local Variables

dcbtab
static AT45DB_DCB dcbtab[1]
Used in: At45dbGetStatus()  
  At45dbInit()  
  At45dbPageRead()  
  At45dbPageWrite()  
  At45dbParamPage()  
  At45dbParamSize()  
  At45dbSendCmd()  

dcbnum
static int dcbnum

Used in: At45dbInit()  

dd_param
static int dd_param

Used in: At45dbParamPage()  
  At45dbParamRead()  
  At45dbParamSize()  
  At45dbParamWrite()  

Global Function At45dbChipErase()

int At45dbChipErase ( void )
Prototyped in: nut/include/dev/at45db.h

Global Function At45dbGetStatus()

u_char At45dbGetStatus ( int dd )
Prototyped in: nut/include/dev/at45db.h
Calls: At91SpiTransfer2()
Called by: At45dbInit() nut/dev/at45db.c
  At45dbWaitReady() nut/dev/at45db.c
References Variables: dcbtab nut/dev/at45db.c

Global Function At45dbInit()

int At45dbInit ( u_int spibas, u_int spipcs )
Prototyped in: nut/include/dev/at45db.h
Calls: At45dbGetStatus() nut/dev/at45db.c
  At91SpiInit(), At91SpiInitChipSelects(), At91SpiReset(), At91SpiSetModeFlags(), At91SpiSetRate()
Called by: At45dbParamSize() nut/dev/at45db.c
References Variables: at45_devt nut/dev/at45db.c
  dcbnum nut/dev/at45db.c
  dcbtab nut/dev/at45db.c

Global Function At45dbPageErase()

int At45dbPageErase ( int dd, u_int pgn )
Prototyped in: nut/include/dev/at45db.h
Calls: At45dbSendCmd() nut/dev/at45db.c

Global Function At45dbPageRead()

int At45dbPageRead ( int dd, u_long pgn, void* data, u_int len )
Prototyped in: nut/include/dev/at45db.h
Calls: At45dbSendCmd() nut/dev/at45db.c
Called by: At45dbParamRead() nut/dev/at45db.c
  At45dbParamWrite() nut/dev/at45db.c
References Variables: dcbtab nut/dev/at45db.c

Global Function At45dbPageWrite()

int At45dbPageWrite ( int dd, u_int pgn, const void* data, u_int len )
Prototyped in: nut/include/dev/at45db.h
Calls: At45dbSendCmd() nut/dev/at45db.c
  At45dbWaitReady() nut/dev/at45db.c
  free(), malloc()
Called by: At45dbParamWrite() nut/dev/at45db.c
References Variables: dcbtab nut/dev/at45db.c

Global Function At45dbParamPage()

u_long At45dbParamPage ( void )
Called by: At45dbParamRead() nut/dev/at45db.c
  At45dbParamWrite() nut/dev/at45db.c
References Variables: dcbtab nut/dev/at45db.c
  dd_param nut/dev/at45db.c

Global Function At45dbParamRead()

int At45dbParamRead ( u_int pos, void* data, u_int len )
Prototyped in: nut/include/dev/at45db.h
Calls: At45dbPageRead() nut/dev/at45db.c
  At45dbParamPage() nut/dev/at45db.c
  At45dbParamSize() nut/dev/at45db.c
  free(), malloc(), memcpy()
References Variables: dd_param nut/dev/at45db.c

Global Function At45dbParamSize()

int At45dbParamSize ( void )
Calls: At45dbInit() nut/dev/at45db.c
Called by: At45dbParamRead() nut/dev/at45db.c
  At45dbParamWrite() nut/dev/at45db.c
References Variables: dcbtab nut/dev/at45db.c
  dd_param nut/dev/at45db.c

Global Function At45dbParamWrite()

int At45dbParamWrite ( u_int pos, const void* data, u_int len )
Prototyped in: nut/include/dev/at45db.h
Calls: At45dbPageRead() nut/dev/at45db.c
  At45dbPageWrite() nut/dev/at45db.c
  At45dbParamPage() nut/dev/at45db.c
  At45dbParamSize() nut/dev/at45db.c
  free(), malloc(), memcmp(), memcpy()
References Variables: dd_param nut/dev/at45db.c

Global Function At45dbSendCmd()

int At45dbSendCmd ( int dd, u_char op, u_long parm, int len, const void* tdata, void* rdata, int datalen )
Prototyped in: nut/include/dev/at45db.h
Calls: At91SpiTransfer2(), memset()
Called by: At45dbPageErase() nut/dev/at45db.c
  At45dbPageRead() nut/dev/at45db.c
  At45dbPageWrite() nut/dev/at45db.c
References Variables: dcbtab nut/dev/at45db.c

Global Function At45dbWaitReady()

int At45dbWaitReady ( int dd, u_long tmo, int poll )
Prototyped in: nut/include/dev/at45db.h
Calls: At45dbGetStatus() nut/dev/at45db.c
  NutSleep() nut/os/timer.c
Called by: At45dbPageWrite() nut/dev/at45db.c