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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [OpenRISC_SIM_GCC/] [ParTest/] [ParTest.c] - Blame information for rev 584

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 584 jeremybenn
//--------------------------------------------------------------------------//
2
//----------------------- COPIED FROM AVR32 EXAMPLE ------------------------//
3
//--------------------------------------------------------------------------//
4
 
5
/*This file has been prepared for Doxygen automatic documentation generation.*/
6
/*! \file *********************************************************************
7
 *
8
 * \brief FreeRTOS LEDs Management for AVR32 UC3.
9
 *
10
 * - Compiler:           IAR EWAVR32 and GNU GCC for AVR32
11
 * - Supported devices:  All AVR32 devices can be used.
12
 * - AppNote:
13
 *
14
 * \author               Atmel Corporation: http://www.atmel.com \n
15
 *                       Support and FAQ: http://support.atmel.no/
16
 *
17
 *****************************************************************************/
18
 
19
/* Copyright (c) 2007, Atmel Corporation All rights reserved.
20
 *
21
 * Redistribution and use in source and binary forms, with or without
22
 * modification, are permitted provided that the following conditions are met:
23
 *
24
 * 1. Redistributions of source code must retain the above copyright notice,
25
 * this list of conditions and the following disclaimer.
26
 *
27
 * 2. Redistributions in binary form must reproduce the above copyright notice,
28
 * this list of conditions and the following disclaimer in the documentation
29
 * and/or other materials provided with the distribution.
30
 *
31
 * 3. The name of ATMEL may not be used to endorse or promote products derived
32
 * from this software without specific prior written permission.
33
 *
34
 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
35
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
36
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
37
 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
38
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
41
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
43
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
 */
45
 
46
 
47
 
48
#include <avr32/io.h>
49
#include "FreeRTOS.h"
50
#include "task.h"
51
#include "partest.h"
52
 
53
 
54
/*-----------------------------------------------------------
55
 * Simple parallel port IO routines.
56
 *-----------------------------------------------------------*/
57
 
58
#define partstALL_OUTPUTS_OFF     ( ( unsigned portCHAR ) 0x00 )
59
#if( BOARD==EVK1100 )
60
#  define partstMAX_OUTPUT_LED    ( ( unsigned portCHAR ) 8 )
61
 
62
#elif( BOARD==EVK1101 )
63
#  define partstMAX_OUTPUT_LED    ( ( unsigned portCHAR ) 4 )
64
#endif
65
 
66
static volatile unsigned portCHAR ucCurrentOutputValue = partstALL_OUTPUTS_OFF; /*lint !e956 File scope parameters okay here. */
67
 
68
/*-----------------------------------------------------------*/
69
 
70
void vParTestInitialise( void )
71
{
72
        LED_Display( partstALL_OUTPUTS_OFF ); /* Start with all LEDs off. */
73
}
74
/*-----------------------------------------------------------*/
75
 
76
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
77
{
78
unsigned portCHAR ucBit;
79
 
80
        if( uxLED >= partstMAX_OUTPUT_LED )
81
        {
82
                return;
83
        }
84
 
85
        ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
86
 
87
        vTaskSuspendAll();
88
        {
89
                if( xValue == pdTRUE )
90
                {
91
                        ucCurrentOutputValue |= ucBit;
92
                }
93
                else
94
                {
95
                        ucCurrentOutputValue &= ~ucBit;
96
                }
97
 
98
                LED_Display(ucCurrentOutputValue);
99
        }
100
        xTaskResumeAll();
101
}
102
/*-----------------------------------------------------------*/
103
 
104
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
105
{
106
unsigned portCHAR ucBit;
107
 
108
          if( uxLED >= partstMAX_OUTPUT_LED )
109
          {
110
        return;
111
        }
112
 
113
        ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
114
 
115
        vTaskSuspendAll();
116
        {
117
                ucCurrentOutputValue ^= ucBit;
118
                LED_Display(ucCurrentOutputValue);
119
        }
120
        xTaskResumeAll();
121
}

powered by: WebSVN 2.1.0

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