chg-stn-motherboard-ti-mcu/NOR_FLASH/nor_flash.h

32 lines
1.0 KiB
C

/*
* nor_flash.h
*
* Created on: 16-Jan-2023
* Author: Vecmocon Technology
*/
#ifndef INC_NOR_FLASH_H_
#define INC_NOR_FLASH_H_
#include "SDK/inc/flash_types.h"
#define EEPROM_PARTITION 13 //In sectors
#define MAX_RW_ALLOWED PAGE_SIZE //In Bytes
flashStatus_t flash_eraseCommands(uint32_t address, flash_eraseCmds command);
flashStatus_t flash_programPage(uint32_t address, const uint8_t *data, uint16_t length);
flashStatus_t flash_readData(uint32_t address, uint8_t *data, uint16_t length);
flashStatus_t flash_getUID(uint8_t* uID);
flashStatus_t flash_getMID(uint8_t* mID, uint8_t* dID);
flashStatus_t flash_getRID(uint8_t* mID, uint16_t* id);
#define flashPageErase(address) flash_eraseCommands(address, FLASH_PAGE_ERASE)
#define flashSectorErase(address) flash_eraseCommands(address, FLASH_SECTOR_ERASE)
#define flashBlockErase(address) flash_eraseCommands(address, FLASH_BLOCK_ERASE)
#define flashChipErase(address) flash_eraseCommands(address, FLASH_CHIP_ERASE)
#endif /* INC_NOR_FLASH_H_ */