First version under SVN is V4.0.1

This commit is contained in:
Richard Barry 2006-05-02 09:39:15 +00:00
parent 243393860c
commit b6df57c7e3
918 changed files with 269038 additions and 0 deletions

View file

@ -0,0 +1,79 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
#include <iom323.h>
#define configCALL_STACK_SIZE 20
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*----------------------------------------------------------*/
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 8000000 )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 85 )
#define configTOTAL_HEAP_SIZE ( (size_t ) ( 1500 ) )
#define configMAX_TASK_NAME_LEN ( 8 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 1
#define configIDLE_SHOULD_YIELD 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 0
#define INCLUDE_uxTaskPriorityGet 0
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 0
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#endif /* FREERTOS_CONFIG_H */

View file

@ -0,0 +1,123 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
/*
Changes from V2.0.0
+ Use scheduler suspends in place of critical sections.
Changes from V2.6.0
+ Replaced the inb() and outb() functions with direct memory
access. This allows the port to be built with the 20050414 build of
WinAVR.
*/
#include "FreeRTOS.h"
#include "task.h"
#include "partest.h"
/*-----------------------------------------------------------
* Simple parallel port IO routines.
*-----------------------------------------------------------*/
#define partstALL_BITS_OUTPUT ( ( unsigned portCHAR ) 0xff )
#define partstALL_OUTPUTS_OFF ( ( unsigned portCHAR ) 0xff )
#define partstMAX_OUTPUT_LED ( ( unsigned portCHAR ) 7 )
static volatile unsigned portCHAR ucCurrentOutputValue = partstALL_OUTPUTS_OFF; /*lint !e956 File scope parameters okay here. */
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
ucCurrentOutputValue = partstALL_OUTPUTS_OFF;
/* Set port B direction to outputs. Start with all output off. */
DDRB = partstALL_BITS_OUTPUT;
PORTB = ucCurrentOutputValue;
}
/*-----------------------------------------------------------*/
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
{
unsigned portCHAR ucBit = ( unsigned portCHAR ) 1;
if( uxLED <= partstMAX_OUTPUT_LED )
{
ucBit <<= uxLED;
}
vTaskSuspendAll();
{
if( xValue == pdTRUE )
{
ucBit ^= ( unsigned portCHAR ) 0xff;
ucCurrentOutputValue &= ucBit;
}
else
{
ucCurrentOutputValue |= ucBit;
}
PORTB = ucCurrentOutputValue;
}
xTaskResumeAll();
}
/*-----------------------------------------------------------*/
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
{
unsigned portCHAR ucBit;
if( uxLED <= partstMAX_OUTPUT_LED )
{
ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
vTaskSuspendAll();
{
if( ucCurrentOutputValue & ucBit )
{
ucCurrentOutputValue &= ~ucBit;
}
else
{
ucCurrentOutputValue |= ucBit;
}
PORTB = ucCurrentOutputValue;
}
xTaskResumeAll();
}
}

View file

@ -0,0 +1,249 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
/*
* Creates all the demo application tasks, then starts the scheduler. The WEB
* documentation provides more details of the demo application tasks.
*
* Main. c also creates a task called "Check". This only executes every three
* seconds but has the highest priority so is guaranteed to get processor time.
* Its main function is to check that all the other tasks are still operational.
* Each task that does not flash an LED maintains a unique count that is
* incremented each time the task successfully completes its function. Should
* any error occur within such a task the count is permanently halted. The
* check task inspects the count of each task to ensure it has changed since
* the last time the check task executed. If all the count variables have
* changed all the tasks are still executing error free, and the check task
* toggles an LED. Should any task contain an error at any time the LED toggle
* will stop.
*
* The LED flash and communications test tasks do not maintain a count.
*/
/*
Changes from V1.2.0
+ Changed the baud rate for the serial test from 19200 to 57600.
Changes from V1.2.3
+ The integer and comtest tasks are now used when the cooperative scheduler
is being used. Previously they were only used with the preemptive
scheduler.
Changes from V1.2.5
+ Set the baud rate to 38400. This has a smaller error percentage with an
8MHz clock (according to the manual).
Changes from V2.0.0
+ Delay periods are now specified using variables and constants of
portTickType rather than unsigned portLONG.
Changes from V2.2.0
+ File can now be built using either the IAR or WinAVR compiler.
Changes from V2.6.1
+ The IAR and WinAVR AVR ports are now maintained separately.
*/
#include <stdlib.h>
#include <string.h>
#ifdef GCC_MEGA_AVR
/* EEPROM routines used only with the WinAVR compiler. */
#include <avr/eeprom.h>
#endif
/* Scheduler include files. */
#include "FreeRTOS.h"
#include "task.h"
/* Demo file headers. */
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "flash.h"
#include "print.h"
#include "partest.h"
/* Priority definitions for most of the tasks in the demo application. Some
tasks just use the idle priority. */
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
/* Baud rate used by the serial port tasks. */
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 38400 )
/* 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. */
#define mainCOM_TEST_LED ( 4 )
/* LED that is toggled by the check task. The check task periodically checks
that all the other tasks are operating without error. If no errors are found
the LED is toggled. If an error is found at any time the LED is never toggles
again. */
#define mainCHECK_TASK_LED ( 7 )
/* The period between executions of the check task. */
#define mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )
/* An address in the EEPROM used to count resets. This is used to check that
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( ( void * ) 0x50 )
/*
* The task function for the "Check" task.
*/
static void vErrorChecks( void *pvParameters );
/*
* Checks the unique counts of other tasks to ensure they are still operational.
* Flashes an LED if everything is okay.
*/
static void prvCheckOtherTasksAreStillRunning( void );
/*
* Called on boot to increment a count stored in the EEPROM. This is used to
* ensure the CPU does not reset unexpectedly.
*/
static void prvIncrementResetCount( void );
portSHORT main( void )
{
prvIncrementResetCount();
/* Setup the LED's for output. */
vParTestInitialise();
vStartIntegerMathTasks( tskIDLE_PRIORITY );
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
as 1 in portmacro.h. To use the cooperative scheduler define
configUSE_PREEMPTION as 0. */
vTaskStartScheduler();
return 0;
}
/*-----------------------------------------------------------*/
static void vErrorChecks( void *pvParameters )
{
static volatile unsigned portLONG ulDummyVariable = 3UL;
/* The parameters are not used. */
( void ) pvParameters;
/* Cycle for ever, delaying then checking all the other tasks are still
operating without error. */
for( ;; )
{
vTaskDelay( mainCHECK_PERIOD );
/* Perform a bit of 32bit maths to ensure the registers used by the
integer tasks get some exercise. The result here is not important -
see the demo application documentation for more info. */
ulDummyVariable *= 3;
prvCheckOtherTasksAreStillRunning();
}
}
/*-----------------------------------------------------------*/
static void prvCheckOtherTasksAreStillRunning( void )
{
static portBASE_TYPE xErrorHasOccurred = pdFALSE;
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
xErrorHasOccurred = pdTRUE;
}
if( xAreComTestTasksStillRunning() != pdTRUE )
{
xErrorHasOccurred = pdTRUE;
}
if( xArePollingQueuesStillRunning() != pdTRUE )
{
xErrorHasOccurred = pdTRUE;
}
if( xErrorHasOccurred == pdFALSE )
{
/* Toggle the LED if everything is okay so we know if an error occurs even if not
using console IO. */
vParTestToggleLED( mainCHECK_TASK_LED );
}
}
/*-----------------------------------------------------------*/
static void prvIncrementResetCount( void )
{
unsigned portCHAR ucCount;
const unsigned portCHAR ucReadBit = ( unsigned portCHAR ) 0x01;
const unsigned portCHAR ucWrite1 = ( unsigned portCHAR ) 0x04;
const unsigned portCHAR ucWrite2 = ( unsigned portCHAR ) 0x02;
/* Increment the EEPROM value at 0x00.
Setup the EEPROM address. */
EEARH = 0x00;
EEARL = 0x00;
/* Set the read enable bit. */
EECR |= ucReadBit;
/* Wait for the read. */
while( EECR & ucReadBit );
/* The byte is ready. */
ucCount = EEDR;
/* Increment the reset count, then write the byte back. */
ucCount++;
EEDR = ucCount;
EECR = ucWrite1;
EECR = ( ucWrite1 | ucWrite2 );
}

View file

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project>
<fileVersion>1</fileVersion>
<configuration>
<name>Debug</name>
<file>
<name>$PROJ_DIR$\ParTest\ParTest.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\ParTest.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\serial\serial.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\serial.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\IAR\ATMega323\portmacro.s90</name>
<outputs>
<tool>
<name>AAVR</name>
<file>$PROJ_DIR$\Output\Obj\portmacro.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\comtest.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\comtest.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\tasks.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\tasks.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\integer.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_1.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\heap_1.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\IAR\ATMega323\port.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\port.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\PollQ.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\PollQ.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\queue.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\queue.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\flash.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\flash.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\main.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\main.r90</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\list.c</name>
<outputs>
<tool>
<name>ICCAVR</name>
<file>$PROJ_DIR$\Output\Obj\list.r90</file>
</tool>
</outputs>
</file>
<file>
<name>[ROOT_NODE]</name>
<outputs>
<tool>
<name>XLINK</name>
<file>$PROJ_DIR$\Output\Exe\rtosdemo.a90</file>
<file>$PROJ_DIR$\Output\Exe\rtosdemo.d90</file>
</tool>
</outputs>
</file>
<forcedrebuild>
<name>[MULTI_TOOL]</name>
<tool>XLINK</tool>
</forcedrebuild>
</configuration>
</project>

View file

@ -0,0 +1,613 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project>
<fileVersion>1</fileVersion>
<configuration>
<name>Debug</name>
<toolchain>
<name>AVR</name>
</toolchain>
<debug>1</debug>
<settings>
<name>C-SPY</name>
<archiveVersion>2</archiveVersion>
<data>
<version>11</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CSVariantProcessor</name>
<state>0</state>
</option>
<option>
<name>MacOverride</name>
<state>0</state>
</option>
<option>
<name>MacFile</name>
<state>$TOOLKIT_DIR$\*.mac</state>
</option>
<option>
<name>DDFile</name>
<state>$TOOLKIT_DIR$\Config\iom323.ddf</state>
</option>
<option>
<name>CInput</name>
<state>1</state>
</option>
<option>
<name>OCEnhancedCore</name>
<state>1</state>
</option>
<option>
<name>OC64BitDoubles</name>
<state>1</state>
</option>
<option>
<name>DdfFileSlave</name>
<state></state>
</option>
<option>
<name>RunToEnable</name>
<state>1</state>
</option>
<option>
<name>RunToName</name>
<state>main</state>
</option>
<option>
<name>newDDFileOverride</name>
<state>0</state>
</option>
<option>
<name>CSVariantEepromSize</name>
<state>0</state>
</option>
<option>
<name>CSVariant64KFlash</name>
<state>0</state>
</option>
<option>
<name>CdDllSlave</name>
<state>0</state>
</option>
<option>
<name>CDynDriver</name>
<state>SIMAVR</state>
</option>
</data>
</settings>
<settings>
<name>CCRAVR</name>
<archiveVersion>2</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OCCRAVRDriver</name>
<state>1</state>
</option>
<option>
<name>OCCRAVRExtraOptions</name>
<state></state>
</option>
<option>
<name>OCCRAVRExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>OCCRAVRPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OCCRAVRBaud</name>
<version>0</version>
<state>5</state>
</option>
<option>
<name>OCCRAVRParity</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OCCRAVRDataBits</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OCCRAVRStopBits</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OCCRAVRHandshake</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OCCRAVRAllComm</name>
<state>1</state>
</option>
<option>
<name>OCCRAVRDoLogfile</name>
<state>0</state>
</option>
<option>
<name>OCCRAVRLogFile</name>
<state>cspycomm.log</state>
</option>
<option>
<name>OCCRAVRSuppressLoad</name>
<state>0</state>
</option>
<option>
<name>OCCRAVRFastDownload</name>
<state>1</state>
</option>
<option>
<name>OCCRAVRTargetCCheck</name>
<state>0</state>
</option>
<option>
<name>OCCRAVRdownloadToData</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>ICE200AVR</name>
<archiveVersion>2</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OICE200AVRDriver</name>
<state>1</state>
</option>
<option>
<name>OICE200AVRExtraOptions</name>
<state></state>
</option>
<option>
<name>OICE200AVRExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>OICE200AVRPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OICE200AVRBaud</name>
<version>0</version>
<state>5</state>
</option>
<option>
<name>OICE200AVRParity</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OICE200AVRDataBits</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OICE200AVRStopBits</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OICE200AVRHandshake</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OICE200AVRAllComm</name>
<state>1</state>
</option>
<option>
<name>OICE200AVRDoLogfile</name>
<state>0</state>
</option>
<option>
<name>OICE200AVRLogFile</name>
<state>cspycomm.log</state>
</option>
<option>
<name>OICE200AVRHighSpeed</name>
<state>1</state>
</option>
<option>
<name>OICE200AVRSingleStepTimers</name>
<state>0</state>
</option>
<option>
<name>OICE200AVRRestoreEEPROM</name>
<state>0</state>
</option>
<option>
<name>OICE200AVRComPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OICE200AVRSuppLoad</name>
<state>0</state>
</option>
<option>
<name>OICE200AVRConsCheck</name>
<state>0</state>
</option>
<option>
<name>OICE200AVRIce200ResetDelayList</name>
<version>8</version>
<state>0</state>
</option>
<option>
<name>OICE200AVRIce200downloadToData</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>JTAGICEAVR</name>
<archiveVersion>2</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OJTAGICEAVRDriver</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEAVRExtraOptions</name>
<state></state>
</option>
<option>
<name>OJTAGICEAVRExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRBaud</name>
<version>0</version>
<state>5</state>
</option>
<option>
<name>OJTAGICEAVRParity</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRDataBits</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRStopBits</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRHandshake</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRAllComm</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEAVRDoLogfile</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRLogFile</name>
<state>cspycomm.log</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceDefaultCom</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceComPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceSuppLoad</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceConsCheck</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceJtagFreqRadio</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceJtagFreqManually</name>
<state>100000</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceJtagFreq</name>
<version>0</version>
<state>5</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceJtagDeviceBefore</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceJtagDeviceAfter</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceJtagInstrBitsBefore</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceJtagInstrBitsAfter</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIceDaisyChain</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagDebugTimers</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEAVRJtagDebugEeprom</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagDebugReset</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagDebugFuses</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEAVRJtagIcedownloadToData</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>JTAGICEMKIIAVR</name>
<archiveVersion>1</archiveVersion>
<data>
<version>3</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OJTAGICEMKIIAVRDriver</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEMKIIAVRExtraOptions</name>
<state></state>
</option>
<option>
<name>OJTAGICEMKIIAVRExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRBaud</name>
<version>0</version>
<state>5</state>
</option>
<option>
<name>OJTAGICEMKIIAVRParity</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRDataBits</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRStopBits</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRHandshake</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRAllComm</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEMKIIAVRDoLogfile</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRLogFile</name>
<state>cspycomm.log</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceDefaultCom</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceComPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceSuppLoad</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceConsCheck</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceJtagFreqRadio</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceJtagFreqManually</name>
<state>100000</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceJtagFreq</name>
<version>0</version>
<state>8</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceJtagDeviceBefore</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceJtagDeviceAfter</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceJtagInstrBitsBefore</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceJtagInstrBitsAfter</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIceDaisyChain</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagDebugTimers</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagDebugEeprom</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagDebugReset</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagDebugFuses</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagIcedownloadToData</name>
<state>0</state>
</option>
<option>
<name>OJTAGICEMKIIAVRCommunication</name>
<state>1</state>
</option>
<option>
<name>OJTAGICEMKIIAVRJtagSoftwareBreak</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>SIMAVR</name>
<archiveVersion>2</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OSIMAVRDriver</name>
<state>1</state>
</option>
<option>
<name>OSIMAVRExtraOptions</name>
<state></state>
</option>
<option>
<name>OSIMAVRExtraOptionsCheck</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>THIRDPARTYAVR</name>
<archiveVersion>2</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OTHIRDPARTYAVRDriver</name>
<state>1</state>
</option>
<option>
<name>OTHIRDPARTYAVRExtraOptions</name>
<state></state>
</option>
<option>
<name>OTHIRDPARTYAVRExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>OTHIRDPARTYAVRDriverDll</name>
<state>Browse to your Third party driver</state>
</option>
<option>
<name>OTHIRDPARTYAVRSuppress</name>
<state>0</state>
</option>
<option>
<name>OTHIRDPARTYAVRVerify</name>
<state>0</state>
</option>
<option>
<name>OTHIRDPARTYAVRLogFileCheck</name>
<state>0</state>
</option>
<option>
<name>OTHIRDPARTYAVRLogFileEditB</name>
<state>$TOOLKIT_DIR$\cspycomm.log</state>
</option>
</data>
</settings>
<debuggerPlugins>
<plugin>
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Profiling\Profiling.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Trace\Trace.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
</debuggerPlugins>
</configuration>
</project>

File diff suppressed because it is too large Load diff

View file

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

View file

@ -0,0 +1,195 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR IAR AVR PORT. */
#include <stdlib.h>
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
#include "serial.h"
#define serBAUD_DIV_CONSTANT ( ( unsigned portLONG ) 16 )
/* Constants for writing to UCSRB. */
#define serRX_INT_ENABLE ( ( unsigned portCHAR ) 0x80 )
#define serRX_ENABLE ( ( unsigned portCHAR ) 0x10 )
#define serTX_ENABLE ( ( unsigned portCHAR ) 0x08 )
#define serTX_INT_ENABLE ( ( unsigned portCHAR ) 0x20 )
/* Constants for writing to UCSRC. */
#define serUCSRC_SELECT ( ( unsigned portCHAR ) 0x80 )
#define serEIGHT_DATA_BITS ( ( unsigned portCHAR ) 0x06 )
static xQueueHandle xRxedChars;
static xQueueHandle xCharsForTx;
#define vInterruptOn() \
{ \
unsigned portCHAR ucByte; \
\
ucByte = UCSRB; \
ucByte |= serTX_INT_ENABLE; \
outb( UCSRB, ucByte ); \
}
/*-----------------------------------------------------------*/
#define vInterruptOff() \
{ \
unsigned portCHAR ucByte; \
\
ucByte = UCSRB; \
ucByte &= ~serTX_INT_ENABLE; \
outb( UCSRB, ucByte ); \
}
/*-----------------------------------------------------------*/
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
unsigned portLONG ulBaudRateCounter;
unsigned portCHAR ucByte;
portENTER_CRITICAL();
{
/* Create the queues used by the com test task. */
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
/* Calculate the baud rate register value from the equation in the
data sheet. */
ulBaudRateCounter = ( configCPU_CLOCK_HZ / ( serBAUD_DIV_CONSTANT * ulWantedBaud ) ) - ( unsigned portLONG ) 1;
/* Set the baud rate. */
ucByte = ( unsigned portCHAR ) ( ulBaudRateCounter & ( unsigned portLONG ) 0xff );
outb( UBRRL, ucByte );
ulBaudRateCounter >>= ( unsigned portLONG ) 8;
ucByte = ( unsigned portCHAR ) ( ulBaudRateCounter & ( unsigned portLONG ) 0xff );
outb( UBRRH, ucByte );
/* Enable the Rx interrupt. The Tx interrupt will get enabled
later. Also enable the Rx and Tx. */
outb( UCSRB, serRX_INT_ENABLE | serRX_ENABLE | serTX_ENABLE );
/* Set the data bits to 8. */
outb( UCSRC, serUCSRC_SELECT | serEIGHT_DATA_BITS );
}
portEXIT_CRITICAL();
/* Unlike other ports, this serial code does not allow for more than one
com port. We therefore don't return a pointer to a port structure and can
instead just return NULL. */
return NULL;
}
/*-----------------------------------------------------------*/
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
{
/* Get the next character from the buffer. Return false if no characters
are available, or arrive before xBlockTime expires. */
if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )
{
return pdTRUE;
}
else
{
return pdFALSE;
}
}
/*-----------------------------------------------------------*/
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
{
/* Return false if after the block time there is no room on the Tx queue. */
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
{
return pdFAIL;
}
vInterruptOn();
return pdPASS;
}
/*-----------------------------------------------------------*/
void vSerialClose( xComPortHandle xPort )
{
unsigned portCHAR ucByte;
/* Turn off the interrupts. We may also want to delete the queues and/or
re-install the original ISR. */
portENTER_CRITICAL();
{
vInterruptOff();
ucByte = UCSRB;
ucByte &= ~serRX_INT_ENABLE;
outb( UCSRB, ucByte );
}
portEXIT_CRITICAL();
}
/*-----------------------------------------------------------*/
__interrupt void SIG_UART_RECV( void )
{
signed portCHAR cChar;
/* Get the character and post it on the queue of Rxed characters.
If the post causes a task to wake force a context switch as the woken task
may have a higher priority than the task we have interrupted. */
cChar = UDR;
if( xQueueSendFromISR( xRxedChars, &cChar, pdFALSE ) )
{
taskYIELD();
}
}
/*-----------------------------------------------------------*/
__interrupt void SIG_UART_DATA( void )
{
signed portCHAR cChar, cTaskWoken;
if( xQueueReceiveFromISR( xCharsForTx, &cChar, &cTaskWoken ) == pdTRUE )
{
/* Send the next character queued for Tx. */
outb( UDR, cChar );
}
else
{
/* Queue empty, nothing to send. */
vInterruptOff();
}
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<Project/>

View file

@ -0,0 +1,38 @@
[DisAssemblyWindow]
NumStates=_ 1
State 1=_ 1
[Watch]
Watch 1=_ 1 "usCurrentNumberOfTasks"
Watch 2=
Watch 3=
[CodeCoverage]
State=_ 0
[Profiling]
State=_ 0
[TermIOSettings]
Filename=_ ""
InputMode=_ 1
[QWatch]
WindowContent=_ 100 100 100 100
[Desktop-Debug]
Wnd0=_ "Watch" "open" 44 0 1 -1 -1 -1 -1 1139 276 1595 524 100 100 100 100
Wnd1=_ "Memory" "open" 44 0 1 -1 -1 -1 -1 1139 217 1591 939 1 1872 0 1872 0 1 0 1 0
Wnd2=_ "CallStack" "open" 44 0 1 -1 -1 -1 -1 30 699 277 1037 1
Wnd3=_ "Register" "open" 44 0 1 -1 -1 -1 -1 1237 0 1569 1019 0 0 0 0
Wnd4=_ "Register" "open" 44 0 1 -1 -1 -1 -1 40 264 1312 986 0 0 0 0
Wnd5=_ "Editor-DebugSource" "open" 44 0 1 -1 -1 -1 -1 169 991 1062 2036 "E:\Dev\FreeRTOS\Source\portable\IAR\ATMega323\portmacro.s90" 1 1 0 206 6825 6825
Wnd6=_ "Disassembly" "open" 44 0 1 -1 -1 -4 -28 586 28 1196 854
Wnd7=_ "Log" "closed" 44 0 1 -1 -1 -4 -28 872 845 1595 1069
Wnd8=_ "Locals" "closed" 44 0 1 -1 -1 -1 -1 1139 0 1595 276 100 100 100 100
Wnd9=_ "Terminal I/O" "closed" 44 0 1 -1 -1 -1 -1 1138 522 1595 826
Maximized=_ 0
Count=_ 10
[Log file]
LoggingEnabled=_ 0
LogFile=_ ""
Category=_ 0
[TermIOLog]
LoggingEnabled=_ 0
LogFile=_ ""
[Breakpoints]
Count=0

View file

@ -0,0 +1,4 @@
[struct types]
Count=_ 0
[watch formats]
Count=_ 0

View file

@ -0,0 +1,10 @@
[WorkspaceWindow]
ExpandedNodes=_ 1 "rtosdemo" 1 "rtosdemo/Debug"
SelectedTab=_ 0
[Desktop-Workspace]
Wnd0=_ "TextEditor" "open" 44 0 1 -1 -1 -1 -1 378 14 1227 671 "E:\Dev\FreeRTOS\Source\tasks.c" 1 1 0 1170 37742 37742
Wnd1=_ "TextEditor" "open" 44 0 1 -1 -1 -1 -1 81 81 930 738 "E:\Dev\FreeRTOS\Source\portable\IAR\ATMega323\portmacro.h" 1 1 0 66 3233 3233
Wnd2=_ "Workspace2" "open" 44 0 1 -1 -1 -4 -28 0 0 352 713 276 27 27
Wnd3=_ "Messages2" "open" 44 0 1 -1 -1 -4 -28 -6 714 1590 1104 5 "Build\Messages" 1580 "Find in Files\Line" 79 "Find in Files\Path" 474 "Find in Files\String" 948 "Tool Output\Output" 1560
Maximized=_ 0
Count=_ 4

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<Workspace>
<ConfigDictionary>
<CurrentConfigs><Project>rtosdemo/Debug</Project></CurrentConfigs></ConfigDictionary>
<Desktop>
<Static>
<Workspace>
<ColumnWidths>
<Column0>109</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1153</ColumnWidth1><ColumnWidth2>307</ColumnWidth2><ColumnWidth3>76</ColumnWidth3></Build></Static>
<Windows>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-12388-19520</Identity>
<TabName>Workspace</TabName>
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>rtosdemo</ExpandedNode><ExpandedNode>rtosdemo/portheap.c</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-19172-8303</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1></Windows>
<Editor>
<Pane/><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-0084f828><key>iaridepm1</key></Toolbar-0084f828></Sizes></Row0></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>718</Bottom><Right>183</Right><x>-2</x><y>-2</y><xscreen>185</xscreen><yscreen>185</yscreen><sizeHorzCX>115625</sizeHorzCX><sizeHorzCY>165326</sizeHorzCY><sizeVertCX>115625</sizeVertCX><sizeVertCY>643431</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>354</Bottom><Right>1602</Right><x>-2</x><y>-2</y><xscreen>1604</xscreen><yscreen>356</yscreen><sizeHorzCX>1002500</sizeHorzCX><sizeHorzCY>318141</sizeHorzCY><sizeVertCX>116250</sizeVertCX><sizeVertCY>166219</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>