implemented memory device, flashStorage and cached storage

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@268 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-31 07:35:17 +00:00
parent a50a10995f
commit 76783a6061
17 changed files with 1103 additions and 13 deletions

View File

@@ -0,0 +1,144 @@
// -----------------------------------------------------------------------------
/// @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
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file InternalFlash.h
/// @ingroup {group_name}
#ifndef INC_INTERNALFLASH_H_
#define INC_INTERNALFLASH_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#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_ */