1. 所有的内容放在:http://download.csdn.net/detail/dijkstar/6890899;
2. 观察PCI配置的最好工具是PCIScope和RW-everything,在这里有备份:
2. 1394b中的GUID部分描述见里面的文档:GUID.pdf ,这是一个TI的台湾工程师写的;
3. 里面用到的一访问EEPROM的工具,DOS下的,使用方法见文档:OHCIROM.PDF;工具也备份在里面;
4. EEPROM的生成内容,要点一是GUID,另一是CRC的计算。下面是一个从可以工作的芯片TSB82AA2B,EEPROM中读出的内容(共24个字节),与下面的算法一致,偏移15处的数据为0x70,请自己验证:
// GenROM.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "GenROM.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/
// The one and only application object
CWinApp theApp;
using namespace std;
unsigned char Formula(unsigned char *buf);
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
unsigned char strBuf[] =
{
0x42, //00 ;01000010 PCI max_lat (lower 4 bits)/ PCI min gnt (lower 4 bits)
0x92, //01 ;00000000 * PCI Subsystem Vendor ID (lsbyte) ** Insert your SSVID LSB
0x15, //02 ;00000000 * PCI Subsystem Vendor ID (msbyte) ** Insert your SSVID MSB
0x05, //03 ;00000000 * PCI Subsystem ID (lsbyte) ** Insert your SSID LSB
0x00, //04 ;00000000 * PCI Subsystem ID (Msbyte) ** Insert your SSID MSB
0xC2, //05 ;11000010 Link Enhancement Register Byte 0
0x00, //06 ;00000000 MiniRom enable
//GUID Hi
0x01, //07 ;00000000 * 1394 GUID Hi (0) 8-bit chip id hi
0x3B, //08 ;00000000 * 1394 GUID Hi (1) LSB of 24-bit node vendor id
0x13, //09 ;00000000 * 1394 GUID Hi (2) middle byte of 24-bit node vendor id
0x00, //10 ;00000000 * 1394 GUID Hi (3) MSB of 24-bit node vendor id
//GUID Lo
0x13, //11 ;######## * 1394 GUID Lo (0) byte 0 (LSB) of 32-bit chip id lo - auto incremented from serial.dat
0x01, //12 ;######## * 1394 GUID Lo (1) byte 1 of 32-bit chip id lo - auto incremented from serial.dat
0x01, //13 ;######## * 1394 GUID Lo (2) byte 2 of 32-bit chip id lo - auto incremented from serial.dat
0x00, //14 ;######## * 1394 GUID Lo (3) byte 3 (MSB) of 32-bit chip id lo - auto incremented from serial.dat
//ROM CRC
0x00, //15 ;XXXXXXXX ROM CRC (Calculated by EELynx)
0x40, //16 ;00010000 Link Enhancement Register Byte 1
0x10, //17 ;00010000 PCI Miscellaneous Control Register Byte 0
0x02, //18 ;00100100 PCI Miscellaneous Control Register Byte 1
0xB0, //19 ;00000000 Reserved
0x00, //20 ;00000000 CIS Offset
0x00, //21 ;00000000 Reserved
0x00, //22 ;00000000 Reserved
0x00, //23 ;00000000 MFunc Select
};
//计算CRC
strBuf[15] = Formula(strBuf);
printf("CRC = %02x\n\n", strBuf[15]);
/*
//写入文件"1.dat"
FILE *fp = fopen("1.dat", "wb");
if(fp)
{
fwrite(strBuf, 1, 24, fp);
fclose(fp);
printf("文件1.dat写入成功\n");
}
*/
}
return nRetCode;
}
//计算CRC校验字节
unsigned char Formula(unsigned char *buf)
{
unsigned char crc = 0xaa;
for (int counter2 = 0; counter2 < 23; counter2++)
if (counter2 != 15) crc = crc ^ buf[counter2];
return crc;
}