norflash.h
Go to the documentation of this file.00001
00017 #ifndef __NORFLASH_H
00018 #define __NORFLASH_H
00019
00020 #include <stdint.h>
00021 #include <stdbool.h>
00022 #include <stddef.h>
00023
00024
00029
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037
00039 typedef enum
00040 {
00041 NORFLASH_STATUS_OK = 0,
00042 NORFLASH_NONUNIFORM_GEOMETRY = -1,
00043 NORFLASH_NOT_CFI_DEVICE = -2,
00044 NORFLASH_WRITE_FAILURE = -3,
00045 NORFLASH_WRITE_TIMEOUT = -4,
00046 NORFLASH_INVALID_ADDRESS = -5,
00047 NORFLASH_MISALIGNED_ADDRESS = -6,
00048 } NORFLASH_Status_TypeDef;
00049
00051 typedef struct
00052 {
00053 uint32_t baseAddress;
00054 uint32_t deviceId;
00055 uint32_t deviceSize;
00056 uint32_t sectorCount;
00057 uint32_t sectorSize;
00058 uint16_t manufacturerId;
00059 } NORFLASH_Info_TypeDef;
00060
00061 bool NORFLASH_AddressValid(uint32_t addr);
00062 NORFLASH_Info_TypeDef* NORFLASH_DeviceInfo(void);
00063 int NORFLASH_EraseDevice(void);
00064 int NORFLASH_EraseSector(uint32_t addr);
00065 int NORFLASH_Init(void);
00066 int NORFLASH_ProgramByte(uint32_t addr, uint8_t data);
00067 int NORFLASH_ProgramWord16(uint32_t addr, uint16_t data);
00068 int NORFLASH_ProgramWord32(uint32_t addr, uint32_t data);
00069 int NORFLASH_Program(uint32_t addr, uint8_t *data, uint32_t count);
00070
00071 #ifdef __cplusplus
00072 }
00073 #endif
00074
00078 #endif