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

📄 reg_api.c

📁 开发Inetl IXP2400平台所必须的硬件诊断和测试程序。该软件包支持的功能包括CPU基本功能检测
💻 C
字号:
/*
 *-------------------------------------------------------------------------------
 *                                                                      
 *                  I N T E L   P R O P R I E T A R Y                   
 *                                                                      
 *     COPYRIGHT (c)  2002 BY  INTEL  CORPORATION.  ALL RIGHTS          
 *     RESERVED.   NO  PART  OF THIS PROGRAM  OR  PUBLICATION  MAY      
 *     BE  REPRODUCED,   TRANSMITTED,   TRANSCRIBED,   STORED  IN  A    
 *     RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE OR COMPUTER    
 *     LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, MECHANICAL,    
 *     MAGNETIC,  OPTICAL,  CHEMICAL, MANUAL, OR OTHERWISE,  WITHOUT    
 *     THE PRIOR WRITTEN PERMISSION OF :                                
 *                                                                      
 *                        INTEL  CORPORATION                            
 *                                                                     
 *                     2200 MISSION COLLEGE BLVD                        
 *                                                                      
 *               SANTA  CLARA,  CALIFORNIA  95052-8119                  
 *                                                                      
 * ------------------------------------------------------------------------------
 */

#include "diag.h"
#include "reg_api.h"
#include "type.h"

//extern void eprintf(char *f, ...);
UINT32 media_seat;

/***********************************************
** Slow port read and write have been modified.
** The Slow port address is generated as following:
** address = Base + (register offset << 2)
*************************************************/
//#define DEBUG

/*** 
reg_write routine now accepts register offset 
and genetrates the complete address.
****/
void reg_write( volatile UINT32 offset, UINT32 val)
{
	volatile unsigned int address=0;

	if (media_seat != 0)
	{
//		eprintf("0x%08X\n", media_seat);
		address = REGMAP_BASE_SF + (offset << 2);
	}
	else
	{
		address = REGMAP_BASE + (offset << 2);
	}
	
	//eprintf("Writing to address 0x%x with value 0x%x\n\n",address, val);
	*((volatile unsigned int*)(address)) = val;

}

/*** 
reg_read routine now accepts register offset 
and genetrates the complete address.
****/
UINT32 reg_read( volatile UINT32 offset)
{
	volatile unsigned int address=0;
	UINT32 val=0 ;

	if (media_seat != 0)
	{
//		eprintf("0x%08X\n", media_seat);
		address = REGMAP_BASE_SF + (offset << 2);
	}
	else
	{
		address = REGMAP_BASE + (offset << 2);
	}

	val = *((volatile unsigned int*)(address));

	//eprintf("Reading from address 0x%x \t value 0x%x\n\n", address, val);
	
	return val;
}

⌨️ 快捷键说明

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