Demo tasks:

- Complete the demo projects for the RX113 using IAR, GCC and Renesas compilers by including a basic UART CLI.

Standard demo tasks:
- Add some volatile qualifiers to variables in IntQueue.c.
This commit is contained in:
Richard Barry 2015-10-05 15:23:09 +00:00
parent cd42d2c215
commit f218cf5680
41 changed files with 1304 additions and 1355 deletions

View file

@ -42,9 +42,9 @@
<option id="com.renesas.cdt.renesas.Compiler.option.deviceShortName.491615829" name="DeviceShortName" superClass="com.renesas.cdt.renesas.Compiler.option.deviceShortName" value="R5F51138AxFP" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.renesas.Compiler.option.incFileDirectories.1906083430" name="Include file directories" superClass="com.renesas.cdt.renesas.Compiler.option.incFileDirectories" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${TCINSTALL}/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Full_Demo/FreeRTOS-Plus-CLI}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Full_Demo/Standard_Demo_Tasks/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Full_Demo}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Renesas_Code}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/FreeRTOS_Source/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/FreeRTOS_Source/portable/Renesas/RX100}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
@ -137,8 +137,14 @@
</fileInfo>
<folderInfo id="com.renesas.cdt.rxc.hardwaredebug.win32.configuration.Id.941970450.497502634" name="/" resourcePath="src/FreeRTOS_Source">
<toolChain id="com.renesas.cdt.rxc.hardwaredebug.win32.toolChain.Id.45016972" name="Renesas RXC Toolchain" superClass="com.renesas.cdt.rxc.hardwaredebug.win32.toolChain.Id" unusedChildren="">
<tool id="com.renesas.cdt.rxc.hardwaredebug.win32.tool.compiler.Id.1830726910" name="Compiler" superClass="com.renesas.cdt.rxc.hardwaredebug.win32.tool.compiler.Id.741766106"/>
<tool id="com.renesas.cdt.rxc.hardwaredebug.win32.tool.assembler.Id.252059482" name="Assembler" superClass="com.renesas.cdt.rxc.hardwaredebug.win32.tool.assembler.Id.1503720976"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE" id="com.renesas.cdt.rxc.hardwaredebug.win32.targetPlatform.Id" isAbstract="false" osList="win32" superClass="com.renesas.cdt.rxc.hardwaredebug.win32.targetPlatform.Id"/>
<tool id="com.renesas.cdt.rxc.hardwaredebug.win32.tool.compiler.Id.1830726910" name="Compiler" superClass="com.renesas.cdt.rxc.hardwaredebug.win32.tool.compiler.Id.741766106">
<inputType id="%Base.Compiler.Shc.C.Input.Id.1332314765" name="C Input" superClass="%Base.Compiler.Shc.C.Input.Id"/>
<inputType id="%Base.Compiler.Shc.C.Input1.Id.1495032261" name="C++ Input" superClass="%Base.Compiler.Shc.C.Input1.Id"/>
</tool>
<tool id="com.renesas.cdt.rxc.hardwaredebug.win32.tool.assembler.Id.252059482" name="Assembler" outputFlag="" superClass="com.renesas.cdt.rxc.hardwaredebug.win32.tool.assembler.Id.1503720976">
<inputType id="%Base.Assembler.shcInputType.Id.1764572327" name="Assembler InputType" superClass="%Base.Assembler.shcInputType.Id"/>
</tool>
<tool id="com.renesas.cdt.rxc.hardwaredebug.win32.tool.linker.Id.270734961" name="Linker" superClass="com.renesas.cdt.rxc.hardwaredebug.win32.tool.linker.Id.1635879936"/>
<tool id="%com.renesas.cdt.rxc.hardwaredebug.win32.tool.libgen.Id.345810510" name="Standard Library" superClass="%com.renesas.cdt.rxc.hardwaredebug.win32.tool.libgen.Id.763608360"/>
<tool id="com.renesas.cdt.rxc.hardwaredebug.win32.tool.convertor.Id.2001992067" name="Converter" superClass="com.renesas.cdt.rxc.hardwaredebug.win32.tool.convertor.Id.345873254"/>
@ -178,7 +184,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="cg_src/r_cg_sbrk.h|cg_src/r_cg_sbrk.c|cg_src/r_cg_main.c|cg_src/r_cg_cmt_user.c|cg_src/r_cg_cmt.h|cg_src/r_cg_cmt.c|cg_src - Copy|r_okaya_lcd.c|cg_src_OLD|r_cg_vecttbl.c|r_cg_vect.h|r_cg_userdefine.h|r_cg_stacksct.h|r_cg_sci.h|r_cg_sci.c|r_cg_sci_user.c|r_cg_sbrk.h|r_cg_sbrk.c|r_cg_resetprg.c|r_cg_port.h|r_cg_port.c|r_cg_port_user.c|r_cg_main.c|r_cg_macrodriver.h|r_cg_lpc.h|r_cg_lpc.c|r_cg_lpc_user.c|r_cg_intprg.c|r_cg_icu.h|r_cg_icu.c|r_cg_icu_user.c|r_cg_hardware_setup.c|r_cg_dbsct.c|r_cg_cmt.h|r_cg_cmt.c|r_cg_cmt_user.c|r_cg_cgc.h|r_cg_cgc.c|r_cg_cgc_user.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry excluding="cg_src/r_cg_main.c|cg_src/r_cg_cmt_user.c|cg_src/r_cg_cmt.h|cg_src/r_cg_cmt.c|cg_src - Copy|r_okaya_lcd.c|cg_src_OLD|r_cg_vecttbl.c|r_cg_vect.h|r_cg_userdefine.h|r_cg_stacksct.h|r_cg_sci.h|r_cg_sci.c|r_cg_sci_user.c|r_cg_sbrk.h|r_cg_sbrk.c|r_cg_resetprg.c|r_cg_port.h|r_cg_port.c|r_cg_port_user.c|r_cg_main.c|r_cg_macrodriver.h|r_cg_lpc.h|r_cg_lpc.c|r_cg_lpc_user.c|r_cg_intprg.c|r_cg_icu.h|r_cg_icu.c|r_cg_icu_user.c|r_cg_hardware_setup.c|r_cg_dbsct.c|r_cg_cmt.h|r_cg_cmt.c|r_cg_cmt_user.c|r_cg_cgc.h|r_cg_cgc.c|r_cg_cgc_user.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>

View file

@ -30,11 +30,26 @@
<type>2</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Source</locationURI>
</link>
<link>
<name>src/Full_Demo/FreeRTOS-Plus-CLI</name>
<type>2</type>
<locationURI>FREERTOS_ROOT/FreeRTOS-Plus/Source/FreeRTOS-Plus-CLI</locationURI>
</link>
<link>
<name>src/Full_Demo/Sample-CLI-commands.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c</locationURI>
</link>
<link>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>2</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal</locationURI>
</link>
<link>
<name>src/Full_Demo/UARTCommandConsole.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UARTCommandConsole.c</locationURI>
</link>
<link>
<name>src/Full_Demo/Standard_Demo_Tasks/include</name>
<type>2</type>
@ -79,7 +94,34 @@
</matcher>
</filter>
<filter>
<id>1442838201321</id>
<id>1443945160058</id>
<name>src/Full_Demo/FreeRTOS-Plus-CLI</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-*.c</arguments>
</matcher>
</filter>
<filter>
<id>1443945160058</id>
<name>src/Full_Demo/FreeRTOS-Plus-CLI</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-*.h</arguments>
</matcher>
</filter>
<filter>
<id>1443945160068</id>
<name>src/Full_Demo/FreeRTOS-Plus-CLI</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-*.url</arguments>
</matcher>
</filter>
<filter>
<id>1443988432315</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -88,7 +130,7 @@
</matcher>
</filter>
<filter>
<id>1442838201326</id>
<id>1443988432325</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -97,7 +139,7 @@
</matcher>
</filter>
<filter>
<id>1442838201332</id>
<id>1443988432325</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -106,7 +148,7 @@
</matcher>
</filter>
<filter>
<id>1442838201337</id>
<id>1443988432335</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -115,7 +157,7 @@
</matcher>
</filter>
<filter>
<id>1442838201342</id>
<id>1443988432345</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -124,7 +166,7 @@
</matcher>
</filter>
<filter>
<id>1442838201347</id>
<id>1443988432345</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -133,7 +175,7 @@
</matcher>
</filter>
<filter>
<id>1442838201353</id>
<id>1443988432355</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -142,7 +184,7 @@
</matcher>
</filter>
<filter>
<id>1442838201358</id>
<id>1443988432365</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -151,7 +193,7 @@
</matcher>
</filter>
<filter>
<id>1442838201363</id>
<id>1443988432365</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -160,7 +202,7 @@
</matcher>
</filter>
<filter>
<id>1442838201367</id>
<id>1443988432375</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -169,7 +211,7 @@
</matcher>
</filter>
<filter>
<id>1442838201373</id>
<id>1443988432385</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -178,7 +220,7 @@
</matcher>
</filter>
<filter>
<id>1442838201377</id>
<id>1443988432395</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -187,7 +229,7 @@
</matcher>
</filter>
<filter>
<id>1442838201382</id>
<id>1443988432405</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -196,7 +238,7 @@
</matcher>
</filter>
<filter>
<id>1442838201387</id>
<id>1443988432415</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
@ -204,15 +246,6 @@
<arguments>1.0-name-matches-false-false-TaskNotify.c</arguments>
</matcher>
</filter>
<filter>
<id>1442838201391</id>
<name>src/Full_Demo/Standard_Demo_Tasks</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-TimerDemo.c</arguments>
</matcher>
</filter>
<filter>
<id>1442832632368</id>
<name>src/FreeRTOS_Source/portable/MemMang</name>

View file

@ -84,24 +84,14 @@
*
* The Queue Send Task:
* The queue send task is implemented by the prvQueueSendTask() function in
* this file. prvQueueSendTask() sits in a loop that causes it to repeatedly
* block for 200 milliseconds, before sending the value 100 to the queue that
* was created within main_blinky(). Once the value is sent, the task loops
* back around to block for another 200 milliseconds...and so on.
* this file. It sends the value 100 to the queue every 200 milliseconds.
*
* The Queue Receive Task:
* The queue receive task is implemented by the prvQueueReceiveTask() function
* in this file. prvQueueReceiveTask() sits in a loop where it repeatedly
* blocks on attempts to read data from the queue that was created within
* main_blinky(). When data is received, the task checks the value of the
* data, and if the value equals the expected 100, toggles an LED. The 'block
* time' parameter passed to the queue receive function specifies that the
* task should be held in the Blocked state indefinitely to wait for data to
* be available on the queue. The queue receive task will only leave the
* Blocked state when the queue send task writes to the queue. As the queue
* send task writes to the queue every 200 milliseconds, the queue receive
* task leaves the Blocked state every 200 milliseconds, and therefore toggles
* the LED every 200 milliseconds.
* in this file. It blocks on the queue to wait for data to arrive from the
* queue send task - toggling the LED each time it receives the value 100. The
* queue send task writes to the queue every 200ms, so the LED should toggle
* every 200ms.
*/
/* Kernel includes. */
@ -120,7 +110,7 @@
/* The rate at which data is sent to the queue. The 200ms value is converted
to ticks using the portTICK_PERIOD_MS constant. */
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS )
#define mainQUEUE_SEND_FREQUENCY_MS ( pdMS_TO_TICKS( 200UL ) )
/* The number of items the queue can hold. This is 1 as the receive task
will remove items as they are added, meaning the send task should always find

View file

@ -87,13 +87,14 @@
*----------------------------------------------------------*/
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( 32000000 ) /* Set in mcu_info.h. */
#define configPERIPHERAL_CLOCK_HZ ( 32000000 ) /* Set in muc_info.h. */
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 7 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 100 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 45 * 1024 ) )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 38 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
@ -107,13 +108,17 @@
#define configUSE_MALLOC_FAILED_HOOK 0
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_TICKLESS_IDLE 0
#define configMAX_PRIORITIES ( 7 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* This demo makes use of one or more example stats formatting functions. These
format the raw data provided by the uxTaskGetSystemState() function in to human
readable ASCII form. See the notes in the implementation of vTaskList() within
FreeRTOS/Source/tasks.c for limitations. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 3 )
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
@ -127,8 +132,8 @@ kernel is doing. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
to exclude the API function - alternative just use the linker to remove unused
functions - which would be normal anyway. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
@ -141,18 +146,15 @@ to exclude the API function. */
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 1
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
/* Assert stops the system on the line that failed the assert(), which can then
be viewed by pausing the debugger. */
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); brk(); for( ;; ); }
/* The configPRE_SLEEP_PROCESSING() and configPOST_SLEEP_PROCESSING() macros
allow the application writer to add additional code before and after the MCU is
placed into the low power state respectively. The implementations provided in
this demo can be extended to save even more power - for example the analog
input used by the low power demo could be switched off in the pre-sleep macro
and back on again in the post sleep macro. */
void vPreSleepProcessing( unsigned long xExpectedIdleTime );
void vPostSleepProcessing( unsigned long xExpectedIdleTime );
#define configPRE_SLEEP_PROCESSING( xExpectedIdleTime ) vPreSleepProcessing( xExpectedIdleTime );
#define configPOST_SLEEP_PROCESSING( xExpectedIdleTime ) vPostSleepProcessing( xExpectedIdleTime );
/* The buffer into which output generated by FreeRTOS+CLI is placed. This must
be at least big enough to contain the output of the task-stats command, as the
example implementation does not include buffer overlow checking. */
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 3500
#define configINCLUDE_QUERY_HEAP_COMMAND 1
/* configTICK_VECTOR must be set to the interrupt vector used by the peripheral
that generates the tick interrupt. */

View file

@ -81,7 +81,7 @@
*
******************************************************************************
*
* main_full() creates all the demo application tasks and software timers, then
* main_full() creates a set of demo application tasks and software timers, then
* starts the scheduler. The web documentation provides more details of the
* standard demo application tasks, which provide no particular functionality,
* but do provide a good example of how to use the FreeRTOS API.
@ -89,6 +89,12 @@
* In addition to the standard demo tasks, the following tasks and tests are
* defined and/or created within this file:
*
* "FreeRTOS+CLI command console" - The command console uses SCI1 for its
* input and output. The baud rate is set to 19200. Type "help" to see a list
* of registered commands. The FreeRTOS+CLI license is different to the
* FreeRTOS license, see http://www.FreeRTOS.org/cli for license and usage
* details.
*
* "Reg test" tasks - These fill both the core and floating point registers with
* known values, then check that each register maintains its expected value for
* the lifetime of the task. Each task uses a different set of values. The reg
@ -97,15 +103,14 @@
* error in the context switching mechanism.
*
* "Check" task - The check task period is initially set to three seconds. The
* task checks that all the standard demo tasks, and the register check tasks,
* are not only still executing, but are executing without reporting any errors.
* If the check task discovers that a task has either stalled, or reported an
* error, then it changes its own execution period from the initial three
* seconds, to just 200ms. The check task also toggles an LED each time it is
* called. This provides a visual indication of the system status: If the LED
* toggles every three seconds, then no issues have been discovered. If the LED
* toggles every 200ms, then an issue has been discovered with at least one
* task.
* task checks that all the standard demo tasks are not only still executing,
* but are executing without reporting any errors. If the check task discovers
* that a task has either stalled, or reported an error, then it changes its own
* execution period from the initial three seconds, to just 200ms. The check
* task also toggles an LED on each iteration of its loop. This provides a
* visual indication of the system status: If the LED toggles every three
* seconds, then no issues have been discovered. If the LED toggles every
* 200ms, then an issue has been discovered with at least one task.
*/
/* Standard includes. */
@ -129,7 +134,6 @@
#include "partest.h"
#include "comtest2.h"
#include "serial.h"
#include "TimerDemo.h"
#include "QueueOverwrite.h"
#include "IntQueue.h"
#include "EventGroupsDemo.h"
@ -146,30 +150,26 @@
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL )
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3UL )
#define mainCOM_TEST_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
/* The priority used by the UART command console task. */
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
/* A block time of zero simply means "don't block". */
#define mainDONT_BLOCK ( 0UL )
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* The period after which the check timer will expire, in ms, provided no errors
have been reported by any of the standard demo tasks. ms are converted to the
equivalent in ticks using the portTICK_PERIOD_MS constant. */
#define mainNO_ERROR_CHECK_TASK_PERIOD ( 3000UL / portTICK_PERIOD_MS )
#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL )
/* The period at which the check timer will expire, in ms, if an error has been
reported in one of the standard demo tasks. ms are converted to the equivalent
in ticks using the portTICK_PERIOD_MS constant. */
#define mainERROR_CHECK_TASK_PERIOD ( 200UL / portTICK_PERIOD_MS )
#define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 200UL )
/* Parameters that are passed into the register check tasks solely for the
purpose of ensuring parameters are passed into tasks correctly. */
#define mainREG_TEST_1_PARAMETER ( ( void * ) 0x12121212UL )
#define mainREG_TEST_2_PARAMETER ( ( void * ) 0x12345678UL )
#define mainREG_TEST_1_PARAMETER ( ( void * ) 0x12121212UL )
#define mainREG_TEST_2_PARAMETER ( ( void * ) 0x12345678UL )
/* The base period used by the timer test tasks. */
#define mainTIMER_TEST_PERIOD ( 50 )
@ -210,6 +210,17 @@ static void prvRegTest2Implementation( void );
*/
static void prvPseudoRandomiser( void *pvParameters );
/*
* Register commands that can be used with FreeRTOS+CLI. The commands are
* defined in CLI-Commands.c and File-Related-CLI-Command.c respectively.
*/
extern void vRegisterSampleCLICommands( void );
/*
* The task that manages the FreeRTOS+CLI input and output.
*/
extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );
/*-----------------------------------------------------------*/
/* The following two variables are used to communicate the status of the
@ -218,9 +229,6 @@ then the register check tasks have not discovered any errors. If a variable
stops incrementing, then an error has been found. */
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
/* String for display in the web server. It is set to an error message if the
check task detects an error. */
const char *pcStatusMessage = "All tasks running without error";
/*-----------------------------------------------------------*/
void main_full( void )
@ -236,7 +244,6 @@ void main_full( void )
vStartGenericQueueTasks( tskIDLE_PRIORITY );
vStartRecursiveMutexTasks();
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
vStartEventGroupTasks();
vStartTaskNotifyTask();
@ -249,6 +256,13 @@ void main_full( void )
/* Create the task that just adds a little random behaviour. */
xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
/* Start the tasks that implements the command console on the UART, as
described above. */
vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );
/* Register the standard CLI commands. */
vRegisterSampleCLICommands();
/* Create the task that performs the 'check' functionality, as described at
the top of this file. */
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
@ -340,11 +354,6 @@ unsigned long ulErrorFound = pdFALSE;
ulErrorFound |= 1UL << 8UL;
}
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )
{
ulErrorFound |= 1UL << 9UL;
}
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound |= 1UL << 10UL;
@ -396,7 +405,6 @@ unsigned long ulErrorFound = pdFALSE;
gone wrong (it might just be that the loop back connector required
by the comtest tasks has not been fitted). */
xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;
pcStatusMessage = "Error found in at least one task.";
}
}
}
@ -441,10 +449,6 @@ volatile uint32_t ulNextRand = ( uint32_t ) &pvParameters, ulValue;
void vFullDemoTickHook( void )
{
/* The full demo includes a software timer demo/test that requires
prodding periodically from the tick interrupt. */
vTimerPeriodicISRTests();
/* Call the periodic queue overwrite from ISR demo. */
vQueueOverwritePeriodicISRDemo();

View file

@ -1,112 +0,0 @@
/*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*******************************************************************************/
/* Copyright (C) 2014 Renesas Electronics Corporation. All rights reserved. */
/*******************************************************************************
* File Name : r_rsk_async.c
* Version : 1.00
* Device(s) : R5F51138AxFP
* Tool-Chain : CCRX
* H/W Platform : RSKRX113
* Description : Functions used to send data via the SCI in asynchronous mode
*******************************************************************************/
/*******************************************************************************
* History : 26.08.2014 Ver. 1.00 First Release
*******************************************************************************/
/*******************************************************************************
System Includes
*******************************************************************************/
/* Following header file provides string type definitions. */
#include <string.h>
/*******************************************************************************
User Includes (Project Level Includes)
*******************************************************************************/
/* Defines port registers */
#include "r_cg_macrodriver.h"
#include "r_cg_sci.h"
#include "r_rsk_async.h"
/*******************************************************************************
User Defines
*******************************************************************************/
/*******************************************************************************
* Global Variables
*******************************************************************************/
/* Declaration of the command string to clear the terminal screen */
static const char cmd_clr_scr[] =
{ 27, 91, 50, 74, 0, 27, 91, 72, 0 };
/*******************************************************************************
* Function Prototypes
*******************************************************************************/
/* text_write function prototype */
static void text_write (const char * const msg_string);
/*******************************************************************************
* Function Name: R_ASYNC_Init
* Description : This function initialises the SCI channel connected to the
* RS232 connector on the RSK. The channel is configured for
* transmission and reception, and instructions are sent to the
* terminal.
* Argument : none
* Return value : none
*******************************************************************************/
void R_ASYNC_Init (void)
{
/* Set up SCI1 receive buffer */
R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);
/* Enable SCI1 operations */
R_SCI1_Start();
/* Clear the text on terminal window */
text_write(cmd_clr_scr);
/* Display splash screen on terminal window */
text_write("Renesas RSKRX113 Async Serial \r\n");
/* Inform user on how to stop transmission */
text_write("Press 'z' to stop and any key to resume\r\n\n");
}
/*******************************************************************************
* End of function R_ASYNC_Init
*******************************************************************************/
/*******************************************************************************
* Function Name : text_write
* Description : Transmits null-terminated string.
* Argument : (char*) msg_string - null terminated string
* Return value : None
*******************************************************************************/
static void text_write (const char * const msg_string)
{
R_SCI1_AsyncTransmit((uint8_t *) msg_string, (uint16_t) strlen(msg_string));
}
/*******************************************************************************
* End of function text_write
*******************************************************************************/

View file

@ -1,50 +0,0 @@
/*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*******************************************************************************/
/* Copyright (C) 2014 Renesas Electronics Corporation. All rights reserved. */
/*******************************************************************************
* File Name : r_rsk_async.h
* Version : 1.00
* Device(s) : R5F51138AxFP
* Tool-Chain : CCRX
* H/W Platform : RSKRX113
* Description : Functions used to send data via the SCI in asynchronous mode
******************************************************************************/
/*******************************************************************************
* History : 26.08.2014 Ver. 1.00 First Release
*******************************************************************************/
/*******************************************************************************
* Macro Definitions
*******************************************************************************/
/* Multiple inclusion prevention macro */
#ifndef R_RSK_ASYNC_H
#define R_RSK_ASYNC_H
/*******************************************************************************
* Global Function Prototypes
*******************************************************************************/
/* initialise asynchronous transmission*/
void R_ASYNC_Init (void);
/* End of multiple inclusion prevention macro */
#endif

View file

@ -285,9 +285,9 @@ void R_SCI1_Start(void);
void R_SCI1_Stop(void);
MD_STATUS R_SCI1_Serial_Send(uint8_t * const tx_buf, uint16_t tx_num);
MD_STATUS R_SCI1_Serial_Receive(uint8_t * const rx_buf, uint16_t rx_num);
static void r_sci1_callback_transmitend(void);
static void r_sci1_callback_receiveend(void);
static void r_sci1_callback_receiveerror(void);
void r_sci1_callback_transmitend(void);
void r_sci1_callback_receiveend(void);
void r_sci1_callback_receiveerror(void);
/* Start user code for function. Do not edit comment generated here */
@ -304,4 +304,4 @@ extern uint8_t g_rx_char;
extern volatile uint8_t g_tx_flag;
/* End user code. Do not edit comment generated here */
#endif
#endif

View file

@ -30,6 +30,16 @@
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/*
* This file originated from an example project for the RSK - it has been
* adapted to allow it to be used in the FreeRTOS demo. Functions required by
* UARTCommandConsole.c have been added.
*/
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
@ -39,7 +49,10 @@ Includes
#include "r_cg_sci.h"
/* Start user code for include. Do not edit comment generated here */
#include "rskrx113def.h"
//_RB_#include "r_cg_cmt.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "serial.h"
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
@ -59,7 +72,21 @@ uint8_t g_rx_char;
/* Flag used to control transmission to PC terminal */
volatile uint8_t g_tx_flag = FALSE;
/* Flag used locally to detect transmission complete */
/* Characters received from the UART are stored in this queue, ready to be
received by the application. ***NOTE*** Using a queue in this way is very
convenient, but also very inefficient. It can be used here because characters
will only arrive slowly. In a higher bandwidth system a circular RAM buffer or
DMA should be used in place of this queue. */
static QueueHandle_t xRxQueue = NULL;
/* When a task calls vSerialPutString() its handle is stored in xSendingTask,
before being placed into the Blocked state (so does not use any CPU time) to
wait for the transmission to end. The task handle is then used from the UART
transmit end interrupt to remove the task from the Blocked state. */
static TaskHandle_t xSendingTask = NULL;
/* Flag used locally to detect transmission complete. This is used by the
auto generated API only. */
static volatile uint8_t sci1_txdone;
/* End user code. Do not edit comment generated here */
@ -154,7 +181,7 @@ static void r_sci1_receiveerror_interrupt(void)
/* Clear overrun, framing and parity error flags */
err_type = SCI1.SSR.BYTE;
SCI1.SSR.BYTE = err_type & 0xC7U;
SCI1.SSR.BYTE = err_type & ( uint8_t ) 0xC7;
}
/***********************************************************************************************************************
* Function Name: r_sci1_callback_transmitend
@ -162,11 +189,23 @@ static void r_sci1_receiveerror_interrupt(void)
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void r_sci1_callback_transmitend(void)
void r_sci1_callback_transmitend(void)
{
/* Start user code. Do not edit comment generated here */
sci1_txdone = TRUE;
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
/* The sci1_txdone flag is used by the auto generated API only. */
sci1_txdone = TRUE;
if( xSendingTask != NULL )
{
/* A task is waiting for the end of the Tx, unblock it now.
http://www.freertos.org/vTaskNotifyGiveFromISR.html */
vTaskNotifyGiveFromISR( xSendingTask, &xHigherPriorityTaskWoken );
xSendingTask = NULL;
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
@ -175,34 +214,33 @@ static void r_sci1_callback_transmitend(void)
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void r_sci1_callback_receiveend(void)
void r_sci1_callback_receiveend(void)
{
/* Start user code. Do not edit comment generated here */
/* Check the contents of g_rx_char */
if ('z' == g_rx_char)
{
/* Stop the timer used to control transmission to PC terminal*/
//_RB_ R_CMT0_Stop();
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
/* Turn off LED0 and turn on LED1 to indicate serial transmission
inactive */
LED0 = LED_OFF;
LED1 = LED_ON;
}
else
{
/* Start the timer used to control transmission to PC terminal*/
//_RB_ R_CMT0_Start();
configASSERT( xRxQueue );
/* Turn on LED0 and turn off LED1 to indicate serial transmission
active */
LED0 = LED_ON;
LED1 = LED_OFF;
}
/* Transmitting generates an interrupt for each character, which consumes
CPU time, and can cause standard demo RTOS tasks that monitor their own
performance to fail asserts - so don't receive new CLI commands if a
transmit is not already in progress. */
if( sci1_txdone == TRUE )
{
/* Characters received from the UART are stored in this queue, ready to be
received by the application. ***NOTE*** Using a queue in this way is very
convenient, but also very inefficient. It can be used here because
characters will only arrive slowly. In a higher bandwidth system a circular
RAM buffer or DMA should be used in place of this queue. */
xQueueSendFromISR( xRxQueue, &g_rx_char, &xHigherPriorityTaskWoken );
}
/* Set up SCI1 receive buffer again */
R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);
/* See http://www.freertos.org/xQueueOverwriteFromISR.html for information
on the semantics of this ISR. */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
@ -211,7 +249,7 @@ static void r_sci1_callback_receiveend(void)
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void r_sci1_callback_receiveerror(void)
void r_sci1_callback_receiveerror(void)
{
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
@ -249,4 +287,89 @@ MD_STATUS R_SCI1_AsyncTransmit (uint8_t * const tx_buf, const uint16_t tx_num)
* End of function R_SCI1_AsyncTransmit
***********************************************************************************************************************/
/* Function required in order to link UARTCommandConsole.c - which is used by
multiple different demo application. */
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
( void ) ulWantedBaud;
( void ) uxQueueLength;
/* Characters received from the UART are stored in this queue, ready to be
received by the application. ***NOTE*** Using a queue in this way is very
convenient, but also very inefficient. It can be used here because
characters will only arrive slowly. In a higher bandwidth system a circular
RAM buffer or DMA should be used in place of this queue. */
xRxQueue = xQueueCreate( uxQueueLength, sizeof( char ) );
configASSERT( xRxQueue );
/* Set up SCI1 receive buffer */
R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);
/* Ensure the interrupt priority is at or below
configMAX_SYSCALL_INTERRUPT_PRIORITY. */
IPR( SCI1, ERI1 ) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
/* Enable SCI1 operations */
R_SCI1_Start();
/* Only one UART is supported, so it doesn't matter what is returned
here. */
return 0;
}
/* Function required in order to link UARTCommandConsole.c - which is used by
multiple different demo application. */
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
{
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 5000 );
/* Only one port is supported. */
( void ) pxPort;
/* Clear the flag before initiating a new transmission */
sci1_txdone = FALSE;
/* Don't send the string unless the previous string has been sent. */
if( xSendingTask == NULL )
{
/* Ensure the calling task's notification state is not already
pending. */
vTaskNotifyClear( NULL );
/* Store the handle of the transmitting task. This is used to unblock
the task when the transmission has completed. */
xSendingTask = xTaskGetCurrentTaskHandle();
/* Send the string using the auto-generated API. */
R_SCI1_Serial_Send( ( uint8_t * ) pcString, usStringLength );
/* Wait in the Blocked state (so not using any CPU time) until the
transmission has completed. */
ulTaskNotifyTake( pdTRUE, xMaxBlockTime );
}
}
/* Function required in order to link UARTCommandConsole.c - which is used by
multiple different demo application. */
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime )
{
/* Only one UART is supported. */
( void ) pxPort;
/* Return a received character, if any are available. Otherwise block to
wait for a character. */
return xQueueReceive( xRxQueue, pcRxedChar, xBlockTime );
}
/* Function required in order to link UARTCommandConsole.c - which is used by
multiple different demo application. */
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime )
{
/* Just mapped to vSerialPutString() so the block time is not used. */
( void ) xBlockTime;
vSerialPutString( pxPort, &cOutChar, sizeof( cOutChar ) );
return pdPASS;
}
/* End user code. Do not edit comment generated here */

View file

@ -76,8 +76,7 @@
* implemented and described in main_full.c.
*
* This file implements the code that is not demo specific, including the
* hardware setup, standard FreeRTOS hook functions, and the ISR hander called
* by the RTOS after interrupt entry (including nesting) has been taken care of.
* hardware setup and standard FreeRTOS hook functions.
*
* ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON
* THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO
@ -90,16 +89,14 @@
#include "task.h"
#include "semphr.h"
/* Renesas includes. */
/* Renesas includes. */
#include <rskrx113def.h>
#include "r_cg_macrodriver.h"
#include "r_cg_sci.h"
#include "r_rsk_async.h"
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
or 0 to run the more comprehensive test and demo application. */
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
/*-----------------------------------------------------------*/
@ -144,18 +141,15 @@ int main( void )
}
#endif
/* Should never get reached. */
return 0;
}
/*-----------------------------------------------------------*/
static void prvSetupHardware( void )
{
/* Set up SCI1 receive buffer */
R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);
/* Enable SCI1 operations */
R_SCI1_Start();
/* Some hardware setup is performed before main() is called. This routine
just ensures the LEDs start off. */
LED0 = LED_OFF;
LED1 = LED_OFF;
LED2 = LED_OFF;
@ -210,6 +204,7 @@ volatile size_t xFreeHeapSpace;
void vApplicationTickHook( void )
{
/* The tick hook is not used by the blinky demo, but is by the full demo. */
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0
{
extern void vFullDemoTickHook( void );
@ -221,7 +216,9 @@ void vApplicationTickHook( void )
/*-----------------------------------------------------------*/
/* The RX port uses this callback function to configure its tick interrupt.
This allows the application to choose the tick interrupt source. */
This allows the application to choose the tick interrupt source.
***NOTE***: configTICK_VECTOR must be set in FreeRTOSConfig.h to be correct for
whichever vector is used. */
void vApplicationSetupTimerInterrupt( void )
{
const uint32_t ulEnableRegisterWrite = 0xA50BUL, ulDisableRegisterWrite = 0xA500UL;