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:
@@ -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_ */
|
||||
@@ -49,7 +49,7 @@
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#define CACHED_STORAGE_PAGESIZE ((uint16_t)0x200)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
@@ -79,6 +79,8 @@ extern struct SpiDevice* const spiEEPROM;
|
||||
// Export of Keypad
|
||||
extern struct Keypad* const keypad;
|
||||
extern struct Storm700* const storm700;
|
||||
// internal FLASH
|
||||
extern struct InternalFlash* const iFlash;
|
||||
// Export of GPIOs
|
||||
extern struct Gpio* const ledGreen;
|
||||
extern struct Gpio* const ledOrange;
|
||||
|
||||
Reference in New Issue
Block a user