From acd8cbcab350f0aae18b9eab19f91ff843b0df53 Mon Sep 17 00:00:00 2001 From: rtel Date: Mon, 13 Jan 2014 20:26:47 +0000 Subject: [PATCH] Introduce configENABLE_BACKWARD_COMPATIBILITY to allow the #defines that provide backward compatibility with FreeRTOS version prior to V8 to be optionally omitted. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2167 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Demo/PIC18_MPLAB/stdint.h | 22 +++++-- .../RX600_RX62N-RDK_GNURX/RTOSDemo/stdint.h | 22 +++++-- .../RX600_RX62N-RSK_GNURX/RTOSDemo/stdint.h | 22 +++++-- .../SuperH_SH7216_Renesas/RTOSDemo/stdint.h | 22 +++++-- FreeRTOS/Source/include/FreeRTOS.h | 61 ++++++++++++------- FreeRTOS/Source/include/stdint.readme | 27 ++++++++ .../Source/portable/IAR/ARM_CA9/portmacro.h | 8 +-- .../Source/portable/RVDS/ARM_CA9/portmacro.h | 2 +- 8 files changed, 138 insertions(+), 48 deletions(-) create mode 100644 FreeRTOS/Source/include/stdint.readme diff --git a/FreeRTOS/Demo/PIC18_MPLAB/stdint.h b/FreeRTOS/Demo/PIC18_MPLAB/stdint.h index 30913ad0a..6d86149ca 100644 --- a/FreeRTOS/Demo/PIC18_MPLAB/stdint.h +++ b/FreeRTOS/Demo/PIC18_MPLAB/stdint.h @@ -1,9 +1,21 @@ -#ifndef STDINT_INC -#define STDINT_INC +#ifndef FREERTOS_STDINT +#define FREERTOS_STDINT -/* This file will get picked up when stdint.h does not appear in the default -include path (which it doesn't seem to be - even though the file exists). */ +/******************************************************************************* + * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions + * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be + * built using compilers that do not provide their own stdint.h definition. + * + * To use this file: + * + * 1) Copy this file into the directory that contains your FreeRTOSConfig.h + * header file, as that directory will already be in the compilers include + * path. + * + * 2) Rename the copied file stdint.h. + * + */ typedef signed char int8_t; typedef unsigned char uint8_t; @@ -12,4 +24,4 @@ typedef unsigned short uint16_t; typedef long int32_t; typedef unsigned long uint32_t; -#endif /* STDINT_INC */ +#endif /* FREERTOS_STDINT */ diff --git a/FreeRTOS/Demo/RX600_RX62N-RDK_GNURX/RTOSDemo/stdint.h b/FreeRTOS/Demo/RX600_RX62N-RDK_GNURX/RTOSDemo/stdint.h index 30913ad0a..6d86149ca 100644 --- a/FreeRTOS/Demo/RX600_RX62N-RDK_GNURX/RTOSDemo/stdint.h +++ b/FreeRTOS/Demo/RX600_RX62N-RDK_GNURX/RTOSDemo/stdint.h @@ -1,9 +1,21 @@ -#ifndef STDINT_INC -#define STDINT_INC +#ifndef FREERTOS_STDINT +#define FREERTOS_STDINT -/* This file will get picked up when stdint.h does not appear in the default -include path (which it doesn't seem to be - even though the file exists). */ +/******************************************************************************* + * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions + * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be + * built using compilers that do not provide their own stdint.h definition. + * + * To use this file: + * + * 1) Copy this file into the directory that contains your FreeRTOSConfig.h + * header file, as that directory will already be in the compilers include + * path. + * + * 2) Rename the copied file stdint.h. + * + */ typedef signed char int8_t; typedef unsigned char uint8_t; @@ -12,4 +24,4 @@ typedef unsigned short uint16_t; typedef long int32_t; typedef unsigned long uint32_t; -#endif /* STDINT_INC */ +#endif /* FREERTOS_STDINT */ diff --git a/FreeRTOS/Demo/RX600_RX62N-RSK_GNURX/RTOSDemo/stdint.h b/FreeRTOS/Demo/RX600_RX62N-RSK_GNURX/RTOSDemo/stdint.h index 30913ad0a..6d86149ca 100644 --- a/FreeRTOS/Demo/RX600_RX62N-RSK_GNURX/RTOSDemo/stdint.h +++ b/FreeRTOS/Demo/RX600_RX62N-RSK_GNURX/RTOSDemo/stdint.h @@ -1,9 +1,21 @@ -#ifndef STDINT_INC -#define STDINT_INC +#ifndef FREERTOS_STDINT +#define FREERTOS_STDINT -/* This file will get picked up when stdint.h does not appear in the default -include path (which it doesn't seem to be - even though the file exists). */ +/******************************************************************************* + * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions + * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be + * built using compilers that do not provide their own stdint.h definition. + * + * To use this file: + * + * 1) Copy this file into the directory that contains your FreeRTOSConfig.h + * header file, as that directory will already be in the compilers include + * path. + * + * 2) Rename the copied file stdint.h. + * + */ typedef signed char int8_t; typedef unsigned char uint8_t; @@ -12,4 +24,4 @@ typedef unsigned short uint16_t; typedef long int32_t; typedef unsigned long uint32_t; -#endif /* STDINT_INC */ +#endif /* FREERTOS_STDINT */ diff --git a/FreeRTOS/Demo/SuperH_SH7216_Renesas/RTOSDemo/stdint.h b/FreeRTOS/Demo/SuperH_SH7216_Renesas/RTOSDemo/stdint.h index 30913ad0a..6d86149ca 100644 --- a/FreeRTOS/Demo/SuperH_SH7216_Renesas/RTOSDemo/stdint.h +++ b/FreeRTOS/Demo/SuperH_SH7216_Renesas/RTOSDemo/stdint.h @@ -1,9 +1,21 @@ -#ifndef STDINT_INC -#define STDINT_INC +#ifndef FREERTOS_STDINT +#define FREERTOS_STDINT -/* This file will get picked up when stdint.h does not appear in the default -include path (which it doesn't seem to be - even though the file exists). */ +/******************************************************************************* + * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions + * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be + * built using compilers that do not provide their own stdint.h definition. + * + * To use this file: + * + * 1) Copy this file into the directory that contains your FreeRTOSConfig.h + * header file, as that directory will already be in the compilers include + * path. + * + * 2) Rename the copied file stdint.h. + * + */ typedef signed char int8_t; typedef unsigned char uint8_t; @@ -12,4 +24,4 @@ typedef unsigned short uint16_t; typedef long int32_t; typedef unsigned long uint32_t; -#endif /* STDINT_INC */ +#endif /* FREERTOS_STDINT */ diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h index 39d6d229d..de1a41ff9 100644 --- a/FreeRTOS/Source/include/FreeRTOS.h +++ b/FreeRTOS/Source/include/FreeRTOS.h @@ -73,6 +73,14 @@ #include #include +/* Check stdint.h was included. */ +#ifndef UINT32_MAX + /* Check if the FreeRTOS stdint subset has been included. */ + #ifndef FREERTOS_STDINT + #error Read the instructions in FreeRTOS/source/stdint.readme if stdint.h is not provided with your compiler. + #endif /* FREERTOS_STDINT */ +#endif /* UINT32_MAX */ + /* Basic FreeRTOS definitions. */ #include "projdefs.h" @@ -684,29 +692,36 @@ is included as it is used by the port layer. */ #define mtCOVERAGE_TEST_MARKER() #endif -/* For backward compatibility. */ -#define eTaskStateGet eTaskGetState -#define portTickType TickType_t -#define xTaskHandle TaskHandle_t -#define xQueueHandle QueueHandle_t -#define xSemaphoreHandle SemaphoreHandle_t -#define xQueueSetHandle QueueSetHandle_t -#define xQueueSetMemberHandle QueueSetMemberHandle_t -#define xTimeOutType TimeOut_t -#define xMemoryRegion MemoryRegion_t -#define xTaskParameters TaskParameters_t -#define xTaskStatusType TaskStatus_t -#define xTimerHandle TimerHandle_t -#define xCoRoutineHandle CoRoutineHandle_t -#define pdTASK_HOOK_CODE TaskHookFunction_t -#define portTICK_RATE_MS portTICK_PERIOD_MS - -/* Backward compatibility within the scheduler code only - these definitions -are not really required but are included for completeness. */ -#define tmrTIMER_CALLBACK TimerCallbackFunction_t -#define pdTASK_CODE TaskFunction_t -#define xListItem ListItem_t -#define xList List_t +/* Definitions to allow backward compatibility with FreeRTOS versions prior to +V8 if desired. */ +#ifndef configENABLE_BACKWARD_COMPATIBILITY + #define configENABLE_BACKWARD_COMPATIBILITY 1 +#endif + +#if configENABLE_BACKWARD_COMPATIBILITY == 1 + #define eTaskStateGet eTaskGetState + #define portTickType TickType_t + #define xTaskHandle TaskHandle_t + #define xQueueHandle QueueHandle_t + #define xSemaphoreHandle SemaphoreHandle_t + #define xQueueSetHandle QueueSetHandle_t + #define xQueueSetMemberHandle QueueSetMemberHandle_t + #define xTimeOutType TimeOut_t + #define xMemoryRegion MemoryRegion_t + #define xTaskParameters TaskParameters_t + #define xTaskStatusType TaskStatus_t + #define xTimerHandle TimerHandle_t + #define xCoRoutineHandle CoRoutineHandle_t + #define pdTASK_HOOK_CODE TaskHookFunction_t + #define portTICK_RATE_MS portTICK_PERIOD_MS + + /* Backward compatibility within the scheduler code only - these definitions + are not really required but are included for completeness. */ + #define tmrTIMER_CALLBACK TimerCallbackFunction_t + #define pdTASK_CODE TaskFunction_t + #define xListItem ListItem_t + #define xList List_t +#endif /* configENABLE_BACKWARD_COMPATIBILITY */ #endif /* INC_FREERTOS_H */ diff --git a/FreeRTOS/Source/include/stdint.readme b/FreeRTOS/Source/include/stdint.readme new file mode 100644 index 000000000..6d86149ca --- /dev/null +++ b/FreeRTOS/Source/include/stdint.readme @@ -0,0 +1,27 @@ + +#ifndef FREERTOS_STDINT +#define FREERTOS_STDINT + +/******************************************************************************* + * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions + * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be + * built using compilers that do not provide their own stdint.h definition. + * + * To use this file: + * + * 1) Copy this file into the directory that contains your FreeRTOSConfig.h + * header file, as that directory will already be in the compilers include + * path. + * + * 2) Rename the copied file stdint.h. + * + */ + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef long int32_t; +typedef unsigned long uint32_t; + +#endif /* FREERTOS_STDINT */ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h index eff88c440..143c7ea02 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h @@ -94,9 +94,9 @@ #define portSTACK_TYPE uint32_t #define portBASE_TYPE long -typedef portSTACK_TYPE StackType_t; -typedef long BaseType_t; -typedef unsigned long UBaseType_t; + typedef portSTACK_TYPE StackType_t; + typedef long BaseType_t; + typedef unsigned long UBaseType_t; typedef uint32_t TickType_t; #define portMAX_DELAY ( TickType_t ) 0xffffffffUL @@ -115,7 +115,7 @@ typedef unsigned long UBaseType_t; /* Called at the end of an ISR that can cause a context switch. */ #define portEND_SWITCHING_ISR( xSwitchRequired )\ { \ - extern uint32_t ulPortYieldRequired; \ + extern uint32_t ulPortYieldRequired; \ \ if( xSwitchRequired != pdFALSE ) \ { \ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h index da194a492..3d17000b2 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h @@ -115,7 +115,7 @@ typedef unsigned long UBaseType_t; /* Called at the end of an ISR that can cause a context switch. */ #define portEND_SWITCHING_ISR( xSwitchRequired )\ { \ -extern uint32_t ulPortYieldRequired; \ +extern uint32_t ulPortYieldRequired; \ \ if( xSwitchRequired != pdFALSE ) \ { \ -- 2.39.5