// ----------------------------------------------------------------------------- /// @file InternalFlash.h /// @brief File description // ----------------------------------------------------------------------------- // Micro-Key bv // Industrieweg 28, 9804 TG Noordhorn // Postbus 92, 9800 AB Zuidhorn // The Netherlands // Tel: +31 594 503020 // Fax: +31 594 505825 // Email: support@microkey.nl // Web: www.microkey.nl // ----------------------------------------------------------------------------- /// $Revision$ /// $Author$ /// $Date$ // (c) 2015 Micro-Key bv // ----------------------------------------------------------------------------- /** * InternalFlash implementation * \defgroup InternalFlash Package InternalFlash * \ingroup Platform * @{ */ #ifndef INC_INTERNALFLASH_H_ #define INC_INTERNALFLASH_H_ // ----------------------------------------------------------------------------- // Include files // ----------------------------------------------------------------------------- #include #include "stm32f10x.h" #include "stm32f10x_flash.h" #include "MemoryDevice.h" // ----------------------------------------------------------------------------- // Constant and macro definitions // ----------------------------------------------------------------------------- #define INTERNAL_FLASH_BASE_ADDRESS ((uint32_t)0x08000000) #define INTERNAL_FLASH_PAGE_SIZE ((uint32_t)0x800) #define INTERNAL_FLASH_NUMBER_OF_PAGES ((uint32_t)0x80) // ----------------------------------------------------------------------------- // Type definitions. // ----------------------------------------------------------------------------- struct InternalFlash { struct MemoryDevice memoryDevice; bool initialized; uint32_t startAddress; uint32_t endAddress; uint32_t pageSize; }; // ----------------------------------------------------------------------------- // Function declarations // ----------------------------------------------------------------------------- /** ---------------------------------------------------------------------------- * InternalFlash_construct * Description of function * * @param self * * @return ErrorStatus * * @todo * ----------------------------------------------------------------------------- */ extern ErrorStatus InternalFlash_construct(struct InternalFlash* self); /** ---------------------------------------------------------------------------- * InternalFlash_destruct * Description of function * * @param self * @param * @return void * * @todo * ----------------------------------------------------------------------------- */ extern void InternalFlash_destruct(struct InternalFlash* self); /** ---------------------------------------------------------------------------- * InternalFlash_write * Description of function * * @param self * @param buffer * @param address * @param length * * @return ErrorStatus * * @todo * ----------------------------------------------------------------------------- */ extern ErrorStatus InternalFlash_write(const struct InternalFlash* self, uint32_t* buffer, uint32_t address, unsigned int length); /** ---------------------------------------------------------------------------- * InternalFlash_read * Description of function * * @param self * @param buffer * @param address * @param length * * @return ErrorStatus * * @todo * ----------------------------------------------------------------------------- */ extern ErrorStatus InternalFlash_read(const struct InternalFlash* self, uint32_t* buffer, uint32_t address, unsigned int length); /** ---------------------------------------------------------------------------- * InternalFlash_erasePage * Description of function * * @param self * @param page * * @param length * * @return ErrorStatus * * @todo * ----------------------------------------------------------------------------- */ extern ErrorStatus InternalFlash_erasePage(const struct InternalFlash* self, unsigned int page); #endif /* INC_INTERNALFLASH_H_ */ /** @} */