⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fio.c

📁 讲述LPC2468在无操作系统条件下使用YAFFS文件系统是如何实现的以及完整的测试代码,代码部分详见lpc2468_yaffs2.rar
💻 C
字号:
/*****************************************************************************
 *   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 "stdint.h"
//#include "LPC24xx.h"
//#include "type.h"
//#include "irq.h"
//#include "timer.h"
//#include "fio.h"
#include <target.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( uint32_t PortNum, uint32_t PortType, uint32_t PortDir, uint32_t 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -