at45xx.h File Reference

Serial Data Flash Driver. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FCS0   RC2
 O Second SDF. More...
 
#define DF_CS_LO()   FCS0=0
 
#define DF_CS_HI()   FCS0=1
 
#define MAIN_MEMORY_PAGE_READ   0x52
 
#define BUFFER1_READ   0x54
 
#define BUFFER2_READ   0x56
 
#define MAIN_MEMORY_PAGE_TO_BUFFER1_COPY   0x53
 
#define MAIN_MEMORY_PAGE_TO_BUFFER2_COPY   0x55
 
#define MAIN_MEMORY_PAGE_TO_BUFFER1_COMPARE   0x60
 
#define MAIN_MEMORY_PAGE_TO_BUFFER2_COMPARE   0x61
 
#define BUFFER1_WRITE   0x84
 
#define BUFFER2_WRITE   0x87
 
#define BUFFER1_PROGRAM_WITH_ERASE   0x83
 
#define BUFFER2_PROGRAM_WITH_ERASE   0x86
 
#define BUFFER1_PROGRAM_NO_ERASE   0x88
 
#define BUFFER2_PROGRAM_NO_ERASE   0x89
 
#define PAGE_ERASE   0x81
 
#define BLOCK_ERASE   0x50
 
#define MAIN_MEMORY_THROUGH_BUFFER1_PROGRAM   0x82
 
#define MAIN_MEMORY_THROUGH_BUFFER2_PROGRAM   0x85
 
#define AUTO_PAGE_THROUGH_BUFFER1_REWRITE   0x58
 
#define AUTO_PAGE_THROUGH_BUFFER2_REWRITE   0x59
 
#define DF_STATUS   0x57
 
#define DF_BUFFER1   0x00
 
#define DF_BUFFER2   0x01
 
#define IS_DF_BUSY()   IS_DF_READY_LO()
 
#define DF_STATUS_READY_MASK   0x80
 
#define IS_DF_READY(_status_)
 
#define DF_STATUS_COMP_MASK   0x40
 
#define IS_DF_COMP_OK(_status_)
 
#define DF_STATUS_DENSITY_MASK   0x38
 
#define DF_1MBIT_DENSITY_CODE   0x08
 
#define DF_2MBIT_DENSITY_CODE   0x10
 
#define DF_4MBIT_DENSITY_CODE   0x18
 
#define DF_8MBIT_DENSITY_CODE   0x20
 
#define DF_16MBIT_DENSITY_CODE   0x28
 
#define DF_32MBIT_DENSITY_CODE   0x30
 
#define DF_64MBIT_DENSITY_CODE   0x38
 
#define MAX_PAGE_32MBIT_DENSITY   8192
 
#define MAX_PAGE_1MBIT_DENSITY   512
 
#define PAGESIZE   264
 

Functions

BYTE DF_ReadStatus (void)
 
void DF_WriteBuffer1 (WORD Address, BYTE *Data, WORD size)
 
void DF_ReadBuffer1 (WORD Address, BYTE *data, WORD size)
 
void DF_ErasePage (WORD PageNum)
 
void DF_ReadMainMemory (WORD PageNum, WORD SubAddress, BYTE *buff, WORD size)
 
void DF_Buffer12MainMemory (WORD PageNum)
 
void DF_Buffer12MainMemoryE (WORD PageNum)
 
void DF_Page2Buffer1 (WORD PageNum)
 
void DF_Compare (WORD PageNum)
 
void DF_AutoPageRewrite (WORD PageNum)
 

Detailed Description

Serial Data Flash Driver.

This file is part of JADEKU Portable ADQ device for Routines Control.

Copyright (C) 2006-2009, Hernan Monserrat hemonserrat<at>gmail<dot>com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file at45xx.h.

Macro Definition Documentation

◆ AUTO_PAGE_THROUGH_BUFFER1_REWRITE

#define AUTO_PAGE_THROUGH_BUFFER1_REWRITE   0x58

Definition at line 55 of file at45xx.h.

◆ AUTO_PAGE_THROUGH_BUFFER2_REWRITE

#define AUTO_PAGE_THROUGH_BUFFER2_REWRITE   0x59

Definition at line 56 of file at45xx.h.

◆ BLOCK_ERASE

#define BLOCK_ERASE   0x50

Definition at line 52 of file at45xx.h.

◆ BUFFER1_PROGRAM_NO_ERASE

#define BUFFER1_PROGRAM_NO_ERASE   0x88

Definition at line 49 of file at45xx.h.

◆ BUFFER1_PROGRAM_WITH_ERASE

#define BUFFER1_PROGRAM_WITH_ERASE   0x83

Definition at line 47 of file at45xx.h.

◆ BUFFER1_READ

#define BUFFER1_READ   0x54

Definition at line 39 of file at45xx.h.

◆ BUFFER1_WRITE

#define BUFFER1_WRITE   0x84

Definition at line 45 of file at45xx.h.

◆ BUFFER2_PROGRAM_NO_ERASE

#define BUFFER2_PROGRAM_NO_ERASE   0x89

Definition at line 50 of file at45xx.h.

◆ BUFFER2_PROGRAM_WITH_ERASE

#define BUFFER2_PROGRAM_WITH_ERASE   0x86

Definition at line 48 of file at45xx.h.

◆ BUFFER2_READ

#define BUFFER2_READ   0x56

Definition at line 40 of file at45xx.h.

◆ BUFFER2_WRITE

#define BUFFER2_WRITE   0x87

Definition at line 46 of file at45xx.h.

◆ DF_16MBIT_DENSITY_CODE

#define DF_16MBIT_DENSITY_CODE   0x28

Definition at line 83 of file at45xx.h.

◆ DF_1MBIT_DENSITY_CODE

#define DF_1MBIT_DENSITY_CODE   0x08

Definition at line 79 of file at45xx.h.

◆ DF_2MBIT_DENSITY_CODE

#define DF_2MBIT_DENSITY_CODE   0x10

Definition at line 80 of file at45xx.h.

◆ DF_32MBIT_DENSITY_CODE

#define DF_32MBIT_DENSITY_CODE   0x30

Definition at line 84 of file at45xx.h.

◆ DF_4MBIT_DENSITY_CODE

#define DF_4MBIT_DENSITY_CODE   0x18

Definition at line 81 of file at45xx.h.

◆ DF_64MBIT_DENSITY_CODE

#define DF_64MBIT_DENSITY_CODE   0x38

Definition at line 85 of file at45xx.h.

◆ DF_8MBIT_DENSITY_CODE

#define DF_8MBIT_DENSITY_CODE   0x20

Definition at line 82 of file at45xx.h.

◆ DF_BUFFER1

#define DF_BUFFER1   0x00

Definition at line 59 of file at45xx.h.

◆ DF_BUFFER2

#define DF_BUFFER2   0x01

Definition at line 60 of file at45xx.h.

◆ DF_CS_HI

#define DF_CS_HI ( )    FCS0=1

Definition at line 33 of file at45xx.h.

◆ DF_CS_LO

#define DF_CS_LO ( )    FCS0=0

Definition at line 32 of file at45xx.h.

◆ DF_STATUS

#define DF_STATUS   0x57

Definition at line 57 of file at45xx.h.

◆ DF_STATUS_COMP_MASK

#define DF_STATUS_COMP_MASK   0x40

Definition at line 73 of file at45xx.h.

◆ DF_STATUS_DENSITY_MASK

#define DF_STATUS_DENSITY_MASK   0x38

Definition at line 78 of file at45xx.h.

◆ DF_STATUS_READY_MASK

#define DF_STATUS_READY_MASK   0x80

DataFlash status register bits

Definition at line 70 of file at45xx.h.

◆ FCS0

#define FCS0   RC2

O Second SDF.

Definition at line 26 of file at45xx.h.

◆ IS_DF_BUSY

#define IS_DF_BUSY ( )    IS_DF_READY_LO()

polarity of ready/busy signaling

Definition at line 65 of file at45xx.h.

◆ IS_DF_COMP_OK

#define IS_DF_COMP_OK (   _status_)
Value:
((_status_ & \
DF_STATUS_COMP_MASK) \
== 0)

Definition at line 74 of file at45xx.h.

◆ IS_DF_READY

#define IS_DF_READY (   _status_)
Value:
(_status_ & \
DF_STATUS_READY_MASK)

Definition at line 71 of file at45xx.h.

◆ MAIN_MEMORY_PAGE_READ

#define MAIN_MEMORY_PAGE_READ   0x52

ATMEL SerialDataFlash Commands

Definition at line 38 of file at45xx.h.

◆ MAIN_MEMORY_PAGE_TO_BUFFER1_COMPARE

#define MAIN_MEMORY_PAGE_TO_BUFFER1_COMPARE   0x60

Definition at line 43 of file at45xx.h.

◆ MAIN_MEMORY_PAGE_TO_BUFFER1_COPY

#define MAIN_MEMORY_PAGE_TO_BUFFER1_COPY   0x53

Definition at line 41 of file at45xx.h.

◆ MAIN_MEMORY_PAGE_TO_BUFFER2_COMPARE

#define MAIN_MEMORY_PAGE_TO_BUFFER2_COMPARE   0x61

Definition at line 44 of file at45xx.h.

◆ MAIN_MEMORY_PAGE_TO_BUFFER2_COPY

#define MAIN_MEMORY_PAGE_TO_BUFFER2_COPY   0x55

Definition at line 42 of file at45xx.h.

◆ MAIN_MEMORY_THROUGH_BUFFER1_PROGRAM

#define MAIN_MEMORY_THROUGH_BUFFER1_PROGRAM   0x82

Definition at line 53 of file at45xx.h.

◆ MAIN_MEMORY_THROUGH_BUFFER2_PROGRAM

#define MAIN_MEMORY_THROUGH_BUFFER2_PROGRAM   0x85

Definition at line 54 of file at45xx.h.

◆ MAX_PAGE_1MBIT_DENSITY

#define MAX_PAGE_1MBIT_DENSITY   512

Definition at line 91 of file at45xx.h.

◆ MAX_PAGE_32MBIT_DENSITY

#define MAX_PAGE_32MBIT_DENSITY   8192

Density related parameters

Definition at line 90 of file at45xx.h.

◆ PAGE_ERASE

#define PAGE_ERASE   0x81

Definition at line 51 of file at45xx.h.

◆ PAGESIZE

#define PAGESIZE   264

Definition at line 92 of file at45xx.h.

Function Documentation

◆ DF_AutoPageRewrite()

void DF_AutoPageRewrite ( WORD  PageNum)

Auto page rewrite command

Parameters
PageNum- Page to execute command.

Definition at line 170 of file at45xx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DF_Buffer12MainMemory()

void DF_Buffer12MainMemory ( WORD  PageNum)

◆ DF_Buffer12MainMemoryE()

void DF_Buffer12MainMemoryE ( WORD  PageNum)

Erase, sets to 1's, the selected page.

Parameters
PageNum- Page number to erase. Copy Buffer 1 to Main Memory, erase first.
PageNum- Page number to copy buffer contents.

Definition at line 127 of file at45xx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DF_Compare()

void DF_Compare ( WORD  Pagenum)

Compare buffer and page. Read Status value to see result.

Parameters
PageNum- Page to execute command.

Definition at line 192 of file at45xx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DF_ErasePage()

void DF_ErasePage ( WORD  PageNum)

◆ DF_Page2Buffer1()

void DF_Page2Buffer1 ( WORD  Pagenum)

Get Page to Buffer 1

Parameters
Pagenum- Page numbre to get.

Definition at line 149 of file at45xx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DF_ReadBuffer1()

void DF_ReadBuffer1 ( WORD  Address,
BYTE data,
WORD  size 
)

Reads contents from the buffer 1.

Parameters
Address- offset from the internal buffer. data - buffer to store data size - number of bytes to read

Definition at line 79 of file at45xx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DF_ReadMainMemory()

void DF_ReadMainMemory ( WORD  PageNum,
WORD  SubAddress,
BYTE buff,
WORD  size 
)

◆ DF_ReadStatus()

BYTE DF_ReadStatus ( void  )

Read the status byte from the device

Returns
the status byte.

Definition at line 30 of file at45xx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DF_WriteBuffer1()

void DF_WriteBuffer1 ( WORD  Address,
BYTE Data,
WORD  size 
)

Store a buffer to the internal Buffer 1.

Parameters
Address- offset from the internal buffer. Data - buffer to store data size - number of bytes to read

Definition at line 52 of file at45xx.c.

Here is the call graph for this function:
Here is the caller graph for this function: