From 99006247ae0e797b1e699b6d8fe407ef4a61bab5 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Wed, 18 Aug 2010 13:29:12 +0000 Subject: [PATCH] Continue work on RX600 port - work in progress. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1047 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Source/portable/Renesas/RX600/port.c | 42 ++++++++++++++++------- Source/portable/Renesas/RX600/portmacro.h | 9 +++-- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/Source/portable/Renesas/RX600/port.c b/Source/portable/Renesas/RX600/port.c index 8e3cc871d..2998d30cd 100644 --- a/Source/portable/Renesas/RX600/port.c +++ b/Source/portable/Renesas/RX600/port.c @@ -62,6 +62,9 @@ /* Library includes. */ #include "string.h" +/* Hardware specifics. */ +#include "iodefine.h" + /*-----------------------------------------------------------*/ /* Tasks should start with interrupts enabled, therefore PSW is set with U,I,PM @@ -72,8 +75,8 @@ flags set and IPL clear. */ PM = 0 Supervisor mode. IPL = 0 All interrupt priorities enabled. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) -#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) +#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) +#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) /*-----------------------------------------------------------*/ @@ -163,6 +166,15 @@ extern void vApplicationSetupTimerInterrupt( void ); use. A demo application is provided to show a suitable example. */ vApplicationSetupTimerInterrupt(); + /* Enable the software interrupt. */ + _IEN( _ICU_SWINT ) = 1; + + /* Ensure the software interrupt is clear. */ + _IR( _ICU_SWINT ) = 0; + + /* Ensure the software interrupt is set to the kernel priority. */ + _IPR( _ICU_SWINT ) = configKERNEL_INTERRUPT_PRIORITY; + /* Start the first task. */ prvStartFirstTask(); } @@ -178,26 +190,30 @@ void vPortEndScheduler( void ) } /*-----------------------------------------------------------*/ -void vPortYield( void ) -{ -} -/*-----------------------------------------------------------*/ - -#pragma interrupt (vTickISR(vect=configTICK_VECTOR,enable)) +#pragma interrupt ( vTickISR( vect = _VECT( configTICK_VECTOR ), enable ) ) void vTickISR( void ) { - /* Restore previous IPL on exit. */ - //set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY ); +static volatile unsigned long ul = 0; + + ul++; /* Clear the interrupt. */ - vTaskIncrementTick(); +// vTaskIncrementTick(); #if( configUSE_PREEMPTION == 1 ) - taskYIELD(); +// taskYIELD(); #endif } /*-----------------------------------------------------------*/ +#pragma interrupt ( vSoftwareInterruptISR( vect = _VECT( _ICU_SWINT ), enable ) ) +void vSoftwareInterruptISR( void ) +{ +static volatile unsigned long ul = 0; + + ul++; +} + #pragma inline_asm prvStartFirstTask static void prvStartFirstTask( void ) { @@ -225,3 +241,5 @@ static void prvStartFirstTask( void ) NOP NOP } + + diff --git a/Source/portable/Renesas/RX600/portmacro.h b/Source/portable/Renesas/RX600/portmacro.h index 612219ac2..8bc1667e3 100644 --- a/Source/portable/Renesas/RX600/portmacro.h +++ b/Source/portable/Renesas/RX600/portmacro.h @@ -99,8 +99,10 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portSTART_SCHEDULER_TRAP_NO ( 32 ) #define portKERNEL_INTERRUPT_PRIORITY ( 1 ) -void vPortYield( void ); -#define portYIELD() vPortYield() +/* The location of the software interrupt register. Software interrupts use +vector 27. */ +#define portITU_SWINTR ( ( unsigned char * ) 0x000872E0 ) +#define portYIELD() *portITU_SWINTR = 0x01; nop(); nop(); nop(); nop(); nop() extern void vTaskSwitchContext( void ); #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) vTaskSwitchContext() @@ -110,7 +112,7 @@ extern void vTaskSwitchContext( void ); * and taskEXIT_CRITICAL() macros. */ #define portENABLE_INTERRUPTS() set_ipl( 0 ) -#define portDISABLE_INTERRUPTS() set_ipl( configKERNEL_INTERRUPT_PRIORITY ) +#define portDISABLE_INTERRUPTS() set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY ) #define portSET_INTERRUPT_MASK_FROM_ISR() get_ipl(); set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY ) #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) set_ipl( uxSavedInterruptStatus ) @@ -124,6 +126,7 @@ extern void vTaskExitCritical( void ); #define portENTER_CRITICAL() vTaskEnterCritical(); #define portEXIT_CRITICAL() vTaskExitCritical(); + /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ -- 2.39.2