Starting point for an IAR RX62N project - not yet a working project.

pull/4/head
Richard Barry 15 years ago
parent 9af437a3a9
commit 7768a4e02c

@ -0,0 +1,144 @@
/*
FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
***************************************************************************
* *
* If you are: *
* *
* + New to FreeRTOS, *
* + Wanting to learn FreeRTOS or multitasking in general quickly *
* + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity *
* *
* then take a look at the FreeRTOS eBook *
* *
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation *
* *
* A pdf reference manual is also available. Both are usually delivered *
* to your inbox within 20 minutes to two hours when purchased between 8am *
* and 8pm GMT (although please allow up to 24 hours in case of *
* exceptional circumstances). Thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
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
/* Board specifics. */
#include "rskrx62ndef.h"
/*-----------------------------------------------------------
* 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.
*
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ICLK_FREQUENCY ) /* Set in rskrx62ndef.h. */
#define configPERIPHERAL_CLOCK_HZ ( PCLK_FREQUENCY ) /* Set in rskrx62ndef.h. */
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 140 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 45 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1
#define configGENERATE_RUN_TIME_STATS 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* The interrupt priority used by the kernel itself for the tick interrupt and
the pended interrupt. This would normally be the lowest priority. */
#define configKERNEL_INTERRUPT_PRIORITY 1
/* The maximum interrupt priority from which FreeRTOS API calls can be made.
Interrupts that use a priority above this will not be effected by anything the
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. */
#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
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState 1
/*-----------------------------------------------------------
* Ethernet configuration.
*-----------------------------------------------------------*/
/* MAC address configuration. */
#define configMAC_ADDR0 0x00
#define configMAC_ADDR1 0x12
#define configMAC_ADDR2 0x13
#define configMAC_ADDR3 0x10
#define configMAC_ADDR4 0x15
#define configMAC_ADDR5 0x11
/* IP address configuration. */
#define configIP_ADDR0 192
#define configIP_ADDR1 168
#define configIP_ADDR2 0
#define configIP_ADDR3 201
/* Netmask configuration. */
#define configNET_MASK0 255
#define configNET_MASK1 255
#define configNET_MASK2 255
#define configNET_MASK3 0
#endif /* FREERTOS_CONFIG_H */

@ -0,0 +1,162 @@
/*
FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
***************************************************************************
* *
* If you are: *
* *
* + New to FreeRTOS, *
* + Wanting to learn FreeRTOS or multitasking in general quickly *
* + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity *
* *
* then take a look at the FreeRTOS eBook *
* *
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation *
* *
* A pdf reference manual is also available. Both are usually delivered *
* to your inbox within 20 minutes to two hours when purchased between 8am *
* and 8pm GMT (although please allow up to 24 hours in case of *
* exceptional circumstances). Thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
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.
*/
/*
* High frequency timer test as described in main.c.
*/
/* Scheduler includes. */
#include "FreeRTOS.h"
/* Hardware specifics. */
#include <iorx62n.h>
/* The set frequency of the interrupt. Deviations from this are measured as
the jitter. */
#define timerINTERRUPT_FREQUENCY ( 20000UL )
/* The expected time between each of the timer interrupts - if the jitter was
zero. */
#define timerEXPECTED_DIFFERENCE_VALUE ( ( unsigned short ) ( ( configPERIPHERAL_CLOCK_HZ / 8UL ) / timerINTERRUPT_FREQUENCY ) )
/* The highest available interrupt priority. */
#define timerHIGHEST_PRIORITY ( 15 )
/* Misc defines. */
#define timerTIMER_3_COUNT_VALUE ( *( ( unsigned short * ) 0x8801a ) ) /*( CMT3.CMCNT )*/
/*-----------------------------------------------------------*/
/* Interrupt handler in which the jitter is measured. */
__interrupt void vTimer2IntHandler( void );
/* Stores the value of the maximum recorded jitter between interrupts. */
volatile unsigned short usMaxJitter = 0;
/*-----------------------------------------------------------*/
void vSetupHighFrequencyTimer( void )
{
/* Timer CMT2 is used to generate the interrupts, and CMT3 is used
to measure the jitter. */
/* Enable compare match timer 2 and 3. */
MSTP( CMT2 ) = 0;
MSTP( CMT3 ) = 0;
/* Interrupt on compare match. */
CMT2.CMCR.BIT.CMIE = 1;
/* Set the compare match value. */
CMT2.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / timerINTERRUPT_FREQUENCY ) -1 ) / 8 );
/* Divide the PCLK by 8. */
CMT2.CMCR.BIT.CKS = 0;
CMT3.CMCR.BIT.CKS = 0;
/* Enable the interrupt... */
_IEN( _CMT2_CMI2 ) = 1;
/* ...and set its priority to the maximum possible, this is above the priority
set by configMAX_SYSCALL_INTERRUPT_PRIORITY so will nest. */
_IPR( _CMT2_CMI2 ) = timerHIGHEST_PRIORITY;
/* Start the timers. */
CMT.CMSTR1.BIT.STR2 = 1;
CMT.CMSTR1.BIT.STR3 = 1;
}
/*-----------------------------------------------------------*/
#pragma vector = VECT_CMT2_CMI2
__interrupt void vTimer2IntHandler( void )
{
volatile unsigned short usCurrentCount;
static unsigned short usMaxCount = 0;
static unsigned long ulErrorCount = 0UL;
/* We use the timer 1 counter value to measure the clock cycles between
the timer 0 interrupts. First stop the clock. */
CMT.CMSTR1.BIT.STR3 = 0;
portNOP();
portNOP();
usCurrentCount = timerTIMER_3_COUNT_VALUE;
/* Is this the largest count we have measured yet? */
if( usCurrentCount > usMaxCount )
{
if( usCurrentCount > timerEXPECTED_DIFFERENCE_VALUE )
{
usMaxJitter = usCurrentCount - timerEXPECTED_DIFFERENCE_VALUE;
}
else
{
/* This should not happen! */
ulErrorCount++;
}
usMaxCount = usCurrentCount;
}
/* Clear the timer. */
timerTIMER_3_COUNT_VALUE = 0;
/* Then start the clock again. */
CMT.CMSTR1.BIT.STR3 = 1;
}

@ -0,0 +1,147 @@
/*
FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
***************************************************************************
* *
* If you are: *
* *
* + New to FreeRTOS, *
* + Wanting to learn FreeRTOS or multitasking in general quickly *
* + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity *
* *
* then take a look at the FreeRTOS eBook *
* *
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation *
* *
* A pdf reference manual is also available. Both are usually delivered *
* to your inbox within 20 minutes to two hours when purchased between 8am *
* and 8pm GMT (although please allow up to 24 hours in case of *
* exceptional circumstances). Thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
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.
*/
/*
* This file contains the non-portable and therefore RX62N specific parts of
* the IntQueue standard demo task - namely the configuration of the timers
* that generate the interrupts and the interrupt entry points.
*/
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Demo includes. */
#include "IntQueueTimer.h"
#include "IntQueue.h"
/* Hardware specifics. */
#include <iorx62n.h>
#define tmrTIMER_0_1_FREQUENCY ( 2000UL )
#define tmrTIMER_2_3_FREQUENCY ( 2001UL )
/* Handlers for the two timers used. */
__interrupt void vT0_1InterruptHandler( void );
__interrupt void vT2_3InterruptHandler( void );
void vInitialiseTimerForIntQueueTest( void )
{
/* Ensure interrupts do not start until full configuration is complete. */
portENTER_CRITICAL();
{
/* Cascade two 8bit timer channels to generate the interrupts.
8bit timer unit 1 (TMR0 and TMR1) and 8bit timer unit 2 (TMR2 and TMR3 are
utilised for this test. */
/* Enable the timers. */
SYSTEM.MSTPCRA.BIT.MSTPA5 = 0;
SYSTEM.MSTPCRA.BIT.MSTPA4 = 0;
/* Enable compare match A interrupt request. */
TMR0.TCR.BIT.CMIEA = 1;
TMR2.TCR.BIT.CMIEA = 1;
/* Clear the timer on compare match A. */
TMR0.TCR.BIT.CCLR = 1;
TMR2.TCR.BIT.CCLR = 1;
/* Set the compare match value. */
TMR01.TCORA = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / tmrTIMER_0_1_FREQUENCY ) -1 ) / 8 );
TMR23.TCORA = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / tmrTIMER_0_1_FREQUENCY ) -1 ) / 8 );
/* 16 bit operation ( count from timer 1,2 ). */
TMR0.TCCR.BIT.CSS = 3;
TMR2.TCCR.BIT.CSS = 3;
/* Use PCLK as the input. */
TMR1.TCCR.BIT.CSS = 1;
TMR3.TCCR.BIT.CSS = 1;
/* Divide PCLK by 8. */
TMR1.TCCR.BIT.CKS = 2;
TMR3.TCCR.BIT.CKS = 2;
/* Enable TMR 0, 2 interrupts. */
IEN( TMR0, CMIA0 ) = 1;
IEN( TMR2, CMIA2 ) = 1;
/* Set the timer interrupts to be above the kernel. The interrupts are
assigned different priorities so they nest with each other. */
IPR( TMR0, CMIA0 ) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
IPR( TMR2, CMIA2 ) = ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 2 );
}
portEXIT_CRITICAL();
/* Ensure the interrupts are clear as they are edge detected. */
IR( TMR0, CMIA0 ) = 0;
IR( TMR2, CMIA2 ) = 0;
}
/*-----------------------------------------------------------*/
#pragma vector = VECT_TMR0_CMIA0
__interrupt void vT0_1InterruptHandler( void )
{
portYIELD_FROM_ISR( xFirstTimerHandler() );
}
/*-----------------------------------------------------------*/
#pragma vector = VECT_TMR2_CMIA2
__interrupt void vT2_3InterruptHandler( void )
{
portYIELD_FROM_ISR( xSecondTimerHandler() );
}

@ -0,0 +1,209 @@
/*
FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
***************************************************************************
* *
* If you are: *
* *
* + New to FreeRTOS, *
* + Wanting to learn FreeRTOS or multitasking in general quickly *
* + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity *
* *
* then take a look at the FreeRTOS eBook *
* *
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation *
* *
* A pdf reference manual is also available. Both are usually delivered *
* to your inbox within 20 minutes to two hours when purchased between 8am *
* and 8pm GMT (although please allow up to 24 hours in case of *
* exceptional circumstances). Thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
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 IO routines to control the LEDs.
*-----------------------------------------------------------*/
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Demo includes. */
#include "partest.h"
/* Hardware specifics. */
#include <iorx62n.h>
#define partestNUM_LEDS ( 6 )
long lParTestGetLEDState( unsigned long ulLED );
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
/* Port pin configuration is done by the low level set up prior to this
function being called. */
/* Start with all LEDs off. */
LED0 = LED_OFF;
LED0 = LED_OFF;
LED0 = LED_OFF;
LED0 = LED_OFF;
LED0 = LED_OFF;
LED0 = LED_OFF;
}
/*-----------------------------------------------------------*/
void vParTestSetLED( unsigned long ulLED, signed long xValue )
{
if( ulLED < partestNUM_LEDS )
{
if( xValue != 0 )
{
/* Turn the LED on. */
taskENTER_CRITICAL();
{
switch( ulLED )
{
case 0: LED0 = LED_ON;
break;
case 1: LED1 = LED_ON;
break;
case 2: LED2 = LED_ON;
break;
case 3: LED3 = LED_ON;
break;
case 4: LED4 = LED_ON;
break;
case 5: LED5 = LED_ON;
break;
}
}
taskEXIT_CRITICAL();
}
else
{
/* Turn the LED off. */
taskENTER_CRITICAL();
{
switch( ulLED )
{
case 0: LED0 = LED_OFF;
break;
case 1: LED1 = LED_OFF;
break;
case 2: LED2 = LED_OFF;
break;
case 3: LED3 = LED_OFF;
break;
case 4: LED4 = LED_OFF;
break;
case 5: LED5 = LED_OFF;
break;
}
}
taskEXIT_CRITICAL();
}
}
}
/*-----------------------------------------------------------*/
void vParTestToggleLED( unsigned long ulLED )
{
if( ulLED < partestNUM_LEDS )
{
taskENTER_CRITICAL();
{
if( lParTestGetLEDState( ulLED ) != 0x00 )
{
vParTestSetLED( ulLED, 1 );
}
else
{
vParTestSetLED( ulLED, 0 );
}
}
taskEXIT_CRITICAL();
}
}
/*-----------------------------------------------------------*/
long lParTestGetLEDState( unsigned long ulLED )
{
long lReturn = pdFALSE;
if( ulLED < partestNUM_LEDS )
{
switch( ulLED )
{
case 0 : if( LED0 != 0 )
{
lReturn = pdTRUE;
}
break;
case 1 : if( LED1 != 0 )
{
lReturn = pdTRUE;
}
break;
case 2 : if( LED2 != 0 )
{
lReturn = pdTRUE;
}
break;
case 3 : if( LED3 != 0 )
{
lReturn = pdTRUE;
}
break;
case 4 : if( LED4 != 0 )
{
lReturn = pdTRUE;
}
break;
case 5 : if( LED5 != 0 )
{
lReturn = pdTRUE;
}
break;
}
}
return lReturn;
}
/*-----------------------------------------------------------*/

@ -0,0 +1,260 @@
/*
* Copyright (c) 20010 IAR Systems AB.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* IAR Embedded Workbench tutorial
*
* Test Program for the RSKRX62N Board.
* LED's perform different display according to
* which switch is pressed.
* Used to check that all the LED's, switches,
* clock function and AD trigger are working fine.
*
* $Revision: 1556 $
*/
#include "iorx62n.h"
#include "intrinsics.h"
void ScrollLedsLowHigh(void);
void ScrollLedsHighLow(void);
unsigned long pause;
unsigned long off_set;
#define ON 0
#define OFF 1
#define LED0 PORT0.DR.BIT.B2 // P02 LED0
#define LED1 PORT0.DR.BIT.B3 // P03 LED1
#define LED2 PORT0.DR.BIT.B5 // P05 LED2
#define LED3 PORT3.DR.BIT.B4 // P34 LED3
#define LED4 PORT6.DR.BIT.B0 // P50 LED4
#define LED5 PORT7.DR.BIT.B3 // P73 LED5
/* defined words used in this program */
enum {
SW1,
SW2,
SW3,
NONE
}GetKey;
/* SW1 ISR */
#pragma vector = 72
__interrupt void isr_sw1(void)
{
GetKey=SW1;
CMT.CMSTR0.BIT.STR0 = 0; // stop timer
ICU.IR[72].BIT.IR = 0; // clear interrupt request flag
}
/* SW2 ISR */
#pragma vector = 73
__interrupt void isr_sw2(void)
{
GetKey=SW2;
CMT.CMSTR0.BIT.STR0 = 0; // stop timer
ICU.IR[73].BIT.IR = 0; // clear interrupt request flag
}
/* SW3 ISR */
#pragma vector = 79
__interrupt void isr_sw3(void)
{
GetKey=SW3;
CMT.CMSTR0.BIT.STR0 = 1; // start timer
ICU.IR[79].BIT.IR = 0; // clear interrupt request flag
}
/* Timer ISR */
#pragma vector = 0x1c
__interrupt void isr_cmt0(void)
{
// Toggle LED's
LED0 = ~LED0;
LED1 = ~LED1;
LED2 = ~LED2;
LED3 = ~LED3;
LED4 = ~LED4;
LED5 = ~LED5;
ICU.IR[70].BIT.IR = 0; // clear interrupt request flag
}
/* Main program. */
void main (void)
{
// enable modules
SYSTEM.MSTPCRA.BIT.MSTPA23 = 0; // A/D Converter (Unit 0) Module
// Set up RV1 (potentiometer)
AD0.ADCR.BIT.MODE = 2; // Continuous scan mode
AD0.ADCSR.BIT.CH = 0; // only AD0
AD0.ADCSR.BIT.ADST = 1; // Start A/D
// Set up SW1, SW2, SW3
PORT0.DDR.BIT.B0 = 0; // SW1 input on P00
PORT0.DDR.BIT.B1 = 0; // SW2 input on P01
PORT0.DDR.BIT.B7 = 0; // SW3 input on P07
PORT0.ICR.BIT.B0 = 1; // Enable input buffer
PORT0.ICR.BIT.B1 = 1; // Enable input buffer
PORT0.ICR.BIT.B7 = 1; // Enable input buffer
// IRQ8-A used for SW1
IOPORT.PF8IRQ.BIT.ITS8 = 0; // P00 is designated as the IRQ8-A input pin.
IEN(ICU,IRQ8) = 1;
IPR(ICU,IRQ8) = 3;
// IRQ9-A used for SW2
IOPORT.PF8IRQ.BIT.ITS9 = 0; // P01 is designated as IRQ9-A input pin.
IEN(ICU,IRQ9) = 1;
IPR(ICU,IRQ9) = 3;
// IRQ15-A used for SW3
IOPORT.PF8IRQ.BIT.ITS15 = 0; // P07 is designated as the IRQ15-A input pin.
IEN(ICU,IRQ15) = 1;
IPR(ICU,IRQ15) = 3;
// Set up LED's
PORT0.DDR.BIT.B2 = 1; // P02 LED0
PORT0.DDR.BIT.B3 = 1; // P03 LED1
PORT0.DDR.BIT.B5 = 1; // P05 LED2
PORT3.DDR.BIT.B4 = 1; // P34 LED3
PORT6.DDR.BIT.B0 = 1; // P50 LED4
PORT7.DDR.BIT.B3 = 1; // P73 LED5
// Turn al LED's off
LED0 = LED1 = LED2 = LED3 = LED4 = LED5 = OFF;
// Set up Timer
SYSTEM.MSTPCRA.BIT.MSTPA15 = 0; // CMT timers 0,
CMT0.CMCR.BIT.CKS = 3; // 25MHz/512 = 48.8kHz
CMT0.CMCR.BIT.CMIE = 1; // enable peripheral interrupt source
CMT0.CMCOR = 12212; // 4 Hz operation
ICU.IER[3].BIT.IEN4 = 1; // enable timer 0 interrupt
IPR(CMT0,CMI0) = 1; // LED level 1
__enable_interrupt();
GetKey=SW1;
for (;;)
{
switch (GetKey)
{
case SW1:
ScrollLedsLowHigh();
break;
case SW2:
ScrollLedsHighLow();
break;
case SW3:
GetKey=NONE;
break;
}
}
}
/* scrolls the LED's from low to high */
void ScrollLedsLowHigh()
{
char led_number = 0;
while (GetKey == SW1)
{
if (led_number > 5)
led_number = 0;
switch(led_number)
{
case 0:
LED0=ON;
LED1=LED2=LED3=LED4=LED5=OFF;
break;
case 1:
LED1=ON;
LED0=LED2=LED3=LED4=LED5=OFF;
break;
case 2:
LED2=ON;
LED0=LED1=LED3=LED4=LED5=OFF;
break;
case 3:
LED3=ON;
LED0=LED1=LED2=LED4=LED5=OFF;
break;
case 4:
LED4=ON;
LED0=LED1=LED2=LED3=LED5=OFF;
break;
case 5:
LED5=ON;
LED0=LED1=LED2=LED3=LED4=OFF;
break;
}
led_number++;
off_set = AD0.ADDRA*1000;
for (pause = off_set; pause != 0; pause --);
}
}
/* scrolls the LED's from high to low */
void ScrollLedsHighLow()
{
signed char led_number = 3;
while (GetKey == SW2)
{
if (led_number < 0)
led_number = 5;
switch(led_number)
{
case 0:
LED0=ON;
LED1=LED2=LED3=LED4=LED5=OFF;
break;
case 1:
LED1=ON;
LED0=LED2=LED3=LED4=LED5=OFF;
break;
case 2:
LED2=ON;
LED0=LED1=LED3=LED4=LED5=OFF;
break;
case 3:
LED3=ON;
LED0=LED1=LED2=LED4=LED5=OFF;
break;
case 4:
LED4=ON;
LED0=LED1=LED2=LED3=LED5=OFF;
break;
case 5:
LED5=ON;
LED0=LED1=LED2=LED3=LED4=OFF;
break;
}
led_number--;
off_set = AD0.ADDRA*1000;
for (pause = off_set; pause != 0; pause --);
}
}

@ -0,0 +1,465 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project>
<fileVersion>2</fileVersion>
<configuration>
<name>Debug</name>
<toolchain>
<name>RX</name>
</toolchain>
<debug>1</debug>
<settings>
<name>C-SPY</name>
<archiveVersion>2</archiveVersion>
<data>
<version>4</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>ODebuggerCore</name>
<state>0</state>
</option>
<option>
<name>CMandatory</name>
<state>1</state>
</option>
<option>
<name>CInput</name>
<state>1</state>
</option>
<option>
<name>DebuggerProcessorVariant</name>
<state>0</state>
</option>
<option>
<name>CRunToEnable</name>
<state>1</state>
</option>
<option>
<name>CRunToName</name>
<state>main</state>
</option>
<option>
<name>CMacOverride</name>
<state>0</state>
</option>
<option>
<name>CMacFile</name>
<state></state>
</option>
<option>
<name>DynDriver</name>
<state>RXEMUE20</state>
</option>
<option>
<name>DDFOverride</name>
<state>0</state>
</option>
<option>
<name>DDFFile</name>
<state>$TOOLKIT_DIR$\config\debugger\ior5f562n8.ddf</state>
</option>
<option>
<name>DebuggerUseExtraOptions</name>
<state>0</state>
</option>
<option>
<name>DebuggerExtraOptions</name>
<state></state>
</option>
<option>
<name>ODebuggerDoubleSize</name>
<state>1</state>
</option>
<option>
<name>OCImagesSuppressCheck1</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath1</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck2</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath2</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck3</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath3</name>
<state></state>
</option>
<option>
<name>ODebuggerByteOrder</name>
<state>0</state>
</option>
<option>
<name>ODebuggerIntSize</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>RXEMUE20</name>
<archiveVersion>1</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>EmuMandatory</name>
<state>1</state>
</option>
<option>
<name>OCEmuUseUSBSerialNo</name>
<state>0</state>
</option>
<option>
<name>OCEmuUSBSerialNo</name>
<state></state>
</option>
<option>
<name>OCDownloadSuppressDownload</name>
<state>0</state>
</option>
<option>
<name>OCDownloadVerifyAll</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>RXJLINK</name>
<archiveVersion>1</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>JlinkMandatory</name>
<state>1</state>
</option>
<option>
<name>OCJlinkUseUSBSerialNo</name>
<state>0</state>
</option>
<option>
<name>OCJlinkUSBSerialNo</name>
<state></state>
</option>
<option>
<name>OCJlinkDownloadSuppressDownload</name>
<state>0</state>
</option>
<option>
<name>OCJlinkDownloadVerifyAll</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>SIMRX</name>
<archiveVersion>1</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>SimMandatory</name>
<state>1</state>
</option>
<option>
<name>SimEnablePSP</name>
<state>0</state>
</option>
<option>
<name>SimPspOverrideConfig</name>
<state>0</state>
</option>
<option>
<name>SimPspConfigFile</name>
<state>$TOOLKIT_DIR$\CONFIG\iocf.psp.config</state>
</option>
</data>
</settings>
<debuggerPlugins>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\FreeRTOS\FreeRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
</debuggerPlugins>
</configuration>
<configuration>
<name>Blinky</name>
<toolchain>
<name>RX</name>
</toolchain>
<debug>1</debug>
<settings>
<name>C-SPY</name>
<archiveVersion>2</archiveVersion>
<data>
<version>4</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>ODebuggerCore</name>
<state>0</state>
</option>
<option>
<name>CMandatory</name>
<state>1</state>
</option>
<option>
<name>CInput</name>
<state>1</state>
</option>
<option>
<name>DebuggerProcessorVariant</name>
<state>0</state>
</option>
<option>
<name>CRunToEnable</name>
<state>0</state>
</option>
<option>
<name>CRunToName</name>
<state>main</state>
</option>
<option>
<name>CMacOverride</name>
<state>0</state>
</option>
<option>
<name>CMacFile</name>
<state></state>
</option>
<option>
<name>DynDriver</name>
<state>RXEMUE20</state>
</option>
<option>
<name>DDFOverride</name>
<state>0</state>
</option>
<option>
<name>DDFFile</name>
<state>$TOOLKIT_DIR$\config\debugger\ior5f562n8.ddf</state>
</option>
<option>
<name>DebuggerUseExtraOptions</name>
<state>0</state>
</option>
<option>
<name>DebuggerExtraOptions</name>
<state></state>
</option>
<option>
<name>ODebuggerDoubleSize</name>
<state>1</state>
</option>
<option>
<name>OCImagesSuppressCheck1</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath1</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck2</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath2</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck3</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath3</name>
<state></state>
</option>
<option>
<name>ODebuggerByteOrder</name>
<state>0</state>
</option>
<option>
<name>ODebuggerIntSize</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>RXEMUE20</name>
<archiveVersion>1</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>EmuMandatory</name>
<state>1</state>
</option>
<option>
<name>OCEmuUseUSBSerialNo</name>
<state>0</state>
</option>
<option>
<name>OCEmuUSBSerialNo</name>
<state></state>
</option>
<option>
<name>OCDownloadSuppressDownload</name>
<state>0</state>
</option>
<option>
<name>OCDownloadVerifyAll</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>RXJLINK</name>
<archiveVersion>1</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>JlinkMandatory</name>
<state>1</state>
</option>
<option>
<name>OCJlinkUseUSBSerialNo</name>
<state>0</state>
</option>
<option>
<name>OCJlinkUSBSerialNo</name>
<state></state>
</option>
<option>
<name>OCJlinkDownloadSuppressDownload</name>
<state>0</state>
</option>
<option>
<name>OCJlinkDownloadVerifyAll</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>SIMRX</name>
<archiveVersion>1</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>SimMandatory</name>
<state>1</state>
</option>
<option>
<name>SimEnablePSP</name>
<state>0</state>
</option>
<option>
<name>SimPspOverrideConfig</name>
<state>0</state>
</option>
<option>
<name>SimPspConfigFile</name>
<state>$TOOLKIT_DIR$\CONFIG\iocf.psp.config</state>
</option>
</data>
</settings>
<debuggerPlugins>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\FreeRTOS\FreeRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
</debuggerPlugins>
</configuration>
</project>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\RTOSDemo.ewp</path>
</project>
<batchBuild/>
</workspace>

@ -0,0 +1,225 @@
/*
FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
***************************************************************************
* *
* If you are: *
* *
* + New to FreeRTOS, *
* + Wanting to learn FreeRTOS or multitasking in general quickly *
* + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity *
* *
* then take a look at the FreeRTOS eBook *
* *
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation *
* *
* A pdf reference manual is also available. Both are usually delivered *
* to your inbox within 20 minutes to two hours when purchased between 8am *
* and 8pm GMT (although please allow up to 24 hours in case of *
* exceptional circumstances). Thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
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.
*/
PUBLIC _prvRegTest1Implementation
PUBLIC _prvRegTest2Implementation
EXTERN _ulRegTest1CycleCount
EXTERN _ulRegTest2CycleCount
RSEG CODE:CODE(4)
/* This function is explained in the comments at the top of main.c. */
_prvRegTest1Implementation:
/* Put a known value in each register. */
MOV #1, R1
MOV #2, R2
MOV #3, R3
MOV #4, R4
MOV #5, R5
MOV #6, R6
MOV #7, R7
MOV #8, R8
MOV #9, R9
MOV #10, R10
MOV #11, R11
MOV #12, R12
MOV #13, R13
MOV #14, R14
MOV #15, R15
/* Loop, checking each itteration that each register still contains the
expected value. */
TestLoop1:
/* Push the registers that are going to get clobbered. */
PUSHM R14-R15
/* Increment the loop counter to show this task is still getting CPU time. */
MOV #_ulRegTest1CycleCount, R14
MOV [ R14 ], R15
ADD #1, R15
MOV R15, [ R14 ]
/* Yield to extend the text coverage. Set the bit in the ITU SWINTR register. */
MOV #1, R14
MOV #0872E0H, R15
MOV.B R14, [R15]
NOP
NOP
/* Restore the clobbered registers. */
POPM R14-R15
/* Now compare each register to ensure it still contains the value that was
set before this loop was entered. */
CMP #1, R1
BNE RegTest1Error
CMP #2, R2
BNE RegTest1Error
CMP #3, R3
BNE RegTest1Error
CMP #4, R4
BNE RegTest1Error
CMP #5, R5
BNE RegTest1Error
CMP #6, R6
BNE RegTest1Error
CMP #7, R7
BNE RegTest1Error
CMP #8, R8
BNE RegTest1Error
CMP #9, R9
BNE RegTest1Error
CMP #10, R10
BNE RegTest1Error
CMP #11, R11
BNE RegTest1Error
CMP #12, R12
BNE RegTest1Error
CMP #13, R13
BNE RegTest1Error
CMP #14, R14
BNE RegTest1Error
CMP #15, R15
BNE RegTest1Error
/* All comparisons passed, start a new itteratio of this loop. */
BRA TestLoop1
RegTest1Error:
/* A compare failed, just loop here so the loop counter stops incrementing
- causing the check task to indicate the error. */
BRA RegTest1Error
/*-----------------------------------------------------------*/
/* This function is explained in the comments at the top of main.c. */
_prvRegTest2Implementation:
/* Put a known value in each register. */
MOV #10H, R1
MOV #20H, R2
MOV #30H, R3
MOV #40H, R4
MOV #50H, R5
MOV #60H, R6
MOV #70H, R7
MOV #80H, R8
MOV #90H, R9
MOV #100H, R10
MOV #110H, R11
MOV #120H, R12
MOV #130H, R13
MOV #140H, R14
MOV #150H, R15
/* Loop, checking each itteration that each register still contains the
expected value. */
TestLoop2:
/* Push the registers that are going to get clobbered. */
PUSHM R14-R15
/* Increment the loop counter to show this task is still getting CPU time. */
MOV #_ulRegTest2CycleCount, R14
MOV [ R14 ], R15
ADD #1, R15
MOV R15, [ R14 ]
/* Restore the clobbered registers. */
POPM R14-R15
/* Now compare each register to ensure it still contains the value that was
set before this loop was entered. */
CMP #10H, R1
BNE RegTest2Error
CMP #20H, R2
BNE RegTest2Error
CMP #30H, R3
BNE RegTest2Error
CMP #40H, R4
BNE RegTest2Error
CMP #50H, R5
BNE RegTest2Error
CMP #60H, R6
BNE RegTest2Error
CMP #70H, R7
BNE RegTest2Error
CMP #80H, R8
BNE RegTest2Error
CMP #90H, R9
BNE RegTest2Error
CMP #100H, R10
BNE RegTest2Error
CMP #110H, R11
BNE RegTest2Error
CMP #120H, R12
BNE RegTest2Error
CMP #130H, R13
BNE RegTest2Error
CMP #140H, R14
BNE RegTest2Error
CMP #150H, R15
BNE RegTest2Error
/* All comparisons passed, start a new itteratio of this loop. */
BRA TestLoop2
RegTest2Error:
/* A compare failed, just loop here so the loop counter stops incrementing
- causing the check task to indicate the error. */
BRA RegTest2Error
END

@ -0,0 +1,115 @@
/******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Technology Corp. and is only
* intended for use with Renesas products. No other uses are authorized.
* This software is owned by Renesas Technology Corp. 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
* TECHNOLOGY CORP. NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
* FOR ANY REASON RELATED TO THE 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) 2008. Renesas Technology Corp., All Rights Reserved.
*******************************************************************************
* File Name : hwsetup.c
* Version : 1.00
* Description : Power up hardware initializations
******************************************************************************
* History : DD.MM.YYYY Version Description
* : 15.02.2010 1.00 First Release
******************************************************************************/
/******************************************************************************
Includes <System Includes> , "Project Includes"
******************************************************************************/
#include "iodefine.h"
#include "rskrx62ndef.h"
// #include "lcd.h" Uncomment this if an LCD is present.
/******************************************************************************
Typedef definitions
******************************************************************************/
/******************************************************************************
Macro definitions
******************************************************************************/
/******************************************************************************
Imported global variables and functions (from other files)
******************************************************************************/
/******************************************************************************
Exported global variables and functions (to be accessed by other files)
******************************************************************************/
/******************************************************************************
Private global variables and functions
******************************************************************************/
/******************************************************************************
* Function Name: HardwareSetup
* Description : This function does initial setting for CPG port pins used in
* : the Demo including the MII pins of the Ethernet PHY connection.
* Arguments : none
* Return Value : none
******************************************************************************/
void HardwareSetup(void)
{
unsigned long sckcr = 0;
/* Configure system clocks based on header */
sckcr += (ICLK_MUL==8) ? (0ul << 24) : (ICLK_MUL==4) ? (1ul << 24) : (ICLK_MUL==2) ? (2ul << 24) : (3ul << 24);
sckcr += (BCLK_MUL==8) ? (0ul << 16) : (BCLK_MUL==4) ? (1ul << 16) : (BCLK_MUL==2) ? (2ul << 16) : (3ul << 16);
sckcr += (PCLK_MUL==8) ? (0ul << 8) : (PCLK_MUL==4) ? (1ul << 8) : (PCLK_MUL==2) ? (2ul << 8) : (3ul << 8);
SYSTEM.SCKCR.LONG = sckcr;
/* Configure LED 0-5 pins as outputs */
LED0 = LED_OFF;
LED1 = LED_OFF;
LED2 = LED_OFF;
LED3 = LED_OFF;
LED4 = LED_OFF;
LED5 = LED_OFF;
LED0_DDR = 1;
LED1_DDR = 1;
LED2_DDR = 1;
LED3_DDR = 1;
LED4_DDR = 1;
LED5_DDR = 1;
/* Configure SW 1-3 pins as inputs */
SW1_DDR = 0;
SW2_DDR = 0;
SW3_DDR = 0;
SW1_ICR = 1;
SW2_ICR = 1;
SW3_ICR = 1;
/* Configure LCD pins as outputs - uncomment this if an LCD is present.
LCD_RS_DDR = 1;
LCD_EN_DDR = 1;
LCD_DATA_DDR = 0xF0; */
/* Initialize display - uncomment this if an LCD is present.
InitialiseDisplay(); */
}

@ -0,0 +1,62 @@
/*
FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
***************************************************************************
* *
* If you are: *
* *
* + New to FreeRTOS, *
* + Wanting to learn FreeRTOS or multitasking in general quickly *
* + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity *
* *
* then take a look at the FreeRTOS eBook *
* *
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation *
* *
* A pdf reference manual is also available. Both are usually delivered *
* to your inbox within 20 minutes to two hours when purchased between 8am *
* and 8pm GMT (although please allow up to 24 hours in case of *
* exceptional circumstances). Thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
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 INT_QUEUE_TIMER_H
#define INT_QUEUE_TIMER_H
void vInitialiseTimerForIntQueueTest( void );
portBASE_TYPE xTimer0Handler( void );
portBASE_TYPE xTimer1Handler( void );
#endif

@ -0,0 +1,714 @@
/***********************************************************************/
/* */
/* FILE :inthandler.h */
/* DATE :Wed, Aug 25, 2010 */
/* DESCRIPTION :Interrupt Handler Declarations */
/* CPU TYPE :Other */
/* */
/* This file is generated by KPIT GNU Project Generator. */
/* */
/***********************************************************************/
#ifndef INTHANDLER_H
#define INTHANDLER_H
// Exception(Supervisor Instruction)
void INT_Excep_SuperVisorInst(void) __attribute__ ((interrupt));
// Exception(Undefined Instruction)
void INT_Excep_UndefinedInst(void) __attribute__ ((interrupt));
// Exception(Floating Point)
void INT_Excep_FloatingPoint(void) __attribute__ ((interrupt));
// NMI
void INT_NonMaskableInterrupt(void) __attribute__ ((interrupt));
// Dummy
void Dummy (void) __attribute__ ((interrupt));
// BRK
void INT_Excep_BRK(void) __attribute__ ((interrupt));
// vector 1 reserved
// vector 2 reserved
// vector 3 reserved
// vector 4 reserved
// vector 5 reserved
// vector 6 reserved
// vector 7 reserved
// vector 8 reserved
// vector 9 reserved
// vector 10 reserved
// vector 11 reserved
// vector 12 reserved
// vector 13 reserved
// vector 14 reserved
// vector 15 reserved
// BUSERR
void INT_Excep_BUSERR(void) __attribute__ ((interrupt));
// vector 17 reserved
// vector 18 reserved
// vector 19 reserved
// vector 20 reserved
// FCU_FCUERR
void INT_Excep_FCU_FCUERR(void) __attribute__ ((interrupt));
// vector 22 reserved
// FCU_FRDYI
void INT_Excep_FCU_FRDYI(void) __attribute__ ((interrupt));
// vector 24 reserved
// vector 25 reserved
// vector 26 reserved
// vector 27 reserved
// CMTU0_CMT0
void INT_Excep_CMTU0_CMT0(void) __attribute__ ((interrupt));
// CMTU0_CMT1
void INT_Excep_CMTU0_CMT1(void) __attribute__ ((interrupt));
// CMTU1_CMT2
void INT_Excep_CMTU1_CMT2(void) __attribute__ ((interrupt));
// CMTU1_CMT3
void INT_Excep_CMTU1_CMT3(void) __attribute__ ((interrupt));
// vector 32 reserved
// vector 33 reserved
// vector 34 reserved
// vector 35 reserved
// vector 36 reserved
// vector 37 reserved
// vector 38 reserved
// vector 39 reserved
// vector 40 reserved
// vector 41 reserved
// vector 42 reserved
// vector 43 reserved
// vector 44 reserved
// vector 45 reserved
// vector 46 reserved
// vector 47 reserved
// vector 48 reserved
// vector 49 reserved
// vector 50 reserved
// vector 51 reserved
// vector 52 reserved
// vector 53 reserved
// vector 54 reserved
// vector 55 reserved
// vector 56 reserved
// vector 57 reserved
// vector 58 reserved
// vector 59 reserved
// vector 60 reserved
// vector 61 reserved
// vector 62 reserved
// vector 63 reserved
// IRQ0
void INT_Excep_IRQ0(void) __attribute__ ((interrupt));
// IRQ1
void INT_Excep_IRQ1(void) __attribute__ ((interrupt));
// IRQ2
void INT_Excep_IRQ2(void) __attribute__ ((interrupt));
// IRQ3
void INT_Excep_IRQ3(void) __attribute__ ((interrupt));
// IRQ4
void INT_Excep_IRQ4(void) __attribute__ ((interrupt));
// IRQ5
void INT_Excep_IRQ5(void) __attribute__ ((interrupt));
// IRQ6
void INT_Excep_IRQ6(void) __attribute__ ((interrupt));
// IRQ7
void INT_Excep_IRQ7(void) __attribute__ ((interrupt));
// IRQ8
void INT_Excep_IRQ8(void) __attribute__ ((interrupt));
// IRQ9
void INT_Excep_IRQ9(void) __attribute__ ((interrupt));
// IRQ10
void INT_Excep_IRQ10(void) __attribute__ ((interrupt));
// IRQ11
void INT_Excep_IRQ11(void) __attribute__ ((interrupt));
// IRQ12
void INT_Excep_IRQ12(void) __attribute__ ((interrupt));
// IRQ13
void INT_Excep_IRQ13(void) __attribute__ ((interrupt));
// IRQ14
void INT_Excep_IRQ14(void) __attribute__ ((interrupt));
// IRQ15
void INT_Excep_IRQ15(void) __attribute__ ((interrupt));
// vector 80 reserved
// vector 81 reserved
// vector 82 reserved
// vector 83 reserved
// vector 84 reserved
// vector 85 reserved
// vector 86 reserved
// vector 87 reserved
// vector 88 reserved
// vector 89 reserved
// vector 90 reserved
// vector 91 reserved
// vector 92 reserved
// vector 93 reserved
// vector 94 reserved
// vector 95 reserved
// WDT_WOVI
void INT_Excep_WDT_WOVI(void) __attribute__ ((interrupt));
// vector 97 reserved
// AD0_ADI0
void INT_Excep_AD0_ADI0(void) __attribute__ ((interrupt));
// AD1_ADI1
void INT_Excep_AD1_ADI1(void) __attribute__ ((interrupt));
// AD2_ADI2
void INT_Excep_AD2_ADI2(void) __attribute__ ((interrupt));
// AD3_ADI3
void INT_Excep_AD3_ADI3(void) __attribute__ ((interrupt));
// vector 102 reserved
// vector 103 reserved
// TPU0_TGI0A
void INT_Excep_TPU0_TGI0A(void) __attribute__ ((interrupt));
// TPU0_TGI0B
void INT_Excep_TPU0_TGI0B(void) __attribute__ ((interrupt));
// TPU0_TGI0C
void INT_Excep_TPU0_TGI0C(void) __attribute__ ((interrupt));
// TPU0_TGI0D
void INT_Excep_TPU0_TGI0D(void) __attribute__ ((interrupt));
// TPU0_TCI0V
void INT_Excep_TPU0_TCI0V(void) __attribute__ ((interrupt));
// vector 109 reserved
// vector 110 reserved
// TPU1_TGI1A
void INT_Excep_TPU1_TGI1A(void) __attribute__ ((interrupt));
// TPU1_TGI1B
void INT_Excep_TPU1_TGI1B(void) __attribute__ ((interrupt));
// vector 113 reserved
// vector 114 reserved
// TPU1_TCI1V
void INT_Excep_TPU1_TCI1V(void) __attribute__ ((interrupt));
// TPU1_TCI1U
void INT_Excep_TPU1_TCI1U(void) __attribute__ ((interrupt));
// TPU2_TGI2A
void INT_Excep_TPU2_TGI2A(void) __attribute__ ((interrupt));
// TPU2_TGI2B
void INT_Excep_TPU2_TGI2B(void) __attribute__ ((interrupt));
// vector 119 reserved
// TPU2_TCI2V
void INT_Excep_TPU2_TCI2V(void) __attribute__ ((interrupt));
// TPU2_TCI2U
void INT_Excep_TPU2_TCI2U(void) __attribute__ ((interrupt));
// TPU3_TGI3A
void INT_Excep_TPU3_TGI3A(void) __attribute__ ((interrupt));
// TPU3_TGI3B
void INT_Excep_TPU3_TGI3B(void) __attribute__ ((interrupt));
// TPU3_TGI3C
void INT_Excep_TPU3_TGI3C(void) __attribute__ ((interrupt));
// TPU3_TGI3D
void INT_Excep_TPU3_TGI3D(void) __attribute__ ((interrupt));
// TPU3_TCI3V
void INT_Excep_TPU3_TCI3V(void) __attribute__ ((interrupt));
// TPU4_TGI4A
void INT_Excep_TPU4_TGI4A(void) __attribute__ ((interrupt));
// TPU4_TGI4B
void INT_Excep_TPU4_TGI4B(void) __attribute__ ((interrupt));
// vector 129 reserved
// vector 130 reserved
// TPU4_TCI4V
void INT_Excep_TPU4_TCI4V(void) __attribute__ ((interrupt));
// TPU4_TCI4U
void INT_Excep_TPU4_TCI4U(void) __attribute__ ((interrupt));
// TPU5_TGI5A
void INT_Excep_TPU5_TGI5A(void) __attribute__ ((interrupt));
// TPU5_TGI5B
void INT_Excep_TPU5_TGI5B(void) __attribute__ ((interrupt));
// vector 135 reserved
// TPU5_TCI5V
void INT_Excep_TPU5_TCI5V(void) __attribute__ ((interrupt));
// TPU5_TCI5U
void INT_Excep_TPU5_TCI5U(void) __attribute__ ((interrupt));
// TPU6_TGI6A
void INT_Excep_TPU6_TGI6A(void) __attribute__ ((interrupt));
// TPU6_TGI6B
void INT_Excep_TPU6_TGI6B(void) __attribute__ ((interrupt));
// TPU6_TGI6C
void INT_Excep_TPU6_TGI6C(void) __attribute__ ((interrupt));
// TPU6_TGI6D
void INT_Excep_TPU6_TGI6D(void) __attribute__ ((interrupt));
// TPU6_TCI6V
void INT_Excep_TPU6_TCI6V(void) __attribute__ ((interrupt));
// vector 143 reserved
// vector 144 reserved
// TPU7_TGI7A
void INT_Excep_TPU7_TGI7A(void) __attribute__ ((interrupt));
// TPU7_TGI7B
void INT_Excep_TPU7_TGI7B(void) __attribute__ ((interrupt));
// vector 147 reserved
// vector 148 reserved
// TPU7_TCI7V
void INT_Excep_TPU7_TCI7V(void) __attribute__ ((interrupt));
// TPU7_TCI7U
void INT_Excep_TPU7_TCI7U(void) __attribute__ ((interrupt));
// TPU8_TGI8A
void INT_Excep_TPU8_TGI8A(void) __attribute__ ((interrupt));
// TPU8_TGI8B
void INT_Excep_TPU8_TGI8B(void) __attribute__ ((interrupt));
// vector 153 reserved
// TPU8_TCI8V
void INT_Excep_TPU8_TCI8V(void) __attribute__ ((interrupt));
// TPU8_TCI8U
void INT_Excep_TPU8_TCI8U(void) __attribute__ ((interrupt));
// TPU9_TGI9A
void INT_Excep_TPU9_TGI9A(void) __attribute__ ((interrupt));
// TPU9_TGI9B
void INT_Excep_TPU9_TGI9B(void) __attribute__ ((interrupt));
// TPU9_TGI9C
void INT_Excep_TPU9_TGI9C(void) __attribute__ ((interrupt));
// TPU9_TGI9D
void INT_Excep_TPU9_TGI9D(void) __attribute__ ((interrupt));
// TPU9_TCI9V
void INT_Excep_TPU9_TCI9V(void) __attribute__ ((interrupt));
// TPU10_TGI10A
void INT_Excep_TPU10_TGI10A(void) __attribute__ ((interrupt));
// TPU10_TGI10B
void INT_Excep_TPU10_TGI10B(void) __attribute__ ((interrupt));
// vector 163 reserved
// vector 164 reserved
// TPU10_TCI10V
void INT_Excep_TPU10_TCI10V(void) __attribute__ ((interrupt));
// TPU10_TCI10U
void INT_Excep_TPU10_TCI10U(void) __attribute__ ((interrupt));
// TPU11_TGI11A
void INT_Excep_TPU11_TGI11A(void) __attribute__ ((interrupt));
// TPU11_TGI11B
void INT_Excep_TPU11_TGI11B(void) __attribute__ ((interrupt));
// vector 169 reserved
// TPU11_TCI11V
void INT_Excep_TPU11_TCI11V(void) __attribute__ ((interrupt));
// TPU11_TCI11U
void INT_Excep_TPU11_TCI11U(void) __attribute__ ((interrupt));
// vector 172 reserved
// vector 173 reserved
// TMR0_CMI0A
void INT_Excep_TMR0_CMI0A(void) __attribute__ ((interrupt));
// TMR0_CMI0B
void INT_Excep_TMR0_CMI0B(void) __attribute__ ((interrupt));
// TMR0_OV0I
void INT_Excep_TMR0_OV0I(void) __attribute__ ((interrupt));
// TMR1_CMI1A
void INT_Excep_TMR1_CMI1A(void) __attribute__ ((interrupt));
// TMR1_CMI1B
void INT_Excep_TMR1_CMI1B(void) __attribute__ ((interrupt));
// TMR1_OV1I
void INT_Excep_TMR1_OV1I(void) __attribute__ ((interrupt));
// TMR2_CMI2A
void INT_Excep_TMR2_CMI2A(void) __attribute__ ((interrupt));
// TMR2_CMI2B
void INT_Excep_TMR2_CMI2B(void) __attribute__ ((interrupt));
// TMR2_OV2I
void INT_Excep_TMR2_OV2I(void) __attribute__ ((interrupt));
// TMR3_CMI3A
void INT_Excep_TMR3_CMI3A(void) __attribute__ ((interrupt));
// TMR3_CMI3B
void INT_Excep_TMR3_CMI3B(void) __attribute__ ((interrupt));
// TMR3_OV3I
void INT_Excep_TMR3_OV3I(void) __attribute__ ((interrupt));
// vector 186 reserved
// vector 187 reserved
// vector 188 reserved
// vector 189 reserved
// vector 190 reserved
// vector 191 reserved
// vector 192 reserved
// vector 193 reserved
// vector 194 reserved
// vector 195 reserved
// vector 196 reserved
// vector 197 reserved
// DMAC_DMTEND0
void INT_Excep_DMAC_DMTEND0(void);
// DMAC_DMTEND1
void INT_Excep_DMAC_DMTEND1(void) __attribute__ ((interrupt));
// DMAC_DMTEND2
void INT_Excep_DMAC_DMTEND2(void) __attribute__ ((interrupt));
// DMAC_DMTEND3
void INT_Excep_DMAC_DMTEND3(void) __attribute__ ((interrupt));
// vector 202 reserved
// vector 203 reserved
// vector 204 reserved
// vector 205 reserved
// vector 206 reserved
// vector 207 reserved
// vector 208 reserved
// vector 209 reserved
// vector 210 reserved
// vector 211 reserved
// vector 212 reserved
// vector 213 reserved
// SCI0_ERI0
void INT_Excep_SCI0_ERI0(void) __attribute__ ((interrupt));
// SCI0_RXI0
void INT_Excep_SCI0_RXI0(void) __attribute__ ((interrupt));
// SCI0_TXI0
void INT_Excep_SCI0_TXI0(void) __attribute__ ((interrupt));
// SCI0_TEI0
void INT_Excep_SCI0_TEI0(void) __attribute__ ((interrupt));
// SCI1_ERI1
void INT_Excep_SCI1_ERI1(void) __attribute__ ((interrupt));
// SCI1_RXI1
void INT_Excep_SCI1_RXI1(void) __attribute__ ((interrupt));
// SCI1_TXI1
void INT_Excep_SCI1_TXI1(void) __attribute__ ((interrupt));
// SCI1_TEI1
void INT_Excep_SCI1_TEI1(void) __attribute__ ((interrupt));
// SCI2_ERI2
void INT_Excep_SCI2_ERI2(void) __attribute__ ((interrupt));
// SCI2_RXI2
void INT_Excep_SCI2_RXI2(void) __attribute__ ((interrupt));
// SCI2_TXI2
void INT_Excep_SCI2_TXI2(void) __attribute__ ((interrupt));
// SCI2_TEI2
void INT_Excep_SCI2_TEI2(void) __attribute__ ((interrupt));
// SCI3_ERI3
void INT_Excep_SCI3_ERI3(void) __attribute__ ((interrupt));
// SCI3_RXI3
void INT_Excep_SCI3_RXI3(void) __attribute__ ((interrupt));
// SCI3_TXI3
void INT_Excep_SCI3_TXI3(void) __attribute__ ((interrupt));
// SCI3_TEI3
void INT_Excep_SCI3_TEI3(void) __attribute__ ((interrupt));
// SCI4_ERI4
void INT_Excep_SCI4_ERI4(void) __attribute__ ((interrupt));
// SCI4_RXI4
void INT_Excep_SCI4_RXI4(void) __attribute__ ((interrupt));
// SCI4_TXI4
void INT_Excep_SCI4_TXI4(void) __attribute__ ((interrupt));
// SCI4_TEI4
void INT_Excep_SCI4_TEI4(void) __attribute__ ((interrupt));
// SCI5_ERI5
void INT_Excep_SCI5_ERI5(void) __attribute__ ((interrupt));
// SCI5_RXI5
void INT_Excep_SCI5_RXI5(void) __attribute__ ((interrupt));
// SCI5_TXI5
void INT_Excep_SCI5_TXI5(void) __attribute__ ((interrupt));
// SCI5_TEI5
void INT_Excep_SCI5_TEI5(void) __attribute__ ((interrupt));
// SCI6_ERI6
void INT_Excep_SCI6_ERI6(void) __attribute__ ((interrupt));
// SCI6_RXI6
void INT_Excep_SCI6_RXI6(void) __attribute__ ((interrupt));
// SCI6_TXI6
void INT_Excep_SCI6_TXI6(void) __attribute__ ((interrupt));
// SCI6_TEI6
void INT_Excep_SCI6_TEI6(void) __attribute__ ((interrupt));
// vector 242 reserved
// vector 243 reserved
// vector 244 reserved
// vector 245 reserved
// RIIC0_EEI0
void INT_Excep_RIIC0_EEI0(void) __attribute__ ((interrupt));
// RIIC0_RXI0
void INT_Excep_RIIC0_RXI0(void) __attribute__ ((interrupt));
// RIIC0_TXI0
void INT_Excep_RIIC0_TXI0(void) __attribute__ ((interrupt));
// RIIC0_TEI0
void INT_Excep_RIIC0_TEI0(void) __attribute__ ((interrupt));
// RIIC1_EEI1
void INT_Excep_RIIC1_EEI1(void) __attribute__ ((interrupt));
// RIIC1_RXI1
void INT_Excep_RIIC1_RXI1(void) __attribute__ ((interrupt));
// RIIC1_TXI1
void INT_Excep_RIIC1_TXI1(void) __attribute__ ((interrupt));
// RIIC1_TEI1
void INT_Excep_RIIC1_TEI1(void) __attribute__ ((interrupt));
// vector 254 reserved
// vector 255 reserved
//;<<VECTOR DATA START (POWER ON RESET)>>
//;Power On Reset PC
extern void PowerON_Reset_PC(void) __attribute__ ((interrupt));
//;<<VECTOR DATA END (POWER ON RESET)>>
#endif

@ -0,0 +1,98 @@
/******************************************************************************
* DISCLAIMER
* Please refer to http://www.renesas.com/disclaimer
******************************************************************************
Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved.
*******************************************************************************
* File Name : rsksh7216.h
* Version : 1.00
* Description : RSK 7216 board specific settings
******************************************************************************
* History : DD.MM.YYYY Version Description
* : 06.10.2009 1.00 First Release
******************************************************************************/
#ifndef RSKRX62N_H
#define RSKRX62N_H
/******************************************************************************
Includes <System Includes> , "Project Includes"
******************************************************************************/
/******************************************************************************
Typedef definitions
******************************************************************************/
/******************************************************************************
Macro definitions
******************************************************************************/
/* System Clock Settings */
#define XTAL_FREQUENCY (12000000L)
#define ICLK_MUL (8)
#define PCLK_MUL (4)
#define BCLK_MUL (4)
#define ICLK_FREQUENCY (XTAL_FREQUENCY * ICLK_MUL)
#define PCLK_FREQUENCY (XTAL_FREQUENCY * PCLK_MUL)
#define BCLK_FREQUENCY (XTAL_FREQUENCY * BCLK_MUL)
#define CMT0_CLK_SELECT (512)
/* General Values */
#define LED_ON (0)
#define LED_OFF (1)
#define SET_BIT_HIGH (1)
#define SET_BIT_LOW (0)
#define SET_BYTE_HIGH (0xFF)
#define SET_BYTE_LOW (0x00)
/* Define switches to be polled if not available as interrupts */
#define SW_ACTIVE FALSE
#define SW1 PORT0.DR.BIT.B0
#define SW2 PORT0.DR.BIT.B1
#define SW3 PORT0.DR.BIT.B7
#define SW1_DDR PORT0.DDR.BIT.B0
#define SW2_DDR PORT0.DDR.BIT.B1
#define SW3_DDR PORT0.DDR.BIT.B7
#define SW1_ICR PORT0.ICR.BIT.B0
#define SW2_ICR PORT0.ICR.BIT.B1
#define SW3_ICR PORT0.ICR.BIT.B7
/* LEDs */
#define LED0 PORT0.DR.BIT.B2
#define LED1 PORT0.DR.BIT.B3
#define LED2 PORT0.DR.BIT.B5
#define LED3 PORT3.DR.BIT.B4
#define LED4 PORT6.DR.BIT.B0
#define LED5 PORT7.DR.BIT.B3
#define LED0_DDR PORT0.DDR.BIT.B2
#define LED1_DDR PORT0.DDR.BIT.B3
#define LED2_DDR PORT0.DDR.BIT.B5
#define LED3_DDR PORT3.DDR.BIT.B4
#define LED4_DDR PORT6.DDR.BIT.B0
#define LED5_DDR PORT7.DDR.BIT.B3
/* 2x8 segment LCD */
#define LCD_RS PORT8.DR.BIT.B4
#define LCD_EN PORT8.DR.BIT.B5
#define LCD_DATA PORT9.DR.BYTE
#define LCD_RS_DDR PORT8.DDR.BIT.B4
#define LCD_EN_DDR PORT8.DDR.BIT.B5
#define LCD_DATA_DDR PORT9.DDR.BYTE
/******************************************************************************
Variable Externs
******************************************************************************/
/******************************************************************************
Functions Prototypes
******************************************************************************/
/* RSKRX62N_H */
#endif

@ -0,0 +1,23 @@
/***********************************************************************/
/* */
/* FILE :typedefine.h */
/* DATE :Wed, Aug 25, 2010 */
/* DESCRIPTION :Aliases of Integer Type */
/* CPU TYPE :Other */
/* */
/* This file is generated by KPIT GNU Project Generator. */
/* */
/***********************************************************************/
typedef signed char _SBYTE;
typedef unsigned char _UBYTE;
typedef signed short _SWORD;
typedef unsigned short _UWORD;
typedef signed int _SINT;
typedef unsigned int _UINT;
typedef signed long _SDWORD;
typedef unsigned long _UDWORD;
typedef signed long long _SQWORD;
typedef unsigned long long _UQWORD;

@ -0,0 +1,227 @@
/*
FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
***************************************************************************
* *
* If you are: *
* *
* + New to FreeRTOS, *
* + Wanting to learn FreeRTOS or multitasking in general quickly *
* + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity *
* *
* then take a look at the FreeRTOS eBook *
* *
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation *
* *
* A pdf reference manual is also available. Both are usually delivered *
* to your inbox within 20 minutes to two hours when purchased between 8am *
* and 8pm GMT (although please allow up to 24 hours in case of *
* exceptional circumstances). Thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
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.
*/
/*
* This is a very simple demo that creates two tasks and one queue. One task
* (the queue receive task) blocks on the queue to wait for data to arrive,
* toggling an LED each time '100' is received. The other task (the queue send
* task) repeatedly blocks for a fixed period before sending '100' to the queue
* (causing the first task to toggle the LED).
*
* For a much more complete and complex example select either the Debug or
* Debug_with_optimisation build configurations within the HEW IDE.
*/
/* Hardware specific includes. */
#include <iorx62n.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
/* Demo includes. */
#include "partest.h"
/* Priorities at which the tasks are created. */
#define configQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define configQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* The rate at which data is sent to the queue, specified in milliseconds. */
#define mainQUEUE_SEND_FREQUENCY_MS ( 500 / portTICK_RATE_MS )
/* The number of items the queue can hold. This is 1 as the receive task
will remove items as they are added so the send task should always find the
queue empty. */
#define mainQUEUE_LENGTH ( 1 )
/*
* The tasks as defined at the top of this file.
*/
static void prvQueueReceiveTask( void *pvParameters );
static void prvQueueSendTask( void *pvParameters );
/* The queue used by both tasks. */
static xQueueHandle xQueue = NULL;
/*-----------------------------------------------------------*/
void main(void)
{
extern void HardwareSetup( void );
/* Renesas provided CPU configuration routine. The clocks are configured in
here. */
// HardwareSetup();
/* Turn all LEDs off. */
vParTestInitialise();
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
if( xQueue != NULL )
{
/* Start the two tasks as described at the top of this file. */
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, configQUEUE_RECEIVE_TASK_PRIORITY, NULL );
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, configQUEUE_SEND_TASK_PRIORITY, NULL );
/* Start the tasks running. */
vTaskStartScheduler();
}
/* If all is well we will never reach here as the scheduler will now be
running. If we do reach here then it is likely that there was insufficient
heap available for the idle task to be created. */
for( ;; );
}
/*-----------------------------------------------------------*/
static void prvQueueSendTask( void *pvParameters )
{
portTickType xNextWakeTime;
const unsigned long ulValueToSend = 100UL;
/* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount();
for( ;; )
{
/* Place this task in the blocked state until it is time to run again.
The block state is specified in ticks, the constant used converts ticks
to ms. */
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
/* Send to the queue - causing the queue receive task to flash its LED. 0
is used so the send does not block - it shouldn't need to as the queue
should always be empty here. */
xQueueSend( xQueue, &ulValueToSend, 0 );
}
}
/*-----------------------------------------------------------*/
static void prvQueueReceiveTask( void *pvParameters )
{
unsigned long ulReceivedValue;
for( ;; )
{
/* Wait until something arives in the queue - this will block
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
FreeRTOSConfig.h. */
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
/* To get here something must have arrived, but is it the expected
value? If it is, toggle the LED. */
if( ulReceivedValue == 100UL )
{
vParTestToggleLED( 0 );
}
}
}
/*-----------------------------------------------------------*/
void vApplicationSetupTimerInterrupt( void )
{
/* Enable compare match timer 0. */
MSTP( CMT0 ) = 0;
/* Interrupt on compare match. */
CMT0.CMCR.BIT.CMIE = 1;
/* Set the compare match value. */
CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );
/* Divide the PCLK by 8. */
CMT0.CMCR.BIT.CKS = 0;
/* Enable the interrupt... */
_IEN( _CMT0_CMI0 ) = 1;
/* ...and set its priority to the application defined kernel priority. */
_IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;
/* Start the timer. */
CMT.CMSTR0.BIT.STR0 = 1;
}
/*-----------------------------------------------------------*/
/* This function is explained by the comments above its prototype at the top
of this file. */
void vApplicationMallocFailedHook( void )
{
for( ;; );
}
/*-----------------------------------------------------------*/
/* This function is explained by the comments above its prototype at the top
of this file. */
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
{
for( ;; );
}
/*-----------------------------------------------------------*/
/* This function is explained by the comments above its prototype at the top
of this file. */
void vApplicationIdleHook( void )
{
}
/*-----------------------------------------------------------*/
/* The following two functions are here just to allow all three build
configurations to use the same vector table. They are not used in this
demo, but linker errors will result if they are not defined. They can
be ignored. */
void vT0_1InterruptHandler( void ) {}
void vT2_3InterruptHandler( void ) {}

@ -0,0 +1,490 @@
/*
FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
***************************************************************************
* *
* If you are: *
* *
* + New to FreeRTOS, *
* + Wanting to learn FreeRTOS or multitasking in general quickly *
* + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity *
* *
* then take a look at the FreeRTOS eBook *
* *
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation *
* *
* A pdf reference manual is also available. Both are usually delivered *
* to your inbox within 20 minutes to two hours when purchased between 8am *
* and 8pm GMT (although please allow up to 24 hours in case of *
* exceptional circumstances). Thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
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.
*/
/*
* This project includes a lot of tasks and tests and is therefore complex.
* If you would prefer a much simpler project to get started with then select
* the 'Blinky' build configuration within the HEW IDE.
*
* Creates all the demo application tasks, 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. The tasks defined in flop.c are included in the
* set of standard demo tasks to ensure the floating point unit gets some
* exercise.
*
* In addition to the standard demo tasks, the following tasks and tests are
* defined and/or created within this file:
*
* "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 check variable is incremented on each iteration of the
* test loop. A register containing an unexpected value is indicative of an
* error in the context switching mechanism and will result in a branch to a
* null loop - which in turn will prevent the check variable from incrementing
* any further and allow the check task (described below) to determine that an
* error has occurred. The nature of the reg test tasks necessitates that they
* are written in assembly code.
*
* "Check" task - This only executes every five 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. While no errors have been
* discovered the check task will toggle LED 5 every 5 seconds - the toggle
* rate increasing to 200ms being a visual indication that at least one task has
* reported unexpected behaviour.
*
* "High frequency timer test" - A high frequency periodic interrupt is
* generated using a timer - the interrupt is assigned a priority above
* configMAX_SYSCALL_INTERRUPT_PRIORITY so should not be effected by anything
* the kernel is doing. The interrupt service routine measures the number of
* counts a separate timer performs between each interrupt to determine the
* jitter in the interrupt timing.
*
* *NOTE 1* If LED5 is toggling every 5 seconds then all the demo application
* tasks are executing as expected and no errors have been reported in any
* tasks. The toggle rate increasing to 200ms indicates that at least one task
* has reported unexpected behaviour.
*
* *NOTE 2* vApplicationSetupTimerInterrupt() is called by the kernel to let
* the application set up a timer to generate the tick interrupt. In this
* example a compare match timer is used for this purpose.
*
* *NOTE 3* The CPU must be in Supervisor mode when the scheduler is started.
* The PowerON_Reset_PC() supplied in resetprg.c with this demo has
* Change_PSW_PM_to_UserMode() commented out to ensure this is the case.
*
* *NOTE 4* The IntQueue common demo tasks test interrupt nesting and make use
* of all the 8bit timers (as two cascaded 16bit units).
*/
/* Standard includes. */
#include "string.h"
/* Hardware specific includes. */
#include <iorx62n.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Standard demo includes. */
#include "partest.h"
#include "flash.h"
#include "IntQueue.h"
#include "BlockQ.h"
#include "death.h"
#include "integer.h"
#include "blocktim.h"
#include "semtest.h"
#include "PollQ.h"
#include "GenQTest.h"
#include "QPeek.h"
#include "recmutex.h"
#include "flop.h"
/* Values that are passed into the reg test tasks using the task parameter. The
tasks check that the values are passed in correctly. */
#define mainREG_TEST_1_PARAMETER ( 0x12121212UL )
#define mainREG_TEST_2_PARAMETER ( 0x12345678UL )
/* Priorities at which the tasks are created. */
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
/* The LED toggled by the check task. */
#define mainCHECK_LED ( 5 )
/* The rate at which mainCHECK_LED will toggle when all the tasks are running
without error. Controlled by the check task as described at the top of this
file. */
#define mainNO_ERROR_CYCLE_TIME ( 5000 / portTICK_RATE_MS )
/* The rate at which mainCHECK_LED will toggle when an error has been reported
by at least one task. Controlled by the check task as described at the top of
this file. */
#define mainERROR_CYCLE_TIME ( 200 / portTICK_RATE_MS )
/* The period of the peripheral clock in nano seconds. This is used to calculate
the jitter time in nano seconds as part of the high frequency timer test. The
clock driving the timer is divided by 8. */
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( ( double ) configPERIPHERAL_CLOCK_HZ ) / 8.0 ) * 1000000000.0 ) )
/*
* vApplicationMallocFailedHook() will only be called if
* configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
* function that will execute if a call to pvPortMalloc() fails.
* pvPortMalloc() is called internally by the kernel whenever a task, queue or
* semaphore is created. It is also called by various parts of the demo
* application.
*/
void vApplicationMallocFailedHook( void );
/*
* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set to 1
* in FreeRTOSConfig.h. It is a hook function that is called on each iteration
* of the idle task. It is essential that code added to this hook function
* never attempts to block in any way (for example, call xQueueReceive() with
* a block time specified). If the application makes use of the vTaskDelete()
* API function (as this demo application does) then it is also important that
* vApplicationIdleHook() is permitted to return to its calling function because
* it is the responsibility of the idle task to clean up memory allocated by the
* kernel to any task that has since been deleted.
*/
void vApplicationIdleHook( void );
/*
* vApplicationStackOverflowHook() will only be called if
* configCHECK_FOR_STACK_OVERFLOW is set to a non-zero value. The handle and
* name of the offending task should be passed in the function parameters, but
* it is possible that the stack overflow will have corrupted these - in which
* case pxCurrentTCB can be inspected to find the same information.
*/
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );
/*
* The reg test tasks as described at the top of this file.
*/
static void prvRegTest1Task( void *pvParameters );
static void prvRegTest2Task( void *pvParameters );
/*
* The actual implementation of the reg test functionality, which, because of
* the direct register access, have to be in assembly.
*/
extern void prvRegTest1Implementation( void );
extern void prvRegTest2Implementation( void );
/*
* The check task as described at the top of this file.
*/
static void prvCheckTask( void *pvParameters );
/* Variables that are incremented on each iteration of the reg test tasks -
provided the tasks have not reported any errors. The check task inspects these
variables to ensure they are still incrementing as expected. If a variable
stops incrementing then it is likely that its associate task has stalled. */
unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;
/*-----------------------------------------------------------*/
void main(void)
{
extern void HardwareSetup( void );
/* Renesas provided CPU configuration routine. The clocks are configured in
here. */
//_RB_reSetup();
/* Turn all LEDs off. */
vParTestInitialise();
/* Start the reg test tasks which test the context switching mechanism. */
xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );
/* Start the check task as described at the top of this file. */
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE * 3, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* Create the standard demo tasks. */
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
vStartQueuePeekTasks();
vStartRecursiveMutexTasks();
vStartInterruptQueueTasks();
vStartMathTasks( mainFLOP_TASK_PRIORITY );
/* 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 tasks running. */
vTaskStartScheduler();
/* If all is well we will never reach here as the scheduler will now be
running. If we do reach here then it is likely that there was insufficient
heap available for the idle task to be created. */
for( ;; );
}
/*-----------------------------------------------------------*/
static void prvCheckTask( void *pvParameters )
{
static volatile unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL;
portTickType xNextWakeTime, xCycleFrequency = mainNO_ERROR_CYCLE_TIME;
extern void vSetupHighFrequencyTimer( void );
extern volatile unsigned short usMaxJitter;
//volatile unsigned long ulActualJitter = 0;
//static char cErrorText[ 100 ];
/* If this is being executed then the kernel has been started. Start the high
frequency timer test as described at the top of this file. This is only
included in the optimised build configuration - otherwise it takes up too much
CPU time. */
#ifdef INCLUDE_HIGH_FREQUENCY_TIMER_TEST
vSetupHighFrequencyTimer();
#endif
/* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount();
for( ;; )
{
/* Place this task in the blocked state until it is time to run again. */
vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );
/* Check the standard demo tasks are running without error. */
if( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
/* Increase the rate at which this task cycles, which will increase the
rate at which mainCHECK_LED flashes to give visual feedback that an error
has occurred. */
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: GenQueue" );
}
else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: QueuePeek" );
}
else if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: BlockQueue" );
}
else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: BlockTime" );
}
else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: SemTest" );
}
else if( xArePollingQueuesStillRunning() != pdTRUE )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: PollQueue" );
}
else if( xIsCreateTaskStillRunning() != pdTRUE )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: Death" );
}
else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: IntMath" );
}
else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: RecMutex" );
}
else if( xAreIntQueueTasksStillRunning() != pdPASS )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: IntQueue" );
}
else if( xAreMathsTaskStillRunning() != pdPASS )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: Flop" );
}
/* Check the reg test tasks are still cycling. They will stop incrementing
their loop counters if they encounter an error. */
if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: RegTest1" );
}
if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )
{
xCycleFrequency = mainERROR_CYCLE_TIME;
// strcpy( cErrorText, "Error: RegTest2" );
}
ulLastRegTest1CycleCount = ulRegTest1CycleCount;
ulLastRegTest2CycleCount = ulRegTest2CycleCount;
/* Toggle the check LED to give an indication of the system status. If
the LED toggles every 5 seconds then everything is ok. A faster toggle
indicates an error. */
vParTestToggleLED( mainCHECK_LED );
/* Calculate the maximum jitter experienced by the high frequency timer
test and print it out. It is ok to use printf without worrying about
mutual exclusion as it is not used anywhere else in this demo. */
//sprintf( cTempBuf, "%s [%fns]\n", "Max Jitter = ", ( ( float ) usMaxJitter ) * mainNS_PER_CLOCK );
//ulActualJitter = ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK;
if( xCycleFrequency == mainERROR_CYCLE_TIME )
{
/* Just for break point. */
portNOP();
}
}
}
/*-----------------------------------------------------------*/
/* The RX port uses this callback function to configure its tick interrupt.
This allows the application to choose the tick interrupt source. */
void vApplicationSetupTimerInterrupt( void )
{
/* Enable compare match timer 0. */
MSTP( CMT0 ) = 0;
/* Interrupt on compare match. */
CMT0.CMCR.BIT.CMIE = 1;
/* Set the compare match value. */
CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );
/* Divide the PCLK by 8. */
CMT0.CMCR.BIT.CKS = 0;
/* Enable the interrupt... */
_IEN( _CMT0_CMI0 ) = 1;
/* ...and set its priority to the application defined kernel priority. */
_IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;
/* Start the timer. */
CMT.CMSTR0.BIT.STR0 = 1;
}
/*-----------------------------------------------------------*/
/* This function is explained by the comments above its prototype at the top
of this file. */
void vApplicationMallocFailedHook( void )
{
for( ;; );
}
/*-----------------------------------------------------------*/
/* This function is explained by the comments above its prototype at the top
of this file. */
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
{
for( ;; );
}
/*-----------------------------------------------------------*/
/* This function is explained by the comments above its prototype at the top
of this file. */
void vApplicationIdleHook( void )
{
static volatile unsigned long ulIdleLoopCount = 0UL;
ulIdleLoopCount++;
}
/*-----------------------------------------------------------*/
/* This function is explained in the comments at the top of this file. */
static void prvRegTest1Task( void *pvParameters )
{
if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER )
{
/* The parameter did not contain the expected value. */
for( ;; )
{
/* Stop the tick interrupt so its obvious something has gone wrong. */
taskDISABLE_INTERRUPTS();
}
}
/* This is an asm function that never returns. */
prvRegTest1Implementation();
}
/*-----------------------------------------------------------*/
/* This function is explained in the comments at the top of this file. */
static void prvRegTest2Task( void *pvParameters )
{
if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER )
{
/* The parameter did not contain the expected value. */
for( ;; )
{
/* Stop the tick interrupt so its obvious something has gone wrong. */
taskDISABLE_INTERRUPTS();
}
}
/* This is an asm function that never returns. */
prvRegTest2Implementation();
}
/*-----------------------------------------------------------*/

@ -0,0 +1,33 @@
@REM This bat file has been generated by the IAR Embeddded Workbench
@REM C-SPY interactive debugger,as an aid to preparing a command
@REM line for running the cspybat command line utility with the
@REM appropriate settings.
@REM
@REM After making some adjustments to this file, you can launch cspybat
@REM by typing the name of this file followed by the name of the debug
@REM file (usually an ubrof file). Note that this file is generated
@REM every time a new debug session is initialized, so you may want to
@REM move or rename the file before making changes.
@REM
@REM Note: some command line arguments cannot be properly generated
@REM by this process. Specifically, the plugin which is responsible
@REM for the Terminal I/O window (and other C runtime functionality)
@REM comes in a special version for cspybat, and the name of that
@REM plugin dll is not known when generating this file. It resides in
@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or
@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding
@REM tool chain. Replace the '<libsupport_plugin>' parameter
@REM below with the appropriate file name. Other plugins loaded by
@REM C-SPY are usually not needed by, or will not work in, cspybat
@REM but they are listed at the end of this file for reference.
"C:\devtools\IAR Systems\Embedded Workbench 6.0\common\bin\cspybat" "C:\devtools\IAR Systems\Embedded Workbench 6.0\rx\bin\rxproc.dll" "C:\devtools\IAR Systems\Embedded Workbench 6.0\rx\bin\rxemue20.dll" %1 --plugin "C:\devtools\IAR Systems\Embedded Workbench 6.0\rx\bin\<libsupport_plugin>" --backend -B "--core" "RX600" "-p" "C:\devtools\IAR Systems\Embedded Workbench 6.0\rx\config\debugger\ior5f562n8.ddf" "--double" "32" "--endian" "l" "--int" "32" "-d" "emue20" "--emu" "e1e20" "--drv_communication" "USB" "--verify_download" "all"
@REM Loaded plugins:
@REM rxLibSupport.dll
@REM C:\devtools\IAR Systems\Embedded Workbench 6.0\common\plugins\CodeCoverage\CodeCoverage.dll
@REM C:\devtools\IAR Systems\Embedded Workbench 6.0\common\plugins\Profiling\Profiling.dll
@REM C:\devtools\IAR Systems\Embedded Workbench 6.0\common\plugins\stack\stack.dll
@REM C:\devtools\IAR Systems\Embedded Workbench 6.0\common\plugins\SymList\SymList.dll

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<Project>
<Desktop>
<Static>
<Debug-Log>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log>
<Build>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build>
<Workspace>
<ColumnWidths>
<Column0>124</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Disassembly>
<MixedMode>1</MixedMode><CodeCovShow>0</CodeCovShow><InstrProfShow>0</InstrProfShow></Disassembly>
<Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><Watch><Format><struct_types/><watch_formats/></Format><Column0>209</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3></Watch></Static>
<Windows>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-9252-3823</Identity>
<TabName>Debug Log</TabName>
<Factory>Debug-Log</Factory>
<Session/>
</Tab>
<Tab>
<Identity>TabID-8729-3833</Identity>
<TabName>Build</TabName>
<Factory>Build</Factory>
<Session/>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1>
<Tabs>
<Tab>
<Identity>TabID-20000-3827</Identity>
<TabName>Workspace</TabName>
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>RTOSDemo</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd1><Wnd2>
<Tabs>
<Tab>
<Identity>TabID-30749-3830</Identity>
<TabName>Disassembly</TabName>
<Factory>Disassembly</Factory>
<Session/>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd2><Wnd7><Tabs><Tab><Identity>TabID-2881-13136</Identity><TabName>Watch</TabName><Factory>Watch</Factory><Session><Expressions><Expression><Expression>pxCurrentTCB</Expression></Expression></Expressions><TabId>0</TabId><Column0>209</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3></Session></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd7></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main-full.c</Filename><XPos>0</XPos><YPos>277</YPos><SelStart>13234</SelStart><SelEnd>13234</SelEnd></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>646</YPos><SelStart>25229</SelStart><SelEnd>25229</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-00a2ab38><key>iaridepm.enu1</key></Toolbar-00a2ab38><Toolbar-0332f480><key>debuggergui.enu1</key></Toolbar-0332f480></Sizes></Row0></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>679</Bottom><Right>198</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>693483</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>679</Bottom><Right>481</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>287500</sizeVertCX><sizeVertCY>693483</sizeVertCY></Rect></Wnd2></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>259</Bottom><Right>909</Right><x>-2</x><y>-2</y><xscreen>911</xscreen><yscreen>261</yscreen><sizeHorzCX>542262</sizeHorzCX><sizeHorzCY>265784</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd0><Wnd7><Rect><Top>0</Top><Left>0</Left><Bottom>0</Bottom><Right>0</Right><x>907</x><y>-2</y><xscreen>775</xscreen><yscreen>261</yscreen><sizeHorzCX>461310</sizeHorzCX><sizeHorzCY>265784</sizeHorzCY><sizeVertCX>356548</sizeVertCX><sizeVertCY>238289</sizeVertCY></Rect></Wnd7></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Project>

@ -0,0 +1,55 @@
[E20]
TimeConnected=1283090922
ComuniDllSave=72941568
FfwnsdDllSave=303235072
ChipName=R5F562N8
CpuMode=0
InputClock=12.500000
WorkRamStart=12288
JtagClock=10
DebugFlags=0,0
EmulatorMode=0
NeedInit=1
[DebugChecksum]
Checksum=2002614687
[DisAssemblyWindow]
NumStates=_ 1
State 1=_ 1
[InstructionProfiling]
Enabled=_ 0
[CodeCoverage]
Enabled=_ 0
[Profiling]
Enabled=0
[StackPlugin]
Enabled=1
OverflowWarningsEnabled=1
WarningThreshold=90
SpWarningsEnabled=0
WarnHow=0
UseTrigger=1
TriggerName=main
LimitSize=0
ByteLimit=50
[Log file]
LoggingEnabled=_ 0
LogFile=_ ""
Category=_ 0
[TermIOLog]
LoggingEnabled=_ 0
LogFile=_ ""
[DriverProfiling]
Enabled=0
Source=2
Graph=0
[Breakpoints]
Count=0
[Monitor Execution]
Leave target running=0
Release target=0
[Aliases]
Count=0
SuppressDialog=0
[TraceHelper]
Enabled=0
ShowSource=1

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<Workspace>
<ConfigDictionary>
<CurrentConfigs><Project>RTOSDemo/Debug</Project></CurrentConfigs></ConfigDictionary>
<Desktop>
<Static>
<Workspace>
<ColumnWidths>
<Column0>151</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Build>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build>
<TerminalIO/>
<Debug-Log><ColumnWidth0>18</ColumnWidth0><ColumnWidth1>1624</ColumnWidth1></Debug-Log></Static>
<Windows>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-10758-3386</Identity>
<TabName>Workspace</TabName>
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/Common Demo Files</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source/Portable Layer</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1>
<Tabs>
<Tab>
<Identity>TabID-16801-3477</Identity>
<TabName>Build</TabName>
<Factory>Build</Factory>
<Session/>
</Tab>
<Tab><Identity>TabID-414-15843</Identity><TabName>Breakpoints</TabName><Factory>Breakpoints</Factory></Tab><Tab><Identity>TabID-3320-15993</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs>
<SelectedTab>0</SelectedTab></Wnd1></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main-full.c</Filename><XPos>0</XPos><YPos>277</YPos><SelStart>13234</SelStart><SelEnd>13234</SelEnd></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>646</YPos><SelStart>25229</SelStart><SelEnd>25229</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-00a2ab38><key>iaridepm.enu1</key></Toolbar-00a2ab38></Sizes></Row0><Row1><Sizes/></Row1><Row2><Sizes/></Row2></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>547</Bottom><Right>241</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>144643</sizeVertCX><sizeVertCY>559063</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>391</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>393</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>400204</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>
Loading…
Cancel
Save