2 * FreeRTOS Kernel V10.0.0
\r
3 * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software. If you wish to use our Amazon
\r
14 * FreeRTOS name, please do so in a fair use way that does not cause confusion.
\r
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
18 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
19 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
23 * http://www.FreeRTOS.org
\r
24 * http://aws.amazon.com/freertos
\r
26 * 1 tab == 4 spaces!
\r
28 #include <c8051f120.h>
\r
30 #include "FreeRTOS.h"
\r
32 #include "partest.h"
\r
34 #define partstPUSH_PULL ( ( unsigned char ) 0xff )
\r
35 #define partstALL_OUTPUTS_OFF ( ( unsigned char ) 0xff )
\r
37 /* LED to output is dependent on how the LED's are wired. */
\r
38 #define partstOUTPUT_0 ( ( unsigned char ) 0x02 )
\r
39 #define partstOUTPUT_1 ( ( unsigned char ) 0x08 )
\r
40 #define partstOUTPUT_2 ( ( unsigned char ) 0x20 )
\r
41 #define partstOUTPUT_3 ( ( unsigned char ) 0x01 )
\r
42 #define partstOUTPUT_4 ( ( unsigned char ) 0x04 )
\r
43 #define partstOUTPUT_5 ( ( unsigned char ) 0x10 )
\r
44 #define partstOUTPUT_6 ( ( unsigned char ) 0x40 )
\r
45 #define partstOUTPUT_7 ( ( unsigned char ) 0x80 )
\r
47 /*-----------------------------------------------------------
\r
48 * Simple parallel port IO routines.
\r
49 *-----------------------------------------------------------*/
\r
51 void vParTestInitialise( void )
\r
53 unsigned char ucOriginalSFRPage;
\r
55 /* Remember the SFR page before it is changed so it can get set back
\r
56 before the function exits. */
\r
57 ucOriginalSFRPage = SFRPAGE;
\r
59 /* Setup the SFR page to access the config SFR's. */
\r
60 SFRPAGE = CONFIG_PAGE;
\r
62 /* Set the on board LED to push pull. */
\r
63 P3MDOUT |= partstPUSH_PULL;
\r
65 /* Return the SFR page. */
\r
66 SFRPAGE = ucOriginalSFRPage;
\r
68 P3 = partstALL_OUTPUTS_OFF;
\r
70 /*-----------------------------------------------------------*/
\r
72 void vParTestSetLED( unsigned portBASE_TYPE uxLED, portBASE_TYPE xValue )
\r
74 portBASE_TYPE xError = pdFALSE;
\r
78 if( xValue == pdFALSE )
\r
82 case 0 : P3 |= partstOUTPUT_0;
\r
84 case 1 : P3 |= partstOUTPUT_1;
\r
86 case 2 : P3 |= partstOUTPUT_2;
\r
88 case 3 : P3 |= partstOUTPUT_3;
\r
90 case 4 : P3 |= partstOUTPUT_4;
\r
92 case 5 : P3 |= partstOUTPUT_5;
\r
94 case 6 : P3 |= partstOUTPUT_6;
\r
96 case 7 : P3 |= partstOUTPUT_7;
\r
98 default : /* There are no other LED's wired in. */
\r
107 case 0 : P3 &= ~partstOUTPUT_0;
\r
109 case 1 : P3 &= ~partstOUTPUT_1;
\r
111 case 2 : P3 &= ~partstOUTPUT_2;
\r
113 case 3 : P3 &= ~partstOUTPUT_3;
\r
115 case 4 : P3 &= ~partstOUTPUT_4;
\r
117 case 5 : P3 &= ~partstOUTPUT_5;
\r
119 case 6 : P3 &= ~partstOUTPUT_6;
\r
121 case 7 : P3 &= ~partstOUTPUT_7;
\r
123 default : /* There are no other LED's wired in. */
\r
130 /*-----------------------------------------------------------*/
\r
132 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
\r
134 unsigned char ucBit;
\r
135 portBASE_TYPE xError = pdFALSE;
\r
141 case 0 : ucBit = partstOUTPUT_0;
\r
143 case 1 : ucBit = partstOUTPUT_1;
\r
145 case 2 : ucBit = partstOUTPUT_2;
\r
147 case 3 : ucBit = partstOUTPUT_3;
\r
149 case 4 : ucBit = partstOUTPUT_4;
\r
151 case 5 : ucBit = partstOUTPUT_5;
\r
153 case 6 : ucBit = partstOUTPUT_6;
\r
155 case 7 : ucBit = partstOUTPUT_7;
\r
157 default : /* There are no other LED's wired in. */
\r
162 if( xError != pdTRUE )
\r