diff --git a/os/oslib/include/chobjcaches.h b/os/oslib/include/chobjcaches.h
index 67f5e9527..9b01616e6 100644
--- a/os/oslib/include/chobjcaches.h
+++ b/os/oslib/include/chobjcaches.h
@@ -39,8 +39,9 @@
* @{
*/
#define OC_FLAG_INVALID 0x00000001U
-#define OC_FLAG_CACHEHIT 0x00000002U
-#define OC_FLAG_ERROR 0x00000004U
+#define OC_FLAG_INLRU 0x00000002U
+#define OC_FLAG_CACHEHIT 0x00000004U
+#define OC_FLAG_ERROR 0x00000008U
/** @} */
/**
diff --git a/os/oslib/src/chobjcaches.c b/os/oslib/src/chobjcaches.c
index b6afb491d..4551ec892 100644
--- a/os/oslib/src/chobjcaches.c
+++ b/os/oslib/src/chobjcaches.c
@@ -20,16 +20,30 @@
/**
* @file chobjcaches.c
* @brief Objects Caches code.
- * @details Byte pipes.
+ * @details Objects caches.
*
Operation mode
- * A pipe is an asynchronous communication mechanism.
- * Operations defined for mailboxes:
- * - Write: Writes a buffer of data in the pipe in FIFO order.
- * - Read: A buffer of data is read from the read and removed.
- * - Reset: The pipe is emptied and all the stored data
- * is lost.
+ * An object cache allows to retrieve and release objects from a
+ * slow media, for example a disk or flash.
+ * The most recently used objects are kept in a series of RAM
+ * buffers making access faster. Objects are identified by a
+ * pair which could be mapped, for example, to a
+ * disk drive identifier and sector identifier.
+ * Read and write operations are performed using externally-supplied
+ * functions, the cache is device-agnostic.
+ * 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.
+ * Operations defined for caches:
+ * - Get Object: Retrieves an object from cache, if not
+ * present then an empty buffer is returned.
+ * - Read Object: Retrieves an object from cache, if not
+ * present a buffer is allocated and the object is read from the
+ * media.
+ * - Release Object: 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.
* @note Compatible with RT and NIL.
*
@@ -151,7 +165,7 @@ void chCacheObjectInit(objects_cache_t *ocp,
LRU_INSERT_HEAD(ocp, objp);
objp->obj_group = OC_NO_GROUP;
objp->obj_key = 0U;
- objp->obj_flags = OC_FLAG_INVALID;
+ objp->obj_flags = OC_FLAG_INLRU | OC_FLAG_INVALID;
objp->data = NULL;
}
}