📄 rev.c
字号:
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995, 1996, 1997, 1998 Microsoft Corporation
Module Name:
Abstract:
Functions:
Notes:
--*/
#include <windows.h>
#include <halether.h>
#include "loader.h"
#include "rev.h"
/* Definitions */
#define ID_REG_ADDRESS 0xB0008810UL
/* This switch associates a text explination of the ID */
/* Based on prior knowledge it "Knows" that the serial port is */
/* a specific ID */
char * getName(int id)
{
switch (id) {
case 0: return("none ");
case 1: return("IRDA IR ");
case 2: return("PC keyboard ");
case 3: return("B/W LCD Display ");
case 4: return("Serial Port ");
case 5: return("Touchscreen-Sound");
case 6: return("ColorLCD Display "); /* Use smaller string field *
/* For peripherals */
case 7: return("Sh3 CPU 7708 ");
case 8: return("ArbMux FPGA Internal Datapath ");
case 9: return("Isr FPGA Internal Registers ");
case 10: return("P2 Makefile ");
case 11: return("SH3 Standard Configration ");
case 12: return("P2 Wirelisting program mkwl.c ");
case 13: return("Arm810 CPU ");
case 14: return("Ethernet ");
case 15: return("PPC CPU ");
case 16: return("4101 CPU ");
case 17: return("4102 CPU ");
case 18: return("unknown CPU ");
case 19: return("unknown CPU ");
case 20: return("unknown CPU ");
case 21: return("ARM1100 CPU ");
case 22: return("3912 CPU ");
case 23: return("Unknown CPU ");
case 24: return("Unknown CPU ");
case 25: return("Unknown CPU ");
case 26: return("Unknown CPU ");
case 27: return("Unknown CPU ");
case 28: return("Unknown CPU ");
case 29: return("Unknown CPU ");
case 30: return("Unknown CPU ");
case 31: return("SH3 Color VGA Configuration ");
default: return("Unknown ???? New ???? ");
}
}
USHORT printRev()
{
int i;
volatile unsigned long *pdwData;
unsigned long data;
unsigned int id[32],rev[32];
unsigned char intr[32],dmaCh[32];
/* Read the FPGA lower 16 Registers.. get the */
for (i=0;i<16;i++) {
/* Read the data */
pdwData = (unsigned long *)(ID_REG_ADDRESS | 0x00008000UL | (i<<16));
data = *pdwData;
/* Extract the Informational FIelds */
rev[i] = (data >> 8) & 0x7F;
dmaCh[i] = (unsigned char)((data >> 4) & 0xF);
intr[i] = (unsigned char)(data & 0xF);
/* Get the Associated ID */
pdwData = (unsigned long *)(ID_REG_ADDRESS | 0x00008004UL | (i<<16));
id[i] = *pdwData;
}
/* Read the FPGA Upper 16 Registers.. get the Rev and ID fields*/
for (i=0;i<16;i++) {
/* Read the data */
pdwData = (unsigned long *)(ID_REG_ADDRESS | 0x0000C000 | (i<<16));
data = *pdwData;
/* Extract the Informational FIelds */
rev[i+16] = (data >> 8) & 0x7F;
dmaCh[i+16] = (unsigned char)((data >> 4) & 0x0F);
intr[i+16] = (unsigned char)(data & 0x0F);
/* Get the Associated ID */
pdwData = (unsigned long *)(ID_REG_ADDRESS | 0x0000C004 | (i<<16));
id[i+16] = *pdwData;
}
/* Sign On Banner */
EdbgOutputDebugString("************** Microsoft ODO %s **************\r\n",getName(id[19]));
/* print lower 16 register data .. these have location information */
for (i=0;i<16;i++) {
if (id[i] != 0) {
EdbgOutputDebugString("%s Location - %d Revision %d ",getName(id[i]),i,rev[i]);
if (intr[i] != 15)
EdbgOutputDebugString("Interrupt %d ",intr[i]);
else
EdbgOutputDebugString("Interrupt none ");
if (dmaCh[i] != 15)
EdbgOutputDebugString("DMA Channel %d\r\n",dmaCh[i]);
else
EdbgOutputDebugString("DMA Channel none\r\n");
}
}
/* print upper 16 register data .. these have other revision information */
for (i=16;i<32;i++) {
if (id[i] != 0) {
EdbgOutputDebugString("%s Revision %d ",getName(id[i]),rev[i]);
if (intr[i] != 15)
EdbgOutputDebugString("Interrupt %d ",intr[i]);
else
EdbgOutputDebugString("Interrupt none ");
if (dmaCh[i] != 15)
EdbgOutputDebugString("DMA Channel %d\r\n",dmaCh[i] );
else
EdbgOutputDebugString("DMA Channel none\r\n" );
}
}
EdbgOutputDebugString("*******************************************************************************\r\n");
return(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -