From: RichardBarry Date: Sun, 1 Feb 2009 21:01:43 +0000 (+0000) Subject: Renamed to remove the Fx3 from the directory name. X-Git-Tag: V5.1.2~32 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=309c83353309dd9b338be97da68bc9d55e74cf7f;p=freertos Renamed to remove the Fx3 from the directory name. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@664 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/NEC_V850ES_IAR/FreeRTOSConfig.h b/Demo/NEC_V850ES_IAR/FreeRTOSConfig.h new file mode 100644 index 000000000..cfc583a09 --- /dev/null +++ b/Demo/NEC_V850ES_IAR/FreeRTOSConfig.h @@ -0,0 +1,147 @@ +/* + FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + *************************************************************************** + * * + * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * + * and even write all or part of your application on your behalf. * + * See http://www.OpenRTOS.com for details of the services we provide to * + * expedite your project. * + * * + *************************************************************************** + *************************************************************************** + + Please ensure to read the configuration and relevant port sections of the + online documentation. + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/* only include in C files */ +#ifdef __IAR_SYSTEMS_ICC__ + #pragma language=extended + #pragma system_include + #include +#endif /* __IAR_SYSTEMS_ICC__ */ + +/* V850ES/Fx3 Memory Model + * 1 = Tiny data model + * 0 = Small/Large data model + */ +#define configDATA_MODE 0 + + + +/* + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + */ +#define configUSE_PREEMPTION 1 +/* only include in C files */ + +#ifdef __IAR_SYSTEMS_ICC__ + + #define configUSE_IDLE_HOOK 0 + #define configUSE_TICK_HOOK 0 + #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) + #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 ) + #define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 85 ) + #define configMAX_TASK_NAME_LEN ( 10 ) + #define configUSE_TRACE_FACILITY 0 + #define configUSE_16_BIT_TICKS 0 + #define configIDLE_SHOULD_YIELD 0 + #define configUSE_CO_ROUTINES 0 + #define configUSE_MUTEXES 1 + #define configCHECK_FOR_STACK_OVERFLOW 2 + #define configUSE_RECURSIVE_MUTEXES 1 + #define configQUEUE_REGISTRY_SIZE 0 + #define configUSE_COUNTING_SEMAPHORES 0 + + /* Co-routine definitions. */ + #define configUSE_CO_ROUTINES 0 + #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + + /* Set the following definitions to 1 to include the API function, or zero + to exclude the API function. */ + #define INCLUDE_vTaskPrioritySet 1 + #define INCLUDE_uxTaskPriorityGet 1 + #define INCLUDE_vTaskDelete 1 + #define INCLUDE_vTaskCleanUpResources 0 + #define INCLUDE_vTaskSuspend 1 + #define INCLUDE_vTaskDelayUntil 1 + #define INCLUDE_vTaskDelay 1 + + /* This IAR workspace contains several different projects - each of which + is targeted at a different device variant. The definitions past this point + are dependent on the variant being used. */ + #ifdef __IAR_V850ES_Fx3__ + #include "io70f3385.h" + #define configTOTAL_HEAP_SIZE ( (size_t ) ( 20000 ) ) + #define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 48000000 ) + #endif + + #ifdef __IAR_V850ES_Jx3__ + #include "io70f3746.h" + #define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) + #define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 16000000 ) + #endif + + #ifdef __IAR_V850ES_Jx3_L__ + #include "io70f3738.h" + #define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) + #define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 20000000 ) + #endif + + #ifdef __IAR_V850ES_Jx2__ + #include "io70f3717.h" + #define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) + #define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 20000000 ) + #endif + + #ifdef __IAR_V850ES_Hx2__ + #include "io70f3707.h" + #define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) + #define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 20000000 ) + #endif + +#endif /* __IAR_SYSTEMS_ICC__ */ + +#endif /* FREERTOS_CONFIG_H */ diff --git a/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit.c b/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit.c new file mode 100644 index 000000000..e5a062405 --- /dev/null +++ b/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit.c @@ -0,0 +1,99 @@ +/* + FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + *************************************************************************** + * * + * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * + * and even write all or part of your application on your behalf. * + * See http://www.OpenRTOS.com for details of the services we provide to * + * expedite your project. * + * * + *************************************************************************** + *************************************************************************** + + Please ensure to read the configuration and relevant port sections of the + online documentation. + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +#include "FreeRTOS.h" + +/*-----------------------------------------------------------*/ + +/* Called by the startup code to initialise the run time system. */ +unsigned portCHAR __low_level_init(void); + +/*-----------------------------------------------------------*/ + +unsigned portCHAR __low_level_init(void) +{ +unsigned portCHAR resetflag = RESF; +unsigned portCHAR psval = 0; +unsigned portBASE_TYPE i = 0; + + /* Setup provided by NEC. */ + + portDISABLE_INTERRUPTS(); /* disable global interrupts */ + + PRCMD = 0x00; /* On-chip debug mode */ + OCDM = 0x00; + VSWC = 0x00; /* set system wait control register */ + WDTM2 = 0x00; /* WDT2 setting */ + PLLON = 0; /* PLL stop mode */ + psval = 0x0A | 0x00; + PRCMD = psval; /* set Command Register */ + CKC = psval; /* set Clock Control Register */ + PLLS = 0x03; + psval = 0x80; /* Set fXX and fCPU */ + PRCMD = psval; + PCC = psval; + PLLON = 1; /* activate PLL */ + for( i = 0; i <= 2000; i++ ) /* Wait for stabilisation */ + { + portNOP(); + } + while( LOCK ) /* Wait for PLL frequency stabiliasation */ + { + ; + } + SELPLL = 1; /* Set PLL mode active */ + RSTOP = 0; /* Set fR (enable) */ + BGCE0 = 0; /* Set fBRG(disable) */ + psval = 0x00; /* Stand-by setting */ + PRCMD = psval; /* set Command Register */ + PSC = psval; /* set Power Save Control Register */ + + return pdTRUE; +} +/*-----------------------------------------------------------*/ diff --git a/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Fx3.c b/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Fx3.c new file mode 100644 index 000000000..1551b023b --- /dev/null +++ b/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Fx3.c @@ -0,0 +1,128 @@ +/* + FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + *************************************************************************** + * * + * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * + * and even write all or part of your application on your behalf. * + * See http://www.OpenRTOS.com for details of the services we provide to * + * expedite your project. * + * * + *************************************************************************** + *************************************************************************** + + Please ensure to read the configuration and relevant port sections of the + online documentation. + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +#include "FreeRTOS.h" + +/*-----------------------------------------------------------*/ + +/* Called by the startup code to initialise the run time system. */ +unsigned portCHAR __low_level_init(void); + +/*-----------------------------------------------------------*/ + +unsigned portCHAR __low_level_init(void) +{ +unsigned portCHAR resetflag = RESF; +unsigned portCHAR psval = 0; + + /* Setup provided by NEC. */ + + /* Disable global interrupts to ensure no interrupts occur during system + setup. */ + portDISABLE_INTERRUPTS(); + + PRCMD = 0x00; + OCDM = 0x00; + VSWC = 0x12; + VSWC = 18; + + /* Set main system clock */ + OSTS = 0x06; + psval = 0x80; + PRCMD = psval; + PCC = psval; + while (!OSTC) + { + ; + } + + PLLS = 0x03; + PLLON = 1; + while (LOCKR) + { + ; + } + + psval = 0x01; + PRCMD = psval; + MCM = psval; + SELPLL = 1; + + /* Set fCPU */ + psval = PCC | 0x00; + PRCMD = psval; + PCC = psval; + RCM = 0x83; + + /* Set fXP1 */ + SELCNT4 = 0x00; + + /* Set fBRG */ + PRSM0 = 0x00; + + /* Stand-by setting */ + psval = 0x00; + PRCMD = psval; + PSC = psval; + + /* WDT2 setting */ + WDTM2 = 0x1F; + + /* PCL setting */ + PCLM = 0x00; + + /* disable dma0 - dma3 */ + E00 = 0; + E11 = 0; + E22 = 0; + E33 = 0; + + return pdTRUE; +} +/*-----------------------------------------------------------*/ diff --git a/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Hx2.c b/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Hx2.c new file mode 100644 index 000000000..249850a2a --- /dev/null +++ b/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Hx2.c @@ -0,0 +1,84 @@ +/* + FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + *************************************************************************** + * * + * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * + * and even write all or part of your application on your behalf. * + * See http://www.OpenRTOS.com for details of the services we provide to * + * expedite your project. * + * * + *************************************************************************** + *************************************************************************** + + Please ensure to read the configuration and relevant port sections of the + online documentation. + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +#include "FreeRTOS.h" + +/*-----------------------------------------------------------*/ + +/* Called by the startup code to initialise the run time system. */ +unsigned portCHAR __low_level_init( void ); + +/*-----------------------------------------------------------*/ + +unsigned portCHAR __low_level_init( void ) +{ +unsigned portCHAR resetflag = RESF; +unsigned portBASE_TYPE i = 0; + + portDISABLE_INTERRUPTS(); /* disable global interrupts */ + + PRCMD = 0x00; /* On-chip debug mode */ + PCC = 0x00; /* high speed mode fCPU */ + VSWC = 0x00; + WDTM2 = 0xF; /* Stop watchdog Timer */ + PLLS = 0x03; /* Set PLL stabilisation time */ + PLLON = 1; /* activate PLL */ + for( i = 0; i <= 2000; i++ ) /* Wait for stabilisation */ + { + portNOP(); + } + while( LOCK ) /* Wait for PLL frequency stabiliasation */ + { + portNOP(); + } + SELPLL = 1; /* Set CPU operation to PLL mode */ + + return pdTRUE; +} +/*-----------------------------------------------------------*/ diff --git a/Demo/NEC_V850ES_IAR/ParTest/ParTest_Fx3_App_Board.c b/Demo/NEC_V850ES_IAR/ParTest/ParTest_Fx3_App_Board.c new file mode 100644 index 000000000..d929d4bda --- /dev/null +++ b/Demo/NEC_V850ES_IAR/ParTest/ParTest_Fx3_App_Board.c @@ -0,0 +1,125 @@ +/* + FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + *************************************************************************** + * * + * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * + * and even write all or part of your application on your behalf. * + * See http://www.OpenRTOS.com for details of the services we provide to * + * expedite your project. * + * * + *************************************************************************** + *************************************************************************** + + Please ensure to read the configuration and relevant port sections of the + online documentation. + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +/*----------------------------------------------------------- + * Simple parallel port IO routines. + *-----------------------------------------------------------*/ + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Demo includes. */ +#include "partest.h" + +#define partstNUM_LEDs 4 + +#define LED0_MASK ( ( unsigned short ) 0x08 ) +#define LED1_MASK ( ( unsigned short ) 0x10 ) +#define LED2_MASK ( ( unsigned short ) 0x40 ) +#define LED3_MASK ( ( unsigned short ) 0x80 ) + +static const unsigned short xLEDs[ partstNUM_LEDs ] = { LED0_MASK, LED1_MASK, LED2_MASK, LED3_MASK }; + + + +void vParTestInitialise( void ) +{ + /* Set GPIO to output. */ + PM3 &= ~( LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK ); +} +/*-----------------------------------------------------------*/ + +void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) +{ +unsigned portBASE_TYPE uxLEDMask; + + if( uxLED < partstNUM_LEDs ) + { + uxLEDMask = xLEDs[ uxLED ]; + + taskENTER_CRITICAL(); + { + if( xValue ) + { + P3 |= uxLEDMask; + } + else + { + P3 &= ~uxLEDMask; + } + } + taskEXIT_CRITICAL(); + } +} +/*-----------------------------------------------------------*/ + +void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) +{ +unsigned portBASE_TYPE uxLEDMask; + + if( uxLED < partstNUM_LEDs ) + { + uxLEDMask = xLEDs[ uxLED ]; + + taskENTER_CRITICAL(); + { + if( P3 & uxLEDMask ) + { + P3 &= ~uxLEDMask; + } + else + { + P3 |= uxLEDMask; + } + } + taskEXIT_CRITICAL(); + } +} + diff --git a/Demo/NEC_V850ES_IAR/ParTest/ParTest_Generic_Target_Board.c b/Demo/NEC_V850ES_IAR/ParTest/ParTest_Generic_Target_Board.c new file mode 100644 index 000000000..4d89cdce3 --- /dev/null +++ b/Demo/NEC_V850ES_IAR/ParTest/ParTest_Generic_Target_Board.c @@ -0,0 +1,123 @@ +/* + FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + *************************************************************************** + * * + * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * + * and even write all or part of your application on your behalf. * + * See http://www.OpenRTOS.com for details of the services we provide to * + * expedite your project. * + * * + *************************************************************************** + *************************************************************************** + + Please ensure to read the configuration and relevant port sections of the + online documentation. + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +/*----------------------------------------------------------- + * Simple parallel port IO routines. + *-----------------------------------------------------------*/ + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Demo includes. */ +#include "partest.h" + +#define partstNUM_LEDs 2 + +#define LED0_MASK ( ( unsigned short ) 0x04 ) +#define LED1_MASK ( ( unsigned short ) 0x08 ) + +static const unsigned short xLEDs[ partstNUM_LEDs ] = { LED0_MASK, LED1_MASK }; + +/*-----------------------------------------------------------*/ + +void vParTestInitialise( void ) +{ + /* LED Port Initialization */ + PMCM &= ~( LED0_MASK | LED1_MASK ); +} +/*-----------------------------------------------------------*/ + +void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) +{ +unsigned portBASE_TYPE uxLEDMask; + + if( uxLED < partstNUM_LEDs ) + { + uxLEDMask = xLEDs[ uxLED ]; + + taskENTER_CRITICAL(); + { + if( xValue ) + { + PCM &= ~uxLEDMask; + } + else + { + PCM |= uxLEDMask; + } + } + taskEXIT_CRITICAL(); + } +} +/*-----------------------------------------------------------*/ + +void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) +{ +unsigned portBASE_TYPE uxLEDMask; + + if( uxLED < partstNUM_LEDs ) + { + uxLEDMask = xLEDs[ uxLED ]; + + taskENTER_CRITICAL(); + { + if( PCM & uxLEDMask ) + { + PCM &= ~uxLEDMask; + } + else + { + PCM |= uxLEDMask; + } + } + taskEXIT_CRITICAL(); + } +} + diff --git a/Demo/NEC_V850ES_IAR/RegTest.s85 b/Demo/NEC_V850ES_IAR/RegTest.s85 new file mode 100644 index 000000000..bb65ac034 --- /dev/null +++ b/Demo/NEC_V850ES_IAR/RegTest.s85 @@ -0,0 +1,362 @@ +; FreeRTOS.org V5.1.1 - Copyright (C) 2003-2009 Richard Barry. +; +; This file is part of the FreeRTOS.org distribution. +; +; FreeRTOS.org is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation; either version 2 of the License, or +; (at your option) any later version. +; +; FreeRTOS.org is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with FreeRTOS.org; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +; A special exception to the GPL can be applied should you wish to distribute +; a combined work that includes FreeRTOS.org, without being obliged to provide +; the source code for any proprietary components. See the licensing section +; of http://www.FreeRTOS.org for full details of how and when the exception +; can be applied. +; +; *************************************************************************** +; See http://www.FreeRTOS.org for documentation, latest information, license +; and contact details. Please ensure to read the configuration and relevant +; port sections of the online documentation. +; *************************************************************************** +; +;------------------------------------------------------------------------------ +; Note: Select the correct include files for the device used by the application. + + EXTERN vRegTestFailed + + + +; +; The RegTest tasks as described in the comments at the top of main(). +; + + +;------------------------------------------------------------------------------ + +; Functions implemented in this file +;------------------------------------------------------------------------------ + PUBLIC vRegTest1 + PUBLIC vRegTest2 + + +;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ + RSEG CODE:CODE +vRegTest1: + MOV 0x01010101, R1 + MOV 0x02020202, R2 + ; Ignore R3 and R4 as these are the stack and global pointers respectively. + MOV 0x04040404, R5 + MOV 0x05050505, R6 + MOV 0x06060606, R7 + MOV 0x07070707, R8 + MOV 0x08080808, R9 + MOV 0x09090909, R10 + MOV 0x0a0a0a0a, R11 + MOV 0x0b0b0b0b, R12 + MOV 0x0c0c0c0c, R13 + MOV 0x0d0d0d0d, R14 + MOV 0x0e0e0e0e, R15 + MOV 0x0f0f0f0f, R16 + MOV 0x10101010, R17 + MOV 0x11111111, R18 + MOV 0x12121212, R19 + MOV 0x13131313, R20 + MOV 0x14141414, R21 + MOV 0x15151515, R22 + MOV 0x16161616, R23 + MOV 0x17171717, R24 +#if ( configDATA_MODE == 1 ) + ;R25 is used as a base register except when the tiny model is used. */ + MOV 0x18181818, R25 +#endif + MOV 0x19191919, R26 + MOV 0x20202020, R27 + MOV 0x21212121, R28 + MOV 0x22222222, R29 + MOV 0x23232323, R30 + +vReg1TestLoopStart: + MOV 0x01010101, R31 + CMP R31, R1 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x02020202, R31 + CMP R31, R2 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x04040404, R31 + CMP R31, R5 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x05050505, R31 + CMP R31, R6 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x06060606, R31 + CMP R31, R7 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x07070707, R31 + CMP R31, R8 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x08080808, R31 + CMP R31, R9 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x09090909, R31 + CMP R31, R10 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x0a0a0a0a, R31 + CMP R31, R11 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x0b0b0b0b, R31 + CMP R31, R12 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x0c0c0c0c, R31 + CMP R31, R13 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x0d0d0d0d, R31 + CMP R31, R14 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x0e0e0e0e, R31 + CMP R31, R15 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x0f0f0f0f, R31 + CMP R31, R16 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x10101010, R31 + CMP R31, R17 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x11111111, R31 + CMP R31, R18 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x12121212, R31 + CMP R31, R19 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x13131313, R31 + CMP R31, R20 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x14141414, R31 + CMP R31, R21 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x15151515, R31 + CMP R31, R22 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x16161616, R31 + CMP R31, R23 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x17171717, R31 + CMP R31, R24 + BZ $+6 + JARL vRegTestFailed, lp +#if ( configDATA_MODE == 1 ) + MOV 0x18181818, R31 + CMP R31, R25 + BZ $+6 + JARL vRegTestFailed, lp +#endif + MOV 0x19191919, R31 + CMP R31, R26 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x20202020, R31 + CMP R31, R27 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x21212121, R31 + CMP R31, R28 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x22222222, R31 + CMP R31, R29 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0x23232323, R31 + CMP R31, R30 + BZ $+6 + JARL vRegTestFailed, lp + MOV vReg1TestLoopStart, R31 + JMP [R31] + +;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ + RSEG CODE:CODE +vRegTest2: + MOV 0xa101010b, R1 + MOV 0xa202020b, R2 + ; Ignore R3 and R4 as these are the stack and global pointers respectively. + MOV 0xa404040b, R5 + MOV 0xa505050b, R6 + MOV 0xa606060b, R7 + MOV 0xa707070b, R8 + MOV 0xa808080b, R9 + MOV 0xa909090b, R10 + MOV 0xaa0a0a0b, R11 + MOV 0xab0b0b0b, R12 + MOV 0xac0c0c0b, R13 + MOV 0xad0d0d0b, R14 + MOV 0xae0e0e0b, R15 + MOV 0xaf0f0f0b, R16 + MOV 0xa010101b, R17 + MOV 0xa111111b, R18 + MOV 0xa212121b, R19 + MOV 0xa313131b, R20 + MOV 0xa414141b, R21 + MOV 0xa515151b, R22 + MOV 0xa616161b, R23 + MOV 0xa717171b, R24 +#if ( configDATA_MODE == 1 ) + ;R25 is used as a base register except when the tiny model is used. */ + MOV 0xa818181b, R25 +#endif + MOV 0xa919191b, R26 + MOV 0xa020202b, R27 + MOV 0xa121212b, R28 + MOV 0xa222222b, R29 + MOV 0xa323232b, R30 + +vReg2TestLoopStart: + MOV 0xa101010b, R31 + CMP R31, R1 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa202020b, R31 + CMP R31, R2 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa404040b, R31 + CMP R31, R5 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa505050b, R31 + CMP R31, R6 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa606060b, R31 + CMP R31, R7 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa707070b, R31 + CMP R31, R8 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa808080b, R31 + CMP R31, R9 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa909090b, R31 + CMP R31, R10 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xaa0a0a0b, R31 + CMP R31, R11 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xab0b0b0b, R31 + CMP R31, R12 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xac0c0c0b, R31 + CMP R31, R13 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xad0d0d0b, R31 + CMP R31, R14 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xae0e0e0b, R31 + CMP R31, R15 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xaf0f0f0b, R31 + CMP R31, R16 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa010101b, R31 + CMP R31, R17 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa111111b, R31 + CMP R31, R18 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa212121b, R31 + CMP R31, R19 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa313131b, R31 + CMP R31, R20 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa414141b, R31 + CMP R31, R21 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa515151b, R31 + CMP R31, R22 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa616161b, R31 + CMP R31, R23 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa717171b, R31 + CMP R31, R24 + BZ $+6 + JARL vRegTestFailed, lp +#if ( configDATA_MODE == 1 ) + MOV 0xa818181b, R31 + CMP R31, R25 + BZ $+6 + JARL vRegTestFailed, lp +#endif + MOV 0xa919191b, R31 + CMP R31, R26 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa020202b, R31 + CMP R31, R27 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa121212b, R31 + CMP R31, R28 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa222222b, R31 + CMP R31, R29 + BZ $+6 + JARL vRegTestFailed, lp + MOV 0xa323232b, R31 + CMP R31, R30 + BZ $+6 + JARL vRegTestFailed, lp + MOV vReg2TestLoopStart, R31 + JMP [R31] + + END + \ No newline at end of file diff --git a/Demo/NEC_V850ES_IAR/main.c b/Demo/NEC_V850ES_IAR/main.c new file mode 100644 index 000000000..b32f85e8f --- /dev/null +++ b/Demo/NEC_V850ES_IAR/main.c @@ -0,0 +1,291 @@ +/* + FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + *************************************************************************** + * * + * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * + * and even write all or part of your application on your behalf. * + * See http://www.OpenRTOS.com for details of the services we provide to * + * expedite your project. * + * * + *************************************************************************** + *************************************************************************** + + Please ensure to read the configuration and relevant port sections of the + online documentation. + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +/* + * Creates all the demo application tasks, then starts the scheduler. The WEB + * documentation provides more details of the standard demo application tasks. + * In addition to the standard demo tasks, the following tasks and tests are + * defined and/or created within this file: + * + * "Check" task - This only executes every three seconds but has a high priority + * to ensure it gets processor time. Its main function is to check that all the + * standard demo tasks are still operational. If everything is running as + * expected then the check task will toggle an LED every 3 seconds. An error + * being discovered in any task will cause the toggle rate to increase to 500ms. + * + * "Reg test" tasks - These fill the registers with known values, then check + * that each register still contains its expected value. Each task uses + * different values. The tasks run with very low priority so get preempted very + * frequently. A register containing an unexpected value is indicative of an + * error in the context switching mechanism. + * + */ + +/* Standard include files. */ +#include +#include + +/* Scheduler include files. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Demo file headers. */ +#include +#include "BlockQ.h" +#include "death.h" +#include "flash.h" +#include "partest.h" +#include "semtest.h" +#include "PollQ.h" +#include "GenQTest.h" +#include "QPeek.h" +#include "recmutex.h" +#include "comtest2.h" + +/* + * Priority definitions for most of the tasks in the demo application. Some + * tasks just use the idle priority. + */ +#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCOMTEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) + +/* Passed into the check task just as a test that the parameter passing +mechanism is working correctly. */ +#define mainCHECK_PARAMETER ( ( void * ) 0x12345678 ) + +/* The period between executions of the check task. */ +#define mainNO_ERROR_DELAY ( ( portTickType ) 3000 / portTICK_RATE_MS ) +#define mainERROR_DELAY ( ( portTickType ) 500 / portTICK_RATE_MS ) + +/* There are no spare LEDs for the comtest tasks, so this is just set to an +invalid number. */ +#define mainCOMTEST_LED ( 4 ) + +/* The baud rate used by the comtest task. */ +#define mainBAUD_RATE ( 9600 ) + +/*-----------------------------------------------------------*/ + +/* The implementation of the 'check' task as described at the top of this file. */ +static void prvCheckTask( void *pvParameters ); + +/* Just sets up the LED outputs. Most generic setup is done in +__low_level_init(). */ +static void prvSetupHardware( void ); + +/* The RegTest functions as described at the top of this file. */ +extern void vRegTest1( void *pvParameters ); +extern void vRegTest2( void *pvParameters ); + +/* A variable that will get set to fail if a RegTest task finds an error. The +variable is inspected by the 'Check' task. */ +static volatile portLONG lRegTestStatus = pdPASS; + +/*-----------------------------------------------------------*/ + +/* Create all the demo tasks then start the scheduler. */ +void main( void ) +{ + /* Just sets up the LED outputs. */ + prvSetupHardware(); + + /* Standard demo tasks. */ + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartQueuePeekTasks(); + + /* Create the check task as described at the top of this file. */ + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, mainCHECK_PARAMETER, mainCHECK_TASK_PRIORITY, NULL ); + + /* Create the RegTest tasks as described at the top of this file. */ + xTaskCreate( vRegTest1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + #ifdef __IAR_V850ES_Fx3__ + { + /* The extra IO required for the com test and led flashing tasks is only + available on the application board, not the target boards. */ + vAltStartComTestTasks( mainCOMTEST_PRIORITY, mainBAUD_RATE, mainCOMTEST_LED ); + vStartLEDFlashTasks( mainFLASH_PRIORITY ); + + /* The Fx3 also has enough RAM to run loads more tasks. */ + vStartRecursiveMutexTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + } + #endif + + /* The suicide tasks must be created last as they need to know how many + tasks were running prior to their creation in order to ascertain whether + or not the correct/expected number of tasks are running at any given time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* If this line is reached then vTaskStartScheduler() returned because there + was insufficient heap memory remaining for the idle task to be created. */ + for( ;; ); +} +/*-----------------------------------------------------------*/ + +static void prvCheckTask( void *pvParameters ) +{ +portTickType xDelayPeriod = mainNO_ERROR_DELAY, xLastWakeTime; +unsigned portBASE_TYPE uxLEDToUse = 0; + + /* Ensure parameter is passed in correctly. */ + if( pvParameters != mainCHECK_PARAMETER ) + { + xDelayPeriod = mainERROR_DELAY; + } + + /* Initialise xLastWakeTime before it is used. After this point it is not + written to directly. */ + xLastWakeTime = xTaskGetTickCount(); + + /* Cycle for ever, delaying then checking all the other tasks are still + operating without error. */ + for( ;; ) + { + vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); + + if( lRegTestStatus != pdPASS ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + /* The Fx3 runs more tasks, so more checks are performed. */ + #ifdef __IAR_V850ES_Fx3__ + { + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + /* The application board has more LEDs and uses the flash tasks + so the check task instead uses LED3 as LED3 is still spare. */ + uxLEDToUse = 3; + } + #endif + + vParTestToggleLED( uxLEDToUse ); + } +} +/*-----------------------------------------------------------*/ + +static void prvSetupHardware( void ) +{ + /* Setup the LED outputs. */ + vParTestInitialise(); + + /* Any additional hardware configuration can be added here. */ +} +/*-----------------------------------------------------------*/ + +void vApplicationStackOverflowHook( void ) +{ + /* This will be called if a task overflows its stack. pxCurrentTCB + can be inspected to see which is the offending task. */ + for( ;; ); +} +/*-----------------------------------------------------------*/ + +void vRegTestFailed( void ) +{ + /* Called by the RegTest tasks if an error is found. lRegTestStatus is + inspected by the check task. */ + lRegTestStatus = pdFAIL; + + /* Do not return from here as the reg test tasks clobber all registers so + function calls may not function correctly. */ + for( ;; ); +} diff --git a/Demo/NEC_V850ES_IAR/rtosdemo.ewd b/Demo/NEC_V850ES_IAR/rtosdemo.ewd new file mode 100644 index 000000000..77af96001 --- /dev/null +++ b/Demo/NEC_V850ES_IAR/rtosdemo.ewd @@ -0,0 +1,1827 @@ + + + + 2 + + V850ESJx3 + + V850 + + 1 + + C-SPY + 5 + + 12 + 1 + 1 + + + + + + + + + + + + + + + + + EMUV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + IECV850 + 5 + + 0 + 1 + 1 + + + + + + + + + MICV850 + 5 + + 1 + 1 + 1 + + + + + + + + + + + + NWIV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + ROMV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + + + + + + + SIMV850 + 5 + + 0 + 1 + 1 + + + + + + + + TKSV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + V850ESFx3 + + V850 + + 1 + + C-SPY + 5 + + 12 + 1 + 1 + + + + + + + + + + + + + + + + + EMUV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + IECV850 + 5 + + 0 + 1 + 1 + + + + + + + + + MICV850 + 5 + + 1 + 1 + 1 + + + + + + + + + + + + NWIV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + ROMV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + + + + + + + SIMV850 + 5 + + 0 + 1 + 1 + + + + + + + + TKSV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + V850ESJx3L + + V850 + + 1 + + C-SPY + 5 + + 12 + 1 + 1 + + + + + + + + + + + + + + + + + EMUV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + IECV850 + 5 + + 0 + 1 + 1 + + + + + + + + + MICV850 + 5 + + 1 + 1 + 1 + + + + + + + + + + + + NWIV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + ROMV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + + + + + + + SIMV850 + 5 + + 0 + 1 + 1 + + + + + + + + TKSV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + V850ESJx2 + + V850 + + 1 + + C-SPY + 5 + + 12 + 1 + 1 + + + + + + + + + + + + + + + + + EMUV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + IECV850 + 5 + + 0 + 1 + 1 + + + + + + + + + MICV850 + 5 + + 1 + 1 + 1 + + + + + + + + + + + + NWIV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + ROMV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + + + + + + + SIMV850 + 5 + + 0 + 1 + 1 + + + + + + + + TKSV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + V850ESHx2 + + V850 + + 1 + + C-SPY + 5 + + 12 + 1 + 1 + + + + + + + + + + + + + + + + + EMUV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + IECV850 + 5 + + 0 + 1 + 1 + + + + + + + + + MICV850 + 5 + + 1 + 1 + 1 + + + + + + + + + + + + NWIV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + ROMV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + + + + + + + SIMV850 + 5 + + 0 + 1 + 1 + + + + + + + + TKSV850 + 5 + + 0 + 1 + 1 + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + + diff --git a/Demo/NEC_V850ES_IAR/rtosdemo.ewp b/Demo/NEC_V850ES_IAR/rtosdemo.ewp new file mode 100644 index 000000000..d530d198f --- /dev/null +++ b/Demo/NEC_V850ES_IAR/rtosdemo.ewp @@ -0,0 +1,4276 @@ + + + + 2 + + V850ESJx3 + + V850 + + 1 + + General + 5 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCV850 + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AV850 + 3 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 3 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 3 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + V850ESFx3 + + V850 + + 1 + + General + 5 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCV850 + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AV850 + 3 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 3 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 3 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + V850ESJx3L + + V850 + + 1 + + General + 5 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCV850 + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AV850 + 3 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 3 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 3 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + V850ESJx2 + + V850 + + 1 + + General + 5 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCV850 + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AV850 + 3 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 3 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 3 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + V850ESHx2 + + V850 + + 1 + + General + 5 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCV850 + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AV850 + 3 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 3 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 3 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + demo source + + LEDs + + $PROJ_DIR$\ParTest\ParTest_Fx3_App_Board.c + + V850ESJx3 + V850ESJx3L + V850ESJx2 + V850ESHx2 + + + + $PROJ_DIR$\ParTest\ParTest_Generic_Target_Board.c + + V850ESFx3 + + + + + Low Level Init + + $PROJ_DIR$\LowLevelInit\LowLevelInit.c + + V850ESFx3 + V850ESHx2 + + + + $PROJ_DIR$\LowLevelInit\LowLevelInit_Fx3.c + + V850ESJx3 + V850ESJx3L + V850ESJx2 + V850ESHx2 + + + + $PROJ_DIR$\LowLevelInit\LowLevelInit_Hx2.c + + V850ESJx3 + V850ESFx3 + V850ESJx3L + V850ESJx2 + + + + + Standard Demo Tasks + + $PROJ_DIR$\..\Common\Minimal\BlockQ.c + + + $PROJ_DIR$\..\Common\Minimal\comtest.c + + + $PROJ_DIR$\..\Common\Minimal\death.c + + + $PROJ_DIR$\..\Common\Minimal\flash.c + + + $PROJ_DIR$\..\Common\Minimal\GenQTest.c + + + $PROJ_DIR$\..\Common\Minimal\PollQ.c + + + $PROJ_DIR$\..\Common\Minimal\QPeek.c + + + $PROJ_DIR$\..\Common\Minimal\recmutex.c + + + $PROJ_DIR$\..\Common\Minimal\semtest.c + + + + $PROJ_DIR$\main.c + + + $PROJ_DIR$\RegTest.s85 + + + $PROJ_DIR$\serial\serial.c + + V850ESJx3 + V850ESJx3L + V850ESJx2 + V850ESHx2 + + + + $PROJ_DIR$\serial\serialISR.s85 + + V850ESJx3 + V850ESJx3L + V850ESJx2 + V850ESHx2 + + + + + kernel source + + device specific + + $PROJ_DIR$\..\..\Source\portable\IAR\V850ES\portasm.s85 + + V850ESFx3 + V850ESHx2 + + + + $PROJ_DIR$\..\..\Source\portable\IAR\V850ES\portasm_Fx3.s85 + + V850ESJx3 + V850ESJx3L + V850ESJx2 + V850ESHx2 + + + + $PROJ_DIR$\..\..\Source\portable\IAR\V850ES\portasm_Hx2.s85 + + V850ESJx3 + V850ESFx3 + V850ESJx3L + V850ESJx2 + + + + + $PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c + + + $PROJ_DIR$\..\..\Source\list.c + + + $PROJ_DIR$\..\..\Source\queue.c + + + $PROJ_DIR$\..\..\Source\tasks.c + + + + $PROJ_DIR$\..\..\Source\portable\IAR\V850ES\port.c + + + + diff --git a/Demo/NEC_V850ES_IAR/rtosdemo.eww b/Demo/NEC_V850ES_IAR/rtosdemo.eww new file mode 100644 index 000000000..2294aacb5 --- /dev/null +++ b/Demo/NEC_V850ES_IAR/rtosdemo.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\rtosdemo.ewp + + + + + diff --git a/Demo/NEC_V850ES_IAR/serial/serial.c b/Demo/NEC_V850ES_IAR/serial/serial.c new file mode 100644 index 000000000..59007b347 --- /dev/null +++ b/Demo/NEC_V850ES_IAR/serial/serial.c @@ -0,0 +1,271 @@ +/* + FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + *************************************************************************** + * * + * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * + * and even write all or part of your application on your behalf. * + * See http://www.OpenRTOS.com for details of the services we provide to * + * expedite your project. * + * * + *************************************************************************** + *************************************************************************** + + Please ensure to read the configuration and relevant port sections of the + online documentation. + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +/* + BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0. + + *NOTE* - This file is designed to test some of the RTOS features - it is + not intended to represent an efficient implementation! +*/ + +/* Standard includes. */ +#include + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "queue.h" + +/* Demo application includes. */ +#include "serial.h" + + +/* Hardware specifics. */ +#define serRX_DATA_PIN ( 0x01 ) +#define serTX_DATA_PIN ( 0x02 ) +#define serCLOCK_Fxx_DIV_8 0x03 +#define serUPWR ( 0x80 ) +#define serUTXE ( 0x40 ) +#define serURXE ( 0x20 ) +#define serUCL ( 0x02 ) +#define serLSB ( 0x10 ) + +/* Misc. */ +#define serINVALID_QUEUE ( ( xQueueHandle ) 0 ) +#define serHANDLE ( ( xComPortHandle ) 1 ) +#define serNO_BLOCK ( ( portTickType ) 0 ) + +/*-----------------------------------------------------------*/ + +/* Queues used to hold received characters, and characters waiting to be +transmitted. */ +static xQueueHandle xRxedChars; +static xQueueHandle xCharsForTx; + +/*-----------------------------------------------------------*/ + +/* Interrupt entry point written in the assembler file serialISR.s85. */ +extern void vSerialISREntry( void ); + +/* Flag to indicate whether or not there are characters already queued to send. */ +static volatile unsigned long ulTxInProgress = pdFALSE; + +/*-----------------------------------------------------------*/ + +/* + * See the serial2.h header file. + */ +xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength ) +{ +xComPortHandle xReturn = serHANDLE; +const unsigned portLONG ulFuclk = ( configCPU_CLOCK_HZ / 2 ) / 8UL; + + /* Create the queues used to hold Rx and Tx characters. */ + xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) ); + xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) ); + + /* If the queues were created correctly then setup the serial port + hardware. */ + if( ( xRxedChars != serINVALID_QUEUE ) && ( xCharsForTx != serINVALID_QUEUE ) ) + { + portENTER_CRITICAL(); + { + /* Set the UART0 Rx and Tx pins to their alternative function. */ + PMC3 |= ( serRX_DATA_PIN | serTX_DATA_PIN ); + PM3 &= ~( serTX_DATA_PIN ); + + /* Setup clock for required baud. */ + UD0CTL1 = serCLOCK_Fxx_DIV_8; + UD0CTL2 = ulFuclk / ( 2 * ulWantedBaud ); + + /* Enable, n81. */ + UD0CTL0 = ( serUPWR | serUTXE | serURXE | serUCL | serLSB ); + + /* Enable interrupts for both Rx and Tx. */ + UD0TIC = 0x07; + UD0RIC = 0x07; + + ulTxInProgress = pdFALSE; + } + portEXIT_CRITICAL(); + } + else + { + xReturn = ( xComPortHandle ) 0; + } + + /* This demo file only supports a single port but we have to return + something to comply with the standard demo header file. */ + return xReturn; +} +/*-----------------------------------------------------------*/ + +signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime ) +{ + /* The port handle is not required as this driver only supports one port. */ + ( void ) pxPort; + + /* Get the next character from the buffer. Return false if no characters + are available, or arrive before xBlockTime expires. */ + if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) ) + { + return pdTRUE; + } + else + { + return pdFALSE; + } +} +/*-----------------------------------------------------------*/ + +void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength ) +{ +signed portCHAR *pxNext; + + /* A couple of parameters that this port does not use. */ + ( void ) usStringLength; + ( void ) pxPort; + + /* NOTE: This implementation does not handle the queue being full as no + block time is used! */ + + /* The port handle is not required as this driver only supports UART0. */ + ( void ) pxPort; + + /* Send each character in the string, one at a time. */ + pxNext = ( signed portCHAR * ) pcString; + while( *pxNext ) + { + xSerialPutChar( pxPort, *pxNext, serNO_BLOCK ); + pxNext++; + } +} +/*-----------------------------------------------------------*/ + +signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime ) +{ +portBASE_TYPE xReturn = pdPASS; + + portENTER_CRITICAL(); + { + /* There are currently no characters queued up to send so write the + character directly to the UART. */ + if( ulTxInProgress == pdFALSE ) + { + UD0TX = cOutChar; + ulTxInProgress = pdTRUE; + } + else + { + /* The UART is already busy so write the character to the Tx queue. + The queue is drained from within the Tx interrupt. */ + if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS ) + { + xReturn = pdFAIL; + } + } + } + portEXIT_CRITICAL(); + + return xReturn; +} +/*-----------------------------------------------------------*/ + +void vSerialClose( xComPortHandle xPort ) +{ + /* Not supported as not required by the demo application. */ +} +/*-----------------------------------------------------------*/ + +/* Tx interrupt handler. This is called from the asm file wrapper. */ +void vUARTTxISRHandler( void ) +{ +char cChar; +portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* Are there any more characters queue to transmit? */ + if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE ) + { + /* Send the next character. */ + UD0TX = cChar; + } + else + { + /* The UART is no longer active. */ + ulTxInProgress = pdFALSE; + } + + /* If reading a character from the Rx queue caused a task to unblock, and + the unblocked task has a priority higher than the currently running task, + then xHigherPriorityTaskWoken will have been set to true and a context + switch should occur now. */ + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); +} +/*-----------------------------------------------------------*/ + +/* Rx interrupt handler. This is called from the asm file wrapper. */ +void vUARTRxISRHandler( void ) +{ +portCHAR cChar; +portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* Send the received character to the Rx queue. */ + cChar = UD0RX; + xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken ); + + /* If sending a character to the Tx queue caused a task to unblock, and + the unblocked task has a priority higher than the currently running task, + then xHigherPriorityTaskWoken will have been set to true and a context + switch should occur now. */ + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); +} + + + + + diff --git a/Demo/NEC_V850ES_IAR/serial/serialISR.s85 b/Demo/NEC_V850ES_IAR/serial/serialISR.s85 new file mode 100644 index 000000000..01e81ff7f --- /dev/null +++ b/Demo/NEC_V850ES_IAR/serial/serialISR.s85 @@ -0,0 +1,47 @@ + RSEG ICODE:CODE + + EXTERN vUARTRxISRHandler + EXTERN vUARTTxISRHandler + + PUBLIC vUARTRxISRWrapper + PUBLIC vUARTTxISRWrapper + +; Wrappers for the serial port interrupt service routines. These can cause a +; context switch so requires an assembly wrapper. + +; Defines the portSAVE_CONTEXT and portRESTORE_CONTEXT macros. +#include "ISR_Support.h" + +vUARTRxISRWrapper: + + portSAVE_CONTEXT ; Save the context of the current task. + + jarl vUARTRxISRHandler, lp ; Call the ISR routine. + + portRESTORE_CONTEXT ; Restore the context of the current task - + ; which may be different to the task that + ; was interrupted. + +vUARTTxISRWrapper: + + portSAVE_CONTEXT ; Save the context of the current task. + + jarl vUARTTxISRHandler, lp ; Call the ISR routine. + + portRESTORE_CONTEXT ; Restore the context of the current task - + ; which may be different to the task that + ; was interrupted. + + + COMMON INTVEC:CODE:ROOT(2) + ORG 2c0H +`??vUARTRxISRWrapper??INTVEC 2c0`: + JR vUARTRxISRWrapper + + COMMON INTVEC:CODE:ROOT(2) + ORG 2d0H +`??vUARTTxISRWrapper??INTVEC 2d0`: + JR vUARTTxISRWrapper + + END +