Performed some doxygen updates
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@423 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file CachedStorage.h
|
||||
/// @brief Generic memory cache
|
||||
/// \file CachedStorage.h
|
||||
/// \brief Generic memory cache
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
@@ -17,16 +17,16 @@
|
||||
// (c) 2017 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _CACHEDEEPROM_H_
|
||||
#define _CACHEDEEPROM_H_
|
||||
|
||||
/**
|
||||
* CachedStorage implementation
|
||||
* \defgroup CachedStorage Package CachedStorage
|
||||
* \defgroup CachedStorage CachedStorage
|
||||
* \ingroup HAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _CACHEDEEPROM_H_
|
||||
#define _CACHEDEEPROM_H_
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -49,16 +49,28 @@
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup CachedStorage
|
||||
* \class CachedStorage
|
||||
* The CachedStorage struct that can be used as an object
|
||||
*/
|
||||
struct CachedStorage
|
||||
{
|
||||
bool initialized;
|
||||
unsigned int pageNumber;
|
||||
size_t cacheSize;
|
||||
bool dirty;
|
||||
struct MemoryDevice* memoryDevice;
|
||||
uint32_t* storage;
|
||||
uint32_t* tempBuffer;
|
||||
bool initialized; //!< Flag indicating initialisation status
|
||||
unsigned int pageNumber; //!< The pageNumber of the memory section on
|
||||
//!< which the cache is located.
|
||||
//!< This is usually for FLASH or EEPROM
|
||||
//!< devices and required for PAGE-ERASE
|
||||
//!< functionality. Can be set to any random
|
||||
//!< value if PAGE-ERASE is not necessary
|
||||
size_t cacheSize; //!< The size of the cache in bytes
|
||||
bool dirty; //!< Marker that cache has been updated
|
||||
struct MemoryDevice* memoryDevice; //!< The memory device on which this cache
|
||||
//!< is located
|
||||
uint32_t* storage; //!< Pointer to the cache that is written to
|
||||
//!< read from
|
||||
uint32_t* tempBuffer; //!< Pointer to a temporary buffer for
|
||||
//!< comparison
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -66,134 +78,139 @@ struct CachedStorage
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CachedStorage_construct
|
||||
* Constructor for a new cached storage instance
|
||||
/** CachedStorage_construct
|
||||
* \briefConstructor for a new cached storage instance
|
||||
* Function makes use of MALLOC
|
||||
*
|
||||
* @param self The cache instance
|
||||
* @param memoryDevice The memory device to use on which the
|
||||
* Created by: mmi
|
||||
* \memberof CachedStorage
|
||||
*
|
||||
* \param self The cache instance
|
||||
* \param[in] memoryDevice The memory device to use on which the
|
||||
* cache is located
|
||||
* @param pageNumber The pageNumber of the memory section on
|
||||
* \param[in] pageNumber The pageNumber of the memory section on
|
||||
* which the cache is located.
|
||||
* This is usually for FLASH or EEPROM
|
||||
* devices and required for PAGE-ERASE
|
||||
* functionality. Can be set to any random
|
||||
* value if PAGE-ERASE is not necessary
|
||||
* @param cacheSize The size of the cache.
|
||||
* \param[in] cacheSize The size of the cache.
|
||||
* This value is 32bit oriented and
|
||||
* NOT BYTE-WISE.
|
||||
* The memory allocation will internally
|
||||
* re-calculate to bytes
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if constructor was successful
|
||||
* \return ErrorStatus SUCCESS if constructor was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
* \todo
|
||||
*/
|
||||
ErrorStatus CachedStorage_construct(struct CachedStorage* self, struct MemoryDevice* memoryDevice, unsigned int pageNumber, size_t cacheSize);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CachedStorage_destruct
|
||||
* Destructor for a cached storage instance
|
||||
/** CachedStorage_destruct
|
||||
* \brief Destructor for a cached storage instance
|
||||
* Function makes use of FREE
|
||||
*
|
||||
* @param self The cache instance to destruct
|
||||
* Created by: mmi
|
||||
* \memberof CachedStorage
|
||||
*
|
||||
* @return void
|
||||
* \param self The cache instance to destruct
|
||||
* \return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
* \todo
|
||||
*/
|
||||
void CachedStorage_destruct(struct CachedStorage* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CachedStorage_writeWord
|
||||
* Function to write a word (32bit) to cache
|
||||
/** CachedStorage_writeWord
|
||||
* \brief Function to write a word (32bit) to cache
|
||||
*
|
||||
* @param self The cache instance
|
||||
* @param offset Offset within the cache to put the data
|
||||
* @param value The value/data to write
|
||||
* Created by: mmi
|
||||
* \memberof CachedStorage
|
||||
*
|
||||
* @return void
|
||||
* \param self The cache instance
|
||||
* \param[in] offset Offset within the cache to put the data
|
||||
* \param[in] value The value/data to write
|
||||
* \return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
* \todo
|
||||
*/
|
||||
void CachedStorage_writeWord(struct CachedStorage* self, int offset, uint32_t value);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CachedStorage_writeBlob
|
||||
/** CachedStorage_writeBlob
|
||||
* \brief Function to write a blob.
|
||||
*
|
||||
* Function to write a blob (any given format/amount of data) to cache; hence
|
||||
* the void pointer.
|
||||
* The function verifies cache boundaries using the offset and blob size
|
||||
* blobsize is 32bit oriented, NOT BYTE
|
||||
* the void pointer. The function verifies cache boundaries using the offset and
|
||||
* blob size blobsize is 32bit oriented, NOT BYTE
|
||||
*
|
||||
* @param self The cache instance
|
||||
* @param offset Offset within the cache to put the data
|
||||
* @param blob Void pointer to the data to be written
|
||||
* @param blobSize sizeof the blob structure. Give in 32bit,
|
||||
* Created by: mmi
|
||||
* \memberof CachedStorage
|
||||
*
|
||||
* \param self The cache instance
|
||||
* \param offset Offset within the cache to put the data
|
||||
* \param blob Void pointer to the data to be written
|
||||
* \param blobSize sizeof the blob structure. Give in 32bit,
|
||||
* NOT IN BYTES
|
||||
* \return void
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
* \todo
|
||||
*/
|
||||
void CachedStorage_writeBlob(struct CachedStorage* self, int offset, const void* blob, size_t blobSize);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CachedStorage_readWord
|
||||
* Function to read a word (32bit) from cache
|
||||
/** CachedStorage_readWord
|
||||
* \brief Function to read a word (32bit) from cache
|
||||
*
|
||||
* @param self The cache instance
|
||||
* @param offset Offset within the cache to put the data
|
||||
* Created by: mmi
|
||||
* \memberof CachedStorage
|
||||
*
|
||||
* @return uint32_t The read data
|
||||
* \param self The cache instance
|
||||
* \param[in] offset Offset within the cache to put the data
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
* \return uint32_t The read data
|
||||
*
|
||||
* \todo
|
||||
*/
|
||||
uint32_t CachedStorage_readWord(struct CachedStorage* self, int offset);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CachedStorage_readBlob
|
||||
/** CachedStorage_readBlob
|
||||
* \brief Function to read a blob
|
||||
*
|
||||
* Function to read a blob (any given format/amount of data) from cache; hence
|
||||
* the void pointer.
|
||||
* The function verifies cache boundaries using the offset
|
||||
*
|
||||
* @param self The cache instance
|
||||
* @param offset Offset within the cache to put the data
|
||||
* Created by: mmi
|
||||
* \memberof CachedStorage
|
||||
*
|
||||
* @return void* Void pointer to the blob structure
|
||||
* \param self The cache instance
|
||||
* \param[in] offset Offset within the cache to put the data *
|
||||
* \return void* Void pointer to the blob structure
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
* \todo
|
||||
*/
|
||||
const void* CachedStorage_readBlob(struct CachedStorage* self, int offset);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CachedStorage_commit
|
||||
* Function that puts the data from cache to the memory device.
|
||||
/** CachedStorage_commit
|
||||
* \brief Function that puts the data from cache to the memory device.
|
||||
*
|
||||
* This function will verify that the content of the cache is actually different
|
||||
* from the conent of the memory location. If data is equal, not write action
|
||||
* will be performed
|
||||
* In case of memory that needs PAGE-ERASE prior to write, the erase function
|
||||
* will be called automatically.
|
||||
*
|
||||
* @param self The cache instance
|
||||
* Created by: mmi
|
||||
* \memberof CachedStorage
|
||||
*
|
||||
* @return void
|
||||
* \param self The cache instance
|
||||
* \return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
* \todo
|
||||
*/
|
||||
void CachedStorage_commit(struct CachedStorage* self);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user