]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/croutine.h
Replace standard types with stdint.h types.
[freertos] / FreeRTOS / Source / include / croutine.h
index 914fc367b54cbddf8e1326230c6409544e040c5b..965ec54c1416dda7223942dd4a9cc8acb204d3bd 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -79,28 +79,28 @@ extern "C" {
 /* Used to hide the implementation of the co-routine control block.  The\r
 control block structure however has to be included in the header due to\r
 the macro implementation of the co-routine functionality. */\r
-typedef void * xCoRoutineHandle;\r
+typedef void * CoRoutineHandle_t;\r
 \r
 /* Defines the prototype to which co-routine functions must conform. */\r
-typedef void (*crCOROUTINE_CODE)( xCoRoutineHandle, unsigned portBASE_TYPE );\r
+typedef void (*crCOROUTINE_CODE)( CoRoutineHandle_t, UBaseType_t );\r
 \r
 typedef struct corCoRoutineControlBlock\r
 {\r
-       crCOROUTINE_CODE                pxCoRoutineFunction;\r
-       xListItem                               xGenericListItem;       /*< List item used to place the CRCB in ready and blocked queues. */\r
-       xListItem                               xEventListItem;         /*< List item used to place the CRCB in event lists. */\r
-       unsigned portBASE_TYPE  uxPriority;                     /*< The priority of the co-routine in relation to other co-routines. */\r
-       unsigned portBASE_TYPE  uxIndex;                        /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */\r
-       unsigned short          uxState;                        /*< Used internally by the co-routine implementation. */\r
-} corCRCB; /* Co-routine control block.  Note must be identical in size down to uxPriority with tskTCB. */\r
+       crCOROUTINE_CODE        pxCoRoutineFunction;\r
+       ListItem_t                      xGenericListItem;       /*< List item used to place the CRCB in ready and blocked queues. */\r
+       ListItem_t                      xEventListItem;         /*< List item used to place the CRCB in event lists. */\r
+       UBaseType_t             uxPriority;                     /*< The priority of the co-routine in relation to other co-routines. */\r
+       UBaseType_t             uxIndex;                        /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */\r
+       uint16_t                        uxState;                        /*< Used internally by the co-routine implementation. */\r
+} CRCB_t; /* Co-routine control block.  Note must be identical in size down to uxPriority with TCB_t. */\r
 \r
 /**\r
  * croutine. h\r
  *<pre>\r
portBASE_TYPE xCoRoutineCreate(\r
BaseType_t xCoRoutineCreate(\r
                                  crCOROUTINE_CODE pxCoRoutineCode,\r
-                                 unsigned portBASE_TYPE uxPriority,\r
-                                 unsigned portBASE_TYPE uxIndex\r
+                                 UBaseType_t uxPriority,\r
+                                 UBaseType_t uxIndex\r
                                );</pre>\r
  *\r
  * Create a new co-routine and add it to the list of co-routines that are\r
@@ -123,12 +123,12 @@ typedef struct corCoRoutineControlBlock
  * Example usage:\r
    <pre>\r
  // Co-routine to be created.\r
- void vFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
+ void vFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
  {\r
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
  // This may not be necessary for const variables.\r
  static const char cLedToFlash[ 2 ] = { 5, 6 };\r
- static const portTickType uxFlashRates[ 2 ] = { 200, 400 };\r
+ static const TickType_t uxFlashRates[ 2 ] = { 200, 400 };\r
 \r
      // Must start every co-routine with a call to crSTART();\r
      crSTART( xHandle );\r
@@ -138,7 +138,7 @@ typedef struct corCoRoutineControlBlock
          // This co-routine just delays for a fixed period, then toggles\r
          // an LED.  Two co-routines are created using this function, so\r
          // the uxIndex parameter is used to tell the co-routine which\r
-         // LED to flash and how long to delay.  This assumes xQueue has\r
+         // LED to flash and how int32_t to delay.  This assumes xQueue has\r
          // already been created.\r
          vParTestToggleLED( cLedToFlash[ uxIndex ] );\r
          crDELAY( xHandle, uxFlashRates[ uxIndex ] );\r
@@ -151,9 +151,9 @@ typedef struct corCoRoutineControlBlock
  // Function that creates two co-routines.\r
  void vOtherFunction( void )\r
  {\r
- unsigned char ucParameterToPass;\r
xTaskHandle xHandle;\r
-               \r
+ uint8_t ucParameterToPass;\r
TaskHandle_t xHandle;\r
+\r
      // Create two co-routines at priority 0.  The first is given index 0\r
      // so (from the code above) toggles LED 5 every 200 ticks.  The second\r
      // is given index 1 so toggles LED 6 every 400 ticks.\r
@@ -166,7 +166,7 @@ typedef struct corCoRoutineControlBlock
  * \defgroup xCoRoutineCreate xCoRoutineCreate\r
  * \ingroup Tasks\r
  */\r
-signed portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex );\r
+BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex );\r
 \r
 \r
 /**\r
@@ -213,17 +213,17 @@ void vCoRoutineSchedule( void );
 /**\r
  * croutine. h\r
  * <pre>\r
- crSTART( xCoRoutineHandle xHandle );</pre>\r
+ crSTART( CoRoutineHandle_t xHandle );</pre>\r
  *\r
  * This macro MUST always be called at the start of a co-routine function.\r
  *\r
  * Example usage:\r
    <pre>\r
  // Co-routine to be created.\r
- void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
  {\r
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
- static long ulAVariable;\r
+ static int32_t ulAVariable;\r
 \r
      // Must start every co-routine with a call to crSTART();\r
      crSTART( xHandle );\r
@@ -239,7 +239,7 @@ void vCoRoutineSchedule( void );
  * \defgroup crSTART crSTART\r
  * \ingroup Tasks\r
  */\r
-#define crSTART( pxCRCB ) switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:\r
+#define crSTART( pxCRCB ) switch( ( ( CRCB_t * )( pxCRCB ) )->uxState ) { case 0:\r
 \r
 /**\r
  * croutine. h\r
@@ -251,10 +251,10 @@ void vCoRoutineSchedule( void );
  * Example usage:\r
    <pre>\r
  // Co-routine to be created.\r
- void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
  {\r
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
- static long ulAVariable;\r
+ static int32_t ulAVariable;\r
 \r
      // Must start every co-routine with a call to crSTART();\r
      crSTART( xHandle );\r
@@ -276,13 +276,13 @@ void vCoRoutineSchedule( void );
  * These macros are intended for internal use by the co-routine implementation\r
  * only.  The macros should not be used directly by application writers.\r
  */\r
-#define crSET_STATE0( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):\r
-#define crSET_STATE1( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):\r
+#define crSET_STATE0( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):\r
+#define crSET_STATE1( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):\r
 \r
 /**\r
  * croutine. h\r
  *<pre>\r
- crDELAY( xCoRoutineHandle xHandle, portTickType xTicksToDelay );</pre>\r
+ crDELAY( CoRoutineHandle_t xHandle, TickType_t xTicksToDelay );</pre>\r
  *\r
  * Delay a co-routine for a fixed period of time.\r
  *\r
@@ -301,7 +301,7 @@ void vCoRoutineSchedule( void );
  * Example usage:\r
    <pre>\r
  // Co-routine to be created.\r
- void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
  {\r
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
  // This may not be necessary for const variables.\r
@@ -335,11 +335,11 @@ void vCoRoutineSchedule( void );
 /**\r
  * <pre>\r
  crQUEUE_SEND(\r
-                  xCoRoutineHandle xHandle,\r
-                  xQueueHandle pxQueue,\r
+                  CoRoutineHandle_t xHandle,\r
+                  QueueHandle_t pxQueue,\r
                   void *pvItemToQueue,\r
-                  portTickType xTicksToWait,\r
-                  portBASE_TYPE *pxResult\r
+                  TickType_t xTicksToWait,\r
+                  BaseType_t *pxResult\r
              )</pre>\r
  *\r
  * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine\r
@@ -383,11 +383,11 @@ void vCoRoutineSchedule( void );
    <pre>\r
  // Co-routine function that blocks for a fixed period then posts a number onto\r
  // a queue.\r
- static void prvCoRoutineFlashTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
+ static void prvCoRoutineFlashTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
  {\r
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
- static portBASE_TYPE xNumberToPost = 0;\r
- static portBASE_TYPE xResult;\r
+ static BaseType_t xNumberToPost = 0;\r
+ static BaseType_t xResult;\r
 \r
     // Co-routines must begin with a call to crSTART().\r
     crSTART( xHandle );\r
@@ -434,11 +434,11 @@ void vCoRoutineSchedule( void );
  * croutine. h\r
  * <pre>\r
   crQUEUE_RECEIVE(\r
-                     xCoRoutineHandle xHandle,\r
-                     xQueueHandle pxQueue,\r
+                     CoRoutineHandle_t xHandle,\r
+                     QueueHandle_t pxQueue,\r
                      void *pvBuffer,\r
-                     portTickType xTicksToWait,\r
-                     portBASE_TYPE *pxResult\r
+                     TickType_t xTicksToWait,\r
+                     BaseType_t *pxResult\r
                  )</pre>\r
  *\r
  * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine\r
@@ -481,11 +481,11 @@ void vCoRoutineSchedule( void );
  <pre>\r
  // A co-routine receives the number of an LED to flash from a queue.  It\r
  // blocks on the queue until the number is received.\r
- static void prvCoRoutineFlashWorkTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
+ static void prvCoRoutineFlashWorkTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
  {\r
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
- static portBASE_TYPE xResult;\r
- static unsigned portBASE_TYPE uxLEDToFlash;\r
+ static BaseType_t xResult;\r
+ static UBaseType_t uxLEDToFlash;\r
 \r
     // All co-routines must start with a call to crSTART().\r
     crSTART( xHandle );\r
@@ -526,9 +526,9 @@ void vCoRoutineSchedule( void );
  * croutine. h\r
  * <pre>\r
   crQUEUE_SEND_FROM_ISR(\r
-                            xQueueHandle pxQueue,\r
+                            QueueHandle_t pxQueue,\r
                             void *pvItemToQueue,\r
-                            portBASE_TYPE xCoRoutinePreviouslyWoken\r
+                            BaseType_t xCoRoutinePreviouslyWoken\r
                        )</pre>\r
  *\r
  * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the\r
@@ -566,10 +566,10 @@ void vCoRoutineSchedule( void );
  * Example usage:\r
  <pre>\r
  // A co-routine that blocks on a queue waiting for characters to be received.\r
- static void vReceivingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
+ static void vReceivingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
  {\r
  char cRxedChar;\r
portBASE_TYPE xResult;\r
BaseType_t xResult;\r
 \r
      // All co-routines must start with a call to crSTART().\r
      crSTART( xHandle );\r
@@ -596,7 +596,7 @@ void vCoRoutineSchedule( void );
  void vUART_ISR( void )\r
  {\r
  char cRxedChar;\r
portBASE_TYPE xCRWokenByPost = pdFALSE;\r
BaseType_t xCRWokenByPost = pdFALSE;\r
 \r
      // We loop around reading characters until there are none left in the UART.\r
      while( UART_RX_REG_NOT_EMPTY() )\r
@@ -623,9 +623,9 @@ void vCoRoutineSchedule( void );
  * croutine. h\r
  * <pre>\r
   crQUEUE_SEND_FROM_ISR(\r
-                            xQueueHandle pxQueue,\r
+                            QueueHandle_t pxQueue,\r
                             void *pvBuffer,\r
-                            portBASE_TYPE * pxCoRoutineWoken\r
+                            BaseType_t * pxCoRoutineWoken\r
                        )</pre>\r
  *\r
  * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the\r
@@ -664,12 +664,12 @@ void vCoRoutineSchedule( void );
  <pre>\r
  // A co-routine that posts a character to a queue then blocks for a fixed\r
  // period.  The character is incremented each time.\r
- static void vSendingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )\r
+ static void vSendingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
  {\r
  // cChar holds its value while this co-routine is blocked and must therefore\r
  // be declared static.\r
  static char cCharToTx = 'a';\r
portBASE_TYPE xResult;\r
BaseType_t xResult;\r
 \r
      // All co-routines must start with a call to crSTART().\r
      crSTART( xHandle );\r
@@ -712,7 +712,7 @@ void vCoRoutineSchedule( void );
  void vUART_ISR( void )\r
  {\r
  char cCharToTx;\r
portBASE_TYPE xCRWokenByPost = pdFALSE;\r
BaseType_t xCRWokenByPost = pdFALSE;\r
 \r
      while( UART_TX_REG_EMPTY() )\r
      {\r
@@ -740,7 +740,7 @@ void vCoRoutineSchedule( void );
  * Removes the current co-routine from its ready list and places it in the\r
  * appropriate delayed list.\r
  */\r
-void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList );\r
+void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList );\r
 \r
 /*\r
  * This function is intended for internal use by the queue implementation only.\r
@@ -749,7 +749,7 @@ void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList
  * Removes the highest priority co-routine from the event list and places it in\r
  * the pending ready list.\r
  */\r
-signed portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList );\r
+BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList );\r
 \r
 #ifdef __cplusplus\r
 }\r