OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [RX600_RX62N-RDK_IAR/] [ParTest.c] - Blame information for rev 585

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 585 jeremybenn
/*
2
    FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
3
 
4
    ***************************************************************************
5
    *                                                                         *
6
    * If you are:                                                             *
7
    *                                                                         *
8
    *    + New to FreeRTOS,                                                   *
9
    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
10
    *    + Looking for basic training,                                        *
11
    *    + Wanting to improve your FreeRTOS skills and productivity           *
12
    *                                                                         *
13
    * then take a look at the FreeRTOS books - available as PDF or paperback  *
14
    *                                                                         *
15
    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
16
    *                  http://www.FreeRTOS.org/Documentation                  *
17
    *                                                                         *
18
    * A pdf reference manual is also available.  Both are usually delivered   *
19
    * to your inbox within 20 minutes to two hours when purchased between 8am *
20
    * and 8pm GMT (although please allow up to 24 hours in case of            *
21
    * exceptional circumstances).  Thank you for your support!                *
22
    *                                                                         *
23
    ***************************************************************************
24
 
25
    This file is part of the FreeRTOS distribution.
26
 
27
    FreeRTOS is free software; you can redistribute it and/or modify it under
28
    the terms of the GNU General Public License (version 2) as published by the
29
    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
30
    ***NOTE*** The exception to the GPL is included to allow you to distribute
31
    a combined work that includes FreeRTOS without being obliged to provide the
32
    source code for proprietary components outside of the FreeRTOS kernel.
33
    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
34
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
36
    more details. You should have received a copy of the GNU General Public
37
    License and the FreeRTOS license exception along with FreeRTOS; if not it
38
    can be viewed here: http://www.freertos.org/a00114.html and also obtained
39
    by writing to Richard Barry, contact details for whom are available on the
40
    FreeRTOS WEB site.
41
 
42
    1 tab == 4 spaces!
43
 
44
    http://www.FreeRTOS.org - Documentation, latest information, license and
45
    contact details.
46
 
47
    http://www.SafeRTOS.com - A version that is certified for use in safety
48
    critical systems.
49
 
50
    http://www.OpenRTOS.com - Commercial support, development, porting,
51
    licensing and training services.
52
*/
53
 
54
/*-----------------------------------------------------------
55
 * Simple IO routines to control the LEDs.
56
 *-----------------------------------------------------------*/
57
 
58
/* Scheduler includes. */
59
#include "FreeRTOS.h"
60
#include "task.h"
61
 
62
/* Demo includes. */
63
#include "partest.h"
64
 
65
/* Hardware specifics. */
66
#include <iorx62n.h>
67
 
68
#define partestNUM_LEDS ( 12 )
69
 
70
long lParTestGetLEDState( unsigned long ulLED );
71
 
72
/*-----------------------------------------------------------*/
73
 
74
void vParTestInitialise( void )
75
{
76
        /* Port pin configuration is done by the low level set up prior to this
77
        function being called. */
78
}
79
/*-----------------------------------------------------------*/
80
 
81
void vParTestSetLED( unsigned long ulLED, signed long xValue )
82
{
83
        if( ulLED < partestNUM_LEDS )
84
        {
85
                if( xValue != 0 )
86
                {
87
                        /* Turn the LED on. */
88
                        taskENTER_CRITICAL();
89
                        {
90
                                switch( ulLED )
91
                                {
92
                                        case 0:  LED4 = LED_ON;
93
                                                        break;
94
                                        case 1: LED5 = LED_ON;
95
                                                        break;
96
                                        case 2: LED6 = LED_ON;
97
                                                        break;
98
                                        case 3: LED7 = LED_ON;
99
                                                        break;
100
                                        case 4: LED8 = LED_ON;
101
                                                        break;
102
                                        case 5: LED9 = LED_ON;
103
                                                        break;
104
                                        case 6: LED10 = LED_ON;
105
                                                        break;
106
                                        case 7: LED11 = LED_ON;
107
                                                        break;
108
                                        case 8: LED12 = LED_ON;
109
                                                        break;
110
                                        case 9: LED13 = LED_ON;
111
                                                        break;
112
                                        case 10:LED14 = LED_ON;
113
                                                        break;
114
                                        case 11:LED15 = LED_ON;
115
                                                        break;
116
                                }
117
                        }
118
                        taskEXIT_CRITICAL();
119
                }
120
                else
121
                {
122
                        /* Turn the LED off. */
123
                        taskENTER_CRITICAL();
124
                        {
125
                                switch( ulLED )
126
                                {
127
                                        case 0:  LED4 = LED_OFF;
128
                                                        break;
129
                                        case 1: LED5 = LED_OFF;
130
                                                        break;
131
                                        case 2: LED6 = LED_OFF;
132
                                                        break;
133
                                        case 3: LED7 = LED_OFF;
134
                                                        break;
135
                                        case 4: LED8 = LED_OFF;
136
                                                        break;
137
                                        case 5: LED9 = LED_OFF;
138
                                                        break;
139
                                        case 6: LED10 = LED_OFF;
140
                                                        break;
141
                                        case 7: LED11 = LED_OFF;
142
                                                        break;
143
                                        case 8: LED12 = LED_OFF;
144
                                                        break;
145
                                        case 9: LED13 = LED_OFF;
146
                                                        break;
147
                                        case 10:LED14 = LED_OFF;
148
                                                        break;
149
                                        case 11:LED15 = LED_OFF;
150
                                                        break;
151
                                }
152
 
153
                        }
154
                        taskEXIT_CRITICAL();
155
                }
156
        }
157
}
158
/*-----------------------------------------------------------*/
159
 
160
void vParTestToggleLED( unsigned long ulLED )
161
{
162
        if( ulLED < partestNUM_LEDS )
163
        {
164
                taskENTER_CRITICAL();
165
                {
166
                        if( lParTestGetLEDState( ulLED ) != 0x00 )
167
                        {
168
                                vParTestSetLED( ulLED, 0 );
169
                        }
170
                        else
171
                        {
172
                                vParTestSetLED( ulLED, 1 );
173
                        }
174
                }
175
                taskEXIT_CRITICAL();
176
        }
177
}
178
/*-----------------------------------------------------------*/
179
 
180
long lParTestGetLEDState( unsigned long ulLED )
181
{
182
long lReturn = pdFALSE;
183
 
184
        if( ulLED < partestNUM_LEDS )
185
        {
186
                switch( ulLED )
187
                {
188
                        case 0   :       if( LED4 != LED_OFF )
189
                                                {
190
                                                        lReturn =  pdTRUE;
191
                                                }
192
                                                break;
193
                        case 1  :       if( LED5 != LED_OFF )
194
                                                {
195
                                                        lReturn =  pdTRUE;
196
                                                }
197
                                                break;
198
                        case 2  :       if( LED6 != LED_OFF )
199
                                                {
200
                                                        lReturn =  pdTRUE;
201
                                                }
202
                                                break;
203
                        case 3  :       if( LED7 != LED_OFF )
204
                                                {
205
                                                        lReturn =  pdTRUE;
206
                                                }
207
                                                break;
208
                        case 4  :       if( LED8 != LED_OFF )
209
                                                {
210
                                                        lReturn =  pdTRUE;
211
                                                }
212
                                                break;
213
                        case 5  :       if( LED9 != LED_OFF )
214
                                                {
215
                                                        lReturn =  pdTRUE;
216
                                                }
217
                                                break;
218
                        case 6  :       if( LED10 != LED_OFF )
219
                                                {
220
                                                        lReturn =  pdTRUE;
221
                                                }
222
                                                break;
223
                        case 7  :       if( LED11 != LED_OFF )
224
                                                {
225
                                                        lReturn =  pdTRUE;
226
                                                }
227
                                                break;
228
                        case 8  :       if( LED12 != LED_OFF )
229
                                                {
230
                                                        lReturn =  pdTRUE;
231
                                                }
232
                                                break;
233
                        case 9  :       if( LED13 != LED_OFF )
234
                                                {
235
                                                        lReturn =  pdTRUE;
236
                                                }
237
                                                break;
238
                        case 10 :       if( LED14 != LED_OFF )
239
                                                {
240
                                                        lReturn =  pdTRUE;
241
                                                }
242
                                                break;
243
                        case 11 :       if( LED15 != LED_OFF )
244
                                                {
245
                                                        lReturn =  pdTRUE;
246
                                                }
247
                                                break;
248
                }
249
        }
250
 
251
        return lReturn;
252
}
253
/*-----------------------------------------------------------*/
254
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.