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

📄 cfio.c

📁 使用广泛的日本著名的开源嵌入式实时操作系统T-Kernel的源码
💻 C
字号:
/* *---------------------------------------------------------------------- *    T-Kernel * *    Copyright (C) 2004-2006 by Ken Sakamura. All rights reserved. *    T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * *    Version:   1.02.02 *    Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/9. * *---------------------------------------------------------------------- *//* *      @(#)cfio.c (libtk/M32104) * *      I/O port access (for CF card use) * *	Can also perform normal I/O access, although in_[bwh]() *	or similar will need to be used  */#include <basic.h>#include <tk/syslib.h>EXPORT void cf_out_h( INT port, UH data ){	if ( ((UINT)port & 0xffff8000U) == 0x03010000U ) {		if ( port & 1 ) {			port -= (0x08000 - 0x7ff);			/* 0x7ff -> port |= (1 << 11); port &= ~0x01U; */		} else {			port -= 0x10000;		}	}	Asm("sth %0, @%1":: "r"(data), "r"(port));}EXPORT UH cf_in_h( INT port ){	UH	data;	if ( ((UINT)port & 0xffff8000U) == 0x03010000U ) {		if ( port & 1 ) {			port -= (0x08000 - 0x7ff);			/* 0x7ff ->  port |= (1 << 11); port &= ~0x01U; */		} else {			port -= 0x10000;		}	}	Asm("lduh %0, @%1": "=r"(data): "r"(port));	return data;}EXPORT void cf_out_b( INT port, UB data ){	if ( ((UINT)port & 0xffff8000U) == 0x03010000U && (port & 1) ) {		port += 0x7ff;	/* port |= (1 << 11); port &= ~0x01U; */	}	Asm("stb %0, @%1":: "r"(data), "r"(port));}EXPORT UB cf_in_b( INT port ){	UB	data;	if ( ((UINT)port & 0xffff8000U) == 0x03010000U && (port & 1) ) {		port += 0x7ff;	/* port |= (1 << 11); port &= ~0x01U; */	}	Asm("ldub %0, @%1": "=r"(data) : "r"(port));	return data;}

⌨️ 快捷键说明

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