aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/oslib/include/chfactory.h
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-09-26 08:42:24 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-09-26 08:42:24 +0000
commit3864014e03b6c411613e50e90617f49c016c5aaa (patch)
tree2c73e85cea1db57b527e64c9b04819d2564a2f82 /os/common/oslib/include/chfactory.h
parent9f30d457c02f514d4d60112ba4ffeb367ce3bee6 (diff)
downloadChibiOS-3864014e03b6c411613e50e90617f49c016c5aaa.tar.gz
ChibiOS-3864014e03b6c411613e50e90617f49c016c5aaa.tar.bz2
ChibiOS-3864014e03b6c411613e50e90617f49c016c5aaa.zip
Done some renaming for consistency.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10715 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/common/oslib/include/chfactory.h')
-rw-r--r--os/common/oslib/include/chfactory.h28
1 files changed, 22 insertions, 6 deletions
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 */