コード例 #1
0
ファイル: emc28j60_uip.c プロジェクト: fuinha/cottonwood
/*
                              etherdev_poll()

    This function will read an entire IP packet into the uip_buf.
    If it must wait for more than 0.5 seconds, it will return with
    the return value 0. Otherwise, when a full packet has been read
    into the uip_buf buffer, the length of the packet is returned.
*/
uint16_t etherdev_poll(void)
{
	uint16_t bytes_read = 0;
#if 0

	/* tick_count threshold should be 12 for 0.5 sec bail-out
		One second (24) worked better for me, but socket recycling
		is then slower. I set UIP_TIME_WAIT_TIMEOUT 60 in uipopt.h
		to counter this. Retransmission timing etc. is affected also. */
	while ((!(bytes_read = etherdev_read())) && (timer0_tick() < 12)) continue;

	timer0_reset();

#endif
	return bytes_read;
}
コード例 #2
0
ファイル: lc8670.c プロジェクト: jiangzhonghui/mame
void lc8670_cpu_device::execute_set_input(int inputnum, int state)
{
	switch(inputnum)
	{
		case LC8670_EXT_INT0:
			if ((REG_I01CR & 0x0c) == 0x00 && m_input_lines[inputnum] && !state)        // falling edge
			{
				REG_I01CR |= 0x02;
				if (REG_I01CR & 0x01)
					set_irq_flag(1);
			}
			else if ((REG_I01CR & 0x0c) == 0x04 && !state)      // low level
			{
				REG_I01CR |= 0x02;
				if (REG_I01CR & 0x01)
					set_irq_flag(1);
			}
			else if ((REG_I01CR & 0x0c) == 0x08 && !m_input_lines[inputnum] && state)       // rising edge
			{
				REG_I01CR |= 0x02;
				if (REG_I01CR & 0x01)
					set_irq_flag(1);
			}
			else if ((REG_I01CR & 0x0c) == 0x0c && state)       // high level
			{
				REG_I01CR |= 0x02;
				if (REG_I01CR & 0x01)
					set_irq_flag(1);
			}
			break;
		case LC8670_EXT_INT1:
			if ((REG_I01CR & 0xc0) == 0x00 && m_input_lines[inputnum] && !state)        // falling edge
			{
				REG_I01CR |= 0x20;
				if (REG_I01CR & 0x10)
					set_irq_flag(2);
			}
			else if ((REG_I01CR & 0xc0) == 0x40 && !state)      // low level
			{
				REG_I01CR |= 0x20;
				if (REG_I01CR & 0x10)
					set_irq_flag(2);
			}
			else if ((REG_I01CR & 0xc0) == 0x80 && !m_input_lines[inputnum] && state)       // rising edge
			{
				REG_I01CR |= 0x20;
				if (REG_I01CR & 0x10)
					set_irq_flag(2);
			}
			else if ((REG_I01CR & 0xc0) == 0xc0 && state)       // high level
			{
				REG_I01CR |= 0x20;
				if (REG_I01CR & 0x10)
					set_irq_flag(2);
			}
			break;
		case LC8670_EXT_INT2:
			if ((REG_I23CR & 0x04) && m_input_lines[inputnum] && !state)    // falling edge
			{
				if (!(REG_ISL & 0x01))
					timer0_tick(true);

				REG_I23CR |= 0x02;
				if (REG_I23CR & 0x01)
					set_irq_flag(3);
			}
			if ((REG_I23CR & 0x08) && !m_input_lines[inputnum] && state)    // rising edge
			{
				if (!(REG_ISL & 0x01))
					timer0_tick(true);

				REG_I23CR |= 0x02;
				if (REG_I23CR & 0x01)
					set_irq_flag(3);
			}
			break;
		case LC8670_EXT_INT3:
			if ((REG_I23CR & 0x40) && m_input_lines[inputnum] && !state)    // falling edge
			{
				if (REG_ISL & 0x01)
					timer0_tick(true);

				REG_I23CR |= 0x20;
				if (REG_I23CR & 0x10)
					set_irq_flag(4);
			}
			if ((REG_I23CR & 0x80) && !m_input_lines[inputnum] && state)    // rising edge
			{
				if (REG_ISL & 0x01)
					timer0_tick(true);

				REG_I23CR |= 0x20;
				if (REG_I23CR & 0x10)
					set_irq_flag(4);
			}
			break;
	}

	m_input_lines[inputnum] = state;
}