2 FreeRTOS V5.4.0 - Copyright (C) 2003-2009 Richard Barry.
\r
4 This file is part of the FreeRTOS distribution.
\r
6 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
7 the terms of the GNU General Public License (version 2) as published by the
\r
8 Free Software Foundation and modified by the FreeRTOS exception.
\r
9 **NOTE** The exception to the GPL is included to allow you to distribute a
\r
10 combined work that includes FreeRTOS without being obliged to provide the
\r
11 source code for proprietary components outside of the FreeRTOS kernel.
\r
12 Alternative commercial license and support terms are also available upon
\r
13 request. See the licensing section of http://www.FreeRTOS.org for full
\r
16 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
\r
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
21 You should have received a copy of the GNU General Public License along
\r
22 with FreeRTOS; if not, write to the Free Software Foundation, Inc., 59
\r
23 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\r
26 ***************************************************************************
\r
28 * Looking for a quick start? Then check out the FreeRTOS eBook! *
\r
29 * See http://www.FreeRTOS.org/Documentation for details *
\r
31 ***************************************************************************
\r
35 Please ensure to read the configuration and relevant port sections of the
\r
36 online documentation.
\r
38 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
41 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
44 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
45 licensing and training services.
\r
47 #include <c8051f120.h>
\r
49 #include "FreeRTOS.h"
\r
51 #include "partest.h"
\r
53 #define partstPUSH_PULL ( ( unsigned portCHAR ) 0xff )
\r
54 #define partstALL_OUTPUTS_OFF ( ( unsigned portCHAR ) 0xff )
\r
56 /* LED to output is dependent on how the LED's are wired. */
\r
57 #define partstOUTPUT_0 ( ( unsigned portCHAR ) 0x02 )
\r
58 #define partstOUTPUT_1 ( ( unsigned portCHAR ) 0x08 )
\r
59 #define partstOUTPUT_2 ( ( unsigned portCHAR ) 0x20 )
\r
60 #define partstOUTPUT_3 ( ( unsigned portCHAR ) 0x01 )
\r
61 #define partstOUTPUT_4 ( ( unsigned portCHAR ) 0x04 )
\r
62 #define partstOUTPUT_5 ( ( unsigned portCHAR ) 0x10 )
\r
63 #define partstOUTPUT_6 ( ( unsigned portCHAR ) 0x40 )
\r
64 #define partstOUTPUT_7 ( ( unsigned portCHAR ) 0x80 )
\r
66 /*-----------------------------------------------------------
\r
67 * Simple parallel port IO routines.
\r
68 *-----------------------------------------------------------*/
\r
70 void vParTestInitialise( void )
\r
72 unsigned portCHAR ucOriginalSFRPage;
\r
74 /* Remember the SFR page before it is changed so it can get set back
\r
75 before the function exits. */
\r
76 ucOriginalSFRPage = SFRPAGE;
\r
78 /* Setup the SFR page to access the config SFR's. */
\r
79 SFRPAGE = CONFIG_PAGE;
\r
81 /* Set the on board LED to push pull. */
\r
82 P3MDOUT |= partstPUSH_PULL;
\r
84 /* Return the SFR page. */
\r
85 SFRPAGE = ucOriginalSFRPage;
\r
87 P3 = partstALL_OUTPUTS_OFF;
\r
89 /*-----------------------------------------------------------*/
\r
91 void vParTestSetLED( unsigned portBASE_TYPE uxLED, portBASE_TYPE xValue )
\r
93 portBASE_TYPE xError = pdFALSE;
\r
97 if( xValue == pdFALSE )
\r
101 case 0 : P3 |= partstOUTPUT_0;
\r
103 case 1 : P3 |= partstOUTPUT_1;
\r
105 case 2 : P3 |= partstOUTPUT_2;
\r
107 case 3 : P3 |= partstOUTPUT_3;
\r
109 case 4 : P3 |= partstOUTPUT_4;
\r
111 case 5 : P3 |= partstOUTPUT_5;
\r
113 case 6 : P3 |= partstOUTPUT_6;
\r
115 case 7 : P3 |= partstOUTPUT_7;
\r
117 default : /* There are no other LED's wired in. */
\r
126 case 0 : P3 &= ~partstOUTPUT_0;
\r
128 case 1 : P3 &= ~partstOUTPUT_1;
\r
130 case 2 : P3 &= ~partstOUTPUT_2;
\r
132 case 3 : P3 &= ~partstOUTPUT_3;
\r
134 case 4 : P3 &= ~partstOUTPUT_4;
\r
136 case 5 : P3 &= ~partstOUTPUT_5;
\r
138 case 6 : P3 &= ~partstOUTPUT_6;
\r
140 case 7 : P3 &= ~partstOUTPUT_7;
\r
142 default : /* There are no other LED's wired in. */
\r
149 /*-----------------------------------------------------------*/
\r
151 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
\r
153 unsigned portCHAR ucBit;
\r
154 portBASE_TYPE xError = pdFALSE;
\r
160 case 0 : ucBit = partstOUTPUT_0;
\r
162 case 1 : ucBit = partstOUTPUT_1;
\r
164 case 2 : ucBit = partstOUTPUT_2;
\r
166 case 3 : ucBit = partstOUTPUT_3;
\r
168 case 4 : ucBit = partstOUTPUT_4;
\r
170 case 5 : ucBit = partstOUTPUT_5;
\r
172 case 6 : ucBit = partstOUTPUT_6;
\r
174 case 7 : ucBit = partstOUTPUT_7;
\r
176 default : /* There are no other LED's wired in. */
\r
181 if( xError != pdTRUE )
\r