2 * FreeRTOS Kernel V10.3.0
\r
3 * Copyright (C) 2020 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
28 /* Library includes. */
\r
31 /* Scheduler includes. */
\r
32 #include "FreeRTOS.h"
\r
34 /* Demo application includes. */
\r
35 #include "partest.h"
\r
37 /*-----------------------------------------------------------
\r
38 * Simple parallel port IO routines for the LED's - which are
\r
39 * connected to the second nibble of GPIO port 1.
\r
40 *-----------------------------------------------------------*/
\r
42 #define partstLED_3 0x0080
\r
43 #define partstLED_2 0x0040
\r
44 #define partstLED_1 0x0020
\r
45 #define partstLED_0 0x0010
\r
46 #define partstON_BOARD 0x0100 /* The LED built onto the KickStart board. */
\r
48 #define partstALL_LEDs ( partstLED_0 | partstLED_1 | partstLED_2 | partstLED_3 | partstON_BOARD )
\r
50 #define partstFIRST_LED_BIT 4
\r
52 /* This demo application uses files that are common to all port demo
\r
53 applications. These files assume 6 LED's are available, whereas I have
\r
54 only 5 (including the LED built onto the development board). To prevent
\r
55 two tasks trying to use the same LED a bit of remapping is performed.
\r
56 The ComTest tasks will try and use LED's 6 and 7. LED 6 is ignored and
\r
57 has no effect, LED 7 is mapped to LED3. The LED usage is described in
\r
58 the port documentation available from the FreeRTOS.org WEB site. */
\r
59 #define partstCOM_TEST_LED 7
\r
60 #define partstRX_CHAR_LED 3
\r
62 /*-----------------------------------------------------------*/
\r
64 void vParTestInitialise( void )
\r
66 /* Configure the bits used to flash LED's on port 1 as output. */
\r
67 GPIO_Config(GPIO1, partstALL_LEDs, GPIO_OUT_OD);
\r
69 /*-----------------------------------------------------------*/
\r
71 void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
\r
73 if( uxLED == partstCOM_TEST_LED )
\r
75 /* Remap as described above. */
\r
76 uxLED = partstRX_CHAR_LED;
\r
79 /* Adjust the LED value to map to the port pins actually being used,
\r
80 then write the required value to the port. */
\r
81 uxLED += partstFIRST_LED_BIT;
\r
82 GPIO_BitWrite( GPIO1, uxLED, !xValue );
\r
84 /*-----------------------------------------------------------*/
\r
86 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
\r
88 if( uxLED == partstCOM_TEST_LED )
\r
90 /* Remap as described above. */
\r
91 uxLED = partstRX_CHAR_LED;
\r
94 /* Adjust the LED value to map to the port pins actually being used,
\r
95 then write the opposite value to the current state to the port pin. */
\r
96 uxLED += partstFIRST_LED_BIT;
\r
97 GPIO_BitWrite(GPIO1, uxLED, ~GPIO_BitRead( GPIO1, uxLED ) );
\r