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,475 @@
[F29012037]
x=0
y=115
[F15207742]
x=0
y=48
[F10478061]
x=0
y=48
[F28429921]
x=0
y=0
[ProjectGroup]
nFiles=1
FileName0=Demo4.PC
[Project]
nFiles=8
UseAD=0
CompatOpts=0
AutoHead=
IdentifierPrint=0
TreePrint=0
StatementResultPrint=0
SourcePrint=0
spoPrint=0
AsmPrint=0
CaseSens=1
Optimise=45
AProcFreq=40000000
LOptBytes=16
LOptBytesReg=6
TopROM=32767
StackPointer=3839
HeapPointer=3584
HasDoneOptionDialog=1
ASMProcessor=18F4620
UseLinker=0
DEBUGADV=1
Column0=-1
Column1=-1
Column2=259
TabIndex=0
ShowIcons=0
WindowState=0
Top=418
Left=0
Width=339
Height=209
FileType0_Name=main.c
FileType0_FileType=0
FileType0_DoLast=0
FileType1_Name=interrupt.c
FileType1_FileType=0
FileType1_DoLast=0
FileType2_Name=fuses.c
FileType2_FileType=0
FileType2_DoLast=0
FileType3_Name=..\serial\serial.c
FileType3_FileType=0
FileType3_DoLast=0
FileType4_Name=..\ParTest\ParTest.c
FileType4_FileType=0
FileType4_DoLast=0
FileType5_Name=..\..\Common\Minimal\integer.c
FileType5_FileType=0
FileType5_DoLast=0
FileType6_Name=..\..\Common\Minimal\dynamic.c
FileType6_FileType=0
FileType6_DoLast=0
FileType7_Name=..\..\Common\Minimal\flash.c
FileType7_FileType=0
FileType7_DoLast=0
[Debug]
WindowState=0
Top=0
Left=679
Width=338
Height=626
WinNumberIsIndex0=4097
WinNumberIsIndex1=4096
WinNumberIsIndex2=12
WinNumberIsIndex3=9
WinNumberIsIndex4=8
WinNumberIsIndex5=7
WinNumberIsIndex6=5
WinNumberIsIndex7=4
WinNumberIsIndex8=3
WinNumberIsIndex9=2
WinNumberIsIndex10=1
WinNumberIsIndex11=11
WinNumberIsIndex12=0
nWin=13
HType=0
HFreq=19
ScenixTurbo=1
Watchdog=0
LocalVariables=0
DBPort=3970
DBBit=3
UseICD=0
AutoSet=1
DBVars=3824
DBRate=19200
DBSerPort=1
UsePICKey=0
nTabs=4
Tab0=Main
Tab1=Memory
Tab2=Special
Tab3=History
[Window4097]
aHeight=0
aWidth=0
Height=121
Width=200
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=10
y=427
Left=43
Top=264
Group=0
Page=-1
[ExtDev4097]
Type=2
TypeN=Terminal
Pars0=7
Name=Terminal
FileName=
Layer=0
Ports0=0
Bit0=3
ConLev0=-1
Ports1=0
Bit1=2
ConLev1=-1
Pars1=0
Pars2=0
[Window4096]
aHeight=0
aWidth=0
Height=200
Width=90
isMinimised=0
isVisible=1
ShowBorder=0
ShowCaption=0
Sizeable=0
x=10
y=299
Left=43
Top=131
Group=0
Page=-1
[ExtDev4096]
Type=12
TypeN=Pin Out
Ports0=0
Bit0=3
ConLev0=-1
Ports1=0
Bit1=2
ConLev1=-1
Pars0=0
Pars1=0
Pars2=0
Name=Pin Out : 18F4620
FileName=
Layer=1
[Window12]
aHeight=274
aWidth=732
Height=141
Width=366
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=0
y=38
Left=0
Top=100
Group=0
Page=1
[Window9]
aHeight=250
aWidth=250
Height=247
Width=231
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=0
x=98
y=133
Left=49
Top=149
Group=0
Page=15
[Window8]
aHeight=250
aWidth=250
Height=266
Width=283
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=130
y=3
Left=42
Top=82
Group=0
Page=8
[Window7]
aHeight=947
aWidth=978
Height=490
Width=489
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=16
y=45
Left=8
Top=104
Group=0
Page=3
[Window5]
aHeight=955
aWidth=490
Height=494
Width=161
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=504
y=42
Left=166
Top=102
Group=0
Page=2
[Window4]
aHeight=957
aWidth=498
Height=495
Width=164
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=2
y=40
Left=0
Top=101
Group=0
Page=2
[Window3]
aHeight=191
aWidth=985
Height=98
Width=325
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=0
y=666
Left=0
Top=425
Group=0
Page=7
[Window2]
aHeight=1000
aWidth=538
Height=518
Width=177
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=462
y=0
Left=152
Top=81
Group=0
Page=4
[Window1]
aHeight=480
aWidth=998
Height=248
Width=329
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=0
y=517
Left=0
Top=348
Group=0
Page=1
[Window11]
aHeight=335
aWidth=560
Height=173
Width=184
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=436
y=517
Left=143
Top=348
Group=0
Page=9
[Window0]
aHeight=472
aWidth=558
Height=244
Width=184
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=442
y=92
Left=145
Top=128
Group=0
Page=1
[APPWIZ]
AProcFreq=4000000
nUserTemp=0
Proc=16F84
Left=-44
Top=-2376
Width=750
Heigth=600
nElem=0
[GLOBAL]
LoadCheck=2
SimulateAll=1
[MainWindow]
WindowState=2
Top=-4
Left=-4
Width=1032
Height=748
Update=25000
StopOnError=1
[FindRep]
nTextFind=0
nTextReplace=0
[EditWindow]
Tab=0
nFiles=1
nMRU=9
MarginOn=1
MarginType=2
WindowState=0
Top=0
Left=0
Width=679
Height=418
Files0=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo4\main.c
MRU0=C:\DOCUMENTS AND SETTINGS\marcel\MY DOCUMENTS\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WIZC\Demo4\main.c
Files1=C:\PROGRA~1\FED\PIXIE\Libs\LibCore\Bit16.asm
Files2=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo4\Demo4.rep
MRU1=C:\PROGRA~1\FED\PIXIE\Libs\LibCore\Bit16.asm
MRU2=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo4\Demo4.rep
Files3=C:\PROGRAM FILES\FED\PIXIE\Libs\LibsUser\LIBFREERTOS\Modules\Queue.c
Files4=C:\DOCUMENTS AND SETTINGS\marcel\MY DOCUMENTS\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WIZC\Demo4\INTERRUPT.C
MRU3=C:\DOCUMENTS AND SETTINGS\marcel\MY DOCUMENTS\pic\FreeRTOS\FreeRTOS\Demo\Common\Minimal\integer.c
MRU4=C:\DOCUMENTS AND SETTINGS\marcel\MY DOCUMENTS\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WIZC\Demo4\INTERRUPT.C
Files5=C:\DOCUMENTS AND SETTINGS\marcel\MY DOCUMENTS\pic\FreeRTOS\FreeRTOS\Demo\Common\Minimal\integer.c
MRU5=C:\PROGRAM FILES\FED\PIXIE\Libs\LibsUser\LIBFREERTOS\Modules\Queue.c
MRU6=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo4\FreeRTOSConfig.h
MRU7=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\Common\Minimal\flash.c
MRU8=C:\Program Files\FED\PIXIE\Libs\LibCore\Bit16.asm
Files6=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo4\interrupt.c
[PinConnections]
nPins=0
[AssCode]
ProcType=18F4620
[Information]
Column0=-1
Column1=8
Column2=4
Column3=16
Column4=-1
Column5=50
MemoHeight=154
WindowState=0
Top=418
Left=339
Width=339
Height=209
[F29012293]
x=0
y=113
[F28446561]
x=0
y=0
[F20376480]
x=0
y=1205
[F20539803]
x=0
y=256
[F29011781]
x=0
y=118
[F28413281]
x=0
y=0
[F30163230]
x=33
y=61
[F29565054]
x=0
y=0
[F29055566]
x=0
y=137
[F30163742]
x=32
y=44
[F29565566]
x=0
y=0
[F30163486]
x=0
y=0
[F29565310]
x=0
y=0
[F30089258]
x=21
y=70
[F30089514]
x=0
y=107
[F29012549]
x=0
y=111
[F26101515]
x=0
y=269
[F28463201]
x=0
y=0
[F20220814]
x=0
y=423
[F27125515]
x=0
y=0

View file

@ -0,0 +1,82 @@
/*
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 V3.0.0
+ TickRate reduced to 250Hz.
+ configIDLE_SHOULD_YIELD added.
Changes from V3.0.1
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*----------------------------------------------------------*/
#define configUSE_PREEMPTION ( 1 )
#define configUSE_IDLE_HOOK ( 0 )
#define configUSE_TICK_HOOK ( 0 )
#define configTICK_RATE_HZ ( 250 )
#define configMAX_PRIORITIES ( 4 )
#define configMINIMAL_STACK_SIZE portMINIMAL_STACK_SIZE
#define configMAX_TASK_NAME_LEN ( 3 )
#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 component, or zero
to exclude the component. */
/* Include/exclude the stated API function. */
#define INCLUDE_vTaskPrioritySet ( 1 )
#define INCLUDE_uxTaskPriorityGet ( 1 )
#define INCLUDE_vTaskDelete ( 0 )
#define INCLUDE_vTaskCleanUpResources ( 0 )
#define INCLUDE_vTaskSuspend ( 1 )
#define INCLUDE_vTaskDelayUntil ( 1 )
#define INCLUDE_vTaskDelay ( 1 )
#endif /* FREERTOS_CONFIG_H */

View file

@ -0,0 +1,41 @@
#ifndef _MALLOC_SETTINGS_H
#define _MALLOC_SETTINGS_H
/*********************************************************************
** Title: Dynamic memory (de-)allocation library for wizC.
**
** Author: Marcel van Lieshout
**
** Copyright: (c) 2005, HMCS, Marcel van Lieshout
**
** License: This software is released to the public domain and comes
** without warranty and/or guarantees of any kind. You have
** the right to use, copy, modify and/or (re-)distribute the
** software as long as the reference to the author is
** maintained in the software and a reference to the author
** is included in any documentation of each product in which
** this library (in it's original or in a modified form)
** is used.
*********************************************************************/
/*********************************************************************
** The model to use
*********************************************************************/
//#define MALLOC_SMALL
#define MALLOC_LARGE
/*********************************************************************
** The size of the heap
*********************************************************************/
#define MALLOC_HEAP_SIZE (3200)
/*********************************************************************
** Should released memory be scribbled with 0x55 before releasing it?
*********************************************************************/
//#define MALLOC_SCRIBBLE
/********************************************************************
** Enable Debug-mode?
*********************************************************************/
//#define MALLOC_DEBUG
#endif /* _MALLOC_SETTINGS_H */

View file

@ -0,0 +1,53 @@
/*
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 V3.0.0
+ Several modules predefined to avoid linker problems
Changes from V3.0.1
*/
#ifndef _memcpy
#define _memcpy 1
#endif
#ifndef _memset
#define _memset 1
#endif
#ifndef _strncpy
#define _strncpy 1
#endif
#pragma wizcpp searchpath <../../Common/Include/>

View file

@ -0,0 +1,58 @@
/*
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 V3.0.0
Changes from V3.0.1
*/
/*
** Here are the configuration words set. See the PIC datasheet
** and the wizC manual for an explanation
*/
#include <pic.h>
/*
** These fuses are for PIC18F4620
*/
#pragma __config _CONFIG1H,_IESO_OFF_1H & _FCMEN_OFF_1H & _OSC_HSPLL_1H
#pragma __config _CONFIG2L,_BORV_21_2L & _BOREN_SBORDIS_2L & _PWRT_ON_2L
#pragma __config _CONFIG2H,_WDTPS_32768_2H & _WDT_OFF_2H
#pragma __config _CONFIG3H,_MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_PORTC_3H
#pragma __config _CONFIG4L,_DEBUG_OFF_4L & _XINST_OFF_4L & _LVP_OFF_4L & _STVREN_OFF_4L
#pragma __config _CONFIG5L,_CP3_OFF_5L & _CP2_OFF_5L & _CP1_OFF_5L & _CP0_OFF_5L
#pragma __config _CONFIG5H,_CPD_OFF_5H & _CPB_OFF_5H
#pragma __config _CONFIG6L,_WRT3_OFF_6L & _WRT2_OFF_6L & _WRT1_OFF_6L & _WRT0_OFF_6L
#pragma __config _CONFIG6H,_WRTD_OFF_6H & _WRTB_OFF_6H & _WRTC_OFF_6H
#pragma __config _CONFIG7L,_EBTR3_OFF_7L & _EBTR2_OFF_7L & _EBTR1_OFF_7L & _EBTR0_OFF_7L
#pragma __config _CONFIG7H,_EBTRB_OFF_7H

View file

@ -0,0 +1,118 @@
/*
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 V3.0.0
+ Added functionality to only call vTaskSwitchContext() once
when handling multiple interruptsources in a single interruptcall.
+ Included Filenames changed to a .c extension to allow stepping through
code using F7.
Changes from V3.0.1
*/
#include <pic.h>
/* Scheduler include files. */
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
static bit uxSwitchRequested;
/*
* Vector for the ISR.
*/
void pointed Interrupt()
{
/*
* Save the context of the current task.
*/
portSAVE_CONTEXT( portINTERRUPTS_FORCED );
/*
* No contextswitch requested yet
*/
uxSwitchRequested = pdFALSE;
/*
* Was the interrupt the FreeRTOS SystemTick?
*/
#include <libFreeRTOS/Drivers/Tick/isrTick.c>
/*******************************************************************************
** DO NOT MODIFY ANYTHING ABOVE THIS LINE
********************************************************************************
** Enter the includes for the ISR-code of the FreeRTOS drivers below.
**
** You cannot use local variables. Alternatives are:
** - Use static variables (Global RAM usage increases)
** - Call a function (Additional cycles are needed)
** - Use unused SFR's (preferred, no additional overhead)
** See "../Serial/isrSerialTx.c" for an example of this last option
*******************************************************************************/
/*
* Was the interrupt a byte being received?
*/
#include "../Serial/isrSerialRx.c"
/*
* Was the interrupt the Tx register becoming empty?
*/
#include "../Serial/isrSerialTx.c"
/*******************************************************************************
** DO NOT MODIFY ANYTHING BELOW THIS LINE
*******************************************************************************/
/*
* Was a contextswitch requested by one of the
* interrupthandlers?
*/
if ( uxSwitchRequested )
{
vTaskSwitchContext();
}
/*
* Restore the context of the (possibly other) task.
*/
portRESTORE_CONTEXT();
#pragma asmline retfie 0
}

View file

@ -0,0 +1,189 @@
/*
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 V3.0.0
Changes from V3.0.1
*/
/*
* Instead of the normal single demo application, the PIC18F demo is split
* into several smaller programs of which this is the fourth. This enables the
* demo's to be executed on the RAM limited PIC-devices.
*
* The Demo4 project is configured for a PIC18F4620 device. Main.c starts 11
* tasks (including the idle task). See the indicated files in the demo/common
* directory for more information.
*
* demo/common/minimal/integer.c: Creates 1 task
* demo/common/minimal/dynamic.c: Creates 5 tasks
* demo/common/minimal/flash.c: Creates 3 tasks
*
* Main.c also creates a check task. This periodically checks that all the
* other tasks are still running and have not experienced any unexpected
* results. If all the other tasks are executing correctly an LED is flashed
* once every mainCHECK_PERIOD milliseconds. If any of the tasks have not
* executed, or report an error, the frequency of the LED flash will increase
* to mainERROR_FLASH_RATE.
*
* On entry to main an 'X' is transmitted. Monitoring the serial port using a
* dumb terminal allows for verification that the device is not continuously
* being reset (no more than one 'X' should be transmitted).
*
* http://www.FreeRTOS.org contains important information on the use of the
* wizC PIC18F port.
*/
/* Scheduler include files. */
#include <FreeRTOS.h>
#include <task.h>
/* Demo app include files. */
#include "integer.h"
#include "dynamic.h"
#include "flash.h"
#include "partest.h"
#include "serial.h"
/* The period between executions of the check task before and after an error
has been discovered. If an error has been discovered the check task runs
more frequently - increasing the LED flash rate. */
#define mainNO_ERROR_CHECK_PERIOD ( ( portTickType ) 10000 / portTICK_RATE_MS )
#define mainERROR_CHECK_PERIOD ( ( portTickType ) 1000 / portTICK_RATE_MS )
#define mainCHECK_TASK_LED ( ( unsigned portCHAR ) 3 )
/* Priority definitions for some of the tasks. Other tasks just use the idle
priority. */
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portCHAR ) 3 )
#define mainLED_FLASH_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portCHAR ) 2 )
#define mainINTEGER_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portCHAR ) 0 )
/* Constants required for the communications. Only one character is ever
transmitted. */
#define mainCOMMS_QUEUE_LENGTH ( ( unsigned portCHAR ) 5 )
#define mainNO_BLOCK ( ( portTickType ) 0 )
#define mainBAUD_RATE ( ( unsigned portLONG ) 57600 )
/*
* The task function for the "Check" task.
*/
static portTASK_FUNCTION_PROTO( vErrorChecks, pvParameters );
/*
* Checks the unique counts of other tasks to ensure they are still operational.
* Returns pdTRUE if an error is detected, otherwise pdFALSE.
*/
static portCHAR prvCheckOtherTasksAreStillRunning( void );
/*-----------------------------------------------------------*/
/* Creates the tasks, then starts the scheduler. */
void main( void )
{
/* Initialise the required hardware. */
vParTestInitialise();
/* Send a character so we have some visible feedback of a reset. */
xSerialPortInitMinimal( mainBAUD_RATE, mainCOMMS_QUEUE_LENGTH );
xSerialPutChar( NULL, 'X', mainNO_BLOCK );
/* Start the standard demo tasks found in the demo\common directory. */
vStartIntegerMathTasks( mainINTEGER_PRIORITY);
vStartDynamicPriorityTasks();
vStartLEDFlashTasks( mainLED_FLASH_PRIORITY );
/* Start the check task defined in this file. */
xTaskCreate( vErrorChecks, ( const portCHAR * const ) "Check", portMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* Start the scheduler. Will never return here. */
vTaskStartScheduler( );
while(1) /* This point should never be reached. */
{
}
}
/*-----------------------------------------------------------*/
static portTASK_FUNCTION( vErrorChecks, pvParameters )
{
portTickType xLastCheckTime;
portTickType xDelayTime = mainNO_ERROR_CHECK_PERIOD;
portCHAR cErrorOccurred;
/* We need to initialise xLastCheckTime prior to the first call to
vTaskDelayUntil(). */
xLastCheckTime = xTaskGetTickCount();
/* Cycle for ever, delaying then checking all the other tasks are still
operating without error. */
for( ;; )
{
/* Wait until it is time to check the other tasks again. */
vTaskDelayUntil( &xLastCheckTime, xDelayTime );
/* Check all the other tasks are running, and running without ever
having an error. */
cErrorOccurred = prvCheckOtherTasksAreStillRunning();
/* If an error was detected increase the frequency of the LED flash. */
if( cErrorOccurred == pdTRUE )
{
xDelayTime = mainERROR_CHECK_PERIOD;
}
/* Flash the LED for visual feedback. */
vParTestToggleLED( mainCHECK_TASK_LED );
}
}
/*-----------------------------------------------------------*/
static portCHAR prvCheckOtherTasksAreStillRunning( void )
{
portCHAR cErrorHasOccurred = ( portCHAR ) pdFALSE;
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
cErrorHasOccurred = ( portCHAR ) pdTRUE;
}
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
{
cErrorHasOccurred = ( portCHAR ) pdTRUE;
}
return cErrorHasOccurred;
}
/*-----------------------------------------------------------*/