]> git.sur5r.net Git - freertos/blob - Demo/MB91460_Softune/SRC/partest/partest.c
Get the trace utility and co-routines working.
[freertos] / Demo / MB91460_Softune / SRC / partest / partest.c
1 /*\r
2         FreeRTOS.org V4.7.1 - Copyright (C) 2003-2008 Richard Barry.\r
3 \r
4         This file is part of the FreeRTOS.org distribution.\r
5 \r
6         FreeRTOS.org is free software; you can redistribute it and/or modify\r
7         it under the terms of the GNU General Public License as published by\r
8         the Free Software Foundation; either version 2 of the License, or\r
9         (at your option) any later version.\r
10 \r
11         FreeRTOS.org is distributed in the hope that it will be useful,\r
12         but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14         GNU General Public License for more details.\r
15 \r
16         You should have received a copy of the GNU General Public License\r
17         along with FreeRTOS.org; if not, write to the Free Software\r
18         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19 \r
20         A special exception to the GPL can be applied should you wish to distribute\r
21         a combined work that includes FreeRTOS.org, without being obliged to provide\r
22         the source code for any proprietary components.  See the licensing section\r
23         of http://www.FreeRTOS.org for full details of how and when the exception\r
24         can be applied.\r
25 \r
26         ***************************************************************************\r
27 \r
28         Please ensure to read the configuration and relevant port sections of the \r
29         online documentation.\r
30 \r
31         +++ http://www.FreeRTOS.org +++\r
32         Documentation, latest information, license and contact details.  \r
33 \r
34         +++ http://www.SafeRTOS.com +++\r
35         A version that is certified for use in safety critical systems.\r
36 \r
37         +++ http://www.OpenRTOS.com +++\r
38         Commercial support, development, porting, licensing and training services.\r
39 \r
40         ***************************************************************************\r
41 */\r
42 \r
43 \r
44 /* Scheduler includes. */\r
45 #include "FreeRTOS.h"\r
46 #include "task.h"\r
47 \r
48 #define partstNUM_LEDs  8\r
49 \r
50 static unsigned portCHAR sState[ 2 ] = { 0xFF, 0xFF };\r
51 static unsigned portSHORT sState1[ partstNUM_LEDs ] = { pdFALSE };\r
52 \r
53 /*-----------------------------------------------------------*/\r
54 void vParTestInitialise( void )\r
55 {\r
56 <<<<<<< .mine\r
57         /* Set port for LED outputs. */\r
58         DDR16 = 0xFF;\r
59         DDR25=0xFF;\r
60 \r
61         /* Start with LEDs off. */\r
62         PDR16 = 0x00;\r
63         PDR25 = 0x00;\r
64 =======\r
65         DDR00 = 0xFF;\r
66         PDR00 = 0xFF;\r
67         DDR09 = 0xFF;\r
68         PDR09 = 0xFF;\r
69 >>>>>>> .r192\r
70 }\r
71 /*-----------------------------------------------------------*/\r
72 \r
73 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
74 {\r
75         if( uxLED < partstNUM_LEDs )\r
76         {\r
77 <<<<<<< .mine\r
78                 taskENTER_CRITICAL();\r
79 =======\r
80                 vTaskSuspendAll();\r
81 \r
82                 /* Toggle the state of the single genuine on board LED. */\r
83                 if( ( sState[ 0 ] & ( ( unsigned portCHAR ) ( 1 << uxLED ) ) ) == 0 )\r
84 >>>>>>> .r192\r
85                 {\r
86 <<<<<<< .mine\r
87                         /* Toggle the state of the single genuine on board LED. */\r
88                         if( sState[ uxLED ])    \r
89                         {\r
90                                 PDR25 |= ( 1 << uxLED );\r
91                         }\r
92                         else\r
93                         {\r
94                                 PDR25 &= ~( 1 << uxLED );\r
95                         }\r
96                 \r
97                         sState[ uxLED ] = !( sState[ uxLED ] );\r
98                 }               \r
99                 taskEXIT_CRITICAL();\r
100 =======\r
101                         PDR09 |= ( 1 << uxLED );\r
102                         sState[ 0 ] |= ( 1 << uxLED );\r
103                 }\r
104                 else\r
105                 {\r
106                         PDR09 &= ~( 1 << uxLED );\r
107                         sState[ 0 ] &= ~( 1 << uxLED );\r
108                 }\r
109 \r
110                 xTaskResumeAll();\r
111 >>>>>>> .r192\r
112         }\r
113 <<<<<<< .mine\r
114         else\r
115         {\r
116                 uxLED -= partstNUM_LEDs;\r
117 \r
118                 if( uxLED < partstNUM_LEDs )\r
119                 {\r
120                         taskENTER_CRITICAL();\r
121                         {\r
122                                 /* Toggle the state of the single genuine on board LED. */\r
123                                 if( sState1[uxLED])     \r
124                                 {\r
125                                         PDR16 |= ( 1 << uxLED );\r
126                                 }\r
127                                 else\r
128                                 {\r
129                                         PDR16 &= ~( 1 << uxLED );\r
130                                 }\r
131                         \r
132                                 sState1[ uxLED ] = !( sState1[ uxLED ] );\r
133                         }\r
134                         taskEXIT_CRITICAL();\r
135                 }\r
136         }\r
137 =======\r
138         else\r
139         {\r
140                 vTaskSuspendAll();\r
141 \r
142                 uxLED -= partstNUM_LEDs;\r
143 \r
144                 if( ( sState[ 1 ] & ( ( unsigned portCHAR ) ( 1 << uxLED ) ) ) == 0 )\r
145                 {\r
146                         PDR00 |= ( 1 << uxLED );\r
147                         sState[ 1 ] |= ( 1 << uxLED );\r
148                 }\r
149                 else\r
150                 {\r
151                         PDR00 &= ~( 1 << uxLED );\r
152                         sState[ 1 ] &= ~( 1 << uxLED );\r
153                 }\r
154 \r
155                 xTaskResumeAll();\r
156         }\r
157 >>>>>>> .r192\r
158 }\r
159 /*-----------------------------------------------------------*/\r
160 \r
161 void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
162 {\r
163         /* Set or clear the output [in this case show or hide the '*' character. */\r
164         if( uxLED < partstNUM_LEDs )\r
165         {\r
166                 vTaskSuspendAll();\r
167                 {\r
168                         if( xValue )\r
169                         {\r
170                                 PDR09 &= ~( 1 << uxLED );\r
171                                 sState[ 0 ] &= ~( 1 << uxLED );\r
172                         }\r
173                         else\r
174                         {\r
175                                 PDR09 |= ( 1 << uxLED );\r
176                                 sState[ 0 ] |= ( 1 << uxLED );\r
177                         }\r
178                 }\r
179 \r
180                 xTaskResumeAll();\r
181         }\r
182 <<<<<<< .mine\r
183         else \r
184         {\r
185                 uxLED -= partstNUM_LEDs;\r
186 \r
187                 if( uxLED < partstNUM_LEDs )\r
188                 {\r
189                         taskENTER_CRITICAL();\r
190                         {\r
191                                 if( xValue )\r
192                                 {\r
193                                         PDR16 |= (1 << uxLED);\r
194                                         sState1[uxLED] = 1;\r
195                                 }\r
196                                 else\r
197                                 {\r
198                                         PDR16 &= ~(1 << uxLED);\r
199                                         sState1[uxLED] = 0;\r
200                                 }\r
201                         }\r
202                         taskEXIT_CRITICAL();\r
203                 }\r
204         }\r
205 =======\r
206         else\r
207         {\r
208                 vTaskSuspendAll();\r
209                 {\r
210                         if( xValue )\r
211                         {\r
212                                 PDR00 &= ~( 1 << uxLED );\r
213                                 sState[ 1 ] &= ~( 1 << uxLED );\r
214                         }\r
215                         else\r
216                         {\r
217                                 PDR00 |= ( 1 << uxLED );\r
218                                 sState[ 1 ] |= ( 1 << uxLED );\r
219                         }\r
220                 }\r
221 \r
222                 xTaskResumeAll();\r
223         }\r
224 >>>>>>> .r192\r
225 }\r
226 \r