subsystem id

// 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;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值