]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/event_groups.h
Update the documentation contained in the header files to be correct for V9.0.0 relea...
[freertos] / FreeRTOS / Source / include / event_groups.h
index c7189a1f8268132d583bfc1fa2ba31c8f1d3d865..63a57b20652e0b4b7954cbbffb343bcb93180a7f 100644 (file)
@@ -138,7 +138,17 @@ typedef TickType_t EventBits_t;
  EventGroupHandle_t xEventGroupCreate( void );\r
  </pre>\r
  *\r
- * Create a new event group.  This function cannot be called from an interrupt.\r
+ * Create a new event group.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, event groups use a [small]\r
+ * block of memory, in which the event group's structure is stored.  If an event\r
+ * groups is created using xEventGropuCreate() then the required memory is\r
+ * automatically dynamically allocated inside the xEventGroupCreate() function.\r
+ * (see http://www.freertos.org/a00111.html).  If an event group is created\r
+ * using xEventGropuCreateStatic() then the application writer must instead\r
+ * provide the memory that will get used by the event group.\r
+ * xEventGroupCreateStatic() therefore allows an event group to be created\r
+ * without using any dynamic memory allocation.\r
  *\r
  * Although event groups are not related to ticks, for internal implementation\r
  * reasons the number of bits available for use in an event group is dependent\r
@@ -178,8 +188,57 @@ typedef TickType_t EventBits_t;
        EventGroupHandle_t xEventGroupCreate( void ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+ EventGroupHandle_t xEventGroupCreateStatic( EventGroupHandle_t * pxEventGroupBuffer );\r
+ </pre>\r
+ *\r
+ * Create a new event group.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, event groups use a [small]\r
+ * block of memory, in which the event group's structure is stored.  If an event\r
+ * groups is created using xEventGropuCreate() then the required memory is\r
+ * automatically dynamically allocated inside the xEventGroupCreate() function.\r
+ * (see http://www.freertos.org/a00111.html).  If an event group is created\r
+ * using xEventGropuCreateStatic() then the application writer must instead\r
+ * provide the memory that will get used by the event group.\r
+ * xEventGroupCreateStatic() therefore allows an event group to be created\r
+ * without using any dynamic memory allocation.\r
+ *\r
+ * Although event groups are not related to ticks, for internal implementation\r
+ * reasons the number of bits available for use in an event group is dependent\r
+ * on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h.  If\r
+ * configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit\r
+ * 0 to bit 7).  If configUSE_16_BIT_TICKS is set to 0 then each event group has\r
+ * 24 usable bits (bit 0 to bit 23).  The EventBits_t type is used to store\r
+ * event bits within an event group.\r
+ *\r
+ * @param pxEventGroupBuffer pxEventGroupBuffer must point to a variable of type\r
+ * StaticEventGroup_t, which will be then be used to hold the event group's data\r
+ * structures, removing the need for the memory to be allocated dynamically.\r
+ *\r
+ * @return If the event group was created then a handle to the event group is\r
+ * returned.  If pxEventGroupBuffer was NULL then NULL is returned.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+       // StaticEventGroup_t is a publicly accessible structure that has the same\r
+       // size and alignment requirements as the real event group structure.  It is\r
+       // provided as a mechanism for applications to know the size of the event\r
+       // group (which is dependent on the architecture and configuration file\r
+       // settings) without breaking the strict data hiding policy by exposing the\r
+       // real event group internals.  This StaticEventGroup_t variable is passed\r
+       // into the xSemaphoreCreateEventGroupStatic() function and is used to store\r
+       // the event group's data structures\r
+       StaticEventGroup_t xEventGroupBuffer;\r
+\r
+       // Create the event group without dynamically allocating any memory.\r
+       xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer );\r
+   </pre>\r
+ */\r
 #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
-       EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t *pxStaticEventGroup ) PRIVILEGED_FUNCTION;\r
+       EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
 /**\r