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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [lwIP_AVR32_UC3/] [PARTEST/] [ParTest.c] - Blame information for rev 613

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

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

powered by: WebSVN 2.1.0

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