Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 1 | /*
|
Richard Barry | 8368600 | 2009-07-07 09:29:47 +0000 | [diff] [blame^] | 2 | FreeRTOS.org V5.4.0 - Copyright (C) 2003-2009 Richard Barry.
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 3 |
|
| 4 | This file is part of the FreeRTOS.org distribution.
|
| 5 |
|
Richard Barry | c012651 | 2009-05-30 15:56:05 +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 | c012651 | 2009-05-30 15:56:05 +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 | 6456c00 | 2006-10-20 15:12:17 +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 | c012651 | 2009-05-30 15:56:05 +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 | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 19 |
|
Richard Barry | c012651 | 2009-05-30 15:56:05 +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 | 6456c00 | 2006-10-20 15:12:17 +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 | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 50 | */
|
| 51 |
|
| 52 | /* Library includes. */
|
| 53 | #include "75x_GPIO.h"
|
| 54 | #include "75x_map.h"
|
| 55 |
|
| 56 | /* Scheduler includes. */
|
| 57 | #include "FreeRTOS.h"
|
| 58 |
|
| 59 | /* Demo application includes. */
|
| 60 | #include "partest.h"
|
| 61 |
|
| 62 | /*-----------------------------------------------------------
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 63 | * Simple parallel port IO routines for the LED's
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 64 | *-----------------------------------------------------------*/
|
| 65 |
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 66 | #define partstNUM_LEDS 4
|
| 67 |
|
| 68 | typedef struct GPIOMAP
|
| 69 | {
|
| 70 | GPIO_TypeDef *pxPort;
|
| 71 | unsigned portLONG ulPin;
|
| 72 | unsigned portLONG ulValue;
|
| 73 | } GPIO_MAP;
|
| 74 |
|
| 75 | static GPIO_MAP xLEDMap[ partstNUM_LEDS ] =
|
| 76 | {
|
| 77 | { ( GPIO_TypeDef * )GPIO1_BASE, GPIO_Pin_1, 0UL },
|
| 78 | { ( GPIO_TypeDef * )GPIO0_BASE, GPIO_Pin_16, 0UL },
|
| 79 | { ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_18, 0UL },
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 80 | { ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_19, 0UL }
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 81 | };
|
| 82 |
|
| 83 | /*-----------------------------------------------------------*/
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 84 |
|
| 85 | void vParTestInitialise( void )
|
| 86 | {
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 87 | GPIO_InitTypeDef GPIO_InitStructure ;
|
| 88 |
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 89 | /* Configure the bits used to flash LED's on port 1 as output. */
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 90 |
|
| 91 | /* Configure LED3 */
|
| 92 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
| 93 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_16;
|
| 94 | GPIO_Init(GPIO0,&GPIO_InitStructure);
|
| 95 |
|
| 96 | /* Configure LED2 */
|
| 97 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
|
| 98 | GPIO_Init(GPIO1, &GPIO_InitStructure);
|
| 99 |
|
| 100 | /* Configure LED4 and LED5 */
|
| 101 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_18 | GPIO_Pin_19;
|
| 102 | GPIO_Init(GPIO2, &GPIO_InitStructure);
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 103 |
|
| 104 | vParTestSetLED( 0, 0 );
|
| 105 | vParTestSetLED( 1, 0 );
|
| 106 | vParTestSetLED( 2, 0 );
|
| 107 | vParTestSetLED( 3, 0 );
|
| 108 | }
|
| 109 | /*-----------------------------------------------------------*/
|
| 110 |
|
| 111 | void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
| 112 | {
|
| 113 | if( uxLED < partstNUM_LEDS )
|
| 114 | {
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 115 | portENTER_CRITICAL();
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 116 | {
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 117 | if( xValue )
|
| 118 | {
|
| 119 | GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );
|
| 120 | xLEDMap[ uxLED ].ulValue = 0;
|
| 121 | }
|
| 122 | else
|
| 123 | {
|
| 124 | GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );
|
| 125 | xLEDMap[ uxLED ].ulValue = 1;
|
| 126 | }
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 127 | }
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 128 | portEXIT_CRITICAL();
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 129 | }
|
| 130 | }
|
| 131 | /*-----------------------------------------------------------*/
|
| 132 |
|
| 133 | void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
| 134 | {
|
| 135 | if( uxLED < partstNUM_LEDS )
|
| 136 | {
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 137 | portENTER_CRITICAL();
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 138 | {
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 139 | if( xLEDMap[ uxLED ].ulValue == 1 )
|
| 140 | {
|
| 141 | GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );
|
| 142 | xLEDMap[ uxLED ].ulValue = 0;
|
| 143 | }
|
| 144 | else
|
| 145 | {
|
| 146 | GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );
|
| 147 | xLEDMap[ uxLED ].ulValue = 1;
|
| 148 | }
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 149 | }
|
Richard Barry | c1d020f | 2006-10-20 15:32:33 +0000 | [diff] [blame] | 150 | portEXIT_CRITICAL();
|
Richard Barry | 6456c00 | 2006-10-20 15:12:17 +0000 | [diff] [blame] | 151 | }
|
| 152 | }
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|