2 * FreeRTOS Kernel V10.1.0
\r
3 * Copyright (C) 2018 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.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://www.FreeRTOS.org
\r
23 * http://aws.amazon.com/freertos
\r
25 * 1 tab == 4 spaces!
\r
27 #include <c8051f120.h>
\r
29 #include "FreeRTOS.h"
\r
31 #include "partest.h"
\r
33 #define partstPUSH_PULL ( ( unsigned char ) 0xff )
\r
34 #define partstALL_OUTPUTS_OFF ( ( unsigned char ) 0xff )
\r
36 /* LED to output is dependent on how the LED's are wired. */
\r
37 #define partstOUTPUT_0 ( ( unsigned char ) 0x02 )
\r
38 #define partstOUTPUT_1 ( ( unsigned char ) 0x08 )
\r
39 #define partstOUTPUT_2 ( ( unsigned char ) 0x20 )
\r
40 #define partstOUTPUT_3 ( ( unsigned char ) 0x01 )
\r
41 #define partstOUTPUT_4 ( ( unsigned char ) 0x04 )
\r
42 #define partstOUTPUT_5 ( ( unsigned char ) 0x10 )
\r
43 #define partstOUTPUT_6 ( ( unsigned char ) 0x40 )
\r
44 #define partstOUTPUT_7 ( ( unsigned char ) 0x80 )
\r
46 /*-----------------------------------------------------------
\r
47 * Simple parallel port IO routines.
\r
48 *-----------------------------------------------------------*/
\r
50 void vParTestInitialise( void )
\r
52 unsigned char ucOriginalSFRPage;
\r
54 /* Remember the SFR page before it is changed so it can get set back
\r
55 before the function exits. */
\r
56 ucOriginalSFRPage = SFRPAGE;
\r
58 /* Setup the SFR page to access the config SFR's. */
\r
59 SFRPAGE = CONFIG_PAGE;
\r
61 /* Set the on board LED to push pull. */
\r
62 P3MDOUT |= partstPUSH_PULL;
\r
64 /* Return the SFR page. */
\r
65 SFRPAGE = ucOriginalSFRPage;
\r
67 P3 = partstALL_OUTPUTS_OFF;
\r
69 /*-----------------------------------------------------------*/
\r
71 void vParTestSetLED( unsigned portBASE_TYPE uxLED, portBASE_TYPE xValue )
\r
73 portBASE_TYPE xError = pdFALSE;
\r
77 if( xValue == pdFALSE )
\r
81 case 0 : P3 |= partstOUTPUT_0;
\r
83 case 1 : P3 |= partstOUTPUT_1;
\r
85 case 2 : P3 |= partstOUTPUT_2;
\r
87 case 3 : P3 |= partstOUTPUT_3;
\r
89 case 4 : P3 |= partstOUTPUT_4;
\r
91 case 5 : P3 |= partstOUTPUT_5;
\r
93 case 6 : P3 |= partstOUTPUT_6;
\r
95 case 7 : P3 |= partstOUTPUT_7;
\r
97 default : /* There are no other LED's wired in. */
\r
106 case 0 : P3 &= ~partstOUTPUT_0;
\r
108 case 1 : P3 &= ~partstOUTPUT_1;
\r
110 case 2 : P3 &= ~partstOUTPUT_2;
\r
112 case 3 : P3 &= ~partstOUTPUT_3;
\r
114 case 4 : P3 &= ~partstOUTPUT_4;
\r
116 case 5 : P3 &= ~partstOUTPUT_5;
\r
118 case 6 : P3 &= ~partstOUTPUT_6;
\r
120 case 7 : P3 &= ~partstOUTPUT_7;
\r
122 default : /* There are no other LED's wired in. */
\r
129 /*-----------------------------------------------------------*/
\r
131 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
\r
133 unsigned char ucBit;
\r
134 portBASE_TYPE xError = pdFALSE;
\r
140 case 0 : ucBit = partstOUTPUT_0;
\r
142 case 1 : ucBit = partstOUTPUT_1;
\r
144 case 2 : ucBit = partstOUTPUT_2;
\r
146 case 3 : ucBit = partstOUTPUT_3;
\r
148 case 4 : ucBit = partstOUTPUT_4;
\r
150 case 5 : ucBit = partstOUTPUT_5;
\r
152 case 6 : ucBit = partstOUTPUT_6;
\r
154 case 7 : ucBit = partstOUTPUT_7;
\r
156 default : /* There are no other LED's wired in. */
\r
161 if( xError != pdTRUE )
\r