2 FreeRTOS V4.0.1 - Copyright (C) 2003-2006 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
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 FreeRTOS is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with FreeRTOS; if not, write to the Free Software
\r
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
20 A special exception to the GPL can be applied should you wish to distribute
\r
21 a combined work that includes FreeRTOS, without being obliged to provide
\r
22 the source code for any proprietary components. See the licensing section
\r
23 of http://www.FreeRTOS.org for full details of how and when the exception
\r
26 ***************************************************************************
\r
27 See http://www.FreeRTOS.org for documentation, latest information, license
\r
28 and contact details. Please ensure to read the configuration and relevant
\r
29 port sections of the online documentation.
\r
30 ***************************************************************************
\r
32 #include <c8051f120.h>
\r
34 #include "FreeRTOS.h"
\r
36 #include "partest.h"
\r
38 #define partstPUSH_PULL ( ( unsigned portCHAR ) 0xff )
\r
39 #define partstALL_OUTPUTS_OFF ( ( unsigned portCHAR ) 0xff )
\r
41 /* LED to output is dependent on how the LED's are wired. */
\r
42 #define partstOUTPUT_0 ( ( unsigned portCHAR ) 0x02 )
\r
43 #define partstOUTPUT_1 ( ( unsigned portCHAR ) 0x08 )
\r
44 #define partstOUTPUT_2 ( ( unsigned portCHAR ) 0x20 )
\r
45 #define partstOUTPUT_3 ( ( unsigned portCHAR ) 0x01 )
\r
46 #define partstOUTPUT_4 ( ( unsigned portCHAR ) 0x04 )
\r
47 #define partstOUTPUT_5 ( ( unsigned portCHAR ) 0x10 )
\r
48 #define partstOUTPUT_6 ( ( unsigned portCHAR ) 0x40 )
\r
49 #define partstOUTPUT_7 ( ( unsigned portCHAR ) 0x80 )
\r
51 /*-----------------------------------------------------------
\r
52 * Simple parallel port IO routines.
\r
53 *-----------------------------------------------------------*/
\r
55 void vParTestInitialise( void )
\r
57 unsigned portCHAR ucOriginalSFRPage;
\r
59 /* Remember the SFR page before it is changed so it can get set back
\r
60 before the function exits. */
\r
61 ucOriginalSFRPage = SFRPAGE;
\r
63 /* Setup the SFR page to access the config SFR's. */
\r
64 SFRPAGE = CONFIG_PAGE;
\r
66 /* Set the on board LED to push pull. */
\r
67 P3MDOUT |= partstPUSH_PULL;
\r
69 /* Return the SFR page. */
\r
70 SFRPAGE = ucOriginalSFRPage;
\r
72 P3 = partstALL_OUTPUTS_OFF;
\r
74 /*-----------------------------------------------------------*/
\r
76 void vParTestSetLED( unsigned portBASE_TYPE uxLED, portBASE_TYPE xValue )
\r
78 portBASE_TYPE xError = pdFALSE;
\r
82 if( xValue == pdFALSE )
\r
86 case 0 : P3 |= partstOUTPUT_0;
\r
88 case 1 : P3 |= partstOUTPUT_1;
\r
90 case 2 : P3 |= partstOUTPUT_2;
\r
92 case 3 : P3 |= partstOUTPUT_3;
\r
94 case 4 : P3 |= partstOUTPUT_4;
\r
96 case 5 : P3 |= partstOUTPUT_5;
\r
98 case 6 : P3 |= partstOUTPUT_6;
\r
100 case 7 : P3 |= partstOUTPUT_7;
\r
102 default : /* There are no other LED's wired in. */
\r
111 case 0 : P3 &= ~partstOUTPUT_0;
\r
113 case 1 : P3 &= ~partstOUTPUT_1;
\r
115 case 2 : P3 &= ~partstOUTPUT_2;
\r
117 case 3 : P3 &= ~partstOUTPUT_3;
\r
119 case 4 : P3 &= ~partstOUTPUT_4;
\r
121 case 5 : P3 &= ~partstOUTPUT_5;
\r
123 case 6 : P3 &= ~partstOUTPUT_6;
\r
125 case 7 : P3 &= ~partstOUTPUT_7;
\r
127 default : /* There are no other LED's wired in. */
\r
134 /*-----------------------------------------------------------*/
\r
136 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
\r
138 unsigned portCHAR ucBit;
\r
139 portBASE_TYPE xError = pdFALSE;
\r
145 case 0 : ucBit = partstOUTPUT_0;
\r
147 case 1 : ucBit = partstOUTPUT_1;
\r
149 case 2 : ucBit = partstOUTPUT_2;
\r
151 case 3 : ucBit = partstOUTPUT_3;
\r
153 case 4 : ucBit = partstOUTPUT_4;
\r
155 case 5 : ucBit = partstOUTPUT_5;
\r
157 case 6 : ucBit = partstOUTPUT_6;
\r
159 case 7 : ucBit = partstOUTPUT_7;
\r
161 default : /* There are no other LED's wired in. */
\r
166 if( xError != pdTRUE )
\r