LPCOpen Platform for LPC18XX/43XX microcontrollers: BOARD: Driver for SST39VF320

| LPCOpen Platform for LPC18XX/43XX microcontrollers 18XX43XX LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers

- Main Page
- Modules
- Data Structures
- Files

Macros | Functions
BOARD: Driver for SST39VF320
BOARD: Board specific NOR Flash drivers

## Detailed Description

Various functions for reading and writting to NOR FLASH

## Macros
#define | FLASH_SIZE (4 << 20) /* 2Mx16 */
#define | SECTOR_SIZE (4 << 10) /* 2K words */
#define | BLOCK_SIZE (64 << 10) /* 32K words */
#define | TOGGLE_BIT (1 << 6) /* DQ6 */

## Functions
void | lpc_norflash_init (void)
| Initialize flash. More...
void | lpc_norflash_get_size (UNS_32 *size, UNS_32 *sector_count)
| Return the flash size. More...
UNS_32 | lpc_norflash_get_sector_offset (UNS_32 sector)
| Return the sector offset. More...
void | lpc_norflash_get_id (UNS_16 *manu_id, UNS_16 *device_id)
| Read manufacturer ID and device ID. More...
bool | lpc_norflash_toggle_bit_check (UNS_32 addr)
| Check Toggle Bit is being toggled or not. More...
void | lpc_norflash_erase_sector (UNS_32 sec_addr)
| Erase a sector. More...
void | lpc_norflash_write_word (UNS_32 addr, UNS_16 data)
| Write data to flash. More...
UNS_32 | lpc_norflash_write_buffer (UNS_32 addr, UNS_16 *data, UNS_32 size)
| Write buffer to flash. More...
UNS_16 | lpc_norflash_read_word (UNS_32 addr)
| Read data from flash. More...

## Macro Definition Documentation

#define BLOCK_SIZE (64 << 10) /* 32K words */

Definition at line 49 of file lpc_norflash_sst39vf320.c.

#define FLASH_SIZE (4 << 20) /* 2Mx16 */

Definition at line 45 of file lpc_norflash_sst39vf320.c.

#define SECTOR_SIZE (4 << 10) /* 2K words */

Definition at line 47 of file lpc_norflash_sst39vf320.c.

#define TOGGLE_BIT (1 << 6) /* DQ6 */

Definition at line 51 of file lpc_norflash_sst39vf320.c.

## Function Documentation

void lpc_norflash_erase_sector | ( | UNS_32 | addr | ) |

Erase a sector.

Parameters

  addr | : Sector address

Returns
  Nothing

Definition at line 122 of file lpc_norflash_sst39vf320.c.

void lpc_norflash_get_id | ( | UNS_16 * | manu_id,
|  | UNS_16 * | device_id
| ) |  |

Read manufacturer ID and device ID.

Parameters

  manu_id | : pointer to where to place manufacturer ID
  device_id | : pointer to where to place device ID

Returns
  Nothing

Definition at line 81 of file lpc_norflash_sst39vf320.c.

UNS_32 lpc_norflash_get_sector_offset | ( | UNS_32 | sector | ) |

Return the sector offset.

Parameters

  sector | : Sector number

Returns
  Nothing

Definition at line 76 of file lpc_norflash_sst39vf320.c.

void lpc_norflash_get_size | ( | UNS_32 * | size,
|  | UNS_32 * | sector_count
| ) |  |

Return the flash size.

Parameters

  size | : pointer to where to place the total size(bytes)
  sector_count | : pointer to where to place the number of sectors

Returns
  Nothing

Definition at line 69 of file lpc_norflash_sst39vf320.c.

void lpc_norflash_init | ( | void |  | ) |

Initialize flash.

Returns
  Nothing

Definition at line 65 of file lpc_norflash_sst39vf320.c.

UNS_16 lpc_norflash_read_word | ( | UNS_32 | addr | ) |

Read data from flash.

Parameters

  addr | : Address

Returns
  Data value read from the address

Note
  addr must be word-aligned.

Definition at line 154 of file lpc_norflash_sst39vf320.c.

bool lpc_norflash_toggle_bit_check | ( | UNS_32 | addr | ) |

Check Toggle Bit is being toggled or not.

Parameters

  addr | : Address

Returns
  false(being toggled)/true(stop toggling)

Note
  During the Program/Erase operation, any consecutive attempts to read toggle bit will produce alternating "1"s and "0"s, i.e., toggling between 1 and 0. When the Program or Erase operation is completed, this bit will stop toggling. The flash is then ready for the next operation.
  This function reads a word at the given address (addr) 2 times, and then checks the toggle bit. If the value of toggle bit are the same, true is returned. Otherwise, false is returned.

Definition at line 110 of file lpc_norflash_sst39vf320.c.

UNS_32 lpc_norflash_write_buffer | ( | UNS_32 | addr,
|  | UNS_16 * | data,
|  | UNS_32 | size
| ) |  |

Write buffer to flash.

Parameters

  addr | : Address
  data | : Pointer to data to write
  size | The number of (bytes)

Returns
  The number of written bytes

Note
  addr must be word-aligned.

Definition at line 142 of file lpc_norflash_sst39vf320.c.

void lpc_norflash_write_word | ( | UNS_32 | addr,
|  | UNS_16 | data
| ) |  |

Write data to flash.

Parameters

  addr | : Address
  data | : Data value to write

Returns
  Nothing

Note
  addr must be word-aligned.

Definition at line 133 of file lpc_norflash_sst39vf320.c.