Just doing some refactoring of a project to use Factory library.
I couldn't find a helper for getting a pointer to the objects_fifo_t out of the dyn_objects_fifo_t to use in calls to chfifo functions.
Its trivial to get the reference in code but figured adding an inline to chfactory made sense for simplicity.
Also did some typo fixes in other modules.
Thanks
----------------------------------------------------------
chfactory.h
Code: Select all
Index: chfactory.h
===================================================================
--- chfactory.h (revision 11078)
+++ chfactory.h (working copy)
@@ -349,6 +349,7 @@
unsigned objalign);
dyn_objects_fifo_t *chFactoryFindObjectsFIFO(const char *name);
void chFactoryReleaseObjectsFIFO(dyn_objects_fifo_t *dofp);
+ objects_fifo_t *chFactoryGetObjectsFIFO(dyn_objects_fifo_t *dofp);
#endif
#ifdef __cplusplus
}
chfactory.c
Code: Select all
Index: chfactory.c
===================================================================
--- chfactory.c (revision 11078)
+++ chfactory.c (working copy)
@@ -588,7 +588,7 @@
F_UNLOCK();
}
-#endif /* CH_CFG_FACTORY_MAILBOXES = TRUE */
+#endif /* CH_CFG_FACTORY_MAILBOXES == TRUE */
#if (CH_CFG_FACTORY_OBJ_FIFOS == TRUE) || defined(__DOXIGEN__)
/**
@@ -678,8 +678,22 @@
F_UNLOCK();
}
-#endif /* CH_CFG_FACTORY_MAILBOXES = TRUE */
+/**
+ * @brief Gets the objects from a dynamic "objects FIFO" object.
+ * @details A pointer to the fifo structure is returned for use
+ * in fifo operations
+ *
+ * @param[in] dofp dynamic "objects FIFO" object reference
+ *
+ * @api
+ */
+inline objects_fifo_t *chFactoryGetObjectsFIFO(dyn_objects_fifo_t *dofp) {
+
+ return &dofp->fifo;
+}
+#endif /* CH_CFG_FACTORY_OBJ_FIFOS == TRUE */
+
#endif /* CH_CFG_USE_FACTORY == TRUE */
/** @} */
chfifo.c
Code: Select all
Index: chfifo.h
===================================================================
--- chfifo.h (revision 11078)
+++ chfifo.h (working copy)
@@ -223,7 +223,7 @@
* @note By design the object can be always immediately posted.
*
* @param[in] ofp pointer to a @p objects_fifo_t structure
- * @param[in] objp pointer to the object to be released
+ * @param[in] objp pointer to the object to be posted
*
* @iclass
*/
@@ -240,7 +240,7 @@
* @note By design the object can be always immediately posted.
*
* @param[in] ofp pointer to a @p objects_fifo_t structure
- * @param[in] objp pointer to the object to be released
+ * @param[in] objp pointer to the object to be posted
*
* @sclass
*/
chmempools.c
Code: Select all
Index: chmempools.c
===================================================================
--- chmempools.c (revision 11078)
+++ chmempools.c (working copy)
@@ -87,7 +87,7 @@
/**
* @brief Loads a memory pool with an array of static objects.
- * @pre The memory pool must be already been initialized.
+ * @pre The memory pool must already be initialized.
* @pre The array elements must be of the right size for the specified
* memory pool.
* @pre The array elements size must be a multiple of the alignment
@@ -115,7 +115,7 @@
/**
* @brief Allocates an object from a memory pool.
- * @pre The memory pool must be already been initialized.
+ * @pre The memory pool must already be initialized.
*
* @param[in] mp pointer to a @p memory_pool_t structure
* @return The pointer to the allocated object.
@@ -144,7 +144,7 @@
/**
* @brief Allocates an object from a memory pool.
- * @pre The memory pool must be already been initialized.
+ * @pre The memory pool must already be initialized.
*
* @param[in] mp pointer to a @p memory_pool_t structure
* @return The pointer to the allocated object.
@@ -189,7 +189,7 @@
/**
* @brief Releases an object into a memory pool.
- * @pre The memory pool must be already been initialized.
+ * @pre The memory pool must already be initialized.
* @pre The freed object must be of the right size for the specified
* memory pool.
* @pre The added object must be properly aligned.
@@ -228,7 +228,7 @@
/**
* @brief Loads a guarded memory pool with an array of static objects.
- * @pre The guarded memory pool must be already been initialized.
+ * @pre The guarded memory pool must already be initialized.
* @pre The array elements must be of the right size for the specified
* guarded memory pool.
* @post The guarded memory pool contains the elements of the input array.
@@ -254,7 +254,7 @@
/**
* @brief Allocates an object from a guarded memory pool.
- * @pre The guarded memory pool must be already been initialized.
+ * @pre The guarded memory pool must already be initialized.
*
* @param[in] gmp pointer to a @p guarded_memory_pool_t structure
* @param[in] timeout the number of ticks before the operation timeouts,
@@ -281,7 +281,7 @@
/**
* @brief Allocates an object from a guarded memory pool.
- * @pre The guarded memory pool must be already been initialized.
+ * @pre The guarded memory pool must already be initialized.
*
* @param[in] gmp pointer to a @p guarded_memory_pool_t structure
* @param[in] timeout the number of ticks before the operation timeouts,
@@ -307,7 +307,7 @@
/**
* @brief Releases an object into a guarded memory pool.
- * @pre The guarded memory pool must be already been initialized.
+ * @pre The guarded memory pool must already be initialized.
* @pre The freed object must be of the right size for the specified
* guarded memory pool.
* @pre The added object must be properly aligned.
@@ -325,7 +325,7 @@
/**
* @brief Releases an object into a guarded memory pool.
- * @pre The guarded memory pool must be already been initialized.
+ * @pre The guarded memory pool must already be initialized.
* @pre The freed object must be of the right size for the specified
* guarded memory pool.
* @pre The added object must be properly aligned.