2 FreeRTOS V8.2.0rc1 - Copyright (C) 2014 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 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
14 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
15 >>! obliged to provide the source code for proprietary components !<<
\r
16 >>! outside of the FreeRTOS kernel. !<<
\r
18 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
19 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
20 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
21 link: http://www.freertos.org/a00114.html
\r
25 ***************************************************************************
\r
27 * Having a problem? Start by reading the FAQ "My application does *
\r
28 * not run, what could be wrong?". Have you defined configASSERT()? *
\r
30 * http://www.FreeRTOS.org/FAQHelp.html *
\r
32 ***************************************************************************
\r
34 ***************************************************************************
\r
36 * FreeRTOS provides completely free yet professionally developed, *
\r
37 * robust, strictly quality controlled, supported, and cross *
\r
38 * platform software that is more than just the market leader, it *
\r
39 * is the industry's de facto standard. *
\r
41 * Help yourself get started quickly while simultaneously helping *
\r
42 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
43 * tutorial book, reference manual, or both: *
\r
44 * http://www.FreeRTOS.org/Documentation *
\r
46 ***************************************************************************
\r
48 ***************************************************************************
\r
50 * Investing in training allows your team to be as productive as *
\r
51 * possible as early as possible, lowering your overall development *
\r
52 * cost, and enabling you to bring a more robust product to market *
\r
53 * earlier than would otherwise be possible. Richard Barry is both *
\r
54 * the architect and key author of FreeRTOS, and so also the world's *
\r
55 * leading authority on what is the world's most popular real time *
\r
56 * kernel for deeply embedded MCU designs. Obtaining your training *
\r
57 * from Richard ensures your team will gain directly from his in-depth *
\r
58 * product knowledge and years of usage experience. Contact Real Time *
\r
59 * Engineers Ltd to enquire about the FreeRTOS Masterclass, presented *
\r
60 * by Richard Barry: http://www.FreeRTOS.org/contact
\r
62 ***************************************************************************
\r
64 ***************************************************************************
\r
66 * You are receiving this top quality software for free. Please play *
\r
67 * fair and reciprocate by reporting any suspected issues and *
\r
68 * participating in the community forum: *
\r
69 * http://www.FreeRTOS.org/support *
\r
73 ***************************************************************************
\r
75 http://www.FreeRTOS.org - Documentation, books, training, latest versions,
\r
76 license and Real Time Engineers Ltd. contact details.
\r
78 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
79 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
80 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
82 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
83 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
85 http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
\r
86 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
87 licenses offer ticketed support, indemnification and commercial middleware.
\r
89 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
90 engineered and independently SIL3 certified version for use in safety and
\r
91 mission critical applications that require provable dependability.
\r
96 /*-----------------------------------------------------------
\r
97 * Characters on the LCD are used to simulate LED's. In this case the 'ParTest'
\r
98 * is really operating on the LCD display.
\r
99 *-----------------------------------------------------------*/
\r
102 * This demo is configured to execute on the ES449 prototyping board from
\r
103 * SoftBaugh. The ES449 has a built in LCD display and a single built in user
\r
104 * LED. Therefore, in place of flashing an LED, the 'flash' and 'check' tasks
\r
105 * toggle '*' characters on the LCD. The left most '*' represents LED 0, the
\r
108 * There is a single genuine on board LED referenced as LED 10.
\r
111 /* Standard includes. */
\r
112 #include <signal.h>
\r
114 /* Scheduler includes. */
\r
115 #include "FreeRTOS.h"
\r
118 /* Demo application includes. */
\r
119 #include "partest.h"
\r
121 /* Constants required to setup the LCD. */
\r
122 #define LCD_DIV_64 5
\r
124 /* Constants required to access the "LED's". The LED segments are turned on
\r
125 and off to generate '*' characters. */
\r
126 #define partstNUM_LEDS ( ( unsigned char ) 6 )
\r
127 #define partstSEGMENTS_ON ( ( unsigned char ) 0x0f )
\r
128 #define partstSEGMENTS_OFF ( ( unsigned char ) 0x00 )
\r
130 /* The LED number of the real on board LED, rather than a simulated LED. */
\r
131 #define partstON_BOARD_LED ( ( unsigned portBASE_TYPE ) 10 )
\r
132 #define mainON_BOARD_LED_BIT ( ( unsigned char ) 0x01 )
\r
134 /* The LCD segments used to generate the '*' characters for LED's 0 to 5. */
\r
135 unsigned char * const ucRHSSegments[ partstNUM_LEDS ] = { ( unsigned char * )0xa4,
\r
136 ( unsigned char * )0xa2,
\r
137 ( unsigned char * )0xa0,
\r
138 ( unsigned char * )0x9e,
\r
139 ( unsigned char * )0x9c,
\r
140 ( unsigned char * )0x9a };
\r
142 unsigned char * const ucLHSSegments[ partstNUM_LEDS ] = { ( unsigned char * )0xa3,
\r
143 ( unsigned char * )0xa1,
\r
144 ( unsigned char * )0x9f,
\r
145 ( unsigned char * )0x9d,
\r
146 ( unsigned char * )0x9b,
\r
147 ( unsigned char * )0x99 };
\r
150 * Toggle the single genuine built in LED.
\r
152 static void prvToggleOnBoardLED( void );
\r
154 /*-----------------------------------------------------------*/
\r
156 void vParTestInitialise( void )
\r
158 /* Initialise the LCD hardware. */
\r
160 /* Used for the onboard LED. */
\r
163 // Setup Basic Timer for LCD operation
\r
164 BTCTL = (LCD_DIV_64+0x23);
\r
166 // Setup port functions
\r
173 /* Initialise all segments to off. */
\r
174 LCDM1 = partstSEGMENTS_OFF;
\r
175 LCDM2 = partstSEGMENTS_OFF;
\r
176 LCDM3 = partstSEGMENTS_OFF;
\r
177 LCDM4 = partstSEGMENTS_OFF;
\r
178 LCDM5 = partstSEGMENTS_OFF;
\r
179 LCDM6 = partstSEGMENTS_OFF;
\r
180 LCDM7 = partstSEGMENTS_OFF;
\r
181 LCDM8 = partstSEGMENTS_OFF;
\r
182 LCDM9 = partstSEGMENTS_OFF;
\r
183 LCDM10 = partstSEGMENTS_OFF;
\r
184 LCDM11 = partstSEGMENTS_OFF;
\r
185 LCDM12 = partstSEGMENTS_OFF;
\r
186 LCDM13 = partstSEGMENTS_OFF;
\r
187 LCDM14 = partstSEGMENTS_OFF;
\r
188 LCDM15 = partstSEGMENTS_OFF;
\r
189 LCDM16 = partstSEGMENTS_OFF;
\r
190 LCDM17 = partstSEGMENTS_OFF;
\r
191 LCDM18 = partstSEGMENTS_OFF;
\r
192 LCDM19 = partstSEGMENTS_OFF;
\r
193 LCDM20 = partstSEGMENTS_OFF;
\r
195 /* Setup LCD control. */
\r
196 LCDCTL = (LCDSG0_7|LCD4MUX|LCDON);
\r
198 /*-----------------------------------------------------------*/
\r
200 void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
\r
202 /* Set or clear the output [in this case show or hide the '*' character. */
\r
203 if( uxLED < ( portBASE_TYPE ) partstNUM_LEDS )
\r
209 /* Turn on the segments required to show the '*'. */
\r
210 *( ucRHSSegments[ uxLED ] ) = partstSEGMENTS_ON;
\r
211 *( ucLHSSegments[ uxLED ] ) = partstSEGMENTS_ON;
\r
215 /* Turn off all the segments. */
\r
216 *( ucRHSSegments[ uxLED ] ) = partstSEGMENTS_OFF;
\r
217 *( ucLHSSegments[ uxLED ] ) = partstSEGMENTS_OFF;
\r
223 /*-----------------------------------------------------------*/
\r
225 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
\r
227 if( uxLED < ( portBASE_TYPE ) partstNUM_LEDS )
\r
231 /* If the '*' is already showing - hide it. If it is not already
\r
232 showing then show it. */
\r
233 if( *( ucRHSSegments[ uxLED ] ) )
\r
235 *( ucRHSSegments[ uxLED ] ) = partstSEGMENTS_OFF;
\r
236 *( ucLHSSegments[ uxLED ] ) = partstSEGMENTS_OFF;
\r
240 *( ucRHSSegments[ uxLED ] ) = partstSEGMENTS_ON;
\r
241 *( ucLHSSegments[ uxLED ] ) = partstSEGMENTS_ON;
\r
248 if( uxLED == partstON_BOARD_LED )
\r
250 /* The request related to the genuine on board LED. */
\r
251 prvToggleOnBoardLED();
\r
255 /*-----------------------------------------------------------*/
\r
257 static void prvToggleOnBoardLED( void )
\r
259 static unsigned short sState = pdFALSE;
\r
261 /* Toggle the state of the single genuine on board LED. */
\r
264 P1OUT |= mainON_BOARD_LED_BIT;
\r
268 P1OUT &= ~mainON_BOARD_LED_BIT;
\r
273 /*-----------------------------------------------------------*/
\r