AT45 DataFlash

Defines

#define AT45_PAGE_ADDR_MASK   ((1 << 13) - 1)
 Mask for AT45 page address (13-bit).
#define AT45_PAGE_POS_MASK   ((1 << 11) - 1)
 Mask for AT45 page position (11-bit).
#define AT45_ATMEL_JEDEC_ID   0x1f
 Atmel AT45 JEDEC ID.
#define AT45_DATAFLASH_FAMILY_CODE   0x20
 DataFlash familty code.
#define AT45_FAMILY_CODE_MASK   0xe0
 Mask for AT45 family code.
#define AT45_DENSITY_CODE_MIN   2
 Minimum AT45 density code.
#define AT45_DENSITY_CODE_MAX   8
 Maximum AT45 density code.
#define AT45_DENSITY_CODE_MASK   0x1f
 Mask for AT45 density code.
#define AT45_DENSITY_CODE_0_DEVICE_SIZE   0x8000L
 The device size in bytes for density code 0.
#define AT45_PAGE_SIZE_ID_0_SIZE   256
 The page size in bytes for page size id 0.

Enumerations

enum  at45_cmd {
  AT45_CMD_CONTINOUS_ARRAY_READ = 0x0b, AT45_CMD_MAIN_MEMORY_TO_BUFFER_1_TRANSFER = 0x53, AT45_CMD_BUFFER_1_MAIN_MEMORY_PROGRAM_WITH_ERASE = 0x83, AT45_CMD_BUFFER_1_WRITE = 0x84,
  AT45_CMD_READ_ID = 0x9f, AT45_CMD_READ_STATUS_REG = 0xd7
}
 

AT45 Commands.

More...
enum  at45_status_bit { AT45_STATUS_PAGE_SIZE = 0, AT45_STATUS_PROTECT = 1, AT45_STATUS_COMP = 6, AT45_STATUS_RDY = 7 }
 

AT45 status register bits.

More...

Functions

static bool at45_is_atmel_jedec_id (uint8_t manuf_id)
 Test if AT45 mamufacturer ID is Atmel's.
static bool at45_is_dataflash_family_code (uint8_t device_id1)
 Test if AT45 device ID is DataFlash family.
static uint8_t at45_get_density_code (uint8_t device_id1)
 Get AT45 density code from Device ID 1.
static bool at45_is_valid_density_code (uint8_t device_id1)
 Test if AT45 device ID have a valid density code.
static bool at45_is_valid_id (uint8_t manuf_id, uint8_t device_id1)
 Test if AT45 device ID is DataFlash family.
static uint32_t at45_get_size (uint8_t device_id1)
 Get AT45 device size from Device ID 1.
static uint32_t at45_get_page_size (uint8_t device_id1)
 Get AT45 device page size from Device ID 1.

Variables

static const uint8_t at45_density_table []
 AT45 density code to device size information translation table.

AT45 segmentation defines

This can be used to build up a singel byte of information containing information on page size, sector size and device size.



#define AT45_PS_256   (0 << 0)
 Page size 256 bytes.
#define AT45_PS_512   (1 << 0)
 Page size 512 bytes.
#define AT45_PS_1024   (2 << 0)
 Page size 1024 bytes.
#define AT45_PS_MASK   (7 << 0)
 Page size mask bits.
#define AT45_SS_128P   (0 << 3)
 Sector size 128 pages.
#define AT45_SS_256P   (1 << 3)
 Sector size 256 bytes.
#define AT45_SS_MASK   (3 << 3)
 Sector size mask bits.
#define AT45_DS_4S   (0 << 4)
 Device size 4 sectors.
#define AT45_DS_8S   (1 << 4)
 Device size 8 sectors.
#define AT45_DS_16S   (2 << 4)
 Device size 16 sectors.
#define AT45_DS_32S   (3 << 4)
 Device size 32 sectors.
#define AT45_DS_64S   (4 << 4)
 Device size 64 sectors.
#define AT45_DS_MASK   (7 << 4)

AT45 devices size information bitmask

Associates AT45 device type to a bitmask with size information



#define AT45DB011D   (AT45_PS_256 | AT45_SS_128P | AT45_DS_4S)
 Size definitions for AT45DB011D.
#define AT45DB021D   (AT45_PS_256 | AT45_SS_128P | AT45_DS_8S)
 Size definitions for AT45DB021D.
#define AT45DB041D   (AT45_PS_256 | AT45_SS_256P | AT45_DS_8S)
 Size definitions for AT45DB031D.
#define AT45DB081D   (AT45_PS_256 | AT45_SS_256P | AT45_DS_16S)
 Size definitions for AT45DB081D.
#define AT45DB161D   (AT45_PS_512 | AT45_SS_256P | AT45_DS_16S)
 Size definitions for AT45DB161D.
#define AT45DB321D   (AT45_PS_512 | AT45_SS_128P | AT45_DS_64S)
 Size definitions for AT45DB321D.
#define AT45DB642D   (AT45_PS_1024 | AT45_SS_256P | AT45_DS_32S)
 Size definitions for AT45DB641D.

Detailed Description

The following types of DataFlash are supported:


Define Documentation

#define AT45_ATMEL_JEDEC_ID   0x1f

Atmel AT45 JEDEC ID.

Definition at line 134 of file at45.h.

Referenced by at45_is_atmel_jedec_id().

#define AT45_DATAFLASH_FAMILY_CODE   0x20

DataFlash familty code.

Definition at line 137 of file at45.h.

Referenced by at45_is_dataflash_family_code().

#define AT45_DENSITY_CODE_0_DEVICE_SIZE   0x8000L

The device size in bytes for density code 0.

Not a known density code, but usefull for calculation since for every step up in density code doubles the deviedc size. So it can be used as a base to be shifted.

Definition at line 158 of file at45.h.

Referenced by at45_get_size().

#define AT45_DENSITY_CODE_MASK   0x1f

Mask for AT45 density code.

Definition at line 149 of file at45.h.

Referenced by at45_get_density_code().

#define AT45_DENSITY_CODE_MAX   8

Maximum AT45 density code.

Definition at line 146 of file at45.h.

Referenced by at45_is_valid_density_code().

#define AT45_DENSITY_CODE_MIN   2

Minimum AT45 density code.

Definition at line 143 of file at45.h.

Referenced by at45_is_valid_density_code().

#define AT45_DS_16S   (2 << 4)

Device size 16 sectors.

Definition at line 74 of file at45.h.

#define AT45_DS_32S   (3 << 4)

Device size 32 sectors.

Definition at line 75 of file at45.h.

#define AT45_DS_4S   (0 << 4)

Device size 4 sectors.

Definition at line 72 of file at45.h.

#define AT45_DS_64S   (4 << 4)

Device size 64 sectors.

Definition at line 76 of file at45.h.

#define AT45_DS_8S   (1 << 4)

Device size 8 sectors.

Definition at line 73 of file at45.h.

#define AT45_DS_MASK   (7 << 4)

Device size mask bits

Definition at line 77 of file at45.h.

#define AT45_FAMILY_CODE_MASK   0xe0

Mask for AT45 family code.

Definition at line 140 of file at45.h.

Referenced by at45_is_dataflash_family_code().

#define AT45_PAGE_ADDR_MASK   ((1 << 13) - 1)

Mask for AT45 page address (13-bit).

Definition at line 128 of file at45.h.

Referenced by at45_cmd_buffer_1_main_memory_program_with_erase(), at45_cmd_cont_array_read(), and at45_cmd_main_memory_to_buffer_1_transfer().

#define AT45_PAGE_POS_MASK   ((1 << 11) - 1)

Mask for AT45 page position (11-bit).

Definition at line 131 of file at45.h.

Referenced by at45_cmd_buffer_1_write(), and at45_cmd_cont_array_read().

#define AT45_PAGE_SIZE_ID_0_SIZE   256

The page size in bytes for page size id 0.

Definition at line 161 of file at45.h.

Referenced by at45_get_page_size().

#define AT45_PS_1024   (2 << 0)

Page size 1024 bytes.

Definition at line 67 of file at45.h.

#define AT45_PS_256   (0 << 0)

Page size 256 bytes.

Definition at line 65 of file at45.h.

#define AT45_PS_512   (1 << 0)

Page size 512 bytes.

Definition at line 66 of file at45.h.

#define AT45_PS_MASK   (7 << 0)

Page size mask bits.

Definition at line 68 of file at45.h.

Referenced by at45_get_page_size().

#define AT45_SS_128P   (0 << 3)

Sector size 128 pages.

Definition at line 69 of file at45.h.

#define AT45_SS_256P   (1 << 3)

Sector size 256 bytes.

Definition at line 70 of file at45.h.

#define AT45_SS_MASK   (3 << 3)

Sector size mask bits.

Definition at line 71 of file at45.h.

#define AT45DB011D   (AT45_PS_256 | AT45_SS_128P | AT45_DS_4S)

Size definitions for AT45DB011D.

Definition at line 88 of file at45.h.

#define AT45DB021D   (AT45_PS_256 | AT45_SS_128P | AT45_DS_8S)

Size definitions for AT45DB021D.

Definition at line 90 of file at45.h.

#define AT45DB041D   (AT45_PS_256 | AT45_SS_256P | AT45_DS_8S)

Size definitions for AT45DB031D.

Definition at line 92 of file at45.h.

#define AT45DB081D   (AT45_PS_256 | AT45_SS_256P | AT45_DS_16S)

Size definitions for AT45DB081D.

Definition at line 94 of file at45.h.

#define AT45DB161D   (AT45_PS_512 | AT45_SS_256P | AT45_DS_16S)

Size definitions for AT45DB161D.

Definition at line 96 of file at45.h.

#define AT45DB321D   (AT45_PS_512 | AT45_SS_128P | AT45_DS_64S)

Size definitions for AT45DB321D.

Definition at line 98 of file at45.h.

#define AT45DB642D   (AT45_PS_1024 | AT45_SS_256P | AT45_DS_32S)

Size definitions for AT45DB641D.

Definition at line 100 of file at45.h.


Enumeration Type Documentation

enum at45_cmd

AT45 Commands.

Enumerator:
AT45_CMD_CONTINOUS_ARRAY_READ 

Read continous data.

AT45_CMD_MAIN_MEMORY_TO_BUFFER_1_TRANSFER 

Transfer from flash to buffer 1.

AT45_CMD_BUFFER_1_MAIN_MEMORY_PROGRAM_WITH_ERASE 

Program buffer 1 into flash with built-in erase.

AT45_CMD_BUFFER_1_WRITE 

Write to buffer 1.

AT45_CMD_READ_ID 

Read manufacturer and device ID.

AT45_CMD_READ_STATUS_REG 

Read status register.

Definition at line 104 of file at45.h.

AT45 status register bits.

Enumerator:
AT45_STATUS_PAGE_SIZE 

Page size (1: power-of-2 size).

AT45_STATUS_PROTECT 

Sector protection.

AT45_STATUS_COMP 

Result of compare operation.

AT45_STATUS_RDY 

Ready for next command.

Definition at line 120 of file at45.h.


Function Documentation

static uint8_t at45_get_density_code ( uint8_t  device_id1  )  [inline, static]

Get AT45 density code from Device ID 1.

Parameters:
device_id1 Device ID part 1
Returns:
Density code

Definition at line 210 of file at45.h.

References AT45_DENSITY_CODE_MASK.

Referenced by at45_get_page_size(), at45_get_size(), and at45_is_valid_density_code().

static uint32_t at45_get_page_size ( uint8_t  device_id1  )  [inline, static]

Get AT45 device page size from Device ID 1.

Parameters:
device_id1 Device ID part 1
Returns:
Page size

Definition at line 264 of file at45.h.

References at45_density_table, at45_get_density_code(), AT45_PAGE_SIZE_ID_0_SIZE, and AT45_PS_MASK.

static uint32_t at45_get_size ( uint8_t  device_id1  )  [inline, static]

Get AT45 device size from Device ID 1.

Parameters:
device_id1 Device ID part 1
Returns:
Size of device

Definition at line 251 of file at45.h.

References AT45_DENSITY_CODE_0_DEVICE_SIZE, and at45_get_density_code().

static bool at45_is_atmel_jedec_id ( uint8_t  manuf_id  )  [inline, static]

Test if AT45 mamufacturer ID is Atmel's.

Parameters:
manuf_id Manufacturer ID
Return values:
true Is equal
false Is different

Definition at line 186 of file at45.h.

References AT45_ATMEL_JEDEC_ID.

Referenced by at45_is_valid_id().

static bool at45_is_dataflash_family_code ( uint8_t  device_id1  )  [inline, static]

Test if AT45 device ID is DataFlash family.

Parameters:
device_id1 Device ID part 1
Return values:
true Is equal
false Is different

Definition at line 198 of file at45.h.

References AT45_DATAFLASH_FAMILY_CODE, and AT45_FAMILY_CODE_MASK.

Referenced by at45_is_valid_id().

static bool at45_is_valid_density_code ( uint8_t  device_id1  )  [inline, static]

Test if AT45 device ID have a valid density code.

Parameters:
device_id1 Device ID part 1
Return values:
true Is equal
false Is different

Definition at line 222 of file at45.h.

References AT45_DENSITY_CODE_MAX, AT45_DENSITY_CODE_MIN, and at45_get_density_code().

Referenced by at45_is_valid_id().

static bool at45_is_valid_id ( uint8_t  manuf_id,
uint8_t  device_id1 
) [inline, static]

Test if AT45 device ID is DataFlash family.

Parameters:
manuf_id Manufacturer ID
device_id1 Device ID part 1
Return values:
true Is equal
false Is different

Definition at line 238 of file at45.h.

References at45_is_atmel_jedec_id(), at45_is_dataflash_family_code(), and at45_is_valid_density_code().


Variable Documentation

const uint8_t at45_density_table[] [static]
Initial value:
 {
        [2] = AT45DB011D,
        [3] = AT45DB021D,
        [4] = AT45DB041D,
        [5] = AT45DB081D,
        [6] = AT45DB161D,
        [7] = AT45DB321D,
        [8] = AT45DB642D,
}

AT45 density code to device size information translation table.

The device density code indicates a specific device, and this table translates from this to the device size information value.

Definition at line 169 of file at45.h.

Referenced by at45_get_page_size().

Generated on Thu Apr 29 15:18:24 2010 for display-training by  doxygen 1.6.3