2 FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd.
\r
5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
7 This file is part of the FreeRTOS distribution.
\r
9 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
10 the terms of the GNU General Public License (version 2) as published by the
\r
11 Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
\r
13 ***************************************************************************
\r
14 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
15 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
16 >>! obliged to provide the source code for proprietary components !<<
\r
17 >>! outside of the FreeRTOS kernel. !<<
\r
18 ***************************************************************************
\r
20 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
22 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
23 link: http://www.freertos.org/a00114.html
\r
25 ***************************************************************************
\r
27 * FreeRTOS provides completely free yet professionally developed, *
\r
28 * robust, strictly quality controlled, supported, and cross *
\r
29 * platform software that is more than just the market leader, it *
\r
30 * is the industry's de facto standard. *
\r
32 * Help yourself get started quickly while simultaneously helping *
\r
33 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
34 * tutorial book, reference manual, or both: *
\r
35 * http://www.FreeRTOS.org/Documentation *
\r
37 ***************************************************************************
\r
39 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
\r
40 the FAQ page "My application does not run, what could be wrong?". Have you
\r
41 defined configASSERT()?
\r
43 http://www.FreeRTOS.org/support - In return for receiving this top quality
\r
44 embedded software for free we request you assist our global community by
\r
45 participating in the support forum.
\r
47 http://www.FreeRTOS.org/training - Investing in training allows your team to
\r
48 be as productive as possible as early as possible. Now you can receive
\r
49 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
\r
50 Ltd, and the world's leading authority on the world's leading RTOS.
\r
52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
54 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
56 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
57 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
59 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
\r
60 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
61 licenses offer ticketed support, indemnification and commercial middleware.
\r
63 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
64 engineered and independently SIL3 certified version for use in safety and
\r
65 mission critical applications that require provable dependability.
\r
69 #include <c8051f120.h>
\r
71 #include "FreeRTOS.h"
\r
73 #include "partest.h"
\r
75 #define partstPUSH_PULL ( ( unsigned char ) 0xff )
\r
76 #define partstALL_OUTPUTS_OFF ( ( unsigned char ) 0xff )
\r
78 /* LED to output is dependent on how the LED's are wired. */
\r
79 #define partstOUTPUT_0 ( ( unsigned char ) 0x02 )
\r
80 #define partstOUTPUT_1 ( ( unsigned char ) 0x08 )
\r
81 #define partstOUTPUT_2 ( ( unsigned char ) 0x20 )
\r
82 #define partstOUTPUT_3 ( ( unsigned char ) 0x01 )
\r
83 #define partstOUTPUT_4 ( ( unsigned char ) 0x04 )
\r
84 #define partstOUTPUT_5 ( ( unsigned char ) 0x10 )
\r
85 #define partstOUTPUT_6 ( ( unsigned char ) 0x40 )
\r
86 #define partstOUTPUT_7 ( ( unsigned char ) 0x80 )
\r
88 /*-----------------------------------------------------------
\r
89 * Simple parallel port IO routines.
\r
90 *-----------------------------------------------------------*/
\r
92 void vParTestInitialise( void )
\r
94 unsigned char ucOriginalSFRPage;
\r
96 /* Remember the SFR page before it is changed so it can get set back
\r
97 before the function exits. */
\r
98 ucOriginalSFRPage = SFRPAGE;
\r
100 /* Setup the SFR page to access the config SFR's. */
\r
101 SFRPAGE = CONFIG_PAGE;
\r
103 /* Set the on board LED to push pull. */
\r
104 P3MDOUT |= partstPUSH_PULL;
\r
106 /* Return the SFR page. */
\r
107 SFRPAGE = ucOriginalSFRPage;
\r
109 P3 = partstALL_OUTPUTS_OFF;
\r
111 /*-----------------------------------------------------------*/
\r
113 void vParTestSetLED( unsigned portBASE_TYPE uxLED, portBASE_TYPE xValue )
\r
115 portBASE_TYPE xError = pdFALSE;
\r
119 if( xValue == pdFALSE )
\r
123 case 0 : P3 |= partstOUTPUT_0;
\r
125 case 1 : P3 |= partstOUTPUT_1;
\r
127 case 2 : P3 |= partstOUTPUT_2;
\r
129 case 3 : P3 |= partstOUTPUT_3;
\r
131 case 4 : P3 |= partstOUTPUT_4;
\r
133 case 5 : P3 |= partstOUTPUT_5;
\r
135 case 6 : P3 |= partstOUTPUT_6;
\r
137 case 7 : P3 |= partstOUTPUT_7;
\r
139 default : /* There are no other LED's wired in. */
\r
148 case 0 : P3 &= ~partstOUTPUT_0;
\r
150 case 1 : P3 &= ~partstOUTPUT_1;
\r
152 case 2 : P3 &= ~partstOUTPUT_2;
\r
154 case 3 : P3 &= ~partstOUTPUT_3;
\r
156 case 4 : P3 &= ~partstOUTPUT_4;
\r
158 case 5 : P3 &= ~partstOUTPUT_5;
\r
160 case 6 : P3 &= ~partstOUTPUT_6;
\r
162 case 7 : P3 &= ~partstOUTPUT_7;
\r
164 default : /* There are no other LED's wired in. */
\r
171 /*-----------------------------------------------------------*/
\r
173 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
\r
175 unsigned char ucBit;
\r
176 portBASE_TYPE xError = pdFALSE;
\r
182 case 0 : ucBit = partstOUTPUT_0;
\r
184 case 1 : ucBit = partstOUTPUT_1;
\r
186 case 2 : ucBit = partstOUTPUT_2;
\r
188 case 3 : ucBit = partstOUTPUT_3;
\r
190 case 4 : ucBit = partstOUTPUT_4;
\r
192 case 5 : ucBit = partstOUTPUT_5;
\r
194 case 6 : ucBit = partstOUTPUT_6;
\r
196 case 7 : ucBit = partstOUTPUT_7;
\r
198 default : /* There are no other LED's wired in. */
\r
203 if( xError != pdTRUE )
\r