blob: ec6084f7e5c27fccf721ee0ab6c9d5ad01e43ad4 [file] [log] [blame]
Richard Barry3878b822006-10-09 11:40:24 +00001/*
Richard Barryee0ff3a2009-07-07 09:58:26 +00002 FreeRTOS.org V5.4.0 - Copyright (C) 2003-2009 Richard Barry.
Richard Barry3878b822006-10-09 11:40:24 +00003
4 This file is part of the FreeRTOS.org distribution.
5
Richard Barryd79f0292009-05-30 16:14:31 +00006 FreeRTOS.org is free software; you can redistribute it and/or modify it
Richard Barry2f40ad72009-03-14 19:20:12 +00007 under the terms of the GNU General Public License (version 2) as published
8 by the Free Software Foundation and modified by the FreeRTOS exception.
Richard Barryd79f0292009-05-30 16:14:31 +00009 **NOTE** The exception to the GPL is included to allow you to distribute a
10 combined work that includes FreeRTOS.org without being obliged to provide
11 the source code for any proprietary components. Alternative commercial
12 license and support terms are also available upon request. See the
13 licensing section of http://www.FreeRTOS.org for full details.
Richard Barry3878b822006-10-09 11:40:24 +000014
Richard Barry2f40ad72009-03-14 19:20:12 +000015 FreeRTOS.org is distributed in the hope that it will be useful, but WITHOUT
Richard Barryd79f0292009-05-30 16:14:31 +000016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
Richard Barry2f40ad72009-03-14 19:20:12 +000018 more details.
Richard Barry3878b822006-10-09 11:40:24 +000019
Richard Barryd79f0292009-05-30 16:14:31 +000020 You should have received a copy of the GNU General Public License along
21 with FreeRTOS.org; if not, write to the Free Software Foundation, Inc., 59
Richard Barry2f40ad72009-03-14 19:20:12 +000022 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
Richard Barry3878b822006-10-09 11:40:24 +000023
Richard Barry2f40ad72009-03-14 19:20:12 +000024
25 ***************************************************************************
26 * *
27 * Get the FreeRTOS eBook! See http://www.FreeRTOS.org/Documentation *
Richard Barry52ba0e62009-02-09 20:21:35 +000028 * *
29 * This is a concise, step by step, 'hands on' guide that describes both *
30 * general multitasking concepts and FreeRTOS specifics. It presents and *
31 * explains numerous examples that are written using the FreeRTOS API. *
32 * Full source code for all the examples is provided in an accompanying *
33 * .zip file. *
Richard Barry2f40ad72009-03-14 19:20:12 +000034 * *
35 ***************************************************************************
36
37 1 tab == 4 spaces!
Richard Barry0a6d59a2007-04-01 20:47:49 +000038
Richard Barry527fb6a2008-03-25 21:22:13 +000039 Please ensure to read the configuration and relevant port sections of the
Richard Barryc86dcf72008-02-03 19:45:58 +000040 online documentation.
41
Richard Barry2f40ad72009-03-14 19:20:12 +000042 http://www.FreeRTOS.org - Documentation, latest information, license and
Richard Barry527fb6a2008-03-25 21:22:13 +000043 contact details.
Richard Barryc86dcf72008-02-03 19:45:58 +000044
Richard Barry2f40ad72009-03-14 19:20:12 +000045 http://www.SafeRTOS.com - A version that is certified for use in safety
Richard Barry527fb6a2008-03-25 21:22:13 +000046 critical systems.
Richard Barryc86dcf72008-02-03 19:45:58 +000047
Richard Barry2f40ad72009-03-14 19:20:12 +000048 http://www.OpenRTOS.com - Commercial support, development, porting,
Richard Barry527fb6a2008-03-25 21:22:13 +000049 licensing and training services.
Richard Barry3878b822006-10-09 11:40:24 +000050*/
51
52/* Scheduler includes. */
53#include "FreeRTOS.h"
54
55/* Demo app includes. */
56#include "partest.h"
57
58#define ptOUTPUT 0
59#define ptALL_OFF 0
60
61/*-----------------------------------------------------------
62 * Simple parallel port IO routines.
63 *-----------------------------------------------------------*/
64
65void vParTestInitialise( void )
66{
67 /* The explorer 16 board has LED's on port A. All bits are set as output
68 so PORTA is read-modified-written directly. */
69 TRISA = ptOUTPUT;
70 PORTA = ptALL_OFF;
71}
72/*-----------------------------------------------------------*/
73
74void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
75{
76unsigned portBASE_TYPE uxLEDBit;
77
78 /* Which port A bit is being modified? */
79 uxLEDBit = 1 << uxLED;
80
81 if( xValue )
82 {
83 /* Turn the LED on. */
84 portENTER_CRITICAL();
85 {
86 PORTA |= uxLEDBit;
87 }
88 portEXIT_CRITICAL();
89 }
90 else
91 {
92 /* Turn the LED off. */
93 portENTER_CRITICAL();
94 {
95 PORTA &= ~uxLEDBit;
96 }
97 portEXIT_CRITICAL();
98 }
99}
100/*-----------------------------------------------------------*/
101
102void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
103{
104unsigned portBASE_TYPE uxLEDBit;
105
106 uxLEDBit = 1 << uxLED;
107 portENTER_CRITICAL();
108 {
109 /* If the LED is already on - turn it off. If the LED is already
110 off, turn it on. */
111 if( PORTA & uxLEDBit )
112 {
113 PORTA &= ~uxLEDBit;
114 }
115 else
116 {
117 PORTA |= uxLEDBit;
118 }
119 }
120 portEXIT_CRITICAL();
121}
122