Added module description.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12952 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
db364ffee4
commit
80b3141de4
|
@ -39,8 +39,9 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define OC_FLAG_INVALID 0x00000001U
|
#define OC_FLAG_INVALID 0x00000001U
|
||||||
#define OC_FLAG_CACHEHIT 0x00000002U
|
#define OC_FLAG_INLRU 0x00000002U
|
||||||
#define OC_FLAG_ERROR 0x00000004U
|
#define OC_FLAG_CACHEHIT 0x00000004U
|
||||||
|
#define OC_FLAG_ERROR 0x00000008U
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,16 +20,30 @@
|
||||||
/**
|
/**
|
||||||
* @file chobjcaches.c
|
* @file chobjcaches.c
|
||||||
* @brief Objects Caches code.
|
* @brief Objects Caches code.
|
||||||
* @details Byte pipes.
|
* @details Objects caches.
|
||||||
* <h2>Operation mode</h2>
|
* <h2>Operation mode</h2>
|
||||||
* A pipe is an asynchronous communication mechanism.<br>
|
* An object cache allows to retrieve and release objects from a
|
||||||
* Operations defined for mailboxes:
|
* slow media, for example a disk or flash.<br>
|
||||||
* - <b>Write</b>: Writes a buffer of data in the pipe in FIFO order.
|
* The most recently used objects are kept in a series of RAM
|
||||||
* - <b>Read</b>: A buffer of data is read from the read and removed.
|
* buffers making access faster. Objects are identified by a
|
||||||
* - <b>Reset</b>: The pipe is emptied and all the stored data
|
* pair <group, key> which could be mapped, for example, to a
|
||||||
* is lost.
|
* disk drive identifier and sector identifier.<br>
|
||||||
|
* Read and write operations are performed using externally-supplied
|
||||||
|
* functions, the cache is device-agnostic.<br>
|
||||||
|
* The cache uses internally an hash table, the size of the table
|
||||||
|
* should be dimensioned to minimize the risk of hash collisions,
|
||||||
|
* a factor of two is usually acceptable, it depends on the specific
|
||||||
|
* application requirements.<br>
|
||||||
|
* Operations defined for caches:
|
||||||
|
* - <b>Get Object</b>: Retrieves an object from cache, if not
|
||||||
|
* present then an empty buffer is returned.
|
||||||
|
* - <b>Read Object</b>: Retrieves an object from cache, if not
|
||||||
|
* present a buffer is allocated and the object is read from the
|
||||||
|
* media.
|
||||||
|
* - <b>Release Object</b>: Releases an object to the cache handling
|
||||||
|
* the media update, if required.
|
||||||
* .
|
* .
|
||||||
* @pre In order to use the pipes APIs the @p CH_CFG_USE_PIPES
|
* @pre In order to use the pipes APIs the @p CH_CFG_USE_OBJ_CACHES
|
||||||
* option must be enabled in @p chconf.h.
|
* option must be enabled in @p chconf.h.
|
||||||
* @note Compatible with RT and NIL.
|
* @note Compatible with RT and NIL.
|
||||||
*
|
*
|
||||||
|
@ -151,7 +165,7 @@ void chCacheObjectInit(objects_cache_t *ocp,
|
||||||
LRU_INSERT_HEAD(ocp, objp);
|
LRU_INSERT_HEAD(ocp, objp);
|
||||||
objp->obj_group = OC_NO_GROUP;
|
objp->obj_group = OC_NO_GROUP;
|
||||||
objp->obj_key = 0U;
|
objp->obj_key = 0U;
|
||||||
objp->obj_flags = OC_FLAG_INVALID;
|
objp->obj_flags = OC_FLAG_INLRU | OC_FLAG_INVALID;
|
||||||
objp->data = NULL;
|
objp->data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue