static inline uint16_t
capture_wait( void )
{
	while( !capture_flag() )
		;

	return __inw( ICR1L );
}
Example #2
0
//Write configuration to PCI bus.
static BOOL PciWriteConfig(__SYSTEM_BUS* bus, DWORD dwConfigReg, DWORD dwVal,int size)
{
	DWORD dwTmp = 0;
	DWORD _cfg = 0x80000000;
	DWORD result;

	//Combine the bus number,dev number,function number and offset together.
	dwTmp = bus->dwBusNum;
	dwTmp &= 0x000000FF;
	_cfg += (dwTmp << 16);
	_cfg += (dwConfigReg & 0x0000FFFF);

	//Issue writting.
	__outd(CONFIG_REGISTER, _cfg);
	switch (size)
	{
	case 4:
		__outd(DATA_REGISTER, dwVal);
		result = __ind(DATA_REGISTER);
		break;
	case 2:
		__outw((WORD)dwVal, DATA_REGISTER);
		result = __inw(DATA_REGISTER);
		dwVal &= 0xFFFF;
		break;
	case 1:
		__outb((UCHAR)dwVal, DATA_REGISTER);
		result = __inb(DATA_REGISTER);
		dwVal &= 0xFF;
		break;
	default:
		return FALSE;
	}

	//Check if writting is successful.
	if (dwVal == result)
	{
		return TRUE;
	}
	//For debugging.
	_hx_printf("PCI_DRV: Write data to PCI space failed,val = %d,result = %d.\r\n",dwVal,result);
	return FALSE;
}
Example #3
0
static DWORD inputw(__CMD_PARA_OBJ* lpCmdObj)
{
	WORD           wInputPort         = 0;
	WORD           wr                 = 0;
	DWORD          dwInputPort        = 0;
	CHAR           strBuffer[15]      = {0};

	if(NULL == lpCmdObj)  //Parameter check.
		return IOCTRL_TERMINAL;

	if(lpCmdObj->byParameterNum < 2)  //Two small parameters.
	{
		PrintLine("Please input the port where to read.");
		return IOCTRL_NORMAL;
	}
	if(!Str2Hex(lpCmdObj->Parameter[1],&dwInputPort))  //Convert the string value to hex.
	{
		PrintLine("Invalid port value.");
		return IOCTRL_NORMAL;
	}

	wInputPort = (WORD)(dwInputPort);  //Now,wInputPort contains the port number.
	//ReadWordFromPort(&wr,wInputPort);  //Read one byte from port.
	wr = __inw(wInputPort);

	dwInputPort =  0;
	dwInputPort += wr;

	strBuffer[0] = ' ';
	strBuffer[1] = ' ';
	strBuffer[2] = ' ';
	strBuffer[3] = ' ';

	Hex2Str(dwInputPort,&strBuffer[4]);
	PrintLine(strBuffer);    //Print out the byte.

	return 0;
}
Example #4
0
//Read configuration from PCI bus.
static DWORD PciReadConfig(__SYSTEM_BUS* bus, DWORD dwConfigReg,int size)
{
	DWORD dwTmp = 0;
	DWORD _cfg  = 0x80000000;
	
	dwTmp = bus->dwBusNum;
	dwTmp &= 0x000000FF;    //Only reserve the lowest 7 bits.
	_cfg  += (dwTmp << 16);  //Now,_cfg value countains the bus number.
	_cfg  += (dwConfigReg & 0x0000FFFF); //Now the device and function number are combined into _cfg.

	//Read PCI configuration.
	__outd(CONFIG_REGISTER, _cfg);
	switch (size)
	{
	case 4:
		return __ind(DATA_REGISTER);
	case 2:
		return __inw(DATA_REGISTER);
	case 1:
		return __inb(DATA_REGISTER);
	default:
		return 0;
	}
}
Example #5
0
File: io.c Project: berkus/nemesis
unsigned int _inw(unsigned long addr)
{
	return __inw(addr);
}
static inline uint16_t
compare_get( void )
{
	return __inw( OCR1BL );
}
Example #7
0
void fn0C00_0100(byte bh, Eq_10 * ds)
{
	bios_video_set_mode(0x13);
	Eq_9 Eq_10::*si_18 = &Eq_10::t01BC;
	do
	{
		word16 ax_17 = Mem0[ds:si_18 + 0x0000:word16];
		byte dh_22 = SLICE(ax_17, byte, 8);
		bios_video_set_cursor_position(bh, dh_22, (byte) ax_17);
		si_18 = si_18 + 0x0002 + 0x0001;
		dx = ax_17;
		word16 ax_25 = DPB(dx, 0x02, 8, 8);
		do
		{
			byte al_30 = Mem0[ds:si_18 + 0x0000:byte];
			msdos_write_console_char(al_30);
			ax_25 = DPB(ax_25, al_30, 0, 8);
			si_18 = si_18;
			dx = DPB(dx, al_30, 0, 8);
		} while (al_30 != 0x00);
	} while (dh_22 != 0x00);
	do
	{
		__outb(0x03C9, al_30);
		word16 ax_50 = __rol(DPB(ax_25, ~al_30, 0, 8), 0x01);
		__outb(0x03C9, (byte) ax_50);
		word16 ax_53 = __ror(ax_50, 0x01);
		byte al_54 = (byte) ax_53;
		__outb(0x03C9, al_54);
		word16 ax_57 = DPB(ax_53, ~al_54, 0, 8);
		ax_25 = ax_57 + 0x0001;
		al_30 = (byte) (ax_57 + 0x0001);
	} while (ax_57 != 0x0001);
	Eq_79 Eq_104::*di_111 = Eq_104::a0000;
	byte bl_116 = 0xCC;
	word16 bx_114 = DPB(bx, 0xCC, 0, 8);
	do
	{
		word16 cx_112 = 0x0140;
		byte cl_113 = 0x40;
		do
		{
			Eq_93 al_107;
			if ((0xA000->*di_111).t0000 == 0x00)
			{
				word16 ax_160 = __aam(cl_113 | bl_116);
				al_107 = ((byte) ax_160 | SLICE(ax_160, byte, 8)) & 0x3F;
			}
			else
			{
				Eq_87 al_168 = cl_113 - bl_116;
				al_107 = al_168 - cl_113 - (al_168 <u 0x00);
			}
			(0xA000->*di_111).t0000 = al_107;
			cx_112 = cx_112 - 0x0001;
			di_111 = di_111 + 1;
			cl_113 = (byte) cx_112;
		} while (cx_112 != 0x0000);
		bx_114 = bx_114 - 0x0001;
		bl_116 = (byte) bx_114;
	} while (bx_114 != 0x0000);
	__outb(0x0331, 0x3F);
	Mem129[ss:fp - 0x0002:word16] = 0xFA00;
	byte Eq_104::*si_122 = Eq_104::a0000;
	byte Eq_104::*di_125 = Eq_104::aFFFFFA00;
	word16 cx_126 = 0x0140;
	do
	{
		0xA000->*di_125 = 0xA000->*si_122;
		si_122 = si_122 + 1;
		di_125 = di_125 + 1;
		cx_126 = cx_126 - 0x0001;
	} while (cx_126 != 0x0000);
	Mem151[ss:fp - 0x0002:word16] = 0x0177;
	do
		;
	while (((byte) __inw(0x03DA) & 0x08) == 0x00);
	return;
}