Richard Barry | 3878b82 | 2006-10-09 11:40:24 +0000 | [diff] [blame] | 1 | /*
|
Richard Barry | ee0ff3a | 2009-07-07 09:58:26 +0000 | [diff] [blame] | 2 | FreeRTOS.org V5.4.0 - Copyright (C) 2003-2009 Richard Barry.
|
Richard Barry | 3878b82 | 2006-10-09 11:40:24 +0000 | [diff] [blame] | 3 |
|
| 4 | This file is part of the FreeRTOS.org distribution.
|
| 5 |
|
Richard Barry | d79f029 | 2009-05-30 16:14:31 +0000 | [diff] [blame] | 6 | FreeRTOS.org is free software; you can redistribute it and/or modify it
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 7 | under the terms of the GNU General Public License (version 2) as published
|
| 8 | by the Free Software Foundation and modified by the FreeRTOS exception.
|
Richard Barry | d79f029 | 2009-05-30 16:14:31 +0000 | [diff] [blame] | 9 | **NOTE** The exception to the GPL is included to allow you to distribute a
|
| 10 | combined work that includes FreeRTOS.org without being obliged to provide
|
| 11 | the source code for any proprietary components. Alternative commercial
|
| 12 | license and support terms are also available upon request. See the
|
| 13 | licensing section of http://www.FreeRTOS.org for full details.
|
Richard Barry | 3878b82 | 2006-10-09 11:40:24 +0000 | [diff] [blame] | 14 |
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 15 | FreeRTOS.org is distributed in the hope that it will be useful, but WITHOUT
|
Richard Barry | d79f029 | 2009-05-30 16:14:31 +0000 | [diff] [blame] | 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 17 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 18 | more details.
|
Richard Barry | 3878b82 | 2006-10-09 11:40:24 +0000 | [diff] [blame] | 19 |
|
Richard Barry | d79f029 | 2009-05-30 16:14:31 +0000 | [diff] [blame] | 20 | You should have received a copy of the GNU General Public License along
|
| 21 | with FreeRTOS.org; if not, write to the Free Software Foundation, Inc., 59
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 22 | Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
Richard Barry | 3878b82 | 2006-10-09 11:40:24 +0000 | [diff] [blame] | 23 |
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 24 |
|
| 25 | ***************************************************************************
|
| 26 | * *
|
| 27 | * Get the FreeRTOS eBook! See http://www.FreeRTOS.org/Documentation *
|
Richard Barry | 52ba0e6 | 2009-02-09 20:21:35 +0000 | [diff] [blame] | 28 | * *
|
| 29 | * This is a concise, step by step, 'hands on' guide that describes both *
|
| 30 | * general multitasking concepts and FreeRTOS specifics. It presents and *
|
| 31 | * explains numerous examples that are written using the FreeRTOS API. *
|
| 32 | * Full source code for all the examples is provided in an accompanying *
|
| 33 | * .zip file. *
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 34 | * *
|
| 35 | ***************************************************************************
|
| 36 |
|
| 37 | 1 tab == 4 spaces!
|
Richard Barry | 0a6d59a | 2007-04-01 20:47:49 +0000 | [diff] [blame] | 38 |
|
Richard Barry | 527fb6a | 2008-03-25 21:22:13 +0000 | [diff] [blame] | 39 | Please ensure to read the configuration and relevant port sections of the
|
Richard Barry | c86dcf7 | 2008-02-03 19:45:58 +0000 | [diff] [blame] | 40 | online documentation.
|
| 41 |
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 42 | http://www.FreeRTOS.org - Documentation, latest information, license and
|
Richard Barry | 527fb6a | 2008-03-25 21:22:13 +0000 | [diff] [blame] | 43 | contact details.
|
Richard Barry | c86dcf7 | 2008-02-03 19:45:58 +0000 | [diff] [blame] | 44 |
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 45 | http://www.SafeRTOS.com - A version that is certified for use in safety
|
Richard Barry | 527fb6a | 2008-03-25 21:22:13 +0000 | [diff] [blame] | 46 | critical systems.
|
Richard Barry | c86dcf7 | 2008-02-03 19:45:58 +0000 | [diff] [blame] | 47 |
|
Richard Barry | 2f40ad7 | 2009-03-14 19:20:12 +0000 | [diff] [blame] | 48 | http://www.OpenRTOS.com - Commercial support, development, porting,
|
Richard Barry | 527fb6a | 2008-03-25 21:22:13 +0000 | [diff] [blame] | 49 | licensing and training services.
|
Richard Barry | 3878b82 | 2006-10-09 11:40:24 +0000 | [diff] [blame] | 50 | */
|
| 51 |
|
| 52 | /* Scheduler includes. */
|
| 53 | #include "FreeRTOS.h"
|
| 54 |
|
| 55 | /* Demo app includes. */
|
| 56 | #include "partest.h"
|
| 57 |
|
| 58 | #define ptOUTPUT 0
|
| 59 | #define ptALL_OFF 0
|
| 60 |
|
| 61 | /*-----------------------------------------------------------
|
| 62 | * Simple parallel port IO routines.
|
| 63 | *-----------------------------------------------------------*/
|
| 64 |
|
| 65 | void vParTestInitialise( void )
|
| 66 | {
|
| 67 | /* The explorer 16 board has LED's on port A. All bits are set as output
|
| 68 | so PORTA is read-modified-written directly. */
|
| 69 | TRISA = ptOUTPUT;
|
| 70 | PORTA = ptALL_OFF;
|
| 71 | }
|
| 72 | /*-----------------------------------------------------------*/
|
| 73 |
|
| 74 | void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
| 75 | {
|
| 76 | unsigned portBASE_TYPE uxLEDBit;
|
| 77 |
|
| 78 | /* Which port A bit is being modified? */
|
| 79 | uxLEDBit = 1 << uxLED;
|
| 80 |
|
| 81 | if( xValue )
|
| 82 | {
|
| 83 | /* Turn the LED on. */
|
| 84 | portENTER_CRITICAL();
|
| 85 | {
|
| 86 | PORTA |= uxLEDBit;
|
| 87 | }
|
| 88 | portEXIT_CRITICAL();
|
| 89 | }
|
| 90 | else
|
| 91 | {
|
| 92 | /* Turn the LED off. */
|
| 93 | portENTER_CRITICAL();
|
| 94 | {
|
| 95 | PORTA &= ~uxLEDBit;
|
| 96 | }
|
| 97 | portEXIT_CRITICAL();
|
| 98 | }
|
| 99 | }
|
| 100 | /*-----------------------------------------------------------*/
|
| 101 |
|
| 102 | void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
| 103 | {
|
| 104 | unsigned portBASE_TYPE uxLEDBit;
|
| 105 |
|
| 106 | uxLEDBit = 1 << uxLED;
|
| 107 | portENTER_CRITICAL();
|
| 108 | {
|
| 109 | /* If the LED is already on - turn it off. If the LED is already
|
| 110 | off, turn it on. */
|
| 111 | if( PORTA & uxLEDBit )
|
| 112 | {
|
| 113 | PORTA &= ~uxLEDBit;
|
| 114 | }
|
| 115 | else
|
| 116 | {
|
| 117 | PORTA |= uxLEDBit;
|
| 118 | }
|
| 119 | }
|
| 120 | portEXIT_CRITICAL();
|
| 121 | }
|
| 122 |
|