Wind up the baud rate on the TriCore UART to obtain an extra level of interrupt nesting.

Set the UART into loopback mode so a jumper is not required.
This commit is contained in:
Richard Barry 2011-11-18 11:25:19 +00:00
parent b89f1a729a
commit 9d4616eb55
6 changed files with 277 additions and 248 deletions

View file

@ -168,7 +168,6 @@ static void prvPortHighFrequencyTimerHandler( int iArg )
static volatile unsigned long ulExecutionCounter = 0UL;
unsigned long ulHigherPriorityTaskWoken = pdFALSE;
COUNT_NEST();
/* Just to avoid compiler warnings about unused parameters. */
( void ) iArg;
@ -192,5 +191,4 @@ COUNT_NEST();
}
portYIELD_FROM_ISR( ulHigherPriorityTaskWoken );
ulNest--;
}

View file

@ -1,4 +1,3 @@
volatile unsigned long ulNest = 0UL, ulMaxNest = 0UL;
/*
FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.
@ -60,11 +59,17 @@ volatile unsigned long ulNest = 0UL, ulMaxNest = 0UL;
*
* To create a very simple LED flasher example, set the
* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY constant (defined below) to 1. When
* this is done, only the standard demo flash tasks are created, whereby three
* tasks each toggle an LED at a fixed but different frequency.
* this is done, only the standard demo flash tasks are created. The standard
* demo flash example creates three tasks, each toggle an LED at a fixed but
* different frequency.
*
* To create a more comprehensive test and demo application, set
* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 0.
*
* Two build configurations are provided, one that executes from RAM and one
* that executes from Flash. The RAM build uses size optimisation, the Flash
* build has optimisation completely turned off. The documentation page for
* this port on the FreeRTOS.org web site provides full information.
******************************************************************************
*
* main() creates all the demo application tasks and timers, then starts the
@ -96,7 +101,10 @@ volatile unsigned long ulNest = 0UL, ulMaxNest = 0UL;
* ***NOTE*** This demo uses the standard comtest tasks, which has special
* hardware requirements as a loopback connector, or UART echo server are
* required. See the documentation page for this demo on the FreeRTOS.org web
* site for more information.
* site for more information. Note that the comtest tasks were tested by
* placing the UART into loopback mode directly in the serial initialisation
* sequence, and as such, the baud rate used has not been verified as actually
* being correct.
*/
/* Standard includes. */
@ -129,7 +137,8 @@ volatile unsigned long ulNest = 0UL, ulMaxNest = 0UL;
/*-----------------------------------------------------------*/
/* Constants for the ComTest tasks. */
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 )
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 200000 )
#define mainCOM_TEST_LED ( 5 )
/* Priorities for the demo application tasks. */
@ -147,12 +156,16 @@ error. */
#define mainERROR_FLASH_PERIOD_MS ( ( portTickType ) 500 / portTICK_RATE_MS )
#define mainON_BOARD_LED_BIT ( ( unsigned long ) 7 )
/* Constant used by the standard timer test functions. */
#define mainTIMER_TEST_PERIOD ( 50 )
/* Constant used by the standard timer test functions. The timers created by
the timer test functions will all have a period that is a multiple of this
value. */
#define mainTIMER_TEST_PERIOD ( 200 )
/* Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 1 to create a simple demo.
Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 0 to create a much more
comprehensive test application. See the comments at the top of this file. */
comprehensive test application. See the comments at the top of this file, and
the documentation page on the http://www.FreeRTOS.org web site for more
information. */
#define mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY 0
/*-----------------------------------------------------------*/
@ -177,13 +190,13 @@ static void prvSetupHardware( void );
/*
* Writes to and checks the value of each register that is used in the context
* of a task.
* of a task. See the comments at the top of this file.
*/
static void prvRegisterCheckTask1( void *pvParameters );
static void prvRegisterCheckTask2( void *pvParameters );
/*
* Specific check to see if the Register test functions are still operating
* Specific check to see if the register test functions are still operating
* correctly.
*/
static portBASE_TYPE prvAreRegTestTasksStillRunning( void );
@ -215,11 +228,11 @@ int main( void )
/* Setup the hardware for use with the TriCore evaluation board. */
prvSetupHardware();
/* Start standard demo/test application tasks. See the comments at the
top of this file. The LED flash tasks are always created. The other tasks
are only created if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to 1 (at
the top of this file). See the comments at the top of this file for more
information. */
/* Start standard demo/test application flash tasks. See the comments at
the top of this file. The LED flash tasks are always created. The other
tasks are only created if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to
1 (at the top of this file). See the comments at the top of this file for
more information. */
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
/* The following function will only create more tasks and timers if

View file

@ -99,7 +99,7 @@ xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned port
{
unsigned long ulReloadValue = 0UL;
ulReloadValue = ( configPERIPHERAL_CLOCK_HZ / ( 32 * ulWantedBaud ) ) - 1;
ulReloadValue = ( configPERIPHERAL_CLOCK_HZ / ( 48UL * ulWantedBaud ) ) - 1UL;
if( NULL == xSerialTransmitQueue )
{
@ -126,7 +126,13 @@ unsigned long ulReloadValue = 0UL;
/* Reconfigure and re-initialise the Operation. */
ASC0_PISEL.reg = 0UL;
ASC0_CON.reg = 0x00008011; /* 1 Start, 1 Stop, 8 Data, No Parity, No Error Checking, Receive On, Module On. */
ASC0_CON.reg = 0UL;
ASC0_CON.bits.M = 0x01; /* 8bit async. */
ASC0_CON.bits.REN = 0x01; /* Receiver enabled. */
ASC0_CON.bits.FDE = 0x01; /* Fractional divider enabled. */
ASC0_CON.bits.BRS = 0x01; /* Divide by three. */
ASC0_CON.bits.LB = 0x01; /* Loopback enabled. */
ASC0_CON.bits.R = 0x01; /* Enable the baud rate generator. */
/* Install the Tx interrupt. */
if( 0 != _install_int_handler( configINTERRUPT_PRIORITY_TX, prvTxBufferInterruptHandler, 0 ) )
@ -188,8 +194,6 @@ static void prvTxBufferInterruptHandler( int iArg )
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
unsigned char ucTx;
COUNT_NEST();
/* Just to remove compiler warnings about unused parameters. */
( void ) iArg;
@ -210,7 +214,6 @@ COUNT_NEST();
/* Finally end ISR and switch Task. */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
ulNest--;
}
/*---------------------------------------------------------------------------*/
@ -218,7 +221,7 @@ static void prvRxInterruptHandler( int iArg )
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
unsigned char ucRx;
COUNT_NEST();
/* Just to remove compiler warnings about unused parameters. */
( void ) iArg;
@ -236,7 +239,6 @@ COUNT_NEST();
/* Finally end ISR and switch Task. */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
ulNest--;
}
/*---------------------------------------------------------------------------*/