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 773

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 "FreeRTOS.h"
49
#include "task.h"
50
#include "partest.h"
51 637 filepang
#include "gpio.h"
52 584 jeremybenn
 
53
 
54
/*-----------------------------------------------------------
55
 * Simple parallel port IO routines.
56
 *-----------------------------------------------------------*/
57
 
58 637 filepang
#define partstALL_OUTPUTS_OFF   ( ( unsigned portCHAR ) 0x00 )
59
#define partstMAX_OUTPUT_LED    ( ( unsigned portCHAR ) 0x08 )
60 584 jeremybenn
 
61 637 filepang
static volatile unsigned portCHAR ucCurrentOutputValue = partstALL_OUTPUTS_OFF;
62 584 jeremybenn
 
63
/*-----------------------------------------------------------*/
64
 
65
void vParTestInitialise( void )
66
{
67 637 filepang
        gpio_write(0, partstALL_OUTPUTS_OFF);
68 584 jeremybenn
}
69
/*-----------------------------------------------------------*/
70
 
71
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
72
{
73 637 filepang
        unsigned portCHAR ucBit;
74 584 jeremybenn
 
75
        if( uxLED >= partstMAX_OUTPUT_LED )
76
        {
77
                return;
78
        }
79
 
80
        ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
81
 
82
        vTaskSuspendAll();
83
        {
84
                if( xValue == pdTRUE )
85
                {
86
                        ucCurrentOutputValue |= ucBit;
87
                }
88
                else
89
                {
90
                        ucCurrentOutputValue &= ~ucBit;
91
                }
92
 
93 637 filepang
                gpio_write(0, ucCurrentOutputValue);
94 584 jeremybenn
        }
95
        xTaskResumeAll();
96
}
97
/*-----------------------------------------------------------*/
98
 
99
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
100
{
101 637 filepang
        unsigned portCHAR ucBit;
102 584 jeremybenn
 
103 637 filepang
        if( uxLED >= partstMAX_OUTPUT_LED )
104
        {
105
                return;
106 584 jeremybenn
        }
107
 
108
        ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
109
 
110
        vTaskSuspendAll();
111
        {
112
                ucCurrentOutputValue ^= ucBit;
113 637 filepang
                gpio_write(0, ucCurrentOutputValue);
114 584 jeremybenn
        }
115
        xTaskResumeAll();
116
}
117 637 filepang
 
118
 

powered by: WebSVN 2.1.0

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