📄 sysspeed.c
字号:
/* sysSpeed.c - Support for determining Bus and DRAM speed *//* Copyright 1997-2002 Wind River Systems, Inc. *//* Copyright 1997,1998,1999 Motorola, Inc., All Rights Reserved */#include "copyright_wrs.h"/*modification history--------------------01g,09jul02,jrp Integrated with sysASpeed.s (SPR 71148).01f,29apr02,sbs corrected warning related to vxHid1Get.01e,16sep01,dat Use of WRS_ASM macro01d,04Nov99,srr Adjusted multipliers to be ratios of 2 to avoid overflow.01c,13jan98,srr updated copyright dates to 1998.01b,16aug97,scb Add MPC750 (Arthur) support.01a,09jul97,tb created.*//*DESCRIPTIONThis code is used for both normal and boot runtime support. Since it is used with romInit, it cannot call out to any normal runtime support routinessuch as vxHid1Get().*//* includes */#include "vxWorks.h"#include "config.h"/* defines *//* typedefs *//* globals */LOCAL UINT sysHid1Get (void);IMPORT UINT32 vxHid1Get (void);#ifdef INCLUDE_I2CIMPORT void mtxI2cDimmGet (UINT, UCHAR *, UINT);#endif /* INCLUDE_I2C *//* locals *//* forward declarations */#ifdef INCLUDE_I2CUINT sysDimmSpdGet (void);/******************************************************************************** sysDimmSpdGet - get the DRAM speed for the DIMM banks** This function's purpose is to access the DIMMs via the I2C controller* and return the slowest speed found.** RETURNS: slowest dram speed*/UINT sysDimmSpdGet (void) { UCHAR DIMM_info[15]; UINT dspeed; UINT ii; dspeed = 0; /* Check all of the DRAM Serial Presence Detect (SPD) SROMs */ for (ii = 0; ii <= 6; ii += 2) { /* Get SPD struct */ mtxI2cDimmGet((0xA0 + ii), &(DIMM_info[0]), 14); /* Does this DIMM use the slowest DRAM ? */ if (DIMM_info[9] > dspeed) { /* Yes! update return value */ dspeed = DIMM_info[9]; } } return (dspeed); }/******************************************************************************** sysDimmRefreshRateGet - get DIMM refresh rate** This function's purpose is to access the DIMMs via the I2C controller* and return the fastest refresh rate required.** RETURNS: refresh_rate: 0 = Normal refresh rate, Non-zero = Fast refresh rate.*/UINT sysDimmRefreshRateGet (void) { UCHAR DIMM_info[15]; UINT refresh_rate; UINT ii; /* Default return value to normal refresh rate */ refresh_rate = 0; /* Check all of the DRAM Serial Presence Detect (SPD) SROMs */ for (ii = 0; ii <= 6; ii += 2) { /* Get SPD struct */ mtxI2cDimmGet((0xA0 + ii), &(DIMM_info[0]), 14); /* Does this DIMM require a fast refresh rate? */ if ((DIMM_info[12] == 1) || (DIMM_info[12] == 2)) { /* Yes! Update return value */ refresh_rate = DIMM_info[12]; } } return (refresh_rate); }#endif /* INCLUDE_I2C *//******************************************************************************** sysHid1Get - read from HID1 register SPR1009.** This routine will read the contents the HID1 (SPR1009)** RETURNS: value of SPR1009*/LOCAL UINT sysHid1Get(void) { return vxHid1Get(); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -