📄 partest.c
字号:
/*
********************************************************************
* Project: GNU-Port FreeRTOS Port
* File: ParTest.c
*
* System: ARM7TDMI-S 32 Bit (LPC2378)
* Compiler: GCC 4.0.3
*
* Date: 2006-11-17
* Author: Grohmann
*
* Rights: Hitex Development Tools GmbH
* Greschbachstr. 12
* D-76229 Karlsruhe
********************************************************************
* Description:
*
* This file is part of the GNU FreeRTOS Port
* The code is based on the FreeRTOS originated by Richard Barry
* This is a small implementation preemtive and semaphore task.
* The application runs in ARM mode with high optimization level.
*
********************************************************************
* History:
*
* Revision 1.0 2006/11/17 Gn
* Initial revision
********************************************************************
* This is a preliminary version.
*
* WARRANTY: HITEX warrants that the media on which the SOFTWARE is
* furnished is free from defects in materials and workmanship under
* normal use and service for a period of ninety (90) days. HITEX entire
* liability and your exclusive remedy shall be the replacement of the
* SOFTWARE if the media is defective. This Warranty is void if failure
* of the media resulted from unauthorized modification, accident, abuse,
* or misapplication.
*
* DISCLAIMER: OTHER THAN THE ABOVE WARRANTY, THE SOFTWARE IS FURNISHED
* "AS IS" WITHOUT WARRANTY OF ANY KIND. HITEX DISCLAIMS ALL OTHER WARRANTIES,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* NEITHER HITEX NOR ITS AFFILIATES SHALL BE LIABLE FOR ANY DAMAGES ARISING
* OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, INCLUDING DAMAGES FOR
* LOSS OF PROFITS, BUSINESS INTERRUPTION, OR ANY SPECIAL, INCIDENTAL, INDIRECT
* OR CONSEQUENTIAL DAMAGES EVEN IF HITEX HAS BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGES.
********************************************************************/
#include "FreeRTOS.h"
#include "partest.h"
#define partstFIRST_IO ( ( unsigned portLONG ) 0x00000001 )
#define partstNUM_LEDS ( 8 )
#define partstALL_OUTPUTS_OFF ( ( unsigned portLONG ) 0xffffff00 )
/*-----------------------------------------------------------
* Simple parallel port IO routines.
*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
/* This is performed from main() as the io bits are shared with other setup
functions. */
/* Turn all outputs off. */
/* GPIO0_IOSET = partstALL_OUTPUTS_OFF; */ /* not used yet */
(*(volatile unsigned long *)(0x3FFFC000+2*0x20)) = 0xFFFFFFFF;
/* FGPIO2_IOSET = partstALL_OUTPUTS_OFF; */ /* not working waiting for call */
}
/*-----------------------------------------------------------*/
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
{
unsigned portLONG ulLED = partstFIRST_IO;
if( uxLED < partstNUM_LEDS )
{
/* Rotate to the wanted bit of port 0. Only P10 to P13 have an LED attached. */
ulLED <<= ( unsigned portLONG ) uxLED;
/* Set of clear the output. */
if( xValue )
{
FGPIO2_IOCLR = ulLED; /* not working correctly at the moment */
GPIO0_IOCLR = Speaker; /* produces clicks */
}
else
{
FGPIO2_IOSET = ulLED; /* not working correctly at the moment */
GPIO0_IOSET = Speaker; /* produces clicks */
}
}
}
/*-----------------------------------------------------------*/
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
{
unsigned portLONG ulLED = partstFIRST_IO, ulCurrentState;
if( uxLED < partstNUM_LEDS )
{
/* Rotate to the wanted bit of port 0. Only P10 to P13 have an LED
attached. */
ulLED <<= ( unsigned portLONG ) uxLED;
/* If this bit is already set, clear it, and visa versa. */
ulCurrentState = FGPIO2_IOPIN;
if( ulCurrentState & ulLED )
{
FGPIO2_IOCLR = ulLED; /* not working correctly at the moment */
if (ulLED == 2)
GPIO0_IOCLR = Speaker; /* produces clicks */
}
else
{
FGPIO2_IOSET = ulLED; /* not working correctly at the moment */
if (ulLED == 2)
GPIO0_IOSET = Speaker; /* produces clicks */
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -