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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [RX600_RX62N-RSK_Renesas/] [RTOSDemo/] [ParTest.c] - Blame information for rev 592

Go to most recent revision | 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 "iodefine.h"
67
 
68
#define partestNUM_LEDS ( 6 )
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:  LED0 = LED_ON;
93
                                                        break;
94
                                        case 1: LED1 = LED_ON;
95
                                                        break;
96
                                        case 2: LED2 = LED_ON;
97
                                                        break;
98
                                        case 3: LED3 = LED_ON;
99
                                                        break;
100
                                        case 4: LED4 = LED_ON;
101
                                                        break;
102
                                        case 5: LED5 = LED_ON;
103
                                                        break;
104
                                }
105
                        }
106
                        taskEXIT_CRITICAL();
107
                }
108
                else
109
                {
110
                        /* Turn the LED off. */
111
                        taskENTER_CRITICAL();
112
                        {
113
                                switch( ulLED )
114
                                {
115
                                        case 0:  LED0 = LED_OFF;
116
                                                        break;
117
                                        case 1: LED1 = LED_OFF;
118
                                                        break;
119
                                        case 2: LED2 = LED_OFF;
120
                                                        break;
121
                                        case 3: LED3 = LED_OFF;
122
                                                        break;
123
                                        case 4: LED4 = LED_OFF;
124
                                                        break;
125
                                        case 5: LED5 = LED_OFF;
126
                                                        break;
127
                                }
128
 
129
                        }
130
                        taskEXIT_CRITICAL();
131
                }
132
        }
133
}
134
/*-----------------------------------------------------------*/
135
 
136
void vParTestToggleLED( unsigned long ulLED )
137
{
138
        if( ulLED < partestNUM_LEDS )
139
        {
140
                taskENTER_CRITICAL();
141
                {
142
                        if( lParTestGetLEDState( ulLED ) != 0x00 )
143
                        {
144
                                vParTestSetLED( ulLED, 0 );
145
                        }
146
                        else
147
                        {
148
                                vParTestSetLED( ulLED, 1 );
149
                        }
150
                }
151
                taskEXIT_CRITICAL();
152
        }
153
}
154
/*-----------------------------------------------------------*/
155
 
156
long lParTestGetLEDState( unsigned long ulLED )
157
{
158
long lReturn = pdTRUE;
159
 
160
        if( ulLED < partestNUM_LEDS )
161
        {
162
                switch( ulLED )
163
                {
164
                        case 0   :       if( LED0 != 0 )
165
                                                {
166
                                                        lReturn =  pdFALSE;
167
                                                }
168
                                                break;
169
                        case 1  :       if( LED1 != 0 )
170
                                                {
171
                                                        lReturn =  pdFALSE;
172
                                                }
173
                                                break;
174
                        case 2  :       if( LED2 != 0 )
175
                                                {
176
                                                        lReturn =  pdFALSE;
177
                                                }
178
                                                break;
179
                        case 3  :       if( LED3 != 0 )
180
                                                {
181
                                                        lReturn =  pdFALSE;
182
                                                }
183
                                                break;
184
                        case 4  :       if( LED4 != 0 )
185
                                                {
186
                                                        lReturn =  pdFALSE;
187
                                                }
188
                                                break;
189
                        case 5  :       if( LED5 != 0 )
190
                                                {
191
                                                        lReturn =  pdFALSE;
192
                                                }
193
                                                break;
194
                }
195
        }
196
 
197
        return lReturn;
198
}
199
/*-----------------------------------------------------------*/
200
 
201
 

powered by: WebSVN 2.1.0

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