mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-22 22:42:00 -04:00
Remove unnecessary use of portLONG, portCHAR and portSHORT.
Change version number in headers.
This commit is contained in:
parent
4322b8d649
commit
23a5a73219
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -68,10 +69,10 @@
|
||||||
#define configUSE_PREEMPTION 1
|
#define configUSE_PREEMPTION 1
|
||||||
#define configUSE_IDLE_HOOK 0
|
#define configUSE_IDLE_HOOK 0
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 98000000 )
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 98000000 )
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 200 - ( unsigned portSHORT ) configSTACK_START )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 - ( unsigned short ) configSTACK_START )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 6 * 1024 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 6 * 1024 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 8 )
|
#define configMAX_TASK_NAME_LEN ( 8 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#/*
|
#/*
|
||||||
# FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
# FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
#
|
#
|
||||||
# This file is part of the FreeRTOS distribution.
|
# This file is part of the FreeRTOS distribution.
|
||||||
#
|
#
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
#
|
#
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * Looking for a quick start? Then check out the FreeRTOS eBook! *
|
# * The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
# * See http://www.FreeRTOS.org/Documentation for details *
|
# * small fee. Help yourself get started quickly while also helping the *
|
||||||
|
# * FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -50,18 +51,18 @@
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "partest.h"
|
#include "partest.h"
|
||||||
|
|
||||||
#define partstPUSH_PULL ( ( unsigned portCHAR ) 0xff )
|
#define partstPUSH_PULL ( ( unsigned char ) 0xff )
|
||||||
#define partstALL_OUTPUTS_OFF ( ( unsigned portCHAR ) 0xff )
|
#define partstALL_OUTPUTS_OFF ( ( unsigned char ) 0xff )
|
||||||
|
|
||||||
/* LED to output is dependent on how the LED's are wired. */
|
/* LED to output is dependent on how the LED's are wired. */
|
||||||
#define partstOUTPUT_0 ( ( unsigned portCHAR ) 0x02 )
|
#define partstOUTPUT_0 ( ( unsigned char ) 0x02 )
|
||||||
#define partstOUTPUT_1 ( ( unsigned portCHAR ) 0x08 )
|
#define partstOUTPUT_1 ( ( unsigned char ) 0x08 )
|
||||||
#define partstOUTPUT_2 ( ( unsigned portCHAR ) 0x20 )
|
#define partstOUTPUT_2 ( ( unsigned char ) 0x20 )
|
||||||
#define partstOUTPUT_3 ( ( unsigned portCHAR ) 0x01 )
|
#define partstOUTPUT_3 ( ( unsigned char ) 0x01 )
|
||||||
#define partstOUTPUT_4 ( ( unsigned portCHAR ) 0x04 )
|
#define partstOUTPUT_4 ( ( unsigned char ) 0x04 )
|
||||||
#define partstOUTPUT_5 ( ( unsigned portCHAR ) 0x10 )
|
#define partstOUTPUT_5 ( ( unsigned char ) 0x10 )
|
||||||
#define partstOUTPUT_6 ( ( unsigned portCHAR ) 0x40 )
|
#define partstOUTPUT_6 ( ( unsigned char ) 0x40 )
|
||||||
#define partstOUTPUT_7 ( ( unsigned portCHAR ) 0x80 )
|
#define partstOUTPUT_7 ( ( unsigned char ) 0x80 )
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* Simple parallel port IO routines.
|
* Simple parallel port IO routines.
|
||||||
|
@ -69,7 +70,7 @@
|
||||||
|
|
||||||
void vParTestInitialise( void )
|
void vParTestInitialise( void )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucOriginalSFRPage;
|
unsigned char ucOriginalSFRPage;
|
||||||
|
|
||||||
/* Remember the SFR page before it is changed so it can get set back
|
/* Remember the SFR page before it is changed so it can get set back
|
||||||
before the function exits. */
|
before the function exits. */
|
||||||
|
@ -150,7 +151,7 @@ portBASE_TYPE xError = pdFALSE;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucBit;
|
unsigned char ucBit;
|
||||||
portBASE_TYPE xError = pdFALSE;
|
portBASE_TYPE xError = pdFALSE;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -103,26 +104,26 @@
|
||||||
#define mainINTEGER_PRIORITY tskIDLE_PRIORITY
|
#define mainINTEGER_PRIORITY tskIDLE_PRIORITY
|
||||||
|
|
||||||
/* Constants required to disable the watchdog. */
|
/* Constants required to disable the watchdog. */
|
||||||
#define mainDISABLE_BYTE_1 ( ( unsigned portCHAR ) 0xde )
|
#define mainDISABLE_BYTE_1 ( ( unsigned char ) 0xde )
|
||||||
#define mainDISABLE_BYTE_2 ( ( unsigned portCHAR ) 0xad )
|
#define mainDISABLE_BYTE_2 ( ( unsigned char ) 0xad )
|
||||||
|
|
||||||
/* Constants to setup and use the on board LED. */
|
/* Constants to setup and use the on board LED. */
|
||||||
#define ucLED_BIT ( ( unsigned portCHAR ) 0x40 )
|
#define ucLED_BIT ( ( unsigned char ) 0x40 )
|
||||||
#define mainPORT_1_BIT_6 ( ( unsigned portCHAR ) 0x40 )
|
#define mainPORT_1_BIT_6 ( ( unsigned char ) 0x40 )
|
||||||
#define mainENABLE_CROSS_BAR ( ( unsigned portCHAR ) 0x40 )
|
#define mainENABLE_CROSS_BAR ( ( unsigned char ) 0x40 )
|
||||||
|
|
||||||
/* Constants to set the clock frequency. */
|
/* Constants to set the clock frequency. */
|
||||||
#define mainSELECT_INTERNAL_OSC ( ( unsigned portCHAR ) 0x80 )
|
#define mainSELECT_INTERNAL_OSC ( ( unsigned char ) 0x80 )
|
||||||
#define mainDIVIDE_CLOCK_BY_1 ( ( unsigned portCHAR ) 0x03 )
|
#define mainDIVIDE_CLOCK_BY_1 ( ( unsigned char ) 0x03 )
|
||||||
#define mainPLL_USES_INTERNAL_OSC ( ( unsigned portCHAR ) 0x04 )
|
#define mainPLL_USES_INTERNAL_OSC ( ( unsigned char ) 0x04 )
|
||||||
#define mainFLASH_READ_TIMING ( ( unsigned portCHAR ) 0x30 )
|
#define mainFLASH_READ_TIMING ( ( unsigned char ) 0x30 )
|
||||||
#define mainPLL_POWER_ON ( ( unsigned portCHAR ) 0x01 )
|
#define mainPLL_POWER_ON ( ( unsigned char ) 0x01 )
|
||||||
#define mainPLL_NO_PREDIVIDE ( ( unsigned portCHAR ) 0x01 )
|
#define mainPLL_NO_PREDIVIDE ( ( unsigned char ) 0x01 )
|
||||||
#define mainPLL_FILTER ( ( unsigned portCHAR ) 0x01 )
|
#define mainPLL_FILTER ( ( unsigned char ) 0x01 )
|
||||||
#define mainPLL_MULTIPLICATION ( ( unsigned portCHAR ) 0x04 )
|
#define mainPLL_MULTIPLICATION ( ( unsigned char ) 0x04 )
|
||||||
#define mainENABLE_PLL ( ( unsigned portCHAR ) 0x02 )
|
#define mainENABLE_PLL ( ( unsigned char ) 0x02 )
|
||||||
#define mainPLL_LOCKED ( ( unsigned portCHAR ) 0x10 )
|
#define mainPLL_LOCKED ( ( unsigned char ) 0x10 )
|
||||||
#define mainSELECT_PLL_AS_SOURCE ( ( unsigned portCHAR ) 0x02 )
|
#define mainSELECT_PLL_AS_SOURCE ( ( unsigned char ) 0x02 )
|
||||||
|
|
||||||
/* Toggle rate for the on board LED - which is dependent on whether or not
|
/* Toggle rate for the on board LED - which is dependent on whether or not
|
||||||
an error has been detected. */
|
an error has been detected. */
|
||||||
|
@ -130,7 +131,7 @@ an error has been detected. */
|
||||||
#define mainERROR_FLASH_PERIOD ( ( portTickType ) 250 )
|
#define mainERROR_FLASH_PERIOD ( ( portTickType ) 250 )
|
||||||
|
|
||||||
/* Baud rate used by the serial port tasks. */
|
/* Baud rate used by the serial port tasks. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 115200 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 )
|
||||||
|
|
||||||
/* Pass an invalid LED number to the COM test task as we don't want it to flash
|
/* Pass an invalid LED number to the COM test task as we don't want it to flash
|
||||||
an LED. There are only 8 LEDs (excluding the on board LED) wired in and these
|
an LED. There are only 8 LEDs (excluding the on board LED) wired in and these
|
||||||
|
@ -138,11 +139,11 @@ are all used by the flash tasks. */
|
||||||
#define mainCOM_TEST_LED ( 200 )
|
#define mainCOM_TEST_LED ( 200 )
|
||||||
|
|
||||||
/* We want the Cygnal to act as much as possible as a standard 8052. */
|
/* We want the Cygnal to act as much as possible as a standard 8052. */
|
||||||
#define mainAUTO_SFR_OFF ( ( unsigned portCHAR ) 0 )
|
#define mainAUTO_SFR_OFF ( ( unsigned char ) 0 )
|
||||||
|
|
||||||
/* Constants required to setup the IO pins for serial comms. */
|
/* Constants required to setup the IO pins for serial comms. */
|
||||||
#define mainENABLE_COMS ( ( unsigned portCHAR ) 0x04 )
|
#define mainENABLE_COMS ( ( unsigned char ) 0x04 )
|
||||||
#define mainCOMS_LINES_TO_PUSH_PULL ( ( unsigned portCHAR ) 0x03 )
|
#define mainCOMS_LINES_TO_PUSH_PULL ( ( unsigned char ) 0x03 )
|
||||||
|
|
||||||
/* Pointer passed as a parameter to vRegisterCheck() just so it has some know
|
/* Pointer passed as a parameter to vRegisterCheck() just so it has some know
|
||||||
values to check for in the DPH, DPL and B registers. */
|
values to check for in the DPH, DPL and B registers. */
|
||||||
|
@ -246,7 +247,7 @@ void main( void )
|
||||||
*/
|
*/
|
||||||
static void prvSetupHardware( void )
|
static void prvSetupHardware( void )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucOriginalSFRPage;
|
unsigned char ucOriginalSFRPage;
|
||||||
|
|
||||||
/* Remember the SFR page before it is changed so it can get set back
|
/* Remember the SFR page before it is changed so it can get set back
|
||||||
before the function exits. */
|
before the function exits. */
|
||||||
|
@ -284,9 +285,9 @@ unsigned portCHAR ucOriginalSFRPage;
|
||||||
|
|
||||||
static void prvSetupSystemClock( void )
|
static void prvSetupSystemClock( void )
|
||||||
{
|
{
|
||||||
volatile unsigned portSHORT usWait;
|
volatile unsigned short usWait;
|
||||||
const unsigned portSHORT usWaitTime = ( unsigned portSHORT ) 0x2ff;
|
const unsigned short usWaitTime = ( unsigned short ) 0x2ff;
|
||||||
unsigned portCHAR ucOriginalSFRPage;
|
unsigned char ucOriginalSFRPage;
|
||||||
|
|
||||||
/* Remember the SFR page so we can set it back at the end. */
|
/* Remember the SFR page so we can set it back at the end. */
|
||||||
ucOriginalSFRPage = SFRPAGE;
|
ucOriginalSFRPage = SFRPAGE;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -54,14 +55,14 @@
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
|
|
||||||
/* Constants required to setup the serial control register. */
|
/* Constants required to setup the serial control register. */
|
||||||
#define ser8_BIT_MODE ( ( unsigned portCHAR ) 0x40 )
|
#define ser8_BIT_MODE ( ( unsigned char ) 0x40 )
|
||||||
#define serRX_ENABLE ( ( unsigned portCHAR ) 0x10 )
|
#define serRX_ENABLE ( ( unsigned char ) 0x10 )
|
||||||
|
|
||||||
/* Constants to setup the timer used to generate the baud rate. */
|
/* Constants to setup the timer used to generate the baud rate. */
|
||||||
#define serCLOCK_DIV_48 ( ( unsigned portCHAR ) 0x03 )
|
#define serCLOCK_DIV_48 ( ( unsigned char ) 0x03 )
|
||||||
#define serUSE_PRESCALED_CLOCK ( ( unsigned portCHAR ) 0x10 )
|
#define serUSE_PRESCALED_CLOCK ( ( unsigned char ) 0x10 )
|
||||||
#define ser8BIT_WITH_RELOAD ( ( unsigned portCHAR ) 0x20 )
|
#define ser8BIT_WITH_RELOAD ( ( unsigned char ) 0x20 )
|
||||||
#define serSMOD ( ( unsigned portCHAR ) 0x10 )
|
#define serSMOD ( ( unsigned char ) 0x10 )
|
||||||
|
|
||||||
static xQueueHandle xRxedChars;
|
static xQueueHandle xRxedChars;
|
||||||
static xQueueHandle xCharsForTx;
|
static xQueueHandle xCharsForTx;
|
||||||
|
@ -70,11 +71,11 @@ data static unsigned portBASE_TYPE uxTxEmpty;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulReloadValue;
|
unsigned long ulReloadValue;
|
||||||
const portFLOAT fBaudConst = ( portFLOAT ) configCPU_CLOCK_HZ * ( portFLOAT ) 2.0;
|
const portFLOAT fBaudConst = ( portFLOAT ) configCPU_CLOCK_HZ * ( portFLOAT ) 2.0;
|
||||||
unsigned portCHAR ucOriginalSFRPage;
|
unsigned char ucOriginalSFRPage;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
|
@ -84,11 +85,11 @@ unsigned portCHAR ucOriginalSFRPage;
|
||||||
uxTxEmpty = pdTRUE;
|
uxTxEmpty = pdTRUE;
|
||||||
|
|
||||||
/* Create the queues used by the com test task. */
|
/* Create the queues used by the com test task. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( char ) );
|
||||||
|
|
||||||
/* Calculate the baud rate to use timer 1. */
|
/* Calculate the baud rate to use timer 1. */
|
||||||
ulReloadValue = ( unsigned portLONG ) ( ( ( portFLOAT ) 256 - ( fBaudConst / ( portFLOAT ) ( 32 * ulWantedBaud ) ) ) + ( portFLOAT ) 0.5 );
|
ulReloadValue = ( unsigned long ) ( ( ( portFLOAT ) 256 - ( fBaudConst / ( portFLOAT ) ( 32 * ulWantedBaud ) ) ) + ( portFLOAT ) 0.5 );
|
||||||
|
|
||||||
/* Set timer one for desired mode of operation. */
|
/* Set timer one for desired mode of operation. */
|
||||||
TMOD &= 0x08;
|
TMOD &= 0x08;
|
||||||
|
@ -96,8 +97,8 @@ unsigned portCHAR ucOriginalSFRPage;
|
||||||
SSTA0 |= serSMOD;
|
SSTA0 |= serSMOD;
|
||||||
|
|
||||||
/* Set the reload and start values for the time. */
|
/* Set the reload and start values for the time. */
|
||||||
TL1 = ( unsigned portCHAR ) ulReloadValue;
|
TL1 = ( unsigned char ) ulReloadValue;
|
||||||
TH1 = ( unsigned portCHAR ) ulReloadValue;
|
TH1 = ( unsigned char ) ulReloadValue;
|
||||||
|
|
||||||
/* Setup the control register for standard n, 8, 1 - variable baud rate. */
|
/* Setup the control register for standard n, 8, 1 - variable baud rate. */
|
||||||
SCON = ser8_BIT_MODE | serRX_ENABLE;
|
SCON = ser8_BIT_MODE | serRX_ENABLE;
|
||||||
|
@ -121,7 +122,7 @@ unsigned portCHAR ucOriginalSFRPage;
|
||||||
|
|
||||||
void vSerialISR( void ) interrupt 4
|
void vSerialISR( void ) interrupt 4
|
||||||
{
|
{
|
||||||
portCHAR cChar;
|
char cChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* 8051 port interrupt routines MUST be placed within a critical section
|
/* 8051 port interrupt routines MUST be placed within a critical section
|
||||||
|
@ -165,7 +166,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* There is only one port supported. */
|
/* There is only one port supported. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -183,7 +184,7 @@ portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xReturn;
|
portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 10 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 10 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 128 ) /* This can be made smaller if required. */
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 ) /* This can be made smaller if required. */
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@
|
||||||
/* Demo program include files. */
|
/* Demo program include files. */
|
||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
|
|
||||||
void vDisplayMessage( const portCHAR * const pcMessageToPrint )
|
void vDisplayMessage( const char * const pcMessageToPrint )
|
||||||
{
|
{
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
|
@ -70,11 +71,11 @@ void vDisplayMessage( const portCHAR * const pcMessageToPrint )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vWriteMessageToDisk( const portCHAR * const pcMessage )
|
void vWriteMessageToDisk( const char * const pcMessage )
|
||||||
{
|
{
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
const portCHAR * const pcFileName = "c:\\RTOSlog.txt";
|
const char * const pcFileName = "c:\\RTOSlog.txt";
|
||||||
const portCHAR * const pcSeparator = "\r\n-----------------------\r\n";
|
const char * const pcSeparator = "\r\n-----------------------\r\n";
|
||||||
FILE *pf;
|
FILE *pf;
|
||||||
|
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
|
@ -82,8 +83,8 @@ FILE *pf;
|
||||||
pf = fopen( pcFileName, "a" );
|
pf = fopen( pcFileName, "a" );
|
||||||
if( pf != NULL )
|
if( pf != NULL )
|
||||||
{
|
{
|
||||||
fwrite( pcMessage, strlen( pcMessage ), ( unsigned portSHORT ) 1, pf );
|
fwrite( pcMessage, strlen( pcMessage ), ( unsigned short ) 1, pf );
|
||||||
fwrite( pcSeparator, strlen( pcSeparator ), ( unsigned portSHORT ) 1, pf );
|
fwrite( pcSeparator, strlen( pcSeparator ), ( unsigned short ) 1, pf );
|
||||||
fclose( pf );
|
fclose( pf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,10 +96,10 @@ FILE *pf;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vWriteBufferToDisk( const portCHAR * const pcBuffer, unsigned portLONG ulBufferLength )
|
void vWriteBufferToDisk( const char * const pcBuffer, unsigned long ulBufferLength )
|
||||||
{
|
{
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
const portCHAR * const pcFileName = "c:\\trace.bin";
|
const char * const pcFileName = "c:\\trace.bin";
|
||||||
FILE *pf;
|
FILE *pf;
|
||||||
|
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
|
@ -106,7 +107,7 @@ FILE *pf;
|
||||||
pf = fopen( pcFileName, "wb" );
|
pf = fopen( pcFileName, "wb" );
|
||||||
if( pf )
|
if( pf )
|
||||||
{
|
{
|
||||||
fwrite( pcBuffer, ( size_t ) ulBufferLength, ( unsigned portSHORT ) 1, pf );
|
fwrite( pcBuffer, ( size_t ) ulBufferLength, ( unsigned short ) 1, pf );
|
||||||
fclose( pf );
|
fclose( pf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 10 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 10 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 128 ) /* This can be made smaller if required. */
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 ) /* This can be made smaller if required. */
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -61,14 +62,14 @@ Changes from V2.0.0
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "partest.h"
|
#include "partest.h"
|
||||||
|
|
||||||
#define partstALL_OUTPUTS_OFF ( ( unsigned portSHORT) 0x00 )
|
#define partstALL_OUTPUTS_OFF ( ( unsigned short) 0x00 )
|
||||||
#define partstMAX_OUTPUT_LED ( ( unsigned portCHAR ) 7 )
|
#define partstMAX_OUTPUT_LED ( ( unsigned char ) 7 )
|
||||||
#define partstPORT_F_ADDR ( ( unsigned portSHORT ) 0x605 )
|
#define partstPORT_F_ADDR ( ( unsigned short ) 0x605 )
|
||||||
#define partstPORT_DIRECTION_REG ( ( unsigned portSHORT ) 0x606 )
|
#define partstPORT_DIRECTION_REG ( ( unsigned short ) 0x606 )
|
||||||
#define partstPORT_F_DIR_BIT ( ( unsigned portSHORT ) 0x20 )
|
#define partstPORT_F_DIR_BIT ( ( unsigned short ) 0x20 )
|
||||||
|
|
||||||
/*lint -e956 File scope parameters okay here. */
|
/*lint -e956 File scope parameters okay here. */
|
||||||
static volatile unsigned portCHAR ucCurrentOutputValue = partstALL_OUTPUTS_OFF;
|
static volatile unsigned char ucCurrentOutputValue = partstALL_OUTPUTS_OFF;
|
||||||
/*lint +e956 */
|
/*lint +e956 */
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
|
@ -77,7 +78,7 @@ static volatile unsigned portCHAR ucCurrentOutputValue = partstALL_OUTPUTS_OFF;
|
||||||
|
|
||||||
void vParTestInitialise( void )
|
void vParTestInitialise( void )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usInput;
|
unsigned short usInput;
|
||||||
|
|
||||||
ucCurrentOutputValue = partstALL_OUTPUTS_OFF;
|
ucCurrentOutputValue = partstALL_OUTPUTS_OFF;
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ unsigned portSHORT usInput;
|
||||||
|
|
||||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, portBASE_TYPE xValue )
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, portBASE_TYPE xValue )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucBit = ( unsigned portCHAR ) 1;
|
unsigned char ucBit = ( unsigned char ) 1;
|
||||||
|
|
||||||
if( uxLED <= partstMAX_OUTPUT_LED )
|
if( uxLED <= partstMAX_OUTPUT_LED )
|
||||||
{
|
{
|
||||||
|
@ -104,7 +105,7 @@ unsigned portCHAR ucBit = ( unsigned portCHAR ) 1;
|
||||||
{
|
{
|
||||||
if( xValue == pdTRUE )
|
if( xValue == pdTRUE )
|
||||||
{
|
{
|
||||||
ucBit ^= ( unsigned portCHAR ) 0xff;
|
ucBit ^= ( unsigned char ) 0xff;
|
||||||
ucCurrentOutputValue &= ucBit;
|
ucCurrentOutputValue &= ucBit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -120,11 +121,11 @@ unsigned portCHAR ucBit = ( unsigned portCHAR ) 1;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucBit;
|
unsigned char ucBit;
|
||||||
|
|
||||||
if( uxLED <= partstMAX_OUTPUT_LED )
|
if( uxLED <= partstMAX_OUTPUT_LED )
|
||||||
{
|
{
|
||||||
ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
|
ucBit = ( ( unsigned char ) 1 ) << uxLED;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ Changes from V1.2.5
|
||||||
Changes from V2.0.0
|
Changes from V2.0.0
|
||||||
|
|
||||||
+ Delay periods are now specified using variables and constants of
|
+ Delay periods are now specified using variables and constants of
|
||||||
portTickType rather than unsigned portLONG.
|
portTickType rather than unsigned long.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -126,12 +127,12 @@ Changes from V2.0.0
|
||||||
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||||
#define mainSEMAPHORE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
#define mainSEMAPHORE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||||
|
|
||||||
#define mainPRINT_STACK_SIZE ( ( unsigned portSHORT ) 256 )
|
#define mainPRINT_STACK_SIZE ( ( unsigned short ) 256 )
|
||||||
#define mainDEBUG_LOG_BUFFER_SIZE ( ( unsigned portSHORT ) 20480 )
|
#define mainDEBUG_LOG_BUFFER_SIZE ( ( unsigned short ) 20480 )
|
||||||
|
|
||||||
/* Constant definitions for accessing the build in LED on the Flashlite 186. */
|
/* Constant definitions for accessing the build in LED on the Flashlite 186. */
|
||||||
#define mainLED_REG_DIR ( ( unsigned portSHORT ) 0xff78 )
|
#define mainLED_REG_DIR ( ( unsigned short ) 0xff78 )
|
||||||
#define mainLED_REG ( ( unsigned portSHORT ) 0xff7a )
|
#define mainLED_REG ( ( unsigned short ) 0xff7a )
|
||||||
|
|
||||||
/* If an error is detected in a task then the vErrorChecks() task will enter
|
/* If an error is detected in a task then the vErrorChecks() task will enter
|
||||||
an infinite loop flashing the LED at this rate. */
|
an infinite loop flashing the LED at this rate. */
|
||||||
|
@ -153,10 +154,10 @@ the scheduler. */
|
||||||
static void prvCheckForKeyPresses( void );
|
static void prvCheckForKeyPresses( void );
|
||||||
|
|
||||||
/* Buffer used by the trace visualisation utility. */
|
/* Buffer used by the trace visualisation utility. */
|
||||||
static portCHAR pcWriteBuffer[ mainDEBUG_LOG_BUFFER_SIZE ];
|
static char pcWriteBuffer[ mainDEBUG_LOG_BUFFER_SIZE ];
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
portSHORT main( void )
|
short main( void )
|
||||||
{
|
{
|
||||||
/* Initialise hardware and utilities. */
|
/* Initialise hardware and utilities. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
@ -191,11 +192,11 @@ static void vErrorChecks( void *pvParameters )
|
||||||
{
|
{
|
||||||
portTickType xExpectedWakeTime;
|
portTickType xExpectedWakeTime;
|
||||||
const portTickType xPrintRate = ( portTickType ) 5000 / portTICK_RATE_MS;
|
const portTickType xPrintRate = ( portTickType ) 5000 / portTICK_RATE_MS;
|
||||||
const portLONG lMaxAllowableTimeDifference = ( portLONG ) 0;
|
const long lMaxAllowableTimeDifference = ( long ) 0;
|
||||||
portTickType xWakeTime;
|
portTickType xWakeTime;
|
||||||
portLONG lTimeDifference;
|
long lTimeDifference;
|
||||||
const portCHAR *pcReceivedMessage;
|
const char *pcReceivedMessage;
|
||||||
const portCHAR * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n";
|
const char * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n";
|
||||||
|
|
||||||
/* Stop warnings. */
|
/* Stop warnings. */
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
|
@ -226,11 +227,11 @@ const portCHAR * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r
|
||||||
time we should have unblocked. */
|
time we should have unblocked. */
|
||||||
if( xWakeTime > xExpectedWakeTime )
|
if( xWakeTime > xExpectedWakeTime )
|
||||||
{
|
{
|
||||||
lTimeDifference = ( portLONG ) ( xWakeTime - xExpectedWakeTime );
|
lTimeDifference = ( long ) ( xWakeTime - xExpectedWakeTime );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lTimeDifference = ( portLONG ) ( xExpectedWakeTime - xWakeTime );
|
lTimeDifference = ( long ) ( xExpectedWakeTime - xWakeTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lTimeDifference > lMaxAllowableTimeDifference )
|
if( lTimeDifference > lMaxAllowableTimeDifference )
|
||||||
|
@ -261,7 +262,7 @@ static void prvCheckForKeyPresses( void )
|
||||||
{
|
{
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
|
|
||||||
portSHORT sIn;
|
short sIn;
|
||||||
|
|
||||||
|
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
|
@ -270,7 +271,7 @@ static void prvCheckForKeyPresses( void )
|
||||||
|
|
||||||
if( sIn )
|
if( sIn )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulBufferLength;
|
unsigned long ulBufferLength;
|
||||||
|
|
||||||
/* Key presses can be used to start/stop the trace utility, or end the
|
/* Key presses can be used to start/stop the trace utility, or end the
|
||||||
program. */
|
program. */
|
||||||
|
@ -305,7 +306,7 @@ static void prvCheckForKeyPresses( void )
|
||||||
|
|
||||||
static void prvCheckOtherTasksAreStillRunning( void )
|
static void prvCheckOtherTasksAreStillRunning( void )
|
||||||
{
|
{
|
||||||
portSHORT sErrorHasOccurred = pdFALSE;
|
short sErrorHasOccurred = pdFALSE;
|
||||||
|
|
||||||
if( xAreComTestTasksStillRunning() != pdTRUE )
|
if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
|
@ -365,8 +366,8 @@ portSHORT sErrorHasOccurred = pdFALSE;
|
||||||
|
|
||||||
static void prvInitLED( void )
|
static void prvInitLED( void )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usPortDirection;
|
unsigned short usPortDirection;
|
||||||
const unsigned portSHORT usLEDOut = 0x400;
|
const unsigned short usLEDOut = 0x400;
|
||||||
|
|
||||||
/* Set the LED bit to an output. */
|
/* Set the LED bit to an output. */
|
||||||
|
|
||||||
|
@ -378,9 +379,9 @@ const unsigned portSHORT usLEDOut = 0x400;
|
||||||
|
|
||||||
static void prvToggleLED( void )
|
static void prvToggleLED( void )
|
||||||
{
|
{
|
||||||
static portSHORT sLED = pdTRUE;
|
static short sLED = pdTRUE;
|
||||||
unsigned portSHORT usLEDState;
|
unsigned short usLEDState;
|
||||||
const unsigned portSHORT usLEDBit = 0x400;
|
const unsigned short usLEDBit = 0x400;
|
||||||
|
|
||||||
/* Flip the state of the LED. */
|
/* Flip the state of the LED. */
|
||||||
usLEDState = inpw( mainLED_REG );
|
usLEDState = inpw( mainLED_REG );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ Changes from V2.0.0
|
||||||
#include "portasm.h"
|
#include "portasm.h"
|
||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
|
|
||||||
#define serMAX_PORTS ( ( unsigned portSHORT ) 2 )
|
#define serMAX_PORTS ( ( unsigned short ) 2 )
|
||||||
|
|
||||||
#define serPORT_0_INT_REG ( 0xff44 )
|
#define serPORT_0_INT_REG ( 0xff44 )
|
||||||
#define serPORT_0_BAUD_REG ( 0xff88 )
|
#define serPORT_0_BAUD_REG ( 0xff88 )
|
||||||
|
@ -108,19 +109,19 @@ Changes from V2.0.0
|
||||||
#define serPORT_1_CTRL_REG ( 0xff10 )
|
#define serPORT_1_CTRL_REG ( 0xff10 )
|
||||||
#define serPORT_1_IRQ ( 0x11 )
|
#define serPORT_1_IRQ ( 0x11 )
|
||||||
|
|
||||||
#define serTX_EMPTY ( ( unsigned portSHORT ) 0x40 )
|
#define serTX_EMPTY ( ( unsigned short ) 0x40 )
|
||||||
#define serRX_READY ( ( unsigned portSHORT ) 0x80 )
|
#define serRX_READY ( ( unsigned short ) 0x80 )
|
||||||
|
|
||||||
#define serRESET_PIC( usEOI_TYPE ) portOUTPUT_WORD( ( unsigned portSHORT ) 0xff22, usEOI_TYPE )
|
#define serRESET_PIC( usEOI_TYPE ) portOUTPUT_WORD( ( unsigned short ) 0xff22, usEOI_TYPE )
|
||||||
#define serTX_HOLD_EMPTY_INT ( ( unsigned portSHORT ) 0x100 )
|
#define serTX_HOLD_EMPTY_INT ( ( unsigned short ) 0x100 )
|
||||||
|
|
||||||
#define serENABLE_INTERRUPTS ( ( unsigned portSHORT ) 0x80 )
|
#define serENABLE_INTERRUPTS ( ( unsigned short ) 0x80 )
|
||||||
#define serMODE ( ( unsigned portSHORT ) 0x01 )
|
#define serMODE ( ( unsigned short ) 0x01 )
|
||||||
#define serENABLE_TX_MACHINES ( ( unsigned portSHORT ) 0x40 )
|
#define serENABLE_TX_MACHINES ( ( unsigned short ) 0x40 )
|
||||||
#define serENABLE_RX_MACHINES ( ( unsigned portSHORT ) 0x20 )
|
#define serENABLE_RX_MACHINES ( ( unsigned short ) 0x20 )
|
||||||
#define serINTERRUPT_MASK ( ( unsigned portSHORT ) 0x08 )
|
#define serINTERRUPT_MASK ( ( unsigned short ) 0x08 )
|
||||||
#define serCLEAR_ALL_STATUS_BITS ( ( unsigned portSHORT ) 0x00 )
|
#define serCLEAR_ALL_STATUS_BITS ( ( unsigned short ) 0x00 )
|
||||||
#define serINTERRUPT_PRIORITY ( ( unsigned portSHORT ) 0x01 ) /*< Just below the scheduler priority. */
|
#define serINTERRUPT_PRIORITY ( ( unsigned short ) 0x01 ) /*< Just below the scheduler priority. */
|
||||||
|
|
||||||
#define serDONT_BLOCK ( ( portTickType ) 0 )
|
#define serDONT_BLOCK ( ( portTickType ) 0 )
|
||||||
|
|
||||||
|
@ -181,7 +182,7 @@ typedef enum
|
||||||
} eBaud;
|
} eBaud;
|
||||||
|
|
||||||
/* Must be same order as eBaud definitions. */
|
/* Must be same order as eBaud definitions. */
|
||||||
static const unsigned portSHORT usBaudRateDivisor[] =
|
static const unsigned short usBaudRateDivisor[] =
|
||||||
{
|
{
|
||||||
0, /* Not sure if the first 6 are correct. First cannot be used. */
|
0, /* Not sure if the first 6 are correct. First cannot be used. */
|
||||||
29127,
|
29127,
|
||||||
|
@ -206,15 +207,15 @@ static const unsigned portSHORT usBaudRateDivisor[] =
|
||||||
typedef struct xCOM_PORT
|
typedef struct xCOM_PORT
|
||||||
{
|
{
|
||||||
/* Hardware parameters for this port. */
|
/* Hardware parameters for this port. */
|
||||||
portSHORT sTxInterruptOn;
|
short sTxInterruptOn;
|
||||||
unsigned portSHORT usIntReg;
|
unsigned short usIntReg;
|
||||||
unsigned portSHORT usBaudReg;
|
unsigned short usBaudReg;
|
||||||
unsigned portSHORT usRxReg;
|
unsigned short usRxReg;
|
||||||
unsigned portSHORT usTxReg;
|
unsigned short usTxReg;
|
||||||
unsigned portSHORT usStatusReg;
|
unsigned short usStatusReg;
|
||||||
unsigned portSHORT usCtrlReg;
|
unsigned short usCtrlReg;
|
||||||
|
|
||||||
unsigned portSHORT usIRQVector;
|
unsigned short usIRQVector;
|
||||||
|
|
||||||
/* Queues used for communications with com test task. */
|
/* Queues used for communications with com test task. */
|
||||||
xQueueHandle xRxedChars;
|
xQueueHandle xRxedChars;
|
||||||
|
@ -237,17 +238,17 @@ typedef xComPort * xComPortHandle;
|
||||||
/* These prototypes are repeated here so we don't have to include the serial header. This allows
|
/* These prototypes are repeated here so we don't have to include the serial header. This allows
|
||||||
the xComPortHandle structure details to be private to this file. */
|
the xComPortHandle structure details to be private to this file. */
|
||||||
xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength );
|
xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength );
|
||||||
portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, portCHAR *pcRxedChar, portTickType xBlockTime );
|
portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, char *pcRxedChar, portTickType xBlockTime );
|
||||||
portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, portCHAR cOutChar, portTickType xBlockTime );
|
portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, char cOutChar, portTickType xBlockTime );
|
||||||
void vSerialClose( xComPortHandle xPort );
|
void vSerialClose( xComPortHandle xPort );
|
||||||
portSHORT sSerialWaitForSemaphore( xComPortHandle xPort );
|
short sSerialWaitForSemaphore( xComPortHandle xPort );
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static portSHORT xComPortISR( xComPort * const pxPort );
|
static short xComPortISR( xComPort * const pxPort );
|
||||||
|
|
||||||
#define vInterruptOn( pxPort, usInterrupt ) \
|
#define vInterruptOn( pxPort, usInterrupt ) \
|
||||||
{ \
|
{ \
|
||||||
unsigned portSHORT usIn; \
|
unsigned short usIn; \
|
||||||
\
|
\
|
||||||
portENTER_CRITICAL(); \
|
portENTER_CRITICAL(); \
|
||||||
{ \
|
{ \
|
||||||
|
@ -265,7 +266,7 @@ unsigned portSHORT usIn; \
|
||||||
|
|
||||||
#define vInterruptOff( pxPort, usInterrupt ) \
|
#define vInterruptOff( pxPort, usInterrupt ) \
|
||||||
{ \
|
{ \
|
||||||
unsigned portSHORT usIn = portINPUT_WORD( pxPort->usCtrlReg ); \
|
unsigned short usIn = portINPUT_WORD( pxPort->usCtrlReg ); \
|
||||||
if( usIn & usInterrupt ) \
|
if( usIn & usInterrupt ) \
|
||||||
{ \
|
{ \
|
||||||
portOUTPUT_WORD( pxPort->usCtrlReg, usIn & ~usInterrupt); \
|
portOUTPUT_WORD( pxPort->usCtrlReg, usIn & ~usInterrupt); \
|
||||||
|
@ -300,7 +301,7 @@ static pxISR xISRs[ serMAX_PORTS ] =
|
||||||
|
|
||||||
xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength )
|
xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usPort;
|
unsigned short usPort;
|
||||||
xComPortHandle pxPort = NULL;
|
xComPortHandle pxPort = NULL;
|
||||||
|
|
||||||
/* BAUDDIV = ( Microprocessor Clock / Baud Rate ) / 16 */
|
/* BAUDDIV = ( Microprocessor Clock / Baud Rate ) / 16 */
|
||||||
|
@ -313,7 +314,7 @@ xComPortHandle pxPort = NULL;
|
||||||
|
|
||||||
/* Currently only n,8,1 is supported. */
|
/* Currently only n,8,1 is supported. */
|
||||||
|
|
||||||
usPort = ( unsigned portSHORT ) ePort;
|
usPort = ( unsigned short ) ePort;
|
||||||
|
|
||||||
if( usPort < serMAX_PORTS )
|
if( usPort < serMAX_PORTS )
|
||||||
{
|
{
|
||||||
|
@ -321,17 +322,17 @@ xComPortHandle pxPort = NULL;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
unsigned portSHORT usInWord;
|
unsigned short usInWord;
|
||||||
|
|
||||||
/* Create the queues used by the com test task. */
|
/* Create the queues used by the com test task. */
|
||||||
pxPort->xRxedChars = xQueueCreate( uxBufferLength, ( unsigned portBASE_TYPE ) sizeof( portCHAR ) );
|
pxPort->xRxedChars = xQueueCreate( uxBufferLength, ( unsigned portBASE_TYPE ) sizeof( char ) );
|
||||||
pxPort->xCharsForTx = xQueueCreate( uxBufferLength, ( unsigned portBASE_TYPE ) sizeof( portCHAR ) );
|
pxPort->xCharsForTx = xQueueCreate( uxBufferLength, ( unsigned portBASE_TYPE ) sizeof( char ) );
|
||||||
|
|
||||||
/* Create the test semaphore. This does nothing useful except test a feature of the scheduler. */
|
/* Create the test semaphore. This does nothing useful except test a feature of the scheduler. */
|
||||||
vSemaphoreCreateBinary( pxPort->xTestSem );
|
vSemaphoreCreateBinary( pxPort->xTestSem );
|
||||||
|
|
||||||
/* There is no ISR here already to restore later. */
|
/* There is no ISR here already to restore later. */
|
||||||
_dos_setvect( ( portSHORT ) pxPort->usIRQVector, xISRs[ usPort ] );
|
_dos_setvect( ( short ) pxPort->usIRQVector, xISRs[ usPort ] );
|
||||||
|
|
||||||
usInWord = portINPUT_WORD( pxPort->usIntReg );
|
usInWord = portINPUT_WORD( pxPort->usIntReg );
|
||||||
usInWord &= ~serINTERRUPT_MASK;
|
usInWord &= ~serINTERRUPT_MASK;
|
||||||
|
@ -350,12 +351,12 @@ xComPortHandle pxPort = NULL;
|
||||||
} /*lint !e715 Some parameters are not used as only a subset of the serial port functionality is currently implemented. */
|
} /*lint !e715 Some parameters are not used as only a subset of the serial port functionality is currently implemented. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialPutString( xComPortHandle pxPort, const portCHAR * const pcString, unsigned portSHORT usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usByte;
|
unsigned short usByte;
|
||||||
portCHAR *pcNextChar;
|
char *pcNextChar;
|
||||||
|
|
||||||
pcNextChar = ( portCHAR * ) pcString;
|
pcNextChar = ( char * ) pcString;
|
||||||
|
|
||||||
for( usByte = 0; usByte < usStringLength; usByte++ )
|
for( usByte = 0; usByte < usStringLength; usByte++ )
|
||||||
{
|
{
|
||||||
|
@ -367,7 +368,7 @@ portCHAR *pcNextChar;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, portCHAR *pcRxedChar, portTickType xBlockTime )
|
portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Get the next character from the buffer, note that this routine is only
|
/* Get the next character from the buffer, note that this routine is only
|
||||||
called having checked that the is (at least) one to get */
|
called having checked that the is (at least) one to get */
|
||||||
|
@ -382,7 +383,7 @@ portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, portCHAR *pcRxedChar, portT
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, portCHAR cOutChar, portTickType xBlockTime )
|
portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
if( xQueueSend( pxPort->xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
|
if( xQueueSend( pxPort->xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
|
||||||
{
|
{
|
||||||
|
@ -407,7 +408,7 @@ const portTickType xBlockTime = ( portTickType ) 0xffff;
|
||||||
|
|
||||||
void vSerialClose( xComPortHandle xPort )
|
void vSerialClose( xComPortHandle xPort )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usOutput;
|
unsigned short usOutput;
|
||||||
|
|
||||||
/* Turn off the interrupts. We may also want to delete the queues and/or
|
/* Turn off the interrupts. We may also want to delete the queues and/or
|
||||||
re-install the original ISR. */
|
re-install the original ISR. */
|
||||||
|
@ -431,8 +432,8 @@ unsigned portSHORT usOutput;
|
||||||
|
|
||||||
static portBASE_TYPE xComPortISR( xComPort * const pxPort )
|
static portBASE_TYPE xComPortISR( xComPort * const pxPort )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usStatusRegister;
|
unsigned short usStatusRegister;
|
||||||
portCHAR cChar;
|
char cChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xContinue = pdTRUE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xContinue = pdTRUE;
|
||||||
|
|
||||||
/* NOTE: THIS IS NOT AN EFFICIENT ISR AS IT IS DESIGNED SOLELY TO TEST
|
/* NOTE: THIS IS NOT AN EFFICIENT ISR AS IT IS DESIGNED SOLELY TO TEST
|
||||||
|
@ -447,7 +448,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xContinue = pdTRUE;
|
||||||
|
|
||||||
if( usStatusRegister & serRX_READY )
|
if( usStatusRegister & serRX_READY )
|
||||||
{
|
{
|
||||||
cChar = ( portCHAR ) portINPUT_WORD( pxPort->usRxReg );
|
cChar = ( char ) portINPUT_WORD( pxPort->usRxReg );
|
||||||
xQueueSendFromISR( pxPort->xRxedChars, &cChar, &xHigherPriorityTaskWoken );
|
xQueueSendFromISR( pxPort->xRxedChars, &cChar, &xHigherPriorityTaskWoken );
|
||||||
|
|
||||||
/* Also release the semaphore - this does nothing interesting and is just a test. */
|
/* Also release the semaphore - this does nothing interesting and is just a test. */
|
||||||
|
@ -461,7 +462,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xContinue = pdTRUE;
|
||||||
{
|
{
|
||||||
if( xQueueReceiveFromISR( pxPort->xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )
|
if( xQueueReceiveFromISR( pxPort->xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )
|
||||||
{
|
{
|
||||||
portOUTPUT_WORD( pxPort->usTxReg, ( unsigned portSHORT ) cChar );
|
portOUTPUT_WORD( pxPort->usTxReg, ( unsigned short ) cChar );
|
||||||
|
|
||||||
/* We have performed an action this cycle - there may be others to perform. */
|
/* We have performed an action this cycle - there may be others to perform. */
|
||||||
xContinue = pdTRUE;
|
xContinue = pdTRUE;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -66,10 +67,10 @@
|
||||||
#define configUSE_PREEMPTION 1
|
#define configUSE_PREEMPTION 1
|
||||||
#define configUSE_IDLE_HOOK 0
|
#define configUSE_IDLE_HOOK 0
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 22118400 )
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 22118400 )
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 200 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 8 )
|
#define configMAX_TASK_NAME_LEN ( 8 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -59,17 +60,17 @@
|
||||||
*-----------------------------------------------------------*/
|
*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Value for the LED to be off. */
|
/* Value for the LED to be off. */
|
||||||
#define partstLED_OUTPUTS ( ( unsigned portCHAR ) 0xff )
|
#define partstLED_OUTPUTS ( ( unsigned char ) 0xff )
|
||||||
|
|
||||||
/* P2.0 is not used as an output so there are only 7 LEDs on port 2. */
|
/* P2.0 is not used as an output so there are only 7 LEDs on port 2. */
|
||||||
#define partstMAX_LEDs ( 7 )
|
#define partstMAX_LEDs ( 7 )
|
||||||
#define partstALL_OUTPUTS_OFF ( ( unsigned portCHAR ) 0 )
|
#define partstALL_OUTPUTS_OFF ( ( unsigned char ) 0 )
|
||||||
|
|
||||||
/* Maps the LED outputs used by the standard demo application files to
|
/* Maps the LED outputs used by the standard demo application files to
|
||||||
convenient outputs for the EDK2329. Mainly this insures that the LED
|
convenient outputs for the EDK2329. Mainly this insures that the LED
|
||||||
used by the Check task is one of the on board LEDs so the demo can be
|
used by the Check task is one of the on board LEDs so the demo can be
|
||||||
executed on an EDK without any modification. */
|
executed on an EDK without any modification. */
|
||||||
static inline unsigned portCHAR prvMapLED( unsigned portBASE_TYPE uxLED );
|
static inline unsigned char prvMapLED( unsigned portBASE_TYPE uxLED );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -85,17 +86,17 @@ void vParTestInitialise( void )
|
||||||
/*
|
/*
|
||||||
* Described at the top of the file.
|
* Described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static inline unsigned portCHAR prvMapLED( unsigned portBASE_TYPE uxLED )
|
static inline unsigned char prvMapLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
switch( uxLED )
|
switch( uxLED )
|
||||||
{
|
{
|
||||||
case 0 : return ( unsigned portCHAR ) 2;
|
case 0 : return ( unsigned char ) 2;
|
||||||
case 1 : return ( unsigned portCHAR ) 3;
|
case 1 : return ( unsigned char ) 3;
|
||||||
case 2 : return ( unsigned portCHAR ) 4;
|
case 2 : return ( unsigned char ) 4;
|
||||||
case 3 : return ( unsigned portCHAR ) 5;
|
case 3 : return ( unsigned char ) 5;
|
||||||
case 4 : return ( unsigned portCHAR ) 6;
|
case 4 : return ( unsigned char ) 6;
|
||||||
case 5 : return ( unsigned portCHAR ) 0;
|
case 5 : return ( unsigned char ) 0;
|
||||||
case 6 : return ( unsigned portCHAR ) 1;
|
case 6 : return ( unsigned char ) 1;
|
||||||
default : return 0;
|
default : return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,14 +107,14 @@ static inline unsigned portCHAR prvMapLED( unsigned portBASE_TYPE uxLED )
|
||||||
*/
|
*/
|
||||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucLED;
|
unsigned char ucLED;
|
||||||
|
|
||||||
if( uxLED < partstMAX_LEDs )
|
if( uxLED < partstMAX_LEDs )
|
||||||
{
|
{
|
||||||
ucLED = prvMapLED( uxLED );
|
ucLED = prvMapLED( uxLED );
|
||||||
|
|
||||||
/* Set a bit in the required LED position. LED 0 is bit 1. */
|
/* Set a bit in the required LED position. LED 0 is bit 1. */
|
||||||
ucLED = ( unsigned portCHAR ) 1 << ( ucLED + 1 );
|
ucLED = ( unsigned char ) 1 << ( ucLED + 1 );
|
||||||
|
|
||||||
if( xValue )
|
if( xValue )
|
||||||
{
|
{
|
||||||
|
@ -133,14 +134,14 @@ unsigned portCHAR ucLED;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucLED;
|
unsigned char ucLED;
|
||||||
|
|
||||||
if( uxLED < partstMAX_LEDs )
|
if( uxLED < partstMAX_LEDs )
|
||||||
{
|
{
|
||||||
ucLED = prvMapLED( uxLED );
|
ucLED = prvMapLED( uxLED );
|
||||||
|
|
||||||
/* Set a bit in the required LED position. LED 0 is bit 1. */
|
/* Set a bit in the required LED position. LED 0 is bit 1. */
|
||||||
ucLED = ( unsigned portCHAR ) 1 << ( ucLED + 1 );
|
ucLED = ( unsigned char ) 1 << ( ucLED + 1 );
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ tasks just use the idle priority. */
|
||||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
|
|
||||||
/* Baud rate used by the serial port tasks (ComTest tasks). */
|
/* Baud rate used by the serial port tasks (ComTest tasks). */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 115200 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 )
|
||||||
|
|
||||||
/* LED used by the serial port tasks. This is toggled on each character Tx,
|
/* LED used by the serial port tasks. This is toggled on each character Tx,
|
||||||
and mainCOM_TEST_LED + 1 is toggles on each character Rx. */
|
and mainCOM_TEST_LED + 1 is toggles on each character Rx. */
|
||||||
|
@ -114,7 +115,7 @@ the the toggle rate increases to mainERROR_CHECK_PERIOD. */
|
||||||
#define mainERROR_CHECK_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
#define mainERROR_CHECK_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
||||||
|
|
||||||
/* Constants used by the vMemCheckTask() task. */
|
/* Constants used by the vMemCheckTask() task. */
|
||||||
#define mainCOUNT_INITIAL_VALUE ( ( unsigned portLONG ) 0 )
|
#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 )
|
||||||
#define mainNO_TASK ( 0 )
|
#define mainNO_TASK ( 0 )
|
||||||
|
|
||||||
/* The size of the memory blocks allocated by the vMemCheckTask() task. */
|
/* The size of the memory blocks allocated by the vMemCheckTask() task. */
|
||||||
|
@ -130,7 +131,7 @@ static void vErrorChecks( void *pvParameters );
|
||||||
/*
|
/*
|
||||||
* Checks the unique counts of other tasks to ensure they are still operational.
|
* Checks the unique counts of other tasks to ensure they are still operational.
|
||||||
*/
|
*/
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( unsigned portLONG ulMemCheckTaskCount );
|
static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dynamically created and deleted during each cycle of the vErrorChecks()
|
* Dynamically created and deleted during each cycle of the vErrorChecks()
|
||||||
|
@ -160,7 +161,7 @@ int main( void )
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
|
|
||||||
/* Start the 'Check' task. */
|
/* Start the 'Check' task. */
|
||||||
xTaskCreate( vErrorChecks, ( signed portCHAR * )"Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vErrorChecks, ( signed char * )"Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
|
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
|
||||||
as 1 in portmacro.h. To use the cooperative scheduler define
|
as 1 in portmacro.h. To use the cooperative scheduler define
|
||||||
|
@ -188,7 +189,7 @@ int main( void )
|
||||||
static void vErrorChecks( void *pvParameters )
|
static void vErrorChecks( void *pvParameters )
|
||||||
{
|
{
|
||||||
portTickType xDelayPeriod = mainCHECK_PERIOD;
|
portTickType xDelayPeriod = mainCHECK_PERIOD;
|
||||||
volatile unsigned portLONG ulMemCheckTaskRunningCount;
|
volatile unsigned long ulMemCheckTaskRunningCount;
|
||||||
xTaskHandle xCreatedTask;
|
xTaskHandle xCreatedTask;
|
||||||
portTickType xLastWakeTime;
|
portTickType xLastWakeTime;
|
||||||
|
|
||||||
|
@ -205,7 +206,7 @@ portTickType xLastWakeTime;
|
||||||
/* Dynamically create a task - passing ulMemCheckTaskRunningCount as a
|
/* Dynamically create a task - passing ulMemCheckTaskRunningCount as a
|
||||||
parameter. */
|
parameter. */
|
||||||
xCreatedTask = mainNO_TASK;
|
xCreatedTask = mainNO_TASK;
|
||||||
if( xTaskCreate( vMemCheckTask, ( signed portCHAR * ) "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
if( xTaskCreate( vMemCheckTask, ( signed char * ) "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
||||||
{
|
{
|
||||||
/* Could not create the task - we have probably run out of heap. */
|
/* Could not create the task - we have probably run out of heap. */
|
||||||
xDelayPeriod = mainERROR_CHECK_PERIOD;
|
xDelayPeriod = mainERROR_CHECK_PERIOD;
|
||||||
|
@ -241,9 +242,9 @@ portTickType xLastWakeTime;
|
||||||
* Check each set of tasks in turn to see if they have experienced any
|
* Check each set of tasks in turn to see if they have experienced any
|
||||||
* error conditions.
|
* error conditions.
|
||||||
*/
|
*/
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( unsigned portLONG ulMemCheckTaskCount )
|
static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount )
|
||||||
{
|
{
|
||||||
portLONG lNoErrorsDiscovered = ( portLONG ) pdTRUE;
|
long lNoErrorsDiscovered = ( long ) pdTRUE;
|
||||||
|
|
||||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
|
@ -293,9 +294,9 @@ portLONG lNoErrorsDiscovered = ( portLONG ) pdTRUE;
|
||||||
|
|
||||||
static void vMemCheckTask( void *pvParameters )
|
static void vMemCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portLONG *pulMemCheckTaskRunningCounter;
|
unsigned long *pulMemCheckTaskRunningCounter;
|
||||||
void *pvMem1, *pvMem2, *pvMem3;
|
void *pvMem1, *pvMem2, *pvMem3;
|
||||||
static portLONG lErrorOccurred = pdFALSE;
|
static long lErrorOccurred = pdFALSE;
|
||||||
|
|
||||||
/* This task is dynamically created then deleted during each cycle of the
|
/* This task is dynamically created then deleted during each cycle of the
|
||||||
vErrorChecks task to check the operation of the memory allocator. Each time
|
vErrorChecks task to check the operation of the memory allocator. Each time
|
||||||
|
@ -308,7 +309,7 @@ static portLONG lErrorOccurred = pdFALSE;
|
||||||
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
||||||
vErrorChecks() task that this task is still executing without error. */
|
vErrorChecks() task that this task is still executing without error. */
|
||||||
|
|
||||||
pulMemCheckTaskRunningCounter = ( unsigned portLONG * ) pvParameters;
|
pulMemCheckTaskRunningCounter = ( unsigned long * ) pvParameters;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -69,10 +70,10 @@ static xQueueHandle xRxedChars;
|
||||||
static xQueueHandle xCharsForTx;
|
static xQueueHandle xCharsForTx;
|
||||||
|
|
||||||
/* Hardware specific constants. */
|
/* Hardware specific constants. */
|
||||||
#define serTX_INTERRUPT ( ( unsigned portCHAR ) 0x80 )
|
#define serTX_INTERRUPT ( ( unsigned char ) 0x80 )
|
||||||
#define serRX_INTERRUPT ( ( unsigned portCHAR ) 0x40 )
|
#define serRX_INTERRUPT ( ( unsigned char ) 0x40 )
|
||||||
#define serTX_ENABLE ( ( unsigned portCHAR ) 0x20 )
|
#define serTX_ENABLE ( ( unsigned char ) 0x20 )
|
||||||
#define serRX_ENABLE ( ( unsigned portCHAR ) 0x10 )
|
#define serRX_ENABLE ( ( unsigned char ) 0x10 )
|
||||||
|
|
||||||
/* Macros to turn on and off the serial port THRE interrupt while leaving the
|
/* Macros to turn on and off the serial port THRE interrupt while leaving the
|
||||||
other register bits in their correct state. The Rx interrupt is always
|
other register bits in their correct state. The Rx interrupt is always
|
||||||
|
@ -82,7 +83,7 @@ enabled. */
|
||||||
|
|
||||||
/* Bit used to switch on the channel 1 serial port in the module stop
|
/* Bit used to switch on the channel 1 serial port in the module stop
|
||||||
register. */
|
register. */
|
||||||
#define serMSTP6 ( ( unsigned portSHORT ) 0x0040 )
|
#define serMSTP6 ( ( unsigned short ) 0x0040 )
|
||||||
|
|
||||||
/* Interrupt service routines. Note that the Rx and Tx service routines can
|
/* Interrupt service routines. Note that the Rx and Tx service routines can
|
||||||
cause a context switch and are therefore defined with the saveall attribute in
|
cause a context switch and are therefore defined with the saveall attribute in
|
||||||
|
@ -97,12 +98,12 @@ void vCOM_1_Error_ISR( void ) __attribute__ ( ( interrupt_handler ) );
|
||||||
/*
|
/*
|
||||||
* Initialise port 1 for interrupt driven communications.
|
* Initialise port 1 for interrupt driven communications.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
/* Create the queues used to communicate between the tasks and the
|
/* Create the queues used to communicate between the tasks and the
|
||||||
interrupt service routines. */
|
interrupt service routines. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* No parity, 8 data bits and 1 stop bit is the default so does not require
|
/* No parity, 8 data bits and 1 stop bit is the default so does not require
|
||||||
configuration - setup the remains of the hardware. */
|
configuration - setup the remains of the hardware. */
|
||||||
|
@ -143,7 +144,7 @@ xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Get the next character from the buffer queue. Return false if no characters
|
/* Get the next character from the buffer queue. Return false if no characters
|
||||||
are available, or arrive before xBlockTime expires. */
|
are available, or arrive before xBlockTime expires. */
|
||||||
|
@ -158,7 +159,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn = pdPASS;
|
signed portBASE_TYPE xReturn = pdPASS;
|
||||||
|
|
||||||
|
@ -201,7 +202,7 @@ void vCOM_1_Rx_ISR( void )
|
||||||
|
|
||||||
/* As this is a switching ISR the local variables must be declared as
|
/* As this is a switching ISR the local variables must be declared as
|
||||||
static. */
|
static. */
|
||||||
static portCHAR cRxByte;
|
static char cRxByte;
|
||||||
static portBASE_TYPE xHigherPriorityTaskWoken;
|
static portBASE_TYPE xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
xHigherPriorityTaskWoken = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
@ -231,7 +232,7 @@ void vCOM_1_Tx_ISR( void )
|
||||||
|
|
||||||
/* As this is a switching ISR the local variables must be declared as
|
/* As this is a switching ISR the local variables must be declared as
|
||||||
static. */
|
static. */
|
||||||
static portCHAR cTxByte;
|
static char cTxByte;
|
||||||
static signed portBASE_TYPE xTaskWokenByTx;
|
static signed portBASE_TYPE xTaskWokenByTx;
|
||||||
|
|
||||||
/* This variable is static so must be explicitly reinitialised each
|
/* This variable is static so must be explicitly reinitialised each
|
||||||
|
@ -269,7 +270,7 @@ void vCOM_1_Tx_ISR( void )
|
||||||
*/
|
*/
|
||||||
void vCOM_1_Error_ISR( void )
|
void vCOM_1_Error_ISR( void )
|
||||||
{
|
{
|
||||||
volatile unsigned portCHAR ucIn;
|
volatile unsigned char ucIn;
|
||||||
|
|
||||||
ucIn = SSR1;
|
ucIn = SSR1;
|
||||||
SSR1 = 0;
|
SSR1 = 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ model. */
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 80 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10240 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10240 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 1 )
|
#define configMAX_TASK_NAME_LEN ( 1 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
@ -87,7 +88,7 @@ model. */
|
||||||
This port is a bit different in that hardware setup uses the code generated by
|
This port is a bit different in that hardware setup uses the code generated by
|
||||||
the Processor Expert, making this definition obsolete.
|
the Processor Expert, making this definition obsolete.
|
||||||
|
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 25000000 )
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 25000000 )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -26,8 +26,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -110,10 +111,10 @@ then the toggle rate increases to mainERROR_CHECK_PERIOD. */
|
||||||
#define mainERROR_CHECK_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
#define mainERROR_CHECK_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
||||||
|
|
||||||
/* The constants used in the idle task calculation. */
|
/* The constants used in the idle task calculation. */
|
||||||
#define intgCONST1 ( ( portLONG ) 123 )
|
#define intgCONST1 ( ( long ) 123 )
|
||||||
#define intgCONST2 ( ( portLONG ) 234567 )
|
#define intgCONST2 ( ( long ) 234567 )
|
||||||
#define intgCONST3 ( ( portLONG ) -3 )
|
#define intgCONST3 ( ( long ) -3 )
|
||||||
#define intgCONST4 ( ( portLONG ) 7 )
|
#define intgCONST4 ( ( long ) 7 )
|
||||||
#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
|
#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ download this value must be one of the following:
|
||||||
1 to configure for 19200 baud.
|
1 to configure for 19200 baud.
|
||||||
2 to configure for 9600 baud.
|
2 to configure for 9600 baud.
|
||||||
3 to configure for 4800 baud. */
|
3 to configure for 4800 baud. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 2 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 2 )
|
||||||
|
|
||||||
/* LED used by the serial port tasks. This is toggled on each character Tx,
|
/* LED used by the serial port tasks. This is toggled on each character Tx,
|
||||||
and mainCOM_TEST_LED + 1 is toggles on each character Rx. */
|
and mainCOM_TEST_LED + 1 is toggles on each character Rx. */
|
||||||
|
@ -150,7 +151,7 @@ void vApplicationIdleHook( void );
|
||||||
/*
|
/*
|
||||||
* Checks the unique counts of other tasks to ensure they are still operational.
|
* Checks the unique counts of other tasks to ensure they are still operational.
|
||||||
*/
|
*/
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void );
|
static long prvCheckOtherTasksAreStillRunning( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,7 +226,7 @@ portTickType xLastWakeTime;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void )
|
static long prvCheckOtherTasksAreStillRunning( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xAllTasksPassed = pdPASS;
|
portBASE_TYPE xAllTasksPassed = pdPASS;
|
||||||
|
|
||||||
|
@ -273,7 +274,7 @@ void vApplicationIdleHook( void )
|
||||||
{
|
{
|
||||||
/* This variable is effectively set to a constant so it is made volatile to
|
/* This variable is effectively set to a constant so it is made volatile to
|
||||||
ensure the compiler does not just get rid of it. */
|
ensure the compiler does not just get rid of it. */
|
||||||
volatile portLONG lValue;
|
volatile long lValue;
|
||||||
|
|
||||||
/* Keep performing a calculation and checking the result against a constant. */
|
/* Keep performing a calculation and checking the result against a constant. */
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -78,22 +79,22 @@ static xQueueHandle xCharsForTx;
|
||||||
/*
|
/*
|
||||||
* Initialise port for interrupt driven communications.
|
* Initialise port for interrupt driven communications.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
/* Hardware setup is performed by the Processor Expert generated code.
|
/* Hardware setup is performed by the Processor Expert generated code.
|
||||||
This function just creates the queues used to communicate between the
|
This function just creates the queues used to communicate between the
|
||||||
interrupt code and the task code - then sets the required baud rate. */
|
interrupt code and the task code - then sets the required baud rate. */
|
||||||
|
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
COM0_SetBaudRateMode( ( portCHAR ) ulWantedBaud );
|
COM0_SetBaudRateMode( ( char ) ulWantedBaud );
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Get the next character from the buffer queue. Return false if no characters
|
/* Get the next character from the buffer queue. Return false if no characters
|
||||||
are available, or arrive before xBlockTime expires. */
|
are available, or arrive before xBlockTime expires. */
|
||||||
|
@ -108,7 +109,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Place the character in the queue of characters to be transmitted. */
|
/* Place the character in the queue of characters to be transmitted. */
|
||||||
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
|
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
|
||||||
|
@ -143,7 +144,7 @@ void vSerialClose( xComPortHandle xPort )
|
||||||
|
|
||||||
__interrupt void vCOM0_ISR( void )
|
__interrupt void vCOM0_ISR( void )
|
||||||
{
|
{
|
||||||
volatile unsigned portCHAR ucByte, ucStatus;
|
volatile unsigned char ucByte, ucStatus;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* What caused the interrupt? */
|
/* What caused the interrupt? */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 70 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2048 - 256 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2048 - 256 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 1 )
|
#define configMAX_TASK_NAME_LEN ( 1 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
This port is a bit different in that hardware setup uses the code generated by
|
This port is a bit different in that hardware setup uses the code generated by
|
||||||
the Processor Expert, making this definition obsolete.
|
the Processor Expert, making this definition obsolete.
|
||||||
|
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 24000000 )
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 24000000 )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -140,10 +141,10 @@ then the toggle rate increases to mainERROR_CHECK_PERIOD. */
|
||||||
#define mainBUTTON_PUSH_LED ( 5 )
|
#define mainBUTTON_PUSH_LED ( 5 )
|
||||||
|
|
||||||
/* The constants used in the idle task calculation. */
|
/* The constants used in the idle task calculation. */
|
||||||
#define intgCONST1 ( ( portLONG ) 123 )
|
#define intgCONST1 ( ( long ) 123 )
|
||||||
#define intgCONST2 ( ( portLONG ) 234567 )
|
#define intgCONST2 ( ( long ) 234567 )
|
||||||
#define intgCONST3 ( ( portLONG ) -3 )
|
#define intgCONST3 ( ( long ) -3 )
|
||||||
#define intgCONST4 ( ( portLONG ) 7 )
|
#define intgCONST4 ( ( long ) 7 )
|
||||||
#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
|
#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
|
||||||
|
|
||||||
/* The length of the queue between is button push ISR and the Button Push task
|
/* The length of the queue between is button push ISR and the Button Push task
|
||||||
|
@ -173,7 +174,7 @@ void vApplicationIdleHook( void );
|
||||||
/*
|
/*
|
||||||
* Checks the unique counts of other tasks to ensure they are still operational.
|
* Checks the unique counts of other tasks to ensure they are still operational.
|
||||||
*/
|
*/
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void );
|
static long prvCheckOtherTasksAreStillRunning( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,7 +248,7 @@ portTickType xLastWakeTime;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void )
|
static long prvCheckOtherTasksAreStillRunning( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xAllTasksPassed = pdPASS;
|
portBASE_TYPE xAllTasksPassed = pdPASS;
|
||||||
|
|
||||||
|
@ -275,7 +276,7 @@ void vApplicationIdleHook( void )
|
||||||
{
|
{
|
||||||
/* This variable is effectively set to a constant so it is made volatile to
|
/* This variable is effectively set to a constant so it is made volatile to
|
||||||
ensure the compiler does not just get rid of it. */
|
ensure the compiler does not just get rid of it. */
|
||||||
volatile portLONG lValue;
|
volatile long lValue;
|
||||||
|
|
||||||
/* Keep performing a calculation and checking the result against a constant. */
|
/* Keep performing a calculation and checking the result against a constant. */
|
||||||
for( ;; )
|
for( ;; )
|
||||||
|
@ -353,7 +354,7 @@ unsigned portBASE_TYPE uxExpected = 1, uxReceived;
|
||||||
void interrupt vButtonPush( void )
|
void interrupt vButtonPush( void )
|
||||||
{
|
{
|
||||||
static unsigned portBASE_TYPE uxValToSend = 0;
|
static unsigned portBASE_TYPE uxValToSend = 0;
|
||||||
static unsigned portLONG xHigherPriorityTaskWoken;
|
static unsigned long xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
xHigherPriorityTaskWoken = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -66,19 +67,19 @@ to represent an optimised solution. */
|
||||||
/*
|
/*
|
||||||
* Initialise port 1 for interrupt driven communications.
|
* Initialise port 1 for interrupt driven communications.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
return pdFALSE;
|
return pdFALSE;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn = pdPASS;
|
signed portBASE_TYPE xReturn = pdPASS;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ model. */
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 977 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 977 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 300/*128*/ )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 300/*128*/ )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10752 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10752 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 3 )
|
#define configMAX_TASK_NAME_LEN ( 3 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
@ -89,7 +90,7 @@ model. */
|
||||||
/* This parameter is normally affects the clock frequency. In this port, at the moment
|
/* This parameter is normally affects the clock frequency. In this port, at the moment
|
||||||
it might just be used for reference. */
|
it might just be used for reference. */
|
||||||
|
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 24000000 )
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 24000000 )
|
||||||
|
|
||||||
/* Set the following definitions to 1 to include the API function, or zero
|
/* Set the following definitions to 1 to include the API function, or zero
|
||||||
to exclude the API function. */
|
to exclude the API function. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -26,8 +26,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -113,10 +114,10 @@ then the toggle rate increases to mainERROR_CHECK_PERIOD. */
|
||||||
#define mainERROR_CHECK_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
#define mainERROR_CHECK_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
||||||
|
|
||||||
/* The constants used in the idle task calculation. */
|
/* The constants used in the idle task calculation. */
|
||||||
#define intgCONST1 ( ( portLONG ) 123 )
|
#define intgCONST1 ( ( long ) 123 )
|
||||||
#define intgCONST2 ( ( portLONG ) 234567 )
|
#define intgCONST2 ( ( long ) 234567 )
|
||||||
#define intgCONST3 ( ( portLONG ) -3 )
|
#define intgCONST3 ( ( long ) -3 )
|
||||||
#define intgCONST4 ( ( portLONG ) 7 )
|
#define intgCONST4 ( ( long ) 7 )
|
||||||
#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
|
#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +130,7 @@ download this value must be one of the following:
|
||||||
1 to configure for 19200 baud.
|
1 to configure for 19200 baud.
|
||||||
2 to configure for 9600 baud.
|
2 to configure for 9600 baud.
|
||||||
3 to configure for 4800 baud. */
|
3 to configure for 4800 baud. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 2 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 2 )
|
||||||
|
|
||||||
/* LED used by the serial port tasks. This is toggled on each character Tx,
|
/* LED used by the serial port tasks. This is toggled on each character Tx,
|
||||||
and mainCOM_TEST_LED + 1 is toggles on each character Rx. */
|
and mainCOM_TEST_LED + 1 is toggles on each character Rx. */
|
||||||
|
@ -153,7 +154,7 @@ void ATTR_BANK0 vApplicationIdleHook( void );
|
||||||
/*
|
/*
|
||||||
* Checks the unique counts of other tasks to ensure they are still operational.
|
* Checks the unique counts of other tasks to ensure they are still operational.
|
||||||
*/
|
*/
|
||||||
static portLONG ATTR_BANK0 prvCheckOtherTasksAreStillRunning( void );
|
static long ATTR_BANK0 prvCheckOtherTasksAreStillRunning( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,7 +228,7 @@ portTickType xLastWakeTime;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void )
|
static long prvCheckOtherTasksAreStillRunning( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xAllTasksPassed = pdPASS;
|
portBASE_TYPE xAllTasksPassed = pdPASS;
|
||||||
|
|
||||||
|
@ -275,7 +276,7 @@ void vApplicationIdleHook( void )
|
||||||
{
|
{
|
||||||
/* This variable is effectively set to a constant so it is made volatile to
|
/* This variable is effectively set to a constant so it is made volatile to
|
||||||
ensure the compiler does not just get rid of it. */
|
ensure the compiler does not just get rid of it. */
|
||||||
volatile portLONG lValue;
|
volatile long lValue;
|
||||||
|
|
||||||
/* Keep performing a calculation and checking the result against a constant. */
|
/* Keep performing a calculation and checking the result against a constant. */
|
||||||
|
|
||||||
|
|
|
@ -37,22 +37,22 @@ static xQueueHandle xCharsForTx;
|
||||||
/*
|
/*
|
||||||
* Initialise port for interrupt driven communications.
|
* Initialise port for interrupt driven communications.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
/* Hardware setup is performed by the Processor Expert generated code.
|
/* Hardware setup is performed by the Processor Expert generated code.
|
||||||
This function just creates the queues used to communicate between the
|
This function just creates the queues used to communicate between the
|
||||||
interrupt code and the task code - then sets the required baud rate. */
|
interrupt code and the task code - then sets the required baud rate. */
|
||||||
|
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
SCI_SetBaudRateMode( ( portCHAR ) ulWantedBaud );
|
SCI_SetBaudRateMode( ( char ) ulWantedBaud );
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Get the next character from the buffer queue. Return false if no characters
|
/* Get the next character from the buffer queue. Return false if no characters
|
||||||
are available, or arrive before xBlockTime expires. */
|
are available, or arrive before xBlockTime expires. */
|
||||||
|
@ -67,7 +67,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Place the character in the queue of characters to be transmitted. */
|
/* Place the character in the queue of characters to be transmitted. */
|
||||||
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
|
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
|
||||||
|
@ -102,7 +102,7 @@ void ATTR_INT ATTR_NEAR vCOM_ISR( void );
|
||||||
|
|
||||||
void vCOM_ISR( void )
|
void vCOM_ISR( void )
|
||||||
{
|
{
|
||||||
volatile unsigned portCHAR ucByte, ucStatus;
|
volatile unsigned char ucByte, ucStatus;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* What caused the interrupt? */
|
/* What caused the interrupt? */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@
|
||||||
#define configUSE_IDLE_HOOK 1
|
#define configUSE_IDLE_HOOK 1
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 25000000 ) /* Fosc / 2 */
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 25000000 ) /* Fosc / 2 */
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
||||||
#define configMINIMAL_STACK_SIZE ( 105 )
|
#define configMINIMAL_STACK_SIZE ( 105 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) 5120 )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) 5120 )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ typedef struct
|
||||||
portTickType xMinDisplayTime;
|
portTickType xMinDisplayTime;
|
||||||
|
|
||||||
/* A pointer to the string to be displayed. */
|
/* A pointer to the string to be displayed. */
|
||||||
portCHAR *pcMessage;
|
char *pcMessage;
|
||||||
|
|
||||||
} xLCDMessage;
|
} xLCDMessage;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ interrupt test" interrupt. */
|
||||||
#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( configCPU_CLOCK_HZ / mainTEST_INTERRUPT_FREQUENCY )
|
#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( configCPU_CLOCK_HZ / mainTEST_INTERRUPT_FREQUENCY )
|
||||||
|
|
||||||
/* The number of nano seconds between each processor clock. */
|
/* The number of nano seconds between each processor clock. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portSHORT ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned short ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* Dimension the buffer used to hold the value of the maximum jitter time when
|
/* Dimension the buffer used to hold the value of the maximum jitter time when
|
||||||
it is converted to a string. */
|
it is converted to a string. */
|
||||||
|
@ -166,7 +167,7 @@ int main( void )
|
||||||
vCreateBlockTimeTasks();
|
vCreateBlockTimeTasks();
|
||||||
|
|
||||||
/* Create the test tasks defined within this file. */
|
/* Create the test tasks defined within this file. */
|
||||||
xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", mainCHECK_TAKS_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vCheckTask, ( signed char * ) "Check", mainCHECK_TAKS_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the task that will control the LCD. This returns the handle
|
/* Start the task that will control the LCD. This returns the handle
|
||||||
to the queue used to write text out to the task. */
|
to the queue used to write text out to the task. */
|
||||||
|
@ -196,10 +197,10 @@ static void vCheckTask( void *pvParameters )
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
|
|
||||||
/* The maximum jitter time measured by the fast interrupt test. */
|
/* The maximum jitter time measured by the fast interrupt test. */
|
||||||
extern unsigned portSHORT usMaxJitter ;
|
extern unsigned short usMaxJitter ;
|
||||||
|
|
||||||
/* Buffer into which the maximum jitter time is written as a string. */
|
/* Buffer into which the maximum jitter time is written as a string. */
|
||||||
static portCHAR cStringBuffer[ mainMAX_STRING_LENGTH ];
|
static char cStringBuffer[ mainMAX_STRING_LENGTH ];
|
||||||
|
|
||||||
/* The message that is sent on the queue to the LCD task. The first
|
/* The message that is sent on the queue to the LCD task. The first
|
||||||
parameter is the minimum time (in ticks) that the message should be
|
parameter is the minimum time (in ticks) that the message should be
|
||||||
|
@ -208,7 +209,7 @@ to the message to display itself. */
|
||||||
xLCDMessage xMessage = { 0, cStringBuffer };
|
xLCDMessage xMessage = { 0, cStringBuffer };
|
||||||
|
|
||||||
/* Set to pdTRUE should an error be detected in any of the standard demo tasks. */
|
/* Set to pdTRUE should an error be detected in any of the standard demo tasks. */
|
||||||
unsigned portSHORT usErrorDetected = pdFALSE;
|
unsigned short usErrorDetected = pdFALSE;
|
||||||
|
|
||||||
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
||||||
works correctly. */
|
works correctly. */
|
||||||
|
@ -249,7 +250,7 @@ unsigned portSHORT usErrorDetected = pdFALSE;
|
||||||
{
|
{
|
||||||
/* No errors have been discovered, so display the maximum jitter
|
/* No errors have been discovered, so display the maximum jitter
|
||||||
timer discovered by the "fast interrupt test". */
|
timer discovered by the "fast interrupt test". */
|
||||||
sprintf( cStringBuffer, "%dns max jitter", ( portSHORT ) ( usMaxJitter - mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ) * mainNS_PER_CLOCK );
|
sprintf( cStringBuffer, "%dns max jitter", ( short ) ( usMaxJitter - mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ) * mainNS_PER_CLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the message to the LCD gatekeeper for display. */
|
/* Send the message to the LCD gatekeeper for display. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -93,13 +94,13 @@ static xQueueHandle xCharsForTx;
|
||||||
static portBASE_TYPE xTxHasEnded;
|
static portBASE_TYPE xTxHasEnded;
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
portCHAR cChar;
|
char cChar;
|
||||||
|
|
||||||
/* Create the queues used by the com test task. */
|
/* Create the queues used by the com test task. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* Setup the UART. */
|
/* Setup the UART. */
|
||||||
U2MODEbits.BRGH = serLOW_SPEED;
|
U2MODEbits.BRGH = serLOW_SPEED;
|
||||||
|
@ -113,7 +114,7 @@ portCHAR cChar;
|
||||||
U2MODEbits.USIDL = serCONTINUE_IN_IDLE_MODE;
|
U2MODEbits.USIDL = serCONTINUE_IN_IDLE_MODE;
|
||||||
U2MODEbits.UARTEN = serUART_ENABLED;
|
U2MODEbits.UARTEN = serUART_ENABLED;
|
||||||
|
|
||||||
U2BRG = (unsigned portSHORT)(( (float)configCPU_CLOCK_HZ / ( (float)16 * (float)ulWantedBaud ) ) - (float)0.5);
|
U2BRG = (unsigned short)(( (float)configCPU_CLOCK_HZ / ( (float)16 * (float)ulWantedBaud ) ) - (float)0.5);
|
||||||
|
|
||||||
U2STAbits.URXISEL = serINTERRUPT_ON_SINGLE_CHAR;
|
U2STAbits.URXISEL = serINTERRUPT_ON_SINGLE_CHAR;
|
||||||
U2STAbits.UTXEN = serTX_ENABLE;
|
U2STAbits.UTXEN = serTX_ENABLE;
|
||||||
|
@ -145,7 +146,7 @@ portCHAR cChar;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Only one port is supported. */
|
/* Only one port is supported. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -163,7 +164,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Only one port is supported. */
|
/* Only one port is supported. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -193,7 +194,7 @@ void vSerialClose( xComPortHandle xPort )
|
||||||
|
|
||||||
void __attribute__((__interrupt__, auto_psv)) _U2RXInterrupt( void )
|
void __attribute__((__interrupt__, auto_psv)) _U2RXInterrupt( void )
|
||||||
{
|
{
|
||||||
portCHAR cChar;
|
char cChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Get the character and post it on the queue of Rxed characters.
|
/* Get the character and post it on the queue of Rxed characters.
|
||||||
|
@ -215,7 +216,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
void __attribute__((__interrupt__, auto_psv)) _U2TXInterrupt( void )
|
void __attribute__((__interrupt__, auto_psv)) _U2TXInterrupt( void )
|
||||||
{
|
{
|
||||||
signed portCHAR cChar;
|
signed char cChar;
|
||||||
portBASE_TYPE xTaskWoken = pdFALSE;
|
portBASE_TYPE xTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* If the transmit buffer is full we cannot get the next character.
|
/* If the transmit buffer is full we cannot get the next character.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
#define TIMER_TEST_H
|
#define TIMER_TEST_H
|
||||||
|
|
||||||
/* Setup the high frequency timer interrupt. */
|
/* Setup the high frequency timer interrupt. */
|
||||||
void vSetupTimerTest( unsigned portSHORT usFrequencyHz );
|
void vSetupTimerTest( unsigned short usFrequencyHz );
|
||||||
|
|
||||||
#endif /* TIMER_TEST_H */
|
#endif /* TIMER_TEST_H */
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
#define configPBA_CLOCK_HZ ( 24000000 )
|
#define configPBA_CLOCK_HZ ( 24000000 )
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 8 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 8 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 256 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 )
|
||||||
/* configTOTAL_HEAP_SIZE is not used when heap_3.c is used. */
|
/* configTOTAL_HEAP_SIZE is not used when heap_3.c is used. */
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024*25 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024*25 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 20 )
|
#define configMAX_TASK_NAME_LEN ( 20 )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -123,11 +124,11 @@ static void vProcessConnection( struct netconn *pxNetCon );
|
||||||
|
|
||||||
static void vProcessConnection( struct netconn *pxNetCon )
|
static void vProcessConnection( struct netconn *pxNetCon )
|
||||||
{
|
{
|
||||||
static portCHAR cDynamicPage[ webMAX_PAGE_SIZE ], cPageHits[ 11 ];
|
static char cDynamicPage[ webMAX_PAGE_SIZE ], cPageHits[ 11 ];
|
||||||
struct netbuf *pxRxBuffer;
|
struct netbuf *pxRxBuffer;
|
||||||
portCHAR *pcRxString;
|
char *pcRxString;
|
||||||
unsigned portSHORT usLength;
|
unsigned short usLength;
|
||||||
static unsigned portLONG ulPageHits = 0;
|
static unsigned long ulPageHits = 0;
|
||||||
|
|
||||||
/* We expect to immediately get data. */
|
/* We expect to immediately get data. */
|
||||||
pxRxBuffer = netconn_recv( pxNetCon );
|
pxRxBuffer = netconn_recv( pxNetCon );
|
||||||
|
@ -157,7 +158,7 @@ static unsigned portLONG ulPageHits = 0;
|
||||||
strcat( cDynamicPage, cPageHits );
|
strcat( cDynamicPage, cPageHits );
|
||||||
strcat( cDynamicPage, "<p><pre>Task State Priority Stack #<br>************************************************<br>" );
|
strcat( cDynamicPage, "<p><pre>Task State Priority Stack #<br>************************************************<br>" );
|
||||||
/* ... Then the list of tasks and their status... */
|
/* ... Then the list of tasks and their status... */
|
||||||
vTaskList( ( signed portCHAR * ) cDynamicPage + strlen( cDynamicPage ) );
|
vTaskList( ( signed char * ) cDynamicPage + strlen( cDynamicPage ) );
|
||||||
/* ... Finally the page footer. */
|
/* ... Finally the page footer. */
|
||||||
strcat( cDynamicPage, webHTML_END );
|
strcat( cDynamicPage, webHTML_END );
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -102,15 +103,15 @@ to use an MII interface. */
|
||||||
/* The buffer addresses written into the descriptors must be aligned so the
|
/* The buffer addresses written into the descriptors must be aligned so the
|
||||||
last few bits are zero. These bits have special meaning for the EMAC
|
last few bits are zero. These bits have special meaning for the EMAC
|
||||||
peripheral and cannot be used as part of the address. */
|
peripheral and cannot be used as part of the address. */
|
||||||
#define emacADDRESS_MASK ( ( unsigned portLONG ) 0xFFFFFFFC )
|
#define emacADDRESS_MASK ( ( unsigned long ) 0xFFFFFFFC )
|
||||||
|
|
||||||
/* Bit used within the address stored in the descriptor to mark the last
|
/* Bit used within the address stored in the descriptor to mark the last
|
||||||
descriptor in the array. */
|
descriptor in the array. */
|
||||||
#define emacRX_WRAP_BIT ( ( unsigned portLONG ) 0x02 )
|
#define emacRX_WRAP_BIT ( ( unsigned long ) 0x02 )
|
||||||
|
|
||||||
/* Bit used within the Tx descriptor status to indicate whether the
|
/* Bit used within the Tx descriptor status to indicate whether the
|
||||||
descriptor is under the control of the EMAC or the software. */
|
descriptor is under the control of the EMAC or the software. */
|
||||||
#define emacTX_BUF_USED ( ( unsigned portLONG ) 0x80000000 )
|
#define emacTX_BUF_USED ( ( unsigned long ) 0x80000000 )
|
||||||
|
|
||||||
/* A short delay is used to wait for a buffer to become available, should
|
/* A short delay is used to wait for a buffer to become available, should
|
||||||
one not be immediately available when trying to transmit a frame. */
|
one not be immediately available when trying to transmit a frame. */
|
||||||
|
@ -121,32 +122,32 @@ one not be immediately available when trying to transmit a frame. */
|
||||||
#define emacBLOCK_TIME_WAITING_FOR_INPUT ( ( portTickType ) 100 )
|
#define emacBLOCK_TIME_WAITING_FOR_INPUT ( ( portTickType ) 100 )
|
||||||
|
|
||||||
/* Peripheral setup for the EMAC. */
|
/* Peripheral setup for the EMAC. */
|
||||||
#define emacPERIPHERAL_A_SETUP ( ( unsigned portLONG ) AT91C_PB2_ETX0 ) | \
|
#define emacPERIPHERAL_A_SETUP ( ( unsigned long ) AT91C_PB2_ETX0 ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB12_ETXER ) | \
|
( ( unsigned long ) AT91C_PB12_ETXER ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB16_ECOL ) | \
|
( ( unsigned long ) AT91C_PB16_ECOL ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB11_ETX3 ) | \
|
( ( unsigned long ) AT91C_PB11_ETX3 ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB6_ERX1 ) | \
|
( ( unsigned long ) AT91C_PB6_ERX1 ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB15_ERXDV ) | \
|
( ( unsigned long ) AT91C_PB15_ERXDV ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB13_ERX2 ) | \
|
( ( unsigned long ) AT91C_PB13_ERX2 ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB3_ETX1 ) | \
|
( ( unsigned long ) AT91C_PB3_ETX1 ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB8_EMDC ) | \
|
( ( unsigned long ) AT91C_PB8_EMDC ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB5_ERX0 ) | \
|
( ( unsigned long ) AT91C_PB5_ERX0 ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB14_ERX3 ) | \
|
( ( unsigned long ) AT91C_PB14_ERX3 ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB4_ECRS_ECRSDV ) | \
|
( ( unsigned long ) AT91C_PB4_ECRS_ECRSDV ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB1_ETXEN ) | \
|
( ( unsigned long ) AT91C_PB1_ETXEN ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB10_ETX2 ) | \
|
( ( unsigned long ) AT91C_PB10_ETX2 ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB0_ETXCK_EREFCK ) | \
|
( ( unsigned long ) AT91C_PB0_ETXCK_EREFCK ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB9_EMDIO ) | \
|
( ( unsigned long ) AT91C_PB9_EMDIO ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB7_ERXER ) | \
|
( ( unsigned long ) AT91C_PB7_ERXER ) | \
|
||||||
( ( unsigned portLONG ) AT91C_PB17_ERXCK );
|
( ( unsigned long ) AT91C_PB17_ERXCK );
|
||||||
|
|
||||||
/* Misc defines. */
|
/* Misc defines. */
|
||||||
#define emacINTERRUPT_LEVEL ( 5 )
|
#define emacINTERRUPT_LEVEL ( 5 )
|
||||||
#define emacNO_DELAY ( 0 )
|
#define emacNO_DELAY ( 0 )
|
||||||
#define emacTOTAL_FRAME_HEADER_SIZE ( 54 )
|
#define emacTOTAL_FRAME_HEADER_SIZE ( 54 )
|
||||||
#define emacPHY_INIT_DELAY ( 5000 / portTICK_RATE_MS )
|
#define emacPHY_INIT_DELAY ( 5000 / portTICK_RATE_MS )
|
||||||
#define emacRESET_KEY ( ( unsigned portLONG ) 0xA5000000 )
|
#define emacRESET_KEY ( ( unsigned long ) 0xA5000000 )
|
||||||
#define emacRESET_LENGTH ( ( unsigned portLONG ) ( 0x01 << 8 ) )
|
#define emacRESET_LENGTH ( ( unsigned long ) ( 0x01 << 8 ) )
|
||||||
|
|
||||||
/* The Atmel header file only defines the TX frame length mask. */
|
/* The Atmel header file only defines the TX frame length mask. */
|
||||||
#define emacRX_LENGTH_FRAME ( 0xfff )
|
#define emacRX_LENGTH_FRAME ( 0xfff )
|
||||||
|
@ -155,11 +156,11 @@ one not be immediately available when trying to transmit a frame. */
|
||||||
|
|
||||||
/* Buffer written to by the EMAC DMA. Must be aligned as described by the
|
/* Buffer written to by the EMAC DMA. Must be aligned as described by the
|
||||||
comment above the emacADDRESS_MASK definition. */
|
comment above the emacADDRESS_MASK definition. */
|
||||||
static volatile portCHAR pcRxBuffer[ NB_RX_BUFFERS * ETH_RX_BUFFER_SIZE ] __attribute__ ((aligned (8)));
|
static volatile char pcRxBuffer[ NB_RX_BUFFERS * ETH_RX_BUFFER_SIZE ] __attribute__ ((aligned (8)));
|
||||||
|
|
||||||
/* Buffer read by the EMAC DMA. Must be aligned as described by the comment
|
/* Buffer read by the EMAC DMA. Must be aligned as described by the comment
|
||||||
above the emacADDRESS_MASK definition. */
|
above the emacADDRESS_MASK definition. */
|
||||||
static portCHAR pcTxBuffer[ NB_TX_BUFFERS * ETH_TX_BUFFER_SIZE ] __attribute__ ((aligned (8)));
|
static char pcTxBuffer[ NB_TX_BUFFERS * ETH_TX_BUFFER_SIZE ] __attribute__ ((aligned (8)));
|
||||||
|
|
||||||
/* Descriptors used to communicate between the program and the EMAC peripheral.
|
/* Descriptors used to communicate between the program and the EMAC peripheral.
|
||||||
These descriptors hold the locations and state of the Rx and Tx buffers. */
|
These descriptors hold the locations and state of the Rx and Tx buffers. */
|
||||||
|
@ -167,7 +168,7 @@ static volatile AT91S_TxTdDescriptor xTxDescriptors[ NB_TX_BUFFERS ];
|
||||||
static volatile AT91S_RxTdDescriptor xRxDescriptors[ NB_RX_BUFFERS ];
|
static volatile AT91S_RxTdDescriptor xRxDescriptors[ NB_RX_BUFFERS ];
|
||||||
|
|
||||||
/* The IP and Ethernet addresses are read from the header files. */
|
/* The IP and Ethernet addresses are read from the header files. */
|
||||||
const portCHAR cMACAddress[ 6 ] = { emacETHADDR0, emacETHADDR1, emacETHADDR2, emacETHADDR3, emacETHADDR4, emacETHADDR5 };
|
const char cMACAddress[ 6 ] = { emacETHADDR0, emacETHADDR1, emacETHADDR2, emacETHADDR3, emacETHADDR4, emacETHADDR5 };
|
||||||
const unsigned char ucIPAddress[ 4 ] = { emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 };
|
const unsigned char ucIPAddress[ 4 ] = { emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 };
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -197,11 +198,11 @@ static void prvSetupEMACInterrupt( void );
|
||||||
/*
|
/*
|
||||||
* Some initialisation functions taken from the Atmel EMAC sample code.
|
* Some initialisation functions taken from the Atmel EMAC sample code.
|
||||||
*/
|
*/
|
||||||
static void vReadPHY( unsigned portCHAR ucPHYAddress, unsigned portCHAR ucAddress, unsigned portLONG *pulValue );
|
static void vReadPHY( unsigned char ucPHYAddress, unsigned char ucAddress, unsigned long *pulValue );
|
||||||
static portBASE_TYPE xGetLinkSpeed( void );
|
static portBASE_TYPE xGetLinkSpeed( void );
|
||||||
static portBASE_TYPE prvProbePHY( void );
|
static portBASE_TYPE prvProbePHY( void );
|
||||||
#if USE_RMII_INTERFACE != 1
|
#if USE_RMII_INTERFACE != 1
|
||||||
static void vWritePHY( unsigned portCHAR ucPHYAddress, unsigned portCHAR ucAddress, unsigned portLONG ulValue);
|
static void vWritePHY( unsigned char ucPHYAddress, unsigned char ucAddress, unsigned long ulValue);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,18 +210,18 @@ static portBASE_TYPE prvProbePHY( void );
|
||||||
static xSemaphoreHandle xSemaphore = NULL;
|
static xSemaphoreHandle xSemaphore = NULL;
|
||||||
|
|
||||||
/* Holds the index to the next buffer from which data will be read. */
|
/* Holds the index to the next buffer from which data will be read. */
|
||||||
static volatile unsigned portLONG ulNextRxBuffer = 0;
|
static volatile unsigned long ulNextRxBuffer = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* See the header file for descriptions of public functions. */
|
/* See the header file for descriptions of public functions. */
|
||||||
portLONG lEMACSend( portCHAR *pcFrom, unsigned portLONG ulLength, portLONG lEndOfFrame )
|
long lEMACSend( char *pcFrom, unsigned long ulLength, long lEndOfFrame )
|
||||||
{
|
{
|
||||||
static unsigned portBASE_TYPE uxTxBufferIndex = 0;
|
static unsigned portBASE_TYPE uxTxBufferIndex = 0;
|
||||||
portBASE_TYPE xWaitCycles = 0;
|
portBASE_TYPE xWaitCycles = 0;
|
||||||
portLONG lReturn = pdPASS;
|
long lReturn = pdPASS;
|
||||||
portCHAR *pcBuffer;
|
char *pcBuffer;
|
||||||
unsigned portLONG ulLastBuffer, ulDataBuffered = 0, ulDataRemainingToSend, ulLengthToSend;
|
unsigned long ulLastBuffer, ulDataBuffered = 0, ulDataRemainingToSend, ulLengthToSend;
|
||||||
|
|
||||||
/* If the length of data to be transmitted is greater than each individual
|
/* If the length of data to be transmitted is greater than each individual
|
||||||
transmit buffer then the data will be split into more than one buffer.
|
transmit buffer then the data will be split into more than one buffer.
|
||||||
|
@ -252,7 +253,7 @@ unsigned portLONG ulLastBuffer, ulDataBuffered = 0, ulDataRemainingToSend, ulLen
|
||||||
{
|
{
|
||||||
/* Get the address of the buffer from the descriptor, then copy
|
/* Get the address of the buffer from the descriptor, then copy
|
||||||
the data into the buffer. */
|
the data into the buffer. */
|
||||||
pcBuffer = ( portCHAR * ) xTxDescriptors[ uxTxBufferIndex ].addr;
|
pcBuffer = ( char * ) xTxDescriptors[ uxTxBufferIndex ].addr;
|
||||||
|
|
||||||
/* How much can we write to the buffer? */
|
/* How much can we write to the buffer? */
|
||||||
ulDataRemainingToSend = ulLength - ulDataBuffered;
|
ulDataRemainingToSend = ulLength - ulDataBuffered;
|
||||||
|
@ -288,14 +289,14 @@ unsigned portLONG ulLastBuffer, ulDataBuffered = 0, ulDataRemainingToSend, ulLen
|
||||||
then move to the next descriptor, wrapping if necessary. */
|
then move to the next descriptor, wrapping if necessary. */
|
||||||
if( uxTxBufferIndex >= ( NB_TX_BUFFERS - 1 ) )
|
if( uxTxBufferIndex >= ( NB_TX_BUFFERS - 1 ) )
|
||||||
{
|
{
|
||||||
xTxDescriptors[ uxTxBufferIndex ].U_Status.status = ( ulLengthToSend & ( unsigned portLONG ) AT91C_LENGTH_FRAME )
|
xTxDescriptors[ uxTxBufferIndex ].U_Status.status = ( ulLengthToSend & ( unsigned long ) AT91C_LENGTH_FRAME )
|
||||||
| ulLastBuffer
|
| ulLastBuffer
|
||||||
| AT91C_TRANSMIT_WRAP;
|
| AT91C_TRANSMIT_WRAP;
|
||||||
uxTxBufferIndex = 0;
|
uxTxBufferIndex = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xTxDescriptors[ uxTxBufferIndex ].U_Status.status = ( ulLengthToSend & ( unsigned portLONG ) AT91C_LENGTH_FRAME )
|
xTxDescriptors[ uxTxBufferIndex ].U_Status.status = ( ulLengthToSend & ( unsigned long ) AT91C_LENGTH_FRAME )
|
||||||
| ulLastBuffer;
|
| ulLastBuffer;
|
||||||
uxTxBufferIndex++;
|
uxTxBufferIndex++;
|
||||||
}
|
}
|
||||||
|
@ -320,9 +321,9 @@ unsigned portLONG ulLastBuffer, ulDataBuffered = 0, ulDataRemainingToSend, ulLen
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* See the header file for descriptions of public functions. */
|
/* See the header file for descriptions of public functions. */
|
||||||
unsigned portLONG ulEMACInputLength( void )
|
unsigned long ulEMACInputLength( void )
|
||||||
{
|
{
|
||||||
register unsigned portLONG ulIndex, ulLength = 0;
|
register unsigned long ulIndex, ulLength = 0;
|
||||||
|
|
||||||
/* Skip any fragments. We are looking for the first buffer that contains
|
/* Skip any fragments. We are looking for the first buffer that contains
|
||||||
data and has the SOF (start of frame) bit set. */
|
data and has the SOF (start of frame) bit set. */
|
||||||
|
@ -361,11 +362,11 @@ register unsigned portLONG ulIndex, ulLength = 0;
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* See the header file for descriptions of public functions. */
|
/* See the header file for descriptions of public functions. */
|
||||||
void vEMACRead( portCHAR *pcTo, unsigned portLONG ulSectionLength, unsigned portLONG ulTotalFrameLength )
|
void vEMACRead( char *pcTo, unsigned long ulSectionLength, unsigned long ulTotalFrameLength )
|
||||||
{
|
{
|
||||||
static unsigned portLONG ulSectionBytesReadSoFar = 0, ulBufferPosition = 0, ulFameBytesReadSoFar = 0;
|
static unsigned long ulSectionBytesReadSoFar = 0, ulBufferPosition = 0, ulFameBytesReadSoFar = 0;
|
||||||
static portCHAR *pcSource;
|
static char *pcSource;
|
||||||
register unsigned portLONG ulBytesRemainingInBuffer, ulRemainingSectionBytes;
|
register unsigned long ulBytesRemainingInBuffer, ulRemainingSectionBytes;
|
||||||
|
|
||||||
/* Read ulSectionLength bytes from the Rx buffers. This is not necessarily any
|
/* Read ulSectionLength bytes from the Rx buffers. This is not necessarily any
|
||||||
correspondence between the length of our Rx buffers, and the length of the
|
correspondence between the length of our Rx buffers, and the length of the
|
||||||
|
@ -390,9 +391,9 @@ register unsigned portLONG ulBytesRemainingInBuffer, ulRemainingSectionBytes;
|
||||||
than one buffer. */
|
than one buffer. */
|
||||||
|
|
||||||
/* Reset our state variables ready for the next read from this buffer. */
|
/* Reset our state variables ready for the next read from this buffer. */
|
||||||
pcSource = ( portCHAR * )( xRxDescriptors[ ulNextRxBuffer ].addr & emacADDRESS_MASK );
|
pcSource = ( char * )( xRxDescriptors[ ulNextRxBuffer ].addr & emacADDRESS_MASK );
|
||||||
ulFameBytesReadSoFar = ( unsigned portLONG ) 0;
|
ulFameBytesReadSoFar = ( unsigned long ) 0;
|
||||||
ulBufferPosition = ( unsigned portLONG ) 0;
|
ulBufferPosition = ( unsigned long ) 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -425,12 +426,12 @@ register unsigned portLONG ulBytesRemainingInBuffer, ulRemainingSectionBytes;
|
||||||
ulNextRxBuffer++;
|
ulNextRxBuffer++;
|
||||||
if( ulNextRxBuffer >= NB_RX_BUFFERS )
|
if( ulNextRxBuffer >= NB_RX_BUFFERS )
|
||||||
{
|
{
|
||||||
ulNextRxBuffer = ( unsigned portLONG ) 0;
|
ulNextRxBuffer = ( unsigned long ) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the variables for the new buffer. */
|
/* Reset the variables for the new buffer. */
|
||||||
pcSource = ( portCHAR * )( xRxDescriptors[ ulNextRxBuffer ].addr & emacADDRESS_MASK );
|
pcSource = ( char * )( xRxDescriptors[ ulNextRxBuffer ].addr & emacADDRESS_MASK );
|
||||||
ulBufferPosition = ( unsigned portLONG ) 0;
|
ulBufferPosition = ( unsigned long ) 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -457,7 +458,7 @@ register unsigned portLONG ulBytesRemainingInBuffer, ulRemainingSectionBytes;
|
||||||
ulNextRxBuffer = 0;
|
ulNextRxBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pcSource = ( portCHAR * )( xRxDescriptors[ ulNextRxBuffer ].addr & emacADDRESS_MASK );
|
pcSource = ( char * )( xRxDescriptors[ ulNextRxBuffer ].addr & emacADDRESS_MASK );
|
||||||
ulBufferPosition = 0;
|
ulBufferPosition = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -514,7 +515,7 @@ xSemaphoreHandle xEMACInit( void )
|
||||||
/* PHY configuration. */
|
/* PHY configuration. */
|
||||||
#if USE_RMII_INTERFACE != 1
|
#if USE_RMII_INTERFACE != 1
|
||||||
{
|
{
|
||||||
unsigned portLONG ulControl;
|
unsigned long ulControl;
|
||||||
|
|
||||||
/* PHY has internal pull down : disable MII isolate. */
|
/* PHY has internal pull down : disable MII isolate. */
|
||||||
vReadPHY( AT91C_PHY_ADDR, MII_BMCR, &ulControl );
|
vReadPHY( AT91C_PHY_ADDR, MII_BMCR, &ulControl );
|
||||||
|
@ -600,13 +601,13 @@ static unsigned portBASE_TYPE uxNextBufferToClear = 0;
|
||||||
static void prvSetupDescriptors(void)
|
static void prvSetupDescriptors(void)
|
||||||
{
|
{
|
||||||
unsigned portBASE_TYPE xIndex;
|
unsigned portBASE_TYPE xIndex;
|
||||||
unsigned portLONG ulAddress;
|
unsigned long ulAddress;
|
||||||
|
|
||||||
/* Initialise xRxDescriptors descriptor. */
|
/* Initialise xRxDescriptors descriptor. */
|
||||||
for( xIndex = 0; xIndex < NB_RX_BUFFERS; ++xIndex )
|
for( xIndex = 0; xIndex < NB_RX_BUFFERS; ++xIndex )
|
||||||
{
|
{
|
||||||
/* Calculate the address of the nth buffer within the array. */
|
/* Calculate the address of the nth buffer within the array. */
|
||||||
ulAddress = ( unsigned portLONG )( pcRxBuffer + ( xIndex * ETH_RX_BUFFER_SIZE ) );
|
ulAddress = ( unsigned long )( pcRxBuffer + ( xIndex * ETH_RX_BUFFER_SIZE ) );
|
||||||
|
|
||||||
/* Write the buffer address into the descriptor. The DMA will place
|
/* Write the buffer address into the descriptor. The DMA will place
|
||||||
the data at this address when this descriptor is being used. Mask off
|
the data at this address when this descriptor is being used. Mask off
|
||||||
|
@ -622,7 +623,7 @@ unsigned portLONG ulAddress;
|
||||||
for( xIndex = 0; xIndex < NB_TX_BUFFERS; ++xIndex )
|
for( xIndex = 0; xIndex < NB_TX_BUFFERS; ++xIndex )
|
||||||
{
|
{
|
||||||
/* Calculate the address of the nth buffer within the array. */
|
/* Calculate the address of the nth buffer within the array. */
|
||||||
ulAddress = ( unsigned portLONG )( pcTxBuffer + ( xIndex * ETH_TX_BUFFER_SIZE ) );
|
ulAddress = ( unsigned long )( pcTxBuffer + ( xIndex * ETH_TX_BUFFER_SIZE ) );
|
||||||
|
|
||||||
/* Write the buffer address into the descriptor. The DMA will read
|
/* Write the buffer address into the descriptor. The DMA will read
|
||||||
data from here when the descriptor is being used. */
|
data from here when the descriptor is being used. */
|
||||||
|
@ -635,8 +636,8 @@ unsigned portLONG ulAddress;
|
||||||
xTxDescriptors[ NB_TX_BUFFERS - 1 ].U_Status.status = AT91C_TRANSMIT_WRAP | AT91C_TRANSMIT_OK;
|
xTxDescriptors[ NB_TX_BUFFERS - 1 ].U_Status.status = AT91C_TRANSMIT_WRAP | AT91C_TRANSMIT_OK;
|
||||||
|
|
||||||
/* Tell the EMAC where to find the descriptors. */
|
/* Tell the EMAC where to find the descriptors. */
|
||||||
AT91C_BASE_EMAC->EMAC_RBQP = ( unsigned portLONG ) xRxDescriptors;
|
AT91C_BASE_EMAC->EMAC_RBQP = ( unsigned long ) xRxDescriptors;
|
||||||
AT91C_BASE_EMAC->EMAC_TBQP = ( unsigned portLONG ) xTxDescriptors;
|
AT91C_BASE_EMAC->EMAC_TBQP = ( unsigned long ) xTxDescriptors;
|
||||||
|
|
||||||
/* Clear all the bits in the receive status register. */
|
/* Clear all the bits in the receive status register. */
|
||||||
AT91C_BASE_EMAC->EMAC_RSR = ( AT91C_EMAC_OVR | AT91C_EMAC_REC | AT91C_EMAC_BNA );
|
AT91C_BASE_EMAC->EMAC_RSR = ( AT91C_EMAC_OVR | AT91C_EMAC_REC | AT91C_EMAC_BNA );
|
||||||
|
@ -653,12 +654,12 @@ unsigned portLONG ulAddress;
|
||||||
static void prvSetupMACAddress( void )
|
static void prvSetupMACAddress( void )
|
||||||
{
|
{
|
||||||
/* Must be written SA1L then SA1H. */
|
/* Must be written SA1L then SA1H. */
|
||||||
AT91C_BASE_EMAC->EMAC_SA1L = ( ( unsigned portLONG ) cMACAddress[ 3 ] << 24 ) |
|
AT91C_BASE_EMAC->EMAC_SA1L = ( ( unsigned long ) cMACAddress[ 3 ] << 24 ) |
|
||||||
( ( unsigned portLONG ) cMACAddress[ 2 ] << 16 ) |
|
( ( unsigned long ) cMACAddress[ 2 ] << 16 ) |
|
||||||
( ( unsigned portLONG ) cMACAddress[ 1 ] << 8 ) |
|
( ( unsigned long ) cMACAddress[ 1 ] << 8 ) |
|
||||||
cMACAddress[ 0 ];
|
cMACAddress[ 0 ];
|
||||||
|
|
||||||
AT91C_BASE_EMAC->EMAC_SA1H = ( ( unsigned portLONG ) cMACAddress[ 5 ] << 8 ) |
|
AT91C_BASE_EMAC->EMAC_SA1H = ( ( unsigned long ) cMACAddress[ 5 ] << 8 ) |
|
||||||
cMACAddress[ 4 ];
|
cMACAddress[ 4 ];
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -697,7 +698,7 @@ static void prvSetupEMACInterrupt( void )
|
||||||
|
|
||||||
static portBASE_TYPE prvProbePHY( void )
|
static portBASE_TYPE prvProbePHY( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulPHYId1, ulPHYId2, ulStatus;
|
unsigned long ulPHYId1, ulPHYId2, ulStatus;
|
||||||
portBASE_TYPE xReturn = pdPASS;
|
portBASE_TYPE xReturn = pdPASS;
|
||||||
|
|
||||||
/* Code supplied by Atmel (reformatted) -----------------*/
|
/* Code supplied by Atmel (reformatted) -----------------*/
|
||||||
|
@ -740,7 +741,7 @@ portBASE_TYPE xReturn = pdPASS;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vReadPHY( unsigned portCHAR ucPHYAddress, unsigned portCHAR ucAddress, unsigned portLONG *pulValue )
|
static void vReadPHY( unsigned char ucPHYAddress, unsigned char ucAddress, unsigned long *pulValue )
|
||||||
{
|
{
|
||||||
/* Code supplied by Atmel (reformatted) ----------------------*/
|
/* Code supplied by Atmel (reformatted) ----------------------*/
|
||||||
|
|
||||||
|
@ -762,7 +763,7 @@ static void vReadPHY( unsigned portCHAR ucPHYAddress, unsigned portCHAR ucAddres
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if USE_RMII_INTERFACE != 1
|
#if USE_RMII_INTERFACE != 1
|
||||||
static void vWritePHY( unsigned portCHAR ucPHYAddress, unsigned portCHAR ucAddress, unsigned portLONG ulValue )
|
static void vWritePHY( unsigned char ucPHYAddress, unsigned char ucAddress, unsigned long ulValue )
|
||||||
{
|
{
|
||||||
/* Code supplied by Atmel (reformatted) ----------------------*/
|
/* Code supplied by Atmel (reformatted) ----------------------*/
|
||||||
|
|
||||||
|
@ -785,7 +786,7 @@ static void vWritePHY( unsigned portCHAR ucPHYAddress, unsigned portCHAR ucAddre
|
||||||
|
|
||||||
static portBASE_TYPE xGetLinkSpeed( void )
|
static portBASE_TYPE xGetLinkSpeed( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulBMSR, ulBMCR, ulLPA, ulMACCfg, ulSpeed, ulDuplex;
|
unsigned long ulBMSR, ulBMCR, ulLPA, ulMACCfg, ulSpeed, ulDuplex;
|
||||||
|
|
||||||
/* Code supplied by Atmel (reformatted) -----------------*/
|
/* Code supplied by Atmel (reformatted) -----------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ xSemaphoreHandle xEMACInit( void );
|
||||||
* If lEndOfFrame is true then the data being copied is the end of the frame
|
* If lEndOfFrame is true then the data being copied is the end of the frame
|
||||||
* and the frame can be transmitted.
|
* and the frame can be transmitted.
|
||||||
*/
|
*/
|
||||||
portLONG lEMACSend( portCHAR *pcFrom, unsigned portLONG ulLength, portLONG lEndOfFrame );
|
long lEMACSend( char *pcFrom, unsigned long ulLength, long lEndOfFrame );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Frames can be read from the EMAC in multiple sections.
|
* Frames can be read from the EMAC in multiple sections.
|
||||||
|
@ -104,7 +105,7 @@ portLONG lEMACSend( portCHAR *pcFrom, unsigned portLONG ulLength, portLONG lEndO
|
||||||
* will be repetedly called until the sum of all the ulSectionLenths totals
|
* will be repetedly called until the sum of all the ulSectionLenths totals
|
||||||
* the value of ulTotalFrameLength.
|
* the value of ulTotalFrameLength.
|
||||||
*/
|
*/
|
||||||
void vEMACRead( portCHAR *pcTo, unsigned portLONG ulSectionLength, unsigned portLONG ulTotalFrameLength );
|
void vEMACRead( char *pcTo, unsigned long ulSectionLength, unsigned long ulTotalFrameLength );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The EMAC driver and interrupt service routines are defined in different
|
* The EMAC driver and interrupt service routines are defined in different
|
||||||
|
@ -130,6 +131,6 @@ void vEMACWaitForInput( void );
|
||||||
/*
|
/*
|
||||||
* Return the length of the next frame in the receive buffers.
|
* Return the length of the next frame in the receive buffers.
|
||||||
*/
|
*/
|
||||||
unsigned portLONG ulEMACInputLength( void );
|
unsigned long ulEMACInputLength( void );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ void vEMACISR_Handler( void );
|
||||||
*/
|
*/
|
||||||
void vEMACISR_Handler( void )
|
void vEMACISR_Handler( void )
|
||||||
{
|
{
|
||||||
volatile unsigned portLONG ulIntStatus, ulEventStatus;
|
volatile unsigned long ulIntStatus, ulEventStatus;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
extern void vClearEMACTxBuffer( void );
|
extern void vClearEMACTxBuffer( void );
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -67,10 +68,10 @@
|
||||||
#define configUSE_PREEMPTION 1
|
#define configUSE_PREEMPTION 1
|
||||||
#define configUSE_IDLE_HOOK 1
|
#define configUSE_IDLE_HOOK 1
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 47923200 )
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 47923200 )
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 110 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 110 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) 22000 )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) 22000 )
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
#define configUSE_TRACE_FACILITY 1
|
#define configUSE_TRACE_FACILITY 1
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@
|
||||||
* Simple parallel port IO routines for the LED's. LED's can be set, cleared
|
* Simple parallel port IO routines for the LED's. LED's can be set, cleared
|
||||||
* or toggled.
|
* or toggled.
|
||||||
*-----------------------------------------------------------*/
|
*-----------------------------------------------------------*/
|
||||||
const unsigned portLONG ulLED_MASK[ NB_LED ]= { LED1, LED2, LED3, LED4 };
|
const unsigned long ulLED_MASK[ NB_LED ]= { LED1, LED2, LED3, LED4 };
|
||||||
|
|
||||||
void vParTestInitialise( void )
|
void vParTestInitialise( void )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ static void prvHandleStandardEndPointRequest( xUSB_REQUEST *pxRequest );
|
||||||
static void prvHandleClassInterfaceRequest( xUSB_REQUEST *pxRequest );
|
static void prvHandleClassInterfaceRequest( xUSB_REQUEST *pxRequest );
|
||||||
|
|
||||||
/* Prepare control data transfer. prvSendNextSegment starts transfer. */
|
/* Prepare control data transfer. prvSendNextSegment starts transfer. */
|
||||||
static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT usRequestedLength, unsigned portLONG ulLengthLeftToSend, portLONG lSendingDescriptor );
|
static void prvSendControlData( unsigned char *pucData, unsigned short usRequestedLength, unsigned long ulLengthLeftToSend, long lSendingDescriptor );
|
||||||
|
|
||||||
/* Send next segment of data for the control transfer */
|
/* Send next segment of data for the control transfer */
|
||||||
static void prvSendNextSegment( void );
|
static void prvSendNextSegment( void );
|
||||||
|
@ -116,8 +117,8 @@ static void prvGetStandardInterfaceDescriptor( xUSB_REQUEST *pxRequest );
|
||||||
/*------------------------------------------------------------*/
|
/*------------------------------------------------------------*/
|
||||||
|
|
||||||
/* File scope static variables */
|
/* File scope static variables */
|
||||||
static unsigned portCHAR ucUSBConfig = ( unsigned portCHAR ) 0;
|
static unsigned char ucUSBConfig = ( unsigned char ) 0;
|
||||||
static unsigned portLONG ulReceivedAddress = ( unsigned portLONG ) 0;
|
static unsigned long ulReceivedAddress = ( unsigned long ) 0;
|
||||||
static eDRIVER_STATE eDriverState = eNOTHING;
|
static eDRIVER_STATE eDriverState = eNOTHING;
|
||||||
|
|
||||||
/* Incoming and outgoing control data structures */
|
/* Incoming and outgoing control data structures */
|
||||||
|
@ -133,10 +134,10 @@ static xQueueHandle xRxCDC;
|
||||||
static xQueueHandle xTxCDC;
|
static xQueueHandle xTxCDC;
|
||||||
|
|
||||||
/* Line coding - 115,200 baud, N-8-1 */
|
/* Line coding - 115,200 baud, N-8-1 */
|
||||||
static const unsigned portCHAR pxLineCoding[] = { 0x00, 0xC2, 0x01, 0x00, 0x00, 0x00, 0x08 };
|
static const unsigned char pxLineCoding[] = { 0x00, 0xC2, 0x01, 0x00, 0x00, 0x00, 0x08 };
|
||||||
|
|
||||||
/* Status variables. */
|
/* Status variables. */
|
||||||
static unsigned portCHAR ucControlState;
|
static unsigned char ucControlState;
|
||||||
static unsigned int uiCurrentBank;
|
static unsigned int uiCurrentBank;
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,9 +147,9 @@ static unsigned int uiCurrentBank;
|
||||||
void vUSBCDCTask( void *pvParameters )
|
void vUSBCDCTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xISRStatus *pxMessage;
|
xISRStatus *pxMessage;
|
||||||
unsigned portLONG ulStatus;
|
unsigned long ulStatus;
|
||||||
unsigned portLONG ulRxBytes;
|
unsigned long ulRxBytes;
|
||||||
unsigned portCHAR ucByte;
|
unsigned char ucByte;
|
||||||
portBASE_TYPE xByte;
|
portBASE_TYPE xByte;
|
||||||
|
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
|
@ -251,7 +252,7 @@ portBASE_TYPE xByte;
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------*/
|
/*------------------------------------------------------------*/
|
||||||
|
|
||||||
void vUSBSendByte( portCHAR cByte )
|
void vUSBSendByte( char cByte )
|
||||||
{
|
{
|
||||||
/* Queue the byte to be sent. The USB task will send it. */
|
/* Queue the byte to be sent. The USB task will send it. */
|
||||||
xQueueSend( xTxCDC, &cByte, usbNO_BLOCK );
|
xQueueSend( xTxCDC, &cByte, usbNO_BLOCK );
|
||||||
|
@ -260,7 +261,7 @@ void vUSBSendByte( portCHAR cByte )
|
||||||
|
|
||||||
static void prvSendZLP( void )
|
static void prvSendZLP( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulStatus;
|
unsigned long ulStatus;
|
||||||
|
|
||||||
/* Wait until the FIFO is free - even though we are not going to use it.
|
/* Wait until the FIFO is free - even though we are not going to use it.
|
||||||
THERE IS NO TIMEOUT HERE! */
|
THERE IS NO TIMEOUT HERE! */
|
||||||
|
@ -285,7 +286,7 @@ unsigned portLONG ulStatus;
|
||||||
|
|
||||||
static void prvSendStall( void )
|
static void prvSendStall( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulStatus;
|
unsigned long ulStatus;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
|
@ -300,14 +301,14 @@ static void prvSendStall( void )
|
||||||
|
|
||||||
static void prvResetEndPoints( void )
|
static void prvResetEndPoints( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulTemp;
|
unsigned long ulTemp;
|
||||||
|
|
||||||
eDriverState = eJUST_RESET;
|
eDriverState = eJUST_RESET;
|
||||||
ucControlState = 0;
|
ucControlState = 0;
|
||||||
|
|
||||||
/* Reset all the end points. */
|
/* Reset all the end points. */
|
||||||
AT91C_BASE_UDP->UDP_RSTEP = usbEND_POINT_RESET_MASK;
|
AT91C_BASE_UDP->UDP_RSTEP = usbEND_POINT_RESET_MASK;
|
||||||
AT91C_BASE_UDP->UDP_RSTEP = ( unsigned portLONG ) 0x00;
|
AT91C_BASE_UDP->UDP_RSTEP = ( unsigned long ) 0x00;
|
||||||
|
|
||||||
/* Enable data to be sent and received. */
|
/* Enable data to be sent and received. */
|
||||||
AT91C_BASE_UDP->UDP_FADDR = AT91C_UDP_FEN;
|
AT91C_BASE_UDP->UDP_FADDR = AT91C_UDP_FEN;
|
||||||
|
@ -316,7 +317,7 @@ unsigned portLONG ulTemp;
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ];
|
ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ];
|
||||||
usbCSR_SET_BIT( &ulTemp, ( ( unsigned portLONG ) ( AT91C_UDP_EPEDS | AT91C_UDP_EPTYPE_CTRL ) ) );
|
usbCSR_SET_BIT( &ulTemp, ( ( unsigned long ) ( AT91C_UDP_EPEDS | AT91C_UDP_EPTYPE_CTRL ) ) );
|
||||||
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulTemp;
|
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulTemp;
|
||||||
AT91C_BASE_UDP->UDP_IER = AT91C_UDP_EPINT0;
|
AT91C_BASE_UDP->UDP_IER = AT91C_UDP_EPINT0;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +329,7 @@ unsigned portLONG ulTemp;
|
||||||
static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
|
static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
|
||||||
{
|
{
|
||||||
static xUSB_REQUEST xRequest;
|
static xUSB_REQUEST xRequest;
|
||||||
unsigned portLONG ulRxBytes;
|
unsigned long ulRxBytes;
|
||||||
|
|
||||||
/* Get number of bytes received, if any */
|
/* Get number of bytes received, if any */
|
||||||
ulRxBytes = pxMessage->ulCSR0 >> 16;
|
ulRxBytes = pxMessage->ulCSR0 >> 16;
|
||||||
|
@ -351,7 +352,7 @@ unsigned portLONG ulRxBytes;
|
||||||
/* Set up endpoints */
|
/* Set up endpoints */
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
unsigned portLONG ulTemp;
|
unsigned long ulTemp;
|
||||||
|
|
||||||
/* Set endpoint 1 to bulk-out */
|
/* Set endpoint 1 to bulk-out */
|
||||||
ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ];
|
ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ];
|
||||||
|
@ -377,7 +378,7 @@ unsigned portLONG ulRxBytes;
|
||||||
{
|
{
|
||||||
/* We sent an acknowledgement of a SET_ADDRESS request. Move
|
/* We sent an acknowledgement of a SET_ADDRESS request. Move
|
||||||
to the addressed state. */
|
to the addressed state. */
|
||||||
if( ulReceivedAddress != ( unsigned portLONG ) 0 )
|
if( ulReceivedAddress != ( unsigned long ) 0 )
|
||||||
{
|
{
|
||||||
AT91C_BASE_UDP->UDP_GLBSTATE = AT91C_UDP_FADDEN;
|
AT91C_BASE_UDP->UDP_GLBSTATE = AT91C_UDP_FADDEN;
|
||||||
}
|
}
|
||||||
|
@ -400,7 +401,7 @@ unsigned portLONG ulRxBytes;
|
||||||
if( pxMessage->ulCSR0 & AT91C_UDP_RX_DATA_BK0 )
|
if( pxMessage->ulCSR0 & AT91C_UDP_RX_DATA_BK0 )
|
||||||
{
|
{
|
||||||
/* Received a control data packet. May be a 0-length ACK or a data stage. */
|
/* Received a control data packet. May be a 0-length ACK or a data stage. */
|
||||||
unsigned portCHAR ucBytesToGet;
|
unsigned char ucBytesToGet;
|
||||||
|
|
||||||
/* Got data. Cancel any outgoing data. */
|
/* Got data. Cancel any outgoing data. */
|
||||||
pxControlTx.ulNextCharIndex = pxControlTx.ulTotalDataLength;
|
pxControlTx.ulNextCharIndex = pxControlTx.ulTotalDataLength;
|
||||||
|
@ -470,7 +471,7 @@ unsigned portLONG ulRxBytes;
|
||||||
if( ( pxMessage->ulCSR0 & ( AT91C_UDP_RX_DATA_BK0 | AT91C_UDP_RXSETUP ) )
|
if( ( pxMessage->ulCSR0 & ( AT91C_UDP_RX_DATA_BK0 | AT91C_UDP_RXSETUP ) )
|
||||||
&& ( pxControlRx.ulNextCharIndex >= pxControlRx.ulTotalDataLength ) )
|
&& ( pxControlRx.ulNextCharIndex >= pxControlRx.ulTotalDataLength ) )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucRequest;
|
unsigned char ucRequest;
|
||||||
|
|
||||||
/* Manipulate the ucRequestType and the ucRequest parameters to
|
/* Manipulate the ucRequestType and the ucRequest parameters to
|
||||||
generate a zero based request selection. This is just done to
|
generate a zero based request selection. This is just done to
|
||||||
|
@ -515,11 +516,11 @@ static void prvGetStandardDeviceDescriptor( xUSB_REQUEST *pxRequest )
|
||||||
switch( ( pxRequest->usValue & 0xff00 ) >> 8 )
|
switch( ( pxRequest->usValue & 0xff00 ) >> 8 )
|
||||||
{
|
{
|
||||||
case usbDESCRIPTOR_TYPE_DEVICE:
|
case usbDESCRIPTOR_TYPE_DEVICE:
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &pxDeviceDescriptor, pxRequest->usLength, sizeof( pxDeviceDescriptor ), pdTRUE );
|
prvSendControlData( ( unsigned char * ) &pxDeviceDescriptor, pxRequest->usLength, sizeof( pxDeviceDescriptor ), pdTRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbDESCRIPTOR_TYPE_CONFIGURATION:
|
case usbDESCRIPTOR_TYPE_CONFIGURATION:
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &( pxConfigDescriptor ), pxRequest->usLength, sizeof( pxConfigDescriptor ), pdTRUE );
|
prvSendControlData( ( unsigned char * ) &( pxConfigDescriptor ), pxRequest->usLength, sizeof( pxConfigDescriptor ), pdTRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbDESCRIPTOR_TYPE_STRING:
|
case usbDESCRIPTOR_TYPE_STRING:
|
||||||
|
@ -528,23 +529,23 @@ static void prvGetStandardDeviceDescriptor( xUSB_REQUEST *pxRequest )
|
||||||
switch( pxRequest->usValue & 0xff )
|
switch( pxRequest->usValue & 0xff )
|
||||||
{
|
{
|
||||||
case usbLANGUAGE_STRING:
|
case usbLANGUAGE_STRING:
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &pxLanguageStringDescriptor, pxRequest->usLength, sizeof(pxLanguageStringDescriptor), pdTRUE );
|
prvSendControlData( ( unsigned char * ) &pxLanguageStringDescriptor, pxRequest->usLength, sizeof(pxLanguageStringDescriptor), pdTRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbMANUFACTURER_STRING:
|
case usbMANUFACTURER_STRING:
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &pxManufacturerStringDescriptor, pxRequest->usLength, sizeof( pxManufacturerStringDescriptor ), pdTRUE );
|
prvSendControlData( ( unsigned char * ) &pxManufacturerStringDescriptor, pxRequest->usLength, sizeof( pxManufacturerStringDescriptor ), pdTRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbPRODUCT_STRING:
|
case usbPRODUCT_STRING:
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &pxProductStringDescriptor, pxRequest->usLength, sizeof( pxProductStringDescriptor ), pdTRUE );
|
prvSendControlData( ( unsigned char * ) &pxProductStringDescriptor, pxRequest->usLength, sizeof( pxProductStringDescriptor ), pdTRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbCONFIGURATION_STRING:
|
case usbCONFIGURATION_STRING:
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &pxConfigurationStringDescriptor, pxRequest->usLength, sizeof( pxConfigurationStringDescriptor ), pdTRUE );
|
prvSendControlData( ( unsigned char * ) &pxConfigurationStringDescriptor, pxRequest->usLength, sizeof( pxConfigurationStringDescriptor ), pdTRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbINTERFACE_STRING:
|
case usbINTERFACE_STRING:
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &pxInterfaceStringDescriptor, pxRequest->usLength, sizeof( pxInterfaceStringDescriptor ), pdTRUE );
|
prvSendControlData( ( unsigned char * ) &pxInterfaceStringDescriptor, pxRequest->usLength, sizeof( pxInterfaceStringDescriptor ), pdTRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -562,13 +563,13 @@ static void prvGetStandardDeviceDescriptor( xUSB_REQUEST *pxRequest )
|
||||||
|
|
||||||
static void prvHandleStandardDeviceRequest( xUSB_REQUEST *pxRequest )
|
static void prvHandleStandardDeviceRequest( xUSB_REQUEST *pxRequest )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usStatus = 0;
|
unsigned short usStatus = 0;
|
||||||
|
|
||||||
switch( pxRequest->ucRequest )
|
switch( pxRequest->ucRequest )
|
||||||
{
|
{
|
||||||
case usbGET_STATUS_REQUEST:
|
case usbGET_STATUS_REQUEST:
|
||||||
/* Just send two byte dummy status. */
|
/* Just send two byte dummy status. */
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &usStatus, sizeof( usStatus ), sizeof( usStatus ), pdFALSE );
|
prvSendControlData( ( unsigned char * ) &usStatus, sizeof( usStatus ), sizeof( usStatus ), pdFALSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbGET_DESCRIPTOR_REQUEST:
|
case usbGET_DESCRIPTOR_REQUEST:
|
||||||
|
@ -578,7 +579,7 @@ unsigned portSHORT usStatus = 0;
|
||||||
|
|
||||||
case usbGET_CONFIGURATION_REQUEST:
|
case usbGET_CONFIGURATION_REQUEST:
|
||||||
/* Send selected device configuration */
|
/* Send selected device configuration */
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &ucUSBConfig, sizeof( ucUSBConfig ), sizeof( ucUSBConfig ), pdFALSE );
|
prvSendControlData( ( unsigned char * ) &ucUSBConfig, sizeof( ucUSBConfig ), sizeof( ucUSBConfig ), pdFALSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbSET_FEATURE_REQUEST:
|
case usbSET_FEATURE_REQUEST:
|
||||||
|
@ -589,12 +590,12 @@ unsigned portSHORT usStatus = 0;
|
||||||
/* Get assigned address and send ack, but don't implement new address until we get a TXCOMP */
|
/* Get assigned address and send ack, but don't implement new address until we get a TXCOMP */
|
||||||
prvSendZLP();
|
prvSendZLP();
|
||||||
eDriverState = eJUST_GOT_ADDRESS;
|
eDriverState = eJUST_GOT_ADDRESS;
|
||||||
ulReceivedAddress = ( unsigned portLONG ) pxRequest->usValue;
|
ulReceivedAddress = ( unsigned long ) pxRequest->usValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbSET_CONFIGURATION_REQUEST:
|
case usbSET_CONFIGURATION_REQUEST:
|
||||||
/* Ack SET_CONFIGURATION request, but don't implement until TXCOMP */
|
/* Ack SET_CONFIGURATION request, but don't implement until TXCOMP */
|
||||||
ucUSBConfig = ( unsigned portCHAR ) ( pxRequest->usValue & 0xff );
|
ucUSBConfig = ( unsigned char ) ( pxRequest->usValue & 0xff );
|
||||||
eDriverState = eJUST_GOT_CONFIG;
|
eDriverState = eJUST_GOT_CONFIG;
|
||||||
prvSendZLP();
|
prvSendZLP();
|
||||||
break;
|
break;
|
||||||
|
@ -627,7 +628,7 @@ static void prvHandleClassInterfaceRequest( xUSB_REQUEST *pxRequest )
|
||||||
|
|
||||||
case usbGET_LINE_CODING:
|
case usbGET_LINE_CODING:
|
||||||
/* Get line coding */
|
/* Get line coding */
|
||||||
prvSendControlData( (unsigned portCHAR *) &pxLineCoding, pxRequest->usLength, sizeof( pxLineCoding ), pdFALSE );
|
prvSendControlData( (unsigned char *) &pxLineCoding, pxRequest->usLength, sizeof( pxLineCoding ), pdFALSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbSET_CONTROL_LINE_STATE:
|
case usbSET_CONTROL_LINE_STATE:
|
||||||
|
@ -645,7 +646,7 @@ static void prvHandleClassInterfaceRequest( xUSB_REQUEST *pxRequest )
|
||||||
|
|
||||||
static void prvGetStandardInterfaceDescriptor( xUSB_REQUEST *pxRequest )
|
static void prvGetStandardInterfaceDescriptor( xUSB_REQUEST *pxRequest )
|
||||||
{
|
{
|
||||||
switch( ( pxRequest->usValue & ( unsigned portSHORT ) 0xff00 ) >> 8 )
|
switch( ( pxRequest->usValue & ( unsigned short ) 0xff00 ) >> 8 )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
prvSendStall();
|
prvSendStall();
|
||||||
|
@ -656,13 +657,13 @@ static void prvGetStandardInterfaceDescriptor( xUSB_REQUEST *pxRequest )
|
||||||
|
|
||||||
static void prvHandleStandardInterfaceRequest( xUSB_REQUEST *pxRequest )
|
static void prvHandleStandardInterfaceRequest( xUSB_REQUEST *pxRequest )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usStatus = 0;
|
unsigned short usStatus = 0;
|
||||||
|
|
||||||
switch( pxRequest->ucRequest )
|
switch( pxRequest->ucRequest )
|
||||||
{
|
{
|
||||||
case usbGET_STATUS_REQUEST:
|
case usbGET_STATUS_REQUEST:
|
||||||
/* Send dummy 2 bytes. */
|
/* Send dummy 2 bytes. */
|
||||||
prvSendControlData( ( unsigned portCHAR * ) &usStatus, sizeof( usStatus ), sizeof( usStatus ), pdFALSE );
|
prvSendControlData( ( unsigned char * ) &usStatus, sizeof( usStatus ), sizeof( usStatus ), pdFALSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usbGET_DESCRIPTOR_REQUEST:
|
case usbGET_DESCRIPTOR_REQUEST:
|
||||||
|
@ -717,8 +718,8 @@ extern void ( vUSB_ISR_Wrapper )( void );
|
||||||
xUSBInterruptQueue = xQueueCreate( usbQUEUE_LENGTH + 1, sizeof( xISRStatus * ) );
|
xUSBInterruptQueue = xQueueCreate( usbQUEUE_LENGTH + 1, sizeof( xISRStatus * ) );
|
||||||
|
|
||||||
/* Create the queues used to hold Rx and Tx characters. */
|
/* Create the queues used to hold Rx and Tx characters. */
|
||||||
xRxCDC = xQueueCreate( USB_CDC_QUEUE_SIZE, ( unsigned portCHAR ) sizeof( signed portCHAR ) );
|
xRxCDC = xQueueCreate( USB_CDC_QUEUE_SIZE, ( unsigned char ) sizeof( signed char ) );
|
||||||
xTxCDC = xQueueCreate( USB_CDC_QUEUE_SIZE + 1, ( unsigned portCHAR ) sizeof( signed portCHAR ) );
|
xTxCDC = xQueueCreate( USB_CDC_QUEUE_SIZE + 1, ( unsigned char ) sizeof( signed char ) );
|
||||||
|
|
||||||
if( (!xUSBInterruptQueue) || (!xRxCDC) || (!xTxCDC) )
|
if( (!xUSBInterruptQueue) || (!xRxCDC) || (!xTxCDC) )
|
||||||
{
|
{
|
||||||
|
@ -727,9 +728,9 @@ extern void ( vUSB_ISR_Wrapper )( void );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialise a few state variables. */
|
/* Initialise a few state variables. */
|
||||||
pxControlTx.ulNextCharIndex = ( unsigned portLONG ) 0;
|
pxControlTx.ulNextCharIndex = ( unsigned long ) 0;
|
||||||
pxControlRx.ulNextCharIndex = ( unsigned portLONG ) 0;
|
pxControlRx.ulNextCharIndex = ( unsigned long ) 0;
|
||||||
ucUSBConfig = ( unsigned portCHAR ) 0;
|
ucUSBConfig = ( unsigned char ) 0;
|
||||||
eDriverState = eNOTHING;
|
eDriverState = eNOTHING;
|
||||||
ucControlState = 0;
|
ucControlState = 0;
|
||||||
uiCurrentBank = AT91C_UDP_RX_DATA_BK0;
|
uiCurrentBank = AT91C_UDP_RX_DATA_BK0;
|
||||||
|
@ -757,12 +758,12 @@ extern void ( vUSB_ISR_Wrapper )( void );
|
||||||
/* When using the USB debugger the peripheral registers do not always get
|
/* When using the USB debugger the peripheral registers do not always get
|
||||||
set to the correct default values. To make sure set the relevant registers
|
set to the correct default values. To make sure set the relevant registers
|
||||||
manually here. */
|
manually here. */
|
||||||
AT91C_BASE_UDP->UDP_IDR = ( unsigned portLONG ) 0xffffffff;
|
AT91C_BASE_UDP->UDP_IDR = ( unsigned long ) 0xffffffff;
|
||||||
AT91C_BASE_UDP->UDP_ICR = ( unsigned portLONG ) 0xffffffff;
|
AT91C_BASE_UDP->UDP_ICR = ( unsigned long ) 0xffffffff;
|
||||||
AT91C_BASE_UDP->UDP_CSR[ 0 ] = ( unsigned portLONG ) 0x00;
|
AT91C_BASE_UDP->UDP_CSR[ 0 ] = ( unsigned long ) 0x00;
|
||||||
AT91C_BASE_UDP->UDP_CSR[ 1 ] = ( unsigned portLONG ) 0x00;
|
AT91C_BASE_UDP->UDP_CSR[ 1 ] = ( unsigned long ) 0x00;
|
||||||
AT91C_BASE_UDP->UDP_CSR[ 2 ] = ( unsigned portLONG ) 0x00;
|
AT91C_BASE_UDP->UDP_CSR[ 2 ] = ( unsigned long ) 0x00;
|
||||||
AT91C_BASE_UDP->UDP_CSR[ 3 ] = ( unsigned portLONG ) 0x00;
|
AT91C_BASE_UDP->UDP_CSR[ 3 ] = ( unsigned long ) 0x00;
|
||||||
AT91C_BASE_UDP->UDP_GLBSTATE = 0;
|
AT91C_BASE_UDP->UDP_GLBSTATE = 0;
|
||||||
AT91C_BASE_UDP->UDP_FADDR = 0;
|
AT91C_BASE_UDP->UDP_FADDR = 0;
|
||||||
|
|
||||||
|
@ -781,14 +782,14 @@ extern void ( vUSB_ISR_Wrapper )( void );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT usRequestedLength, unsigned portLONG ulLengthToSend, portLONG lSendingDescriptor )
|
static void prvSendControlData( unsigned char *pucData, unsigned short usRequestedLength, unsigned long ulLengthToSend, long lSendingDescriptor )
|
||||||
{
|
{
|
||||||
if( ( ( unsigned portLONG ) usRequestedLength < ulLengthToSend ) )
|
if( ( ( unsigned long ) usRequestedLength < ulLengthToSend ) )
|
||||||
{
|
{
|
||||||
/* Cap the data length to that requested. */
|
/* Cap the data length to that requested. */
|
||||||
ulLengthToSend = ( unsigned portSHORT ) usRequestedLength;
|
ulLengthToSend = ( unsigned short ) usRequestedLength;
|
||||||
}
|
}
|
||||||
else if( ( ulLengthToSend < ( unsigned portLONG ) usRequestedLength ) && lSendingDescriptor )
|
else if( ( ulLengthToSend < ( unsigned long ) usRequestedLength ) && lSendingDescriptor )
|
||||||
{
|
{
|
||||||
/* We are sending a descriptor. If the descriptor is an exact
|
/* We are sending a descriptor. If the descriptor is an exact
|
||||||
multiple of the FIFO length then it will have to be terminated
|
multiple of the FIFO length then it will have to be terminated
|
||||||
|
@ -810,7 +811,7 @@ static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT u
|
||||||
/* Reinitialise the buffer index so we start sending from the start of
|
/* Reinitialise the buffer index so we start sending from the start of
|
||||||
the data. */
|
the data. */
|
||||||
pxControlTx.ulTotalDataLength = ulLengthToSend;
|
pxControlTx.ulTotalDataLength = ulLengthToSend;
|
||||||
pxControlTx.ulNextCharIndex = ( unsigned portLONG ) 0;
|
pxControlTx.ulNextCharIndex = ( unsigned long ) 0;
|
||||||
|
|
||||||
/* Send the first 8 bytes now. The rest will get sent in response to
|
/* Send the first 8 bytes now. The rest will get sent in response to
|
||||||
TXCOMP interrupts. */
|
TXCOMP interrupts. */
|
||||||
|
@ -820,7 +821,7 @@ static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT u
|
||||||
|
|
||||||
static void prvSendNextSegment( void )
|
static void prvSendNextSegment( void )
|
||||||
{
|
{
|
||||||
volatile unsigned portLONG ulNextLength, ulStatus, ulLengthLeftToSend;
|
volatile unsigned long ulNextLength, ulStatus, ulLengthLeftToSend;
|
||||||
|
|
||||||
/* Is there any data to send? */
|
/* Is there any data to send? */
|
||||||
if( pxControlTx.ulTotalDataLength > pxControlTx.ulNextCharIndex )
|
if( pxControlTx.ulTotalDataLength > pxControlTx.ulNextCharIndex )
|
||||||
|
@ -845,7 +846,7 @@ volatile unsigned portLONG ulNextLength, ulStatus, ulLengthLeftToSend;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the data to the FIFO. */
|
/* Write the data to the FIFO. */
|
||||||
while( ulNextLength > ( unsigned portLONG ) 0 )
|
while( ulNextLength > ( unsigned long ) 0 )
|
||||||
{
|
{
|
||||||
AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_0 ] = pxControlTx.ucBuffer[ pxControlTx.ulNextCharIndex ];
|
AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_0 ] = pxControlTx.ucBuffer[ pxControlTx.ulNextCharIndex ];
|
||||||
|
|
||||||
|
@ -857,7 +858,7 @@ volatile unsigned portLONG ulNextLength, ulStatus, ulLengthLeftToSend;
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulStatus = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ];
|
ulStatus = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ];
|
||||||
usbCSR_SET_BIT( &ulStatus, ( ( unsigned portLONG ) 0x10 ) );
|
usbCSR_SET_BIT( &ulStatus, ( ( unsigned long ) 0x10 ) );
|
||||||
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulStatus;
|
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulStatus;
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
portEXIT_CRITICAL();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -55,19 +56,19 @@
|
||||||
/* Structure used to take a snapshot of the USB status from within the ISR. */
|
/* Structure used to take a snapshot of the USB status from within the ISR. */
|
||||||
typedef struct X_ISR_STATUS
|
typedef struct X_ISR_STATUS
|
||||||
{
|
{
|
||||||
unsigned portLONG ulISR;
|
unsigned long ulISR;
|
||||||
unsigned portLONG ulCSR0;
|
unsigned long ulCSR0;
|
||||||
unsigned portCHAR ucFifoData[ 8 ];
|
unsigned char ucFifoData[ 8 ];
|
||||||
} xISRStatus;
|
} xISRStatus;
|
||||||
|
|
||||||
/* Structure used to hold the received requests. */
|
/* Structure used to hold the received requests. */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucReqType;
|
unsigned char ucReqType;
|
||||||
unsigned portCHAR ucRequest;
|
unsigned char ucRequest;
|
||||||
unsigned portSHORT usValue;
|
unsigned short usValue;
|
||||||
unsigned portSHORT usIndex;
|
unsigned short usIndex;
|
||||||
unsigned portSHORT usLength;
|
unsigned short usLength;
|
||||||
} xUSB_REQUEST;
|
} xUSB_REQUEST;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -83,9 +84,9 @@ typedef enum
|
||||||
/* Structure used to control the data being sent to the host. */
|
/* Structure used to control the data being sent to the host. */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucBuffer[ usbMAX_CONTROL_MESSAGE_SIZE ];
|
unsigned char ucBuffer[ usbMAX_CONTROL_MESSAGE_SIZE ];
|
||||||
unsigned portLONG ulNextCharIndex;
|
unsigned long ulNextCharIndex;
|
||||||
unsigned portLONG ulTotalDataLength;
|
unsigned long ulTotalDataLength;
|
||||||
} xCONTROL_MESSAGE;
|
} xCONTROL_MESSAGE;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -93,7 +94,7 @@ void vUSBCDCTask( void *pvParameters );
|
||||||
|
|
||||||
/* Send cByte down the USB port. Characters are simply buffered and not
|
/* Send cByte down the USB port. Characters are simply buffered and not
|
||||||
sent unless the port is connected. */
|
sent unless the port is connected. */
|
||||||
void vUSBSendByte( portCHAR cByte );
|
void vUSBSendByte( char cByte );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -84,10 +85,10 @@ void vUSB_ISR_Handler( void );
|
||||||
void vUSB_ISR_Handler( void )
|
void vUSB_ISR_Handler( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
static volatile unsigned portLONG ulNextMessage = 0;
|
static volatile unsigned long ulNextMessage = 0;
|
||||||
xISRStatus *pxMessage;
|
xISRStatus *pxMessage;
|
||||||
unsigned portLONG ulRxBytes;
|
unsigned long ulRxBytes;
|
||||||
unsigned portCHAR ucFifoIndex;
|
unsigned char ucFifoIndex;
|
||||||
|
|
||||||
/* Use the next message from the array. */
|
/* Use the next message from the array. */
|
||||||
pxMessage = &( xISRMessages[ ( ulNextMessage & usbQUEUE_LENGTH ) ] );
|
pxMessage = &( xISRMessages[ ( ulNextMessage & usbQUEUE_LENGTH ) ] );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -59,14 +60,14 @@ These take the form:
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const portCHAR pxLanguageStringDescriptor[] =
|
const char pxLanguageStringDescriptor[] =
|
||||||
{
|
{
|
||||||
4,
|
4,
|
||||||
usbDESCRIPTOR_TYPE_STRING,
|
usbDESCRIPTOR_TYPE_STRING,
|
||||||
0x09, 0x04
|
0x09, 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
const portCHAR pxManufacturerStringDescriptor[] =
|
const char pxManufacturerStringDescriptor[] =
|
||||||
{
|
{
|
||||||
18,
|
18,
|
||||||
usbDESCRIPTOR_TYPE_STRING,
|
usbDESCRIPTOR_TYPE_STRING,
|
||||||
|
@ -74,7 +75,7 @@ const portCHAR pxManufacturerStringDescriptor[] =
|
||||||
'F', 0x00, 'r', 0x00, 'e', 0x00, 'e', 0x00, 'R', 0x00, 'T', 0x00, 'O', 0x00, 'S', 0x00
|
'F', 0x00, 'r', 0x00, 'e', 0x00, 'e', 0x00, 'R', 0x00, 'T', 0x00, 'O', 0x00, 'S', 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
const portCHAR pxProductStringDescriptor[] =
|
const char pxProductStringDescriptor[] =
|
||||||
{
|
{
|
||||||
36,
|
36,
|
||||||
usbDESCRIPTOR_TYPE_STRING,
|
usbDESCRIPTOR_TYPE_STRING,
|
||||||
|
@ -83,7 +84,7 @@ const portCHAR pxProductStringDescriptor[] =
|
||||||
'C', 0x00, ' ', 0x00, 'D', 0x00, 'E', 0x00, 'M', 0x00, 'O', 0x00
|
'C', 0x00, ' ', 0x00, 'D', 0x00, 'E', 0x00, 'M', 0x00, 'O', 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
const portCHAR pxConfigurationStringDescriptor[] =
|
const char pxConfigurationStringDescriptor[] =
|
||||||
{
|
{
|
||||||
38,
|
38,
|
||||||
usbDESCRIPTOR_TYPE_STRING,
|
usbDESCRIPTOR_TYPE_STRING,
|
||||||
|
@ -92,7 +93,7 @@ const portCHAR pxConfigurationStringDescriptor[] =
|
||||||
'o', 0x00, 'n', 0x00, ' ', 0x00, 'N', 0x00, 'a', 0x00, 'm', 0x00, 'e', 0x00
|
'o', 0x00, 'n', 0x00, ' ', 0x00, 'N', 0x00, 'a', 0x00, 'm', 0x00, 'e', 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
const portCHAR pxInterfaceStringDescriptor[] =
|
const char pxInterfaceStringDescriptor[] =
|
||||||
{
|
{
|
||||||
30,
|
30,
|
||||||
usbDESCRIPTOR_TYPE_STRING,
|
usbDESCRIPTOR_TYPE_STRING,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -100,20 +101,20 @@
|
||||||
/* Misc application definitions. */
|
/* Misc application definitions. */
|
||||||
#define usbINTERRUPT_PRIORITY ( 3 )
|
#define usbINTERRUPT_PRIORITY ( 3 )
|
||||||
#define usbQUEUE_LENGTH ( 0x3 ) /* Must have all bits set! */
|
#define usbQUEUE_LENGTH ( 0x3 ) /* Must have all bits set! */
|
||||||
#define usbFIFO_LENGTH ( ( unsigned portLONG ) 8 )
|
#define usbFIFO_LENGTH ( ( unsigned long ) 8 )
|
||||||
#define usbEND_POINT_0 ( 0 )
|
#define usbEND_POINT_0 ( 0 )
|
||||||
#define usbEND_POINT_1 ( 1 )
|
#define usbEND_POINT_1 ( 1 )
|
||||||
#define usbEND_POINT_2 ( 2 )
|
#define usbEND_POINT_2 ( 2 )
|
||||||
#define usbEND_POINT_3 ( 3 )
|
#define usbEND_POINT_3 ( 3 )
|
||||||
#define usbMAX_CONTROL_MESSAGE_SIZE ( 128 )
|
#define usbMAX_CONTROL_MESSAGE_SIZE ( 128 )
|
||||||
#define usbRX_COUNT_MASK ( ( unsigned portLONG ) 0x7ff )
|
#define usbRX_COUNT_MASK ( ( unsigned long ) 0x7ff )
|
||||||
#define AT91C_UDP_STALLSENT AT91C_UDP_ISOERROR
|
#define AT91C_UDP_STALLSENT AT91C_UDP_ISOERROR
|
||||||
#define usbSHORTEST_DELAY ( ( portTickType ) 1 )
|
#define usbSHORTEST_DELAY ( ( portTickType ) 1 )
|
||||||
#define usbINIT_DELAY ( ( portTickType ) 1000 / portTICK_RATE_MS )
|
#define usbINIT_DELAY ( ( portTickType ) 1000 / portTICK_RATE_MS )
|
||||||
#define usbSHORT_DELAY ( ( portTickType ) 50 / portTICK_RATE_MS )
|
#define usbSHORT_DELAY ( ( portTickType ) 50 / portTICK_RATE_MS )
|
||||||
#define usbEND_POINT_RESET_MASK ( ( unsigned portLONG ) 0x0f )
|
#define usbEND_POINT_RESET_MASK ( ( unsigned long ) 0x0f )
|
||||||
#define usbDATA_INC ( ( portCHAR ) 5 )
|
#define usbDATA_INC ( ( char ) 5 )
|
||||||
#define usbEXPECTED_NUMBER_OF_BYTES ( ( unsigned portLONG ) 8 )
|
#define usbEXPECTED_NUMBER_OF_BYTES ( ( unsigned long ) 8 )
|
||||||
|
|
||||||
/* Control request types. */
|
/* Control request types. */
|
||||||
#define usbSTANDARD_DEVICE_REQUEST ( 0 )
|
#define usbSTANDARD_DEVICE_REQUEST ( 0 )
|
||||||
|
@ -133,14 +134,14 @@ unchanged by writing with a 1. */
|
||||||
/* Set TXCOMP, RX_DATA_BK0, RXSETUP, */ \
|
/* Set TXCOMP, RX_DATA_BK0, RXSETUP, */ \
|
||||||
/* STALLSENT and RX_DATA_BK1 to 1 so the */ \
|
/* STALLSENT and RX_DATA_BK1 to 1 so the */ \
|
||||||
/* write has no effect. */ \
|
/* write has no effect. */ \
|
||||||
( * ( ( unsigned portLONG * ) pulValueNow ) ) |= ( unsigned portLONG ) 0x4f; \
|
( * ( ( unsigned long * ) pulValueNow ) ) |= ( unsigned long ) 0x4f; \
|
||||||
\
|
\
|
||||||
/* Clear the FORCE_STALL and TXPKTRDY bits */ \
|
/* Clear the FORCE_STALL and TXPKTRDY bits */ \
|
||||||
/* so the write has no effect. */ \
|
/* so the write has no effect. */ \
|
||||||
( * ( ( unsigned portLONG * ) pulValueNow ) ) &= ( unsigned portLONG ) 0xffffffcf; \
|
( * ( ( unsigned long * ) pulValueNow ) ) &= ( unsigned long ) 0xffffffcf; \
|
||||||
\
|
\
|
||||||
/* Set whichever bit we want set. */ \
|
/* Set whichever bit we want set. */ \
|
||||||
( * ( ( unsigned portLONG * ) pulValueNow ) ) |= ( ulBit ); \
|
( * ( ( unsigned long * ) pulValueNow ) ) |= ( ulBit ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define usbCSR_CLEAR_BIT( pulValueNow, ulBit ) \
|
#define usbCSR_CLEAR_BIT( pulValueNow, ulBit ) \
|
||||||
|
@ -148,12 +149,12 @@ unchanged by writing with a 1. */
|
||||||
/* Set TXCOMP, RX_DATA_BK0, RXSETUP, */ \
|
/* Set TXCOMP, RX_DATA_BK0, RXSETUP, */ \
|
||||||
/* STALLSENT and RX_DATA_BK1 to 1 so the */ \
|
/* STALLSENT and RX_DATA_BK1 to 1 so the */ \
|
||||||
/* write has no effect. */ \
|
/* write has no effect. */ \
|
||||||
( * ( ( unsigned portLONG * ) pulValueNow ) ) |= ( unsigned portLONG ) 0x4f; \
|
( * ( ( unsigned long * ) pulValueNow ) ) |= ( unsigned long ) 0x4f; \
|
||||||
\
|
\
|
||||||
/* Clear the FORCE_STALL and TXPKTRDY bits */ \
|
/* Clear the FORCE_STALL and TXPKTRDY bits */ \
|
||||||
/* so the write has no effect. */ \
|
/* so the write has no effect. */ \
|
||||||
( * ( ( unsigned portLONG * ) pulValueNow ) ) &= ( unsigned portLONG ) 0xffffffcf; \
|
( * ( ( unsigned long * ) pulValueNow ) ) &= ( unsigned long ) 0xffffffcf; \
|
||||||
\
|
\
|
||||||
/* Clear whichever bit we want clear. */ \
|
/* Clear whichever bit we want clear. */ \
|
||||||
( * ( ( unsigned portLONG * ) pulValueNow ) ) &= ( ~ulBit ); \
|
( * ( ( unsigned long * ) pulValueNow ) ) &= ( ~ulBit ); \
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
/* Message queue constants. */
|
/* Message queue constants. */
|
||||||
#define archMESG_QUEUE_LENGTH ( 6 )
|
#define archMESG_QUEUE_LENGTH ( 6 )
|
||||||
#define archPOST_BLOCK_TIME_MS ( ( unsigned portLONG ) 10000 )
|
#define archPOST_BLOCK_TIME_MS ( ( unsigned long ) 10000 )
|
||||||
|
|
||||||
struct timeoutlist
|
struct timeoutlist
|
||||||
{
|
{
|
||||||
|
@ -330,12 +330,12 @@ static int iCall = 0;
|
||||||
if( iCall == 0 )
|
if( iCall == 0 )
|
||||||
{
|
{
|
||||||
/* The first time this is called we are creating the lwIP handler. */
|
/* The first time this is called we are creating the lwIP handler. */
|
||||||
result = xTaskCreate( thread, ( signed portCHAR * ) "lwIP", lwipTCP_STACK_SIZE, arg, prio, &CreatedTask );
|
result = xTaskCreate( thread, ( signed char * ) "lwIP", lwipTCP_STACK_SIZE, arg, prio, &CreatedTask );
|
||||||
iCall++;
|
iCall++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = xTaskCreate( thread, ( signed portCHAR * ) "WEBSvr", lwipBASIC_SERVER_STACK_SIZE, arg, prio, &CreatedTask );
|
result = xTaskCreate( thread, ( signed char * ) "WEBSvr", lwipBASIC_SERVER_STACK_SIZE, arg, prio, &CreatedTask );
|
||||||
}
|
}
|
||||||
|
|
||||||
// For each task created, store the task handle (pid) in the timers array.
|
// For each task created, store the task handle (pid) in the timers array.
|
||||||
|
|
|
@ -105,7 +105,7 @@ unsigned portBASE_TYPE uxPriority;
|
||||||
vTaskPrioritySet( NULL, uxPriority );
|
vTaskPrioritySet( NULL, uxPriority );
|
||||||
|
|
||||||
/* Create the task that handles the EMAC. */
|
/* Create the task that handles the EMAC. */
|
||||||
xTaskCreate( ethernetif_input, ( signed portCHAR * ) "ETH_INT", netifINTERFACE_TASK_STACK_SIZE, NULL, netifINTERFACE_TASK_PRIORITY, NULL );
|
xTaskCreate( ethernetif_input, ( signed char * ) "ETH_INT", netifINTERFACE_TASK_STACK_SIZE, NULL, netifINTERFACE_TASK_PRIORITY, NULL );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* Looking for a quick start? Then check out the FreeRTOS eBook! *
|
* The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
* See http://www.FreeRTOS.org/Documentation for details *
|
* small fee. Help yourself get started quickly while also helping the *
|
||||||
|
* FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ error. */
|
||||||
* Checks that all the demo application tasks are still executing without error
|
* Checks that all the demo application tasks are still executing without error
|
||||||
* - as described at the top of the file.
|
* - as described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void );
|
static long prvCheckOtherTasksAreStillRunning( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The task that executes at the highest priority and calls
|
* The task that executes at the highest priority and calls
|
||||||
|
@ -176,7 +177,7 @@ int main( void )
|
||||||
sys_thread_new( vBasicWEBServer, ( void * ) NULL, mainWEBSERVER_PRIORITY );
|
sys_thread_new( vBasicWEBServer, ( void * ) NULL, mainWEBSERVER_PRIORITY );
|
||||||
|
|
||||||
/* Create the demo USB CDC task. */
|
/* Create the demo USB CDC task. */
|
||||||
xTaskCreate( vUSBCDCTask, ( signed portCHAR * ) "USB", mainUSB_TASK_STACK, NULL, mainUSB_PRIORITY, NULL );
|
xTaskCreate( vUSBCDCTask, ( signed char * ) "USB", mainUSB_TASK_STACK, NULL, mainUSB_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the standard demo application tasks. */
|
/* Create the standard demo application tasks. */
|
||||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||||
|
@ -186,7 +187,7 @@ int main( void )
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
|
|
||||||
/* Start the check task - which is defined in this file. */
|
/* Start the check task - which is defined in this file. */
|
||||||
xTaskCreate( vErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vErrorChecks, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Finally, start the scheduler.
|
/* Finally, start the scheduler.
|
||||||
|
|
||||||
|
@ -261,9 +262,9 @@ portTickType xLastWakeTime;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void )
|
static long prvCheckOtherTasksAreStillRunning( void )
|
||||||
{
|
{
|
||||||
portLONG lReturn = ( portLONG ) pdPASS;
|
long lReturn = ( long ) pdPASS;
|
||||||
|
|
||||||
/* Check all the demo tasks (other than the flash tasks) to ensure
|
/* Check all the demo tasks (other than the flash tasks) to ensure
|
||||||
that they are all still running, and that none of them have detected
|
that they are all still running, and that none of them have detected
|
||||||
|
@ -271,22 +272,22 @@ portLONG lReturn = ( portLONG ) pdPASS;
|
||||||
|
|
||||||
if( xArePollingQueuesStillRunning() != pdTRUE )
|
if( xArePollingQueuesStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lReturn;
|
return lReturn;
|
||||||
|
@ -296,7 +297,7 @@ portLONG lReturn = ( portLONG ) pdPASS;
|
||||||
void vApplicationIdleHook( void )
|
void vApplicationIdleHook( void )
|
||||||
{
|
{
|
||||||
static portTickType xLastTx = 0;
|
static portTickType xLastTx = 0;
|
||||||
portCHAR cTxByte;
|
char cTxByte;
|
||||||
|
|
||||||
/* The idle hook simply sends a string of characters to the USB port.
|
/* The idle hook simply sends a string of characters to the USB port.
|
||||||
The characters will be buffered and sent once the port is connected. */
|
The characters will be buffered and sent once the port is connected. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#/*
|
#/*
|
||||||
# FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.
|
# FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
|
||||||
#
|
#
|
||||||
# This file is part of the FreeRTOS distribution.
|
# This file is part of the FreeRTOS distribution.
|
||||||
#
|
#
|
||||||
|
@ -25,8 +25,9 @@
|
||||||
#
|
#
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * Looking for a quick start? Then check out the FreeRTOS eBook! *
|
# * The FreeRTOS eBook and reference manual are available to purchase for a *
|
||||||
# * See http://www.FreeRTOS.org/Documentation for details *
|
# * small fee. Help yourself get started quickly while also helping the *
|
||||||
|
# * FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
#
|
#
|
||||||
|
|
|
@ -69,10 +69,10 @@
|
||||||
#define configUSE_PREEMPTION 1
|
#define configUSE_PREEMPTION 1
|
||||||
#define configUSE_IDLE_HOOK 0
|
#define configUSE_IDLE_HOOK 0
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 25000000 )
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 25000000 )
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 128 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
#define configUSE_TRACE_FACILITY 1
|
#define configUSE_TRACE_FACILITY 1
|
||||||
#define configUSE_16_BIT_TICKS 0
|
#define configUSE_16_BIT_TICKS 0
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
#include "flop.h"
|
#include "flop.h"
|
||||||
|
|
||||||
/* ------------------------ Defines --------------------------------------- */
|
/* ------------------------ Defines --------------------------------------- */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 38400 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 38400 )
|
||||||
|
|
||||||
/* Priorities for the demo application tasks. */
|
/* Priorities for the demo application tasks. */
|
||||||
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
#define mainCHECK_PERIOD ( ( portTickType ) 2000 / portTICK_RATE_MS )
|
#define mainCHECK_PERIOD ( ( portTickType ) 2000 / portTICK_RATE_MS )
|
||||||
|
|
||||||
/* Constants used by the vMemCheckTask() task. */
|
/* Constants used by the vMemCheckTask() task. */
|
||||||
#define mainCOUNT_INITIAL_VALUE ( ( unsigned portLONG ) 0 )
|
#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 )
|
||||||
#define mainNO_TASK ( 0 )
|
#define mainNO_TASK ( 0 )
|
||||||
|
|
||||||
/* The size of the memory blocks allocated by the vMemCheckTask() task. */
|
/* The size of the memory blocks allocated by the vMemCheckTask() task. */
|
||||||
|
@ -109,7 +109,7 @@ xComPortHandle xSTDComPort = NULL;
|
||||||
|
|
||||||
/* ------------------------ Static functions ------------------------------ */
|
/* ------------------------ Static functions ------------------------------ */
|
||||||
static portTASK_FUNCTION( vErrorChecks, pvParameters );
|
static portTASK_FUNCTION( vErrorChecks, pvParameters );
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( unsigned portLONG
|
static long prvCheckOtherTasksAreStillRunning( unsigned long
|
||||||
ulMemCheckTaskCount );
|
ulMemCheckTaskCount );
|
||||||
static portTASK_FUNCTION( vMemCheckTask, pvParameters );
|
static portTASK_FUNCTION( vMemCheckTask, pvParameters );
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ main( int argc, char *argv[] )
|
||||||
( void )sys_thread_new( vBasicWEBServer, NULL, mainWEB_TASK_PRIORITY );
|
( void )sys_thread_new( vBasicWEBServer, NULL, mainWEB_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Start the check task - which is defined in this file. */
|
/* Start the check task - which is defined in this file. */
|
||||||
xTaskCreate( vErrorChecks, ( signed portCHAR * )"Check", 512, NULL,
|
xTaskCreate( vErrorChecks, ( signed char * )"Check", 512, NULL,
|
||||||
mainCHECK_TASK_PRIORITY, NULL );
|
mainCHECK_TASK_PRIORITY, NULL );
|
||||||
/* Now all the tasks have been started - start the scheduler. */
|
/* Now all the tasks have been started - start the scheduler. */
|
||||||
vTaskStartScheduler( );
|
vTaskStartScheduler( );
|
||||||
|
@ -146,7 +146,7 @@ main( int argc, char *argv[] )
|
||||||
static
|
static
|
||||||
portTASK_FUNCTION( vErrorChecks, pvParameters )
|
portTASK_FUNCTION( vErrorChecks, pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulMemCheckTaskRunningCount;
|
unsigned long ulMemCheckTaskRunningCount;
|
||||||
xTaskHandle xCreatedTask;
|
xTaskHandle xCreatedTask;
|
||||||
|
|
||||||
/* The parameters are not used in this function. */
|
/* The parameters are not used in this function. */
|
||||||
|
@ -156,7 +156,7 @@ portTASK_FUNCTION( vErrorChecks, pvParameters )
|
||||||
{
|
{
|
||||||
ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;
|
ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;
|
||||||
xCreatedTask = mainNO_TASK;
|
xCreatedTask = mainNO_TASK;
|
||||||
if( xTaskCreate( vMemCheckTask, ( signed portCHAR * )"MEM",
|
if( xTaskCreate( vMemCheckTask, ( signed char * )"MEM",
|
||||||
configMINIMAL_STACK_SIZE, ( void * )&ulMemCheckTaskRunningCount,
|
configMINIMAL_STACK_SIZE, ( void * )&ulMemCheckTaskRunningCount,
|
||||||
tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
||||||
{
|
{
|
||||||
|
@ -182,10 +182,10 @@ portTASK_FUNCTION( vErrorChecks, pvParameters )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static portLONG
|
static long
|
||||||
prvCheckOtherTasksAreStillRunning( unsigned portLONG ulMemCheckTaskCount )
|
prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount )
|
||||||
{
|
{
|
||||||
portLONG lReturn = ( portLONG ) pdPASS;
|
long lReturn = ( long ) pdPASS;
|
||||||
|
|
||||||
/* Check all the demo tasks (other than the flash tasks) to ensure
|
/* Check all the demo tasks (other than the flash tasks) to ensure
|
||||||
* that they are all still running, and that none of them have detected
|
* that they are all still running, and that none of them have detected
|
||||||
|
@ -193,27 +193,27 @@ prvCheckOtherTasksAreStillRunning( unsigned portLONG ulMemCheckTaskCount )
|
||||||
*/
|
*/
|
||||||
if( xAreIntegerMathsTaskStillRunning( ) != pdTRUE )
|
if( xAreIntegerMathsTaskStillRunning( ) != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xArePollingQueuesStillRunning( ) != pdTRUE )
|
if( xArePollingQueuesStillRunning( ) != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreSemaphoreTasksStillRunning( ) != pdTRUE )
|
if( xAreSemaphoreTasksStillRunning( ) != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning( ) != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning( ) != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreBlockingQueuesStillRunning( ) != pdTRUE )
|
if( xAreBlockingQueuesStillRunning( ) != pdTRUE )
|
||||||
{
|
{
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ulMemCheckTaskCount == mainCOUNT_INITIAL_VALUE )
|
if( ulMemCheckTaskCount == mainCOUNT_INITIAL_VALUE )
|
||||||
|
@ -221,7 +221,7 @@ prvCheckOtherTasksAreStillRunning( unsigned portLONG ulMemCheckTaskCount )
|
||||||
/* The vMemCheckTask did not increment the counter - it must
|
/* The vMemCheckTask did not increment the counter - it must
|
||||||
* have failed.
|
* have failed.
|
||||||
*/
|
*/
|
||||||
lReturn = ( portLONG ) pdFAIL;
|
lReturn = ( long ) pdFAIL;
|
||||||
}
|
}
|
||||||
return lReturn;
|
return lReturn;
|
||||||
}
|
}
|
||||||
|
@ -229,9 +229,9 @@ prvCheckOtherTasksAreStillRunning( unsigned portLONG ulMemCheckTaskCount )
|
||||||
static void
|
static void
|
||||||
vMemCheckTask( void *pvParameters )
|
vMemCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portLONG *pulMemCheckTaskRunningCounter;
|
unsigned long *pulMemCheckTaskRunningCounter;
|
||||||
void *pvMem1, *pvMem2, *pvMem3;
|
void *pvMem1, *pvMem2, *pvMem3;
|
||||||
static portLONG lErrorOccurred = pdFALSE;
|
static long lErrorOccurred = pdFALSE;
|
||||||
|
|
||||||
/* This task is dynamically created then deleted during each cycle of the
|
/* This task is dynamically created then deleted during each cycle of the
|
||||||
vErrorChecks task to check the operation of the memory allocator. Each time
|
vErrorChecks task to check the operation of the memory allocator. Each time
|
||||||
|
@ -244,7 +244,7 @@ vMemCheckTask( void *pvParameters )
|
||||||
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
||||||
vErrorChecks() task that this task is still executing without error. */
|
vErrorChecks() task that this task is still executing without error. */
|
||||||
|
|
||||||
pulMemCheckTaskRunningCounter = ( unsigned portLONG * )pvParameters;
|
pulMemCheckTaskRunningCounter = ( unsigned long * )pvParameters;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
#define MS_TO_TICKS( ms ) \
|
#define MS_TO_TICKS( ms ) \
|
||||||
( portTickType )( ( portTickType ) ( ms ) / portTICK_RATE_MS )
|
( portTickType )( ( portTickType ) ( ms ) / portTICK_RATE_MS )
|
||||||
#define TICKS_TO_MS( ticks ) \
|
#define TICKS_TO_MS( ticks ) \
|
||||||
( unsigned portLONG )( ( portTickType ) ( ticks ) * portTICK_RATE_MS )
|
( unsigned long )( ( portTickType ) ( ticks ) * portTICK_RATE_MS )
|
||||||
#define THREAD_STACK_SIZE ( 1024 )
|
#define THREAD_STACK_SIZE ( 1024 )
|
||||||
#define THREAD_NAME "lwIP"
|
#define THREAD_NAME "lwIP"
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,8 @@
|
||||||
|
|
||||||
/* ------------------------ Prototypes ------------------------------------ */
|
/* ------------------------ Prototypes ------------------------------------ */
|
||||||
void vSerialPutStringNOISR( xComPortHandle pxPort,
|
void vSerialPutStringNOISR( xComPortHandle pxPort,
|
||||||
const signed portCHAR * const pcString,
|
const signed char * const pcString,
|
||||||
unsigned portSHORT usStringLength );
|
unsigned short usStringLength );
|
||||||
|
|
||||||
/* ------------------------ Start implementation -------------------------- */
|
/* ------------------------ Start implementation -------------------------- */
|
||||||
void
|
void
|
||||||
|
@ -109,13 +109,13 @@ write( int fd, const void *buf, size_t nbytes )
|
||||||
{
|
{
|
||||||
case STDERR_FILENO:
|
case STDERR_FILENO:
|
||||||
vSerialPutStringNOISR( xSTDComPort,
|
vSerialPutStringNOISR( xSTDComPort,
|
||||||
( const signed portCHAR * const )buf,
|
( const signed char * const )buf,
|
||||||
( unsigned portSHORT )nbytes );
|
( unsigned short )nbytes );
|
||||||
break;
|
break;
|
||||||
case STDOUT_FILENO:
|
case STDOUT_FILENO:
|
||||||
vSerialPutString( xSTDComPort,
|
vSerialPutString( xSTDComPort,
|
||||||
( const signed portCHAR * const)buf,
|
( const signed char * const)buf,
|
||||||
( unsigned portSHORT )nbytes );
|
( unsigned short )nbytes );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
|
|
|
@ -82,7 +82,7 @@ static xComPortIF_t xComPortIF[ COM_NIFACE ];
|
||||||
|
|
||||||
/* ------------------------ Begin implementation -------------------------- */
|
/* ------------------------ Begin implementation -------------------------- */
|
||||||
xComPortHandle
|
xComPortHandle
|
||||||
xSerialPortInitMinimal( unsigned portLONG ulWantedBaud,
|
xSerialPortInitMinimal( unsigned long ulWantedBaud,
|
||||||
unsigned portBASE_TYPE uxQueueLength )
|
unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
extern void ( *__RAMVEC[] ) ( );
|
extern void ( *__RAMVEC[] ) ( );
|
||||||
|
@ -91,9 +91,9 @@ xSerialPortInitMinimal( unsigned portLONG ulWantedBaud,
|
||||||
|
|
||||||
/* Create the queues used to hold Rx and Tx characters. */
|
/* Create the queues used to hold Rx and Tx characters. */
|
||||||
xComPortIF[ 0 ].xRXChars =
|
xComPortIF[ 0 ].xRXChars =
|
||||||
xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE )sizeof( signed portCHAR ) );
|
xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE )sizeof( signed char ) );
|
||||||
xComPortIF[ 0 ].xTXChars =
|
xComPortIF[ 0 ].xTXChars =
|
||||||
xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE )sizeof( signed portCHAR ) );
|
xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE )sizeof( signed char ) );
|
||||||
|
|
||||||
/* If the queues were created correctly then setup the serial port hardware. */
|
/* If the queues were created correctly then setup the serial port hardware. */
|
||||||
if( ( xComPortIF[ 0 ].xRXChars != 0 ) && ( xComPortIF[ 0 ].xTXChars != 0 ) )
|
if( ( xComPortIF[ 0 ].xRXChars != 0 ) && ( xComPortIF[ 0 ].xTXChars != 0 ) )
|
||||||
|
@ -144,7 +144,7 @@ xSerialPortInitMinimal( unsigned portLONG ulWantedBaud,
|
||||||
}
|
}
|
||||||
|
|
||||||
signed portBASE_TYPE
|
signed portBASE_TYPE
|
||||||
xSerialGetChar( xComPortHandle pxPort, signed portCHAR * pcRxedChar,
|
xSerialGetChar( xComPortHandle pxPort, signed char * pcRxedChar,
|
||||||
portTickType xBlockTime )
|
portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -172,14 +172,14 @@ xSerialGetChar( xComPortHandle pxPort, signed portCHAR * pcRxedChar,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vSerialPutString( xComPortHandle pxPort, const signed portCHAR *
|
vSerialPutString( xComPortHandle pxPort, const signed char *
|
||||||
const pcString, unsigned portSHORT usStringLength )
|
const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
signed portCHAR *pChNext;
|
signed char *pChNext;
|
||||||
|
|
||||||
/* Send each character in the string, one at a time. */
|
/* Send each character in the string, one at a time. */
|
||||||
pChNext = ( signed portCHAR * )pcString;
|
pChNext = ( signed char * )pcString;
|
||||||
for( i = 0; i < usStringLength; i++ )
|
for( i = 0; i < usStringLength; i++ )
|
||||||
{
|
{
|
||||||
/* Block until character has been transmitted. */
|
/* Block until character has been transmitted. */
|
||||||
|
@ -188,7 +188,7 @@ vSerialPutString( xComPortHandle pxPort, const signed portCHAR *
|
||||||
}
|
}
|
||||||
|
|
||||||
signed portBASE_TYPE
|
signed portBASE_TYPE
|
||||||
xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar,
|
xSerialPutChar( xComPortHandle pxPort, signed char cOutChar,
|
||||||
portTickType xBlockTime )
|
portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -218,7 +218,7 @@ xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar,
|
||||||
}
|
}
|
||||||
|
|
||||||
signed portBASE_TYPE
|
signed portBASE_TYPE
|
||||||
xSerialPutCharNOISR( xComPortHandle pxPort, signed portCHAR cOutChar )
|
xSerialPutCharNOISR( xComPortHandle pxPort, signed char cOutChar )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
portBASE_TYPE xResult = pdFALSE;
|
portBASE_TYPE xResult = pdFALSE;
|
||||||
|
@ -245,15 +245,15 @@ xSerialPutCharNOISR( xComPortHandle pxPort, signed portCHAR cOutChar )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vSerialPutStringNOISR( xComPortHandle pxPort, const signed portCHAR *
|
vSerialPutStringNOISR( xComPortHandle pxPort, const signed char *
|
||||||
const pcString, unsigned portSHORT usStringLength )
|
const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
signed portCHAR *pChNext;
|
signed char *pChNext;
|
||||||
portBASE_TYPE xOldIPL = portSET_IPL( portIPL_MAX );
|
portBASE_TYPE xOldIPL = portSET_IPL( portIPL_MAX );
|
||||||
|
|
||||||
/* Send each character in the string, one at a time. */
|
/* Send each character in the string, one at a time. */
|
||||||
pChNext = ( signed portCHAR * )pcString;
|
pChNext = ( signed char * )pcString;
|
||||||
for( i = 0; i < usStringLength; i++ )
|
for( i = 0; i < usStringLength; i++ )
|
||||||
{
|
{
|
||||||
/* Block until character has been transmitted. */
|
/* Block until character has been transmitted. */
|
||||||
|
@ -272,7 +272,7 @@ vSerialClose( xComPortHandle xPort )
|
||||||
void
|
void
|
||||||
prvSerialISR( void )
|
prvSerialISR( void )
|
||||||
{
|
{
|
||||||
static signed portCHAR cChar;
|
static signed char cChar;
|
||||||
static portBASE_TYPE xHigherPriorityTaskWoken;
|
static portBASE_TYPE xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
/* We have to remvoe the effect of the GCC. Please note that the
|
/* We have to remvoe the effect of the GCC. Please note that the
|
||||||
|
|
|
@ -126,11 +126,11 @@ static void vProcessConnection( struct netconn *pxNetCon );
|
||||||
static void
|
static void
|
||||||
vProcessConnection( struct netconn *pxNetCon )
|
vProcessConnection( struct netconn *pxNetCon )
|
||||||
{
|
{
|
||||||
static portCHAR cDynamicPage[webMAX_PAGE_SIZE], cPageHits[11];
|
static char cDynamicPage[webMAX_PAGE_SIZE], cPageHits[11];
|
||||||
struct netbuf *pxRxBuffer;
|
struct netbuf *pxRxBuffer;
|
||||||
portCHAR *pcRxString;
|
char *pcRxString;
|
||||||
unsigned portSHORT usLength;
|
unsigned short usLength;
|
||||||
static unsigned portLONG ulPageHits = 0;
|
static unsigned long ulPageHits = 0;
|
||||||
|
|
||||||
/* We expect to immediately get data. */
|
/* We expect to immediately get data. */
|
||||||
pxRxBuffer = netconn_recv( pxNetCon );
|
pxRxBuffer = netconn_recv( pxNetCon );
|
||||||
|
@ -161,7 +161,7 @@ vProcessConnection( struct netconn *pxNetCon )
|
||||||
strcat( cDynamicPage,
|
strcat( cDynamicPage,
|
||||||
"<p><pre>Task State Priority Stack #<br>************************************************<br>" );
|
"<p><pre>Task State Priority Stack #<br>************************************************<br>" );
|
||||||
/* ... Then the list of tasks and their status... */
|
/* ... Then the list of tasks and their status... */
|
||||||
vTaskList( ( signed portCHAR * )cDynamicPage + strlen( cDynamicPage ) );
|
vTaskList( ( signed char * )cDynamicPage + strlen( cDynamicPage ) );
|
||||||
/* ... Finally the page footer. */
|
/* ... Finally the page footer. */
|
||||||
strcat( cDynamicPage, webHTML_END );
|
strcat( cDynamicPage, webHTML_END );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue