// SSID.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "XIO.h"
#define PCI_CONFIG_ADDRESS_PORT 0x0CF8
#define PCI_CONFIG_VALUE_PORT 0x0CFC
#define VERSION_STRING "SSID.exe for KickStart-- Version 1.0.0 Copyright (C)Aug,26th,2013 Foxconn LTD.\n"
// typedef unsigned long DWORD ;
// typedef unsigned int WORD;
int ret = 0;
DWORD addr;
DWORD data;
DWORD bus = 0;
DWORD dev = 0x1F; //LPC
DWORD func =0x00;
DWORD offset = 0x2C; //ssid&&svid offset
DWORD MkAddr(DWORD bus, DWORD dev, DWORD func, DWORD offset)
{
DWORD addr = 0x80000000 | (bus * 0x10000) | (dev * 0x800 ) | (func * 0x100) | offset;
// printf("%08lX\n", addr);
return addr;
}
void PrtHelp()
{
printf(VERSION_STRING);
printf("Usage:\n");
printf(" ssid [SSID] \n");
printf("For example:\n");
printf(" ssid 02C9\n");
}
int main(int argc, char* argv[])
{
char str[10];
if((argc != 2))
{
ret = 1;
PrtHelp();
}
else if((0 == strcmp(argv[1],"/?"))||(0 == strcmp(argv[1],"-?")))
{
ret = 1;
PrtHelp();
}
else
{
addr = MkAddr(bus, dev, func, offset);
WriteDWord(PCI_CONFIG_ADDRESS_PORT, addr);
data = ReadDWord(PCI_CONFIG_VALUE_PORT);
data = (WORD)(data >> 16);
printf("%04X\n", data);
sprintf_s(str, "%04X", data);
const char *p = _strupr(argv[1]);
// const char *p = argv[1];
if(0 == strcmp(str,p))
{
ret=0;
printf("SSID test pass! \n");
}
else
{
printf("SSID test fail! \n");
ret=1;
}
}
// system("pause");
return 0;
}
subsystem id
最新推荐文章于 2024-01-09 14:24:53 发布