コード例 #1
0
ファイル: hd.c プロジェクト: jameszhan/foundation
static void hd_times_out(void)
{
	if (!CURRENT)
		return;
	printk("HD timeout");
	if (++CURRENT->errors >= MAX_ERRORS)
		end_request(0);
	SET_INTR(NULL);
	reset = 1;
	do_hd_request();
}
コード例 #2
0
ファイル: hd.c プロジェクト: jameszhan/foundation
static void write_intr(void)
{
	if (win_result()) {
		bad_rw_intr();
		do_hd_request();
		return;
	}
	if (--CURRENT->nr_sectors) {
		CURRENT->sector++;
		CURRENT->buffer += 512;
		SET_INTR(&write_intr);
		port_write(HD_DATA,CURRENT->buffer,256);
		return;
	}
	end_request(1);
	do_hd_request();
}
コード例 #3
0
ファイル: hd.c プロジェクト: jameszhan/foundation
static void read_intr(void)
{
	if (win_result()) {
		bad_rw_intr();
		do_hd_request();
		return;
	}
	port_read(HD_DATA,CURRENT->buffer,256);
	CURRENT->errors = 0;
	CURRENT->buffer += 512;
	CURRENT->sector++;
	if (--CURRENT->nr_sectors) {
		SET_INTR(&read_intr);
		return;
	}
	end_request(1);
	do_hd_request();
}
コード例 #4
0
ファイル: hd.c プロジェクト: jiucang/linux0.12_travel
static void hd_out(unsigned int drive,unsigned int nsect,unsigned int sect,
		unsigned int head,unsigned int cyl,unsigned int cmd,
		void (*intr_addr)(void))
{
	register int port asm("dx");

	if (drive>1 || head>15)
		panic("Trying to write bad sector");
	if (!controller_ready())
		panic("HD controller not ready");
	SET_INTR(intr_addr);
	outb_p(hd_info[drive].ctl,HD_CMD);
	port=HD_DATA;
	outb_p(hd_info[drive].wpcom>>2,++port);
	outb_p(nsect,++port);
	outb_p(sect,++port);
	outb_p(cyl,++port);
	outb_p(cyl>>8,++port);
	outb_p(0xA0|(drive<<4)|head,++port);
	outb(cmd,++port);
}
コード例 #5
0
ファイル: hd.c プロジェクト: jameszhan/foundation
static void hd_out(unsigned int drive,unsigned int nsect,unsigned int sect,
		unsigned int head,unsigned int cyl,unsigned int cmd,
		void (*intr_addr)(void))
{
	unsigned short port;

	if (drive>1 || head>15)
		panic("Trying to write bad sector");
	if (reset || !controller_ready()) {
		reset = 1;
		return;
	}
	SET_INTR(intr_addr);
	outb_p(hd_info[drive].ctl,HD_CMD);
	port=HD_DATA;
	outb_p(hd_info[drive].wpcom>>2,++port);
	outb_p(nsect,++port);
	outb_p(sect,++port);
	outb_p(cyl,++port);
	outb_p(cyl>>8,++port);
	outb_p(0xA0|(drive<<4)|head,++port);
	outb(cmd,++port);
}
コード例 #6
0
ファイル: scan_loop.c プロジェクト: Applepi/controller
void Scan_unlockKeyboard( void )
{
	SET_INTR();
}
コード例 #7
0
ファイル: scan_loop.c プロジェクト: Applepi/controller
// Main Detection Loop
inline uint8_t Scan_loop()
{
	/*
	// Packet Read
	if ( packet_index == 8 )
	{
		// Disable Error LED, proper key found
		errorLED( 0 );

//#ifdef MAX_DEBUG
		// Crazy Debug (Read the Scan Code)
		char tmpStr[3];
		hexToStr_op( inputData, tmpStr, 2 );
		dPrintStrsNL( "Read Data: 0x", tmpStr );
//#endif
		// - Map the scan code to the index array -
		// If the 8th bit is high, remove the keypress, else, add the keypress
		// The lower 7 bits are the array index
		KeyIndex_Array[(inputData & 0x7F)] = (inputData & 0x80) ? 0x00 : 0x80;

		// Reset Containers
		packet_index = 0;
		inputData = 0xFF;
	}
	// Bad Packet
	else if ( packet_index > 8 )
	{
		// Signal Error
		errorLED( 1 );

		char tmpStr[3];
		int8ToStr( packet_index, tmpStr );
		erro_dPrint( "Big packet? Mismatched... ", tmpStr );

		packet_index = 0;
		inputData = 0xFF;
	}
	*/

	// Disable keyboard interrupt (does nothing if already off)
	UNSET_INTR();

	/* XXX OLD CODE - Somewhat worked, has glitches, and is not compatible with the current API

	// Read the clock 8 times
	if ( READ_CLK )
	{
		// Mis-read packet, set back to 0
		if ( packet_index == -1 )
			packet_index = 0;

		// Append 1 bit of data
		inputData &= ~(READ_DATA << packet_index);
		packet_index++;

		// 8 Bits have been read
		if ( packet_index == 8 )
		{
			// Wait till clock edge falls
			while ( READ_CLK );

			// Sample both lines to make sure this is not a data value
			//  and definitely the end of packet data blip
			uint16_t badDataCounter = 0;
			while ( !( READ_DATA ) && !( READ_CLK ) )
					badDataCounter++;

			if ( badDataCounter < 25 )
			{
//#ifdef MAX_DEBUG
				// Crazy Debug (Read the Scan Code)
				char tmpStr[3];
				hexToStr_op( inputData, tmpStr, 2 );
				dbug_dPrint( "Read Data: 0x", tmpStr );
//#endif
				// - Map the scan code to the index array -
				// If the 8th bit is high, remove the keypress, else, add the keypress
				// The lower 7 bits are the array index
				KeyIndex_Array[(inputData & 0x7F)] = (inputData & 0x80) ? 0x00 : 0x80;
			}
			// Even though this is a mis-read packet, we still know what the value is
			else
			{
				// Signal Error
				errorLED( 1 );
				char tmpStr[3];
				hexToStr_op( inputData, tmpStr, 2 );
				erro_dPrint( "Bad packet? Mismatched... 0x", tmpStr );
			}

			// Reset Containers
			inputData = 0xFF;
			packet_index = 0;

			// Interrupt the keyboard, so we don't get packet pieces...
			SET_INTR();

			// Do not wait for next clock, let USB do it's thing (if desired)
			return packet_index;
		}

		// Wait till clock edge falls
		while ( READ_CLK );
	}

	*/

	// Interrupt keyboard if there is no pending packet
	SET_INTR();

	return packet_index;
}