NorFlashKit Drivers

Data Structures

struct NORFLASH_Info_TypeDef
NORFLASH device information struct.

Enumerations

enum NORFLASH_Status_TypeDef {
NORFLASH_STATUS_OK = 0,
NORFLASH_NONUNIFORM_GEOMETRY = -1,
NORFLASH_NOT_CFI_DEVICE = -2,
NORFLASH_WRITE_FAILURE = -3,
NORFLASH_WRITE_TIMEOUT = -4,
NORFLASH_INVALID_ADDRESS = -5,
NORFLASH_MISALIGNED_ADDRESS = -6,
NORFLASH_STATUS_OK = 0,
NORFLASH_UNSUPPORTED_GEOMETRY = -1,
NORFLASH_NOT_CFI_DEVICE = -2,
NORFLASH_WRITE_FAILURE = -3,
NORFLASH_WRITE_TIMEOUT = -4,
NORFLASH_INVALID_ADDRESS = -5,
NORFLASH_MISALIGNED_ADDRESS = -6
}
NORFLASH status enumerator.
enum NORFLASH_Status_TypeDef {
NORFLASH_STATUS_OK = 0,
NORFLASH_NONUNIFORM_GEOMETRY = -1,
NORFLASH_NOT_CFI_DEVICE = -2,
NORFLASH_WRITE_FAILURE = -3,
NORFLASH_WRITE_TIMEOUT = -4,
NORFLASH_INVALID_ADDRESS = -5,
NORFLASH_MISALIGNED_ADDRESS = -6,
NORFLASH_STATUS_OK = 0,
NORFLASH_UNSUPPORTED_GEOMETRY = -1,
NORFLASH_NOT_CFI_DEVICE = -2,
NORFLASH_WRITE_FAILURE = -3,
NORFLASH_WRITE_TIMEOUT = -4,
NORFLASH_INVALID_ADDRESS = -5,
NORFLASH_MISALIGNED_ADDRESS = -6
}
NORFLASH status enumerator.

Functions

bool NORFLASH_AddressValid (uint32_t addr)
Check if an address is valid for the flash device.
NORFLASH_Info_TypeDef * NORFLASH_DeviceInfo (void)
Return a pointer to a NORFLASH_Info_TypeDef , which contain vital flash device information.
int NORFLASH_EraseDevice (void)
Erase entire flash device.
int NORFLASH_EraseSector (uint32_t addr)
Erase a sector in the flash device.
uint32_t NORFLASH_getDeviceID (void)
Get flash device ID.
uint32_t NORFLASH_getDeviceSize (void)
Get flash device size.
uint32_t NORFLASH_getSectorRegionCount (void)
Get flash sector region count.
uint32_t NORFLASH_getVendorID (void)
Get manufacturer ID.
int NORFLASH_Init (void)
Initialize the NORFLASH module.
int NORFLASH_Program (uint32_t addr, uint8_t *data, uint32_t count)
Program the flash device.
int NORFLASH_ProgramByte (uint32_t addr, uint8_t data)
Program a single byte in the flash device.
int NORFLASH_ProgramWord16 (uint32_t addr, uint16_t data)
Program a word (16bit) in the flash device.
int NORFLASH_ProgramWord32 (uint32_t addr, uint32_t data)
Program a word (32bit) in the flash device.

Enumeration Type Documentation

NORFLASH status enumerator.

Enumerator
NORFLASH_STATUS_OK

No errors detected.

NORFLASH_NONUNIFORM_GEOMETRY

The flash has non-uniform sector scheme.

NORFLASH_NOT_CFI_DEVICE

The flash is not CFI compliant.

NORFLASH_WRITE_FAILURE

Flash write/erase failure.

NORFLASH_WRITE_TIMEOUT

Flash write/erase timeout.

NORFLASH_INVALID_ADDRESS

Invalid flash address.

NORFLASH_MISALIGNED_ADDRESS

Misaligned flash word address.

NORFLASH_STATUS_OK

No errors detected.

NORFLASH_UNSUPPORTED_GEOMETRY

The flash has an unsupported sector scheme.

NORFLASH_NOT_CFI_DEVICE

The flash is not CFI compliant.

NORFLASH_WRITE_FAILURE

Flash write/erase failure.

NORFLASH_WRITE_TIMEOUT

Flash write/erase timeout.

NORFLASH_INVALID_ADDRESS

Invalid flash address.

NORFLASH_MISALIGNED_ADDRESS

Misaligned flash word address.

Definition at line 38 of file norflash.h .

NORFLASH status enumerator.

Enumerator
NORFLASH_STATUS_OK

No errors detected.

NORFLASH_NONUNIFORM_GEOMETRY

The flash has non-uniform sector scheme.

NORFLASH_NOT_CFI_DEVICE

The flash is not CFI compliant.

NORFLASH_WRITE_FAILURE

Flash write/erase failure.

NORFLASH_WRITE_TIMEOUT

Flash write/erase timeout.

NORFLASH_INVALID_ADDRESS

Invalid flash address.

NORFLASH_MISALIGNED_ADDRESS

Misaligned flash word address.

NORFLASH_STATUS_OK

No errors detected.

NORFLASH_UNSUPPORTED_GEOMETRY

The flash has an unsupported sector scheme.

NORFLASH_NOT_CFI_DEVICE

The flash is not CFI compliant.

NORFLASH_WRITE_FAILURE

Flash write/erase failure.

NORFLASH_WRITE_TIMEOUT

Flash write/erase timeout.

NORFLASH_INVALID_ADDRESS

Invalid flash address.

NORFLASH_MISALIGNED_ADDRESS

Misaligned flash word address.

Definition at line 38 of file norflash_s29gl.h .

Function Documentation

bool NORFLASH_AddressValid ( uint32_t addr )

Check if an address is valid for the flash device.

Parameters
[in] addr The address value to check.
Returns
True if address value is valid, false otherwise.

Definition at line 48 of file norflash.c .

References NORFLASH_Info_TypeDef::baseAddress , NORFLASH_Info_TypeDef::deviceSize , and NORFLASH_STATUS_OK .

Referenced by NORFLASH_EraseSector() , NORFLASH_Program() , and NORFLASH_ProgramWord16() .

NORFLASH_Info_TypeDef * NORFLASH_DeviceInfo ( void )

Return a pointer to a NORFLASH_Info_TypeDef , which contain vital flash device information.

Returns
NULL if unable to initialize the flash if no prior call to NORFLASH_Init() has been made. Pointer to a NORFLASH_Info_TypeDef on success.

Definition at line 74 of file norflash.c .

References NORFLASH_STATUS_OK .

int NORFLASH_EraseDevice ( void )

Erase entire flash device.

Returns
NORFLASH_STATUS_OK on success, an error code enumerated in NORFLASH_Status_TypeDef on failure.

Definition at line 93 of file norflash.c .

References NORFLASH_Info_TypeDef::baseAddress , and NORFLASH_STATUS_OK .

int NORFLASH_EraseSector ( uint32_t addr )

Erase a sector in the flash device.

Parameters
[in] addr Address of the sector to erase.
Returns
NORFLASH_STATUS_OK on success, an error code enumerated in NORFLASH_Status_TypeDef on failure.

Definition at line 126 of file norflash.c .

References NORFLASH_AddressValid() , NORFLASH_INVALID_ADDRESS , NORFLASH_STATUS_OK , and NORFLASH_Info_TypeDef::sectorSize .

uint32_t NORFLASH_getDeviceID ( void )

Get flash device ID.

Returns
Flash device ID

Definition at line 409 of file norflash_s29gl.c .

uint32_t NORFLASH_getDeviceSize ( void )

Get flash device size.

Returns
Flash device size

Definition at line 427 of file norflash_s29gl.c .

uint32_t NORFLASH_getSectorRegionCount ( void )

Get flash sector region count.

Returns
Flash sector region

Definition at line 439 of file norflash_s29gl.c .

uint32_t NORFLASH_getVendorID ( void )

Get manufacturer ID.

Returns
Manufacturer ID

Definition at line 397 of file norflash_s29gl.c .

int NORFLASH_Init ( void )

Initialize the NORFLASH module.

Note
This function should be called before any other NORFLASH_xxx() functions are used.
Returns
NORFLASH_STATUS_OK on success, an error code enumerated in NORFLASH_Status_TypeDef on failure.

Definition at line 169 of file norflash.c .

int NORFLASH_Program ( uint32_t addr,
uint8_t * data,
uint32_t count
)

Program the flash device.

Note
It is assumed that the area to be programmed is erased.
Parameters
[in] addr The first address in the flash to be programmed.
[in] data Pointer to the data to be programmed.
[in] count Number of bytes to be programmed.
Returns
NORFLASH_STATUS_OK on success, an error code enumerated in NORFLASH_Status_TypeDef on failure.

Definition at line 194 of file norflash.c .

References NORFLASH_AddressValid() , NORFLASH_INVALID_ADDRESS , NORFLASH_ProgramByte() , NORFLASH_ProgramWord16() , NORFLASH_STATUS_OK , NORFLASH_Info_TypeDef::sectorSize , and SL_MIN .

int NORFLASH_ProgramByte ( uint32_t addr,
uint8_t data
)

Program a single byte in the flash device.

Note
It is assumed that the area to be programmed is erased.
Parameters
[in] addr The address to be programmed.
[in] data The byte value to be programmed.
Returns
NORFLASH_STATUS_OK on success, an error code enumerated in NORFLASH_Status_TypeDef on failure.

Definition at line 282 of file norflash.c .

References NORFLASH_ProgramWord16() .

Referenced by NORFLASH_Program() .

int NORFLASH_ProgramWord16 ( uint32_t addr,
uint16_t data
)

Program a word (16bit) in the flash device.

Note
It is assumed that the area to be programmed is erased.
Parameters
[in] addr The address to be programmed.
[in] data The word value to be programmed.
Returns
NORFLASH_STATUS_OK on success, an error code enumerated in NORFLASH_Status_TypeDef on failure.

Definition at line 313 of file norflash.c .

References NORFLASH_AddressValid() , NORFLASH_INVALID_ADDRESS , NORFLASH_MISALIGNED_ADDRESS , and NORFLASH_STATUS_OK .

Referenced by NORFLASH_Program() , NORFLASH_ProgramByte() , and NORFLASH_ProgramWord32() .

int NORFLASH_ProgramWord32 ( uint32_t addr,
uint32_t data
)

Program a word (32bit) in the flash device.

Note
It is assumed that the area to be programmed is erased.
Parameters
[in] addr The address to be programmed.
[in] data The word value to be programmed.
Returns
NORFLASH_STATUS_OK on success, an error code enumerated in NORFLASH_Status_TypeDef on failure.

Definition at line 360 of file norflash.c .

References NORFLASH_MISALIGNED_ADDRESS , NORFLASH_ProgramWord16() , and NORFLASH_STATUS_OK .