123
Fork of LG by
Diff: DeviceFlash.h
- Revision:
- 198:78dd6d14d108
- Parent:
- 197:7a05523bf588
diff -r 7a05523bf588 -r 78dd6d14d108 DeviceFlash.h --- a/DeviceFlash.h Wed Oct 19 10:55:05 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -#ifndef __DEVICE_FLASH_H__ -#define __DEVICE_FLASH_H__ - -#include "IAP.h" - -//Flash memory page size: 256|512|1024|4096 allowed -#define FLASH_PAGE_SIZE 256 - -//Hash sector - 8 bytes per hash -typedef struct _DeviceFlashHash { - uint32_t hash; //Hash - uint32_t address; //Address of data located in data sector - //uint16_t size; //Size of data -} DeviceFlashHash; - -typedef struct _DeviceFlashSettings { - uint16_t hashSector; //Sector of "hash - data address" pairs - //uint16_t hashPageLength; - uint16_t dataSector; //Sector of data, referenced from hash sector - //uint16_t dataPageLength; -} DeviceFlashSettings; - -typedef struct _DeviceFlashWriteOperation { - uint8_t pageBuffer[FLASH_PAGE_SIZE]; //Page buffer - //uint16_t pageLength; - uint16_t pagePosition; //Position in page buffer to write in - - uint16_t sector; //Current sector to write data in - uint32_t sectorAddress; //Starting address of sector to write data from page buffer - uint16_t sectorPosition; //Position in sector to write data from page buffer relative to sector start address - uint16_t sectorLength; //Length of current sector - - uint32_t bytes; //Count of bytes written - uint32_t maxBytes; //Maximum allowed bytes to write -} DeviceFlashWriteOperation; - -typedef struct _DeviceFlashState { -} DeviceFlashState; - -typedef struct _DeviceFlash { - DeviceFlashSettings settings; - DeviceFlashState state; -} DeviceFlash; - -void InitFlashDefaultSettings(void); -void InitFlashState(void); - -uint32_t AddressFromSector(uint8_t sector); -uint16_t LengthFromSector(uint8_t sector); -//uint8_t sectorFromAddress(uint32_t address); - -void DeviceFlashReadAll(void); -void DeviceFlashWriteAll(void); - -#endif /* __DEVICE_FLASH_H__ */ \ No newline at end of file