📄 xio.c
字号:
/* $Id: xio.c,v 1.3 2002/06/28 17:55:58 moleres Exp $ *//******************************************************************************** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS* FOR A PARTICULAR PURPOSE.** (c) Copyright 2002 Xilinx Inc.* All rights reserved.*******************************************************************************//*****************************************************************************//**** @file xio.c** Contains I/O functions for memory-mapped or non-memory-mapped I/O* architectures. These functions encapsulate generic CPU I/O requirements.** @note** This file may contain architecture-dependent code.*******************************************************************************//***************************** Include Files *********************************/#include "xio.h"#include "xbasic_types.h"/************************** Constant Definitions *****************************//**************************** Type Definitions *******************************//***************** Macros (Inline Functions) Definitions *********************//************************** Function Prototypes ******************************//*****************************************************************************//**** Performs a 16-bit endian converion.** @param Source contains the value to be converted.* @param DestPtr contains a pointer to the location to put the* converted value.** @return** None.** @note** None.*******************************************************************************/void XIo_EndianSwap16(Xuint16 Source, Xuint16* DestPtr){ *DestPtr = (Xuint16)(((Source & 0xFF00) >> 8) | ((Source & 0x00FF) << 8));}/*****************************************************************************//**** Performs a 32-bit endian converion.** @param Source contains the value to be converted.* @param DestPtr contains a pointer to the location to put the* converted value.** @return** None.** @note** None.*******************************************************************************/void XIo_EndianSwap32(Xuint32 Source, Xuint32* DestPtr){ /* get each of the half words from the 32 bit word */ Xuint16 LoWord = (Xuint16)(Source & 0x0000FFFF); Xuint16 HiWord = (Xuint16)((Source & 0xFFFF0000) >> 16); /* byte swap each of the 16 bit half words */ LoWord = (((LoWord & 0xFF00) >> 8) | ((LoWord & 0x00FF) << 8)); HiWord = (((HiWord & 0xFF00) >> 8) | ((HiWord & 0x00FF) << 8)); /* swap the half words before returning the value */ *DestPtr = (Xuint32)((LoWord << 16) | HiWord);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -