20f7eafc2ce1001c1ffc971745fdb8c3

来自「Hi I send you this document」· 代码 · 共 67 行

TXT
67
字号
/*****************************************************************************
 *   fio.c:  Fast I/O module file for NXP LPC23xx Family Microprocessors
 *
 *   Copyright(C) 2006, NXP Semiconductor
 *   All rights reserved.
 *
 *   History
 *   2006.07.13  ver 1.00    Prelimnary version, first Release
 *
 ******************************************************************************/

#include "LPC23xx.h"
#include "type.h"
#include "irq.h"
#include "timer.h"
#include "fio.h"

/*****************************************************************************
** Function name:   GPIOInit
**
** Descriptions:    initialize GPIO port
**
** parameters:      port number and port type, Fast I/O or
**                  regular GPIO, direction, Mask
** Returned value:  None
**
*****************************************************************************/
void GPIOInit( DWORD PortNum, DWORD PortType, DWORD PortDir, DWORD Mask )
{
	if ( (PortType == REGULAR_PORT) && ((PortNum == 0) || (PortNum == 1)) )
	{
		SCS &= ~GPIOM;    /* set GPIOx to use regular I/O */
		if ( PortDir == DIR_OUT )
		{
			(*(volatile unsigned long *)(REGULAR_PORT_DIR_BASE
				+ PortNum * REGULAR_PORT_DIR_INDEX)) |= Mask;
		}
		else
		{
			(*(volatile unsigned long *)(REGULAR_PORT_DIR_BASE
				+ PortNum * REGULAR_PORT_DIR_INDEX)) &= ~Mask;
		}
	}
	else if ( PortType == FAST_PORT )
	{
		if ( (PortNum == 0) || (PortNum == 1) )
		{
			SCS |= GPIOM; /* set GPIOx to use Fast I/O */
		}
		if ( PortDir == DIR_OUT )
		{
			(*(volatile unsigned long *)(HS_PORT_DIR_BASE
				+ PortNum * HS_PORT_DIR_INDEX)) |= Mask;
		}
		else
		{
			(*(volatile unsigned long *)(HS_PORT_DIR_BASE
				+ PortNum * HS_PORT_DIR_INDEX)) &= ~Mask;
		}
	}
	return;
}

/*********************************************************************************
**                            End Of File
*********************************************************************************/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?