SAM3S8/SD8 Software Package: libraries/memories/include/NorFlashCommon.h File Reference

SAM3S8/SD8 Software Package 1.2
Defines | Functions

# NorFlashCommon.h File Reference

Go to the source code of this file.

## Defines

#define | NorCommon_ERROR_NONE 0
#define | NorCommon_ERROR_UNKNOWNMODEL 1
#define | NorCommon_ERROR_CANNOTREAD 2
#define | NorCommon_ERROR_CANNOTWRITE 3
#define | NorCommon_ERROR_CANNOTERASE 4
#define | NorCommon_ERROR_PROTECT 5

## Functions

unsigned char | WriteCommand (unsigned char portWidth, unsigned int commandAddress, unsigned int command)
| Write a command to address.
void | ReadRawData (unsigned char portWidth, unsigned int dataAddress, unsigned char *buffer)
| Reads data from the NorFlash chip into the provided buffer.
void | WriteRawData (unsigned char portWidth, unsigned int dataAddress, unsigned char *buffer)
| Writes data to the NorFlash chip from the provided buffer.

## Detailed Description

## Purpose

The Hardware Adaptation Layer manages the hardware functions of the NORFLASH Flash. It implements a low level driver to manage the hardware functionality of NORFLASH.

## Usage

1. WriteRawData() is used to write data to the NorFlash device.
2. ReadRawData() is used to read data from the NorFlash device.
3. The specified address for read/write opertion is an linear byte address of targer application byte address space represented by WORD((8-bit, 16-bit, 32-bit). The start (base) address of the flash memory in this address space is defined in board.h file as BOARD_NORFLASH_ADDR and users might need to change it.
4. WriteCommand() is used to write a command to specified command address.

## NorFlash_Error_Codes

It provides detailed error codes to describe the various errors that may occur during the operation. Some functions return an error number directly as the function value. These functions return a value of zero (NorCommon_ERROR_NONE) to indicate a success.

Definition in file NorFlashCommon.h.

## Define Documentation

#define NorCommon_ERROR_CANNOTERASE 4

A erase operation cannot be carried out.

Definition at line 79 of file NorFlashCommon.h.

#define NorCommon_ERROR_CANNOTREAD 2

A read operation cannot be carried out.

Definition at line 73 of file NorFlashCommon.h.

#define NorCommon_ERROR_CANNOTWRITE 3

A write operation cannot be carried out.

Definition at line 76 of file NorFlashCommon.h.

#define NorCommon_ERROR_NONE 0

The function completed successfully.

Definition at line 67 of file NorFlashCommon.h.

#define NorCommon_ERROR_PROTECT 5

A locked operation cannot be carried out.

Definition at line 82 of file NorFlashCommon.h.

#define NorCommon_ERROR_UNKNOWNMODEL 1

Can not detect common flash infterface.

Definition at line 70 of file NorFlashCommon.h.

## Function Documentation

void ReadRawData | ( | unsigned char | busWidth,
|  | unsigned int | address,
|  | unsigned char * | buffer
| ) |  |

Reads data from the NorFlash chip into the provided buffer.

Parameters:

  busWidth | Bus width in device.
  address | Address of data.
  buffer | Buffer where the data will be stored.

Definition at line 104 of file NorFlashCommon.c.

unsigned char WriteCommand | ( | unsigned char | busWidth,
|  | unsigned int | commandAddress,
|  | unsigned int | command
| ) |  |

Write a command to address.

Parameters:

  busWidth | Bus width in device.
  commandAddress | Command address offset.
  command | Command to be send.

Definition at line 79 of file NorFlashCommon.c.

void WriteRawData | ( | unsigned char | busWidth,
|  | unsigned int | address,
|  | unsigned char * | buffer
| ) |  |

Writes data to the NorFlash chip from the provided buffer.

Parameters:

  busWidth | Bus width in device.
  address | Address of data.
  buffer | Buffer where the data will be stored.

Definition at line 130 of file NorFlashCommon.c.

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines