From 3864014e03b6c411613e50e90617f49c016c5aaa Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 26 Sep 2017 08:42:24 +0000 Subject: Done some renaming for consistency. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10715 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/oslib/include/chfactory.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'os/common/oslib/include') diff --git a/os/common/oslib/include/chfactory.h b/os/common/oslib/include/chfactory.h index 2fe2765dd..b06fbcf64 100644 --- a/os/common/oslib/include/chfactory.h +++ b/os/common/oslib/include/chfactory.h @@ -136,8 +136,8 @@ typedef struct ch_dyn_object { * @brief Physical objects. * @note This requires C99. */ - uint8_t obj[]; -} dyn_object_t; + uint8_t buffer[]; +} dyn_buffer_t; #endif #if (CH_CFG_FACTORY_SEMAPHORES == TRUE) || defined(__DOXIGEN__) @@ -194,11 +194,12 @@ objects_factory_t ch_factory; extern "C" { #endif void _factory_init(void); +// dyn_registered_object_t *chFactoryRegisterObject(const char *name, +// void *objp); #if (CH_CFG_FACTORY_GENERIC == TRUE) || defined(__DOXIGEN__) - dyn_object_t *chFactoryCreateObject(const char *name, size_t size); - dyn_object_t *chFactoryFindObject(const char *name); - void chFactoryReleaseObject(dyn_object_t *dop); - size_t chFactoryGetObjectSize(dyn_object_t *dop); + dyn_buffer_t *chFactoryCreateBuffer(const char *name, size_t size); + dyn_buffer_t *chFactoryFindBuffer(const char *name); + void chFactoryReleaseBuffer(dyn_buffer_t *dbp); #endif #if (CH_CFG_FACTORY_SEMAPHORES == TRUE) || defined(__DOXIGEN__) dyn_semaphore_t *chFactoryCreateSemaphore(const char *name, cnt_t n); @@ -215,6 +216,7 @@ extern "C" { /** * @brief Duplicates an object reference. + * @note This function can be used on any kind of dynamic object. * * @param[in] dep pointer to the element field of the object * @@ -229,6 +231,20 @@ static inline dyn_element_t *chFactoryDuplicateReferenceI(dyn_element_t *dep) { return dep; } +#if (CH_CFG_FACTORY_GENERIC == TRUE) || defined(__DOXIGEN__) +/** + * @brief Returns the size of a generic dynamic buffer object. + * + * @return The size of the buffer object in bytes. + * + * @api + */ +static inline size_t chFactoryGetBufferSize(dyn_buffer_t *dbp) { + + return chHeapGetSize(dbp) - sizeof (dyn_element_t); +} +#endif + #endif /* CH_CFG_USE_FACTORY == TRUE */ #endif /* CHFACTORY_H */ -- cgit v1.2.3