norflash.h
Go to the documentation of this file.00001
00035 #ifndef __NORFLASH_H
00036 #define __NORFLASH_H
00037
00038 #include <stdint.h>
00039 #include <stdbool.h>
00040 #include <stddef.h>
00041
00042
00047
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055
00057 typedef enum
00058 {
00059 NORFLASH_STATUS_OK = 0,
00060 NORFLASH_NONUNIFORM_GEOMETRY = -1,
00061 NORFLASH_NOT_CFI_DEVICE = -2,
00062 NORFLASH_WRITE_FAILURE = -3,
00063 NORFLASH_WRITE_TIMEOUT = -4,
00064 NORFLASH_INVALID_ADDRESS = -5,
00065 NORFLASH_MISALIGNED_ADDRESS = -6,
00066 } NORFLASH_Status_TypeDef;
00067
00069 typedef struct
00070 {
00071 uint32_t baseAddress;
00072 uint32_t deviceId;
00073 uint32_t deviceSize;
00074 uint32_t sectorCount;
00075 uint32_t sectorSize;
00076 uint16_t manufacturerId;
00077 } NORFLASH_Info_TypeDef;
00078
00079 bool NORFLASH_AddressValid(uint32_t addr);
00080 NORFLASH_Info_TypeDef* NORFLASH_DeviceInfo(void);
00081 int NORFLASH_EraseDevice(void);
00082 int NORFLASH_EraseSector(uint32_t addr);
00083 int NORFLASH_Init(void);
00084 int NORFLASH_ProgramByte(uint32_t addr, uint8_t data);
00085 int NORFLASH_ProgramWord16(uint32_t addr, uint16_t data);
00086 int NORFLASH_ProgramWord32(uint32_t addr, uint32_t data);
00087 int NORFLASH_Program(uint32_t addr, uint8_t *data, uint32_t count);
00088
00089 #ifdef __cplusplus
00090 }
00091 #endif
00092
00096 #endif