Esempio n. 1
0
void
ep7312_io_do_cycle (ARMul_State * state)
{
	int t;


	for (t = 0; t < 2; t++) {
		if (io.tcd[t] == 0) {

			if (io.syscon & (t ? TC2M : TC1M)) {

				io.tcd[t] = io.tcd_reload[t];
			}
			else {
				io.tcd[t] = 0xffff;
			}
			io.intsr |= (t ? TC2OI : TC1OI);
			ep7312_update_int (state);
		}
		else {
			io.tcd[t]--;
		}
	}
	if (!(io.intsr & URXINT)) {
		/* 2007-01-18 modified by Anthony Lee : for new uart device frame */
		struct timeval tv;
		unsigned char buf;

		tv.tv_sec = 0;
		tv.tv_usec = 0;

		if(skyeye_uart_read(-1, &buf, 1, &tv, NULL) > 0)
		{
			io.uartdr = (int) buf;

			io.sysflg &= ~URXFE;
			io.intsr |= URXINT;
			ep7312_update_int (state);
		}
	}			//if (!(io.intsr & URXINT))

	// ywc 2004-04-01 for touch screen interrupt
	{
		if (!(io.intsr & io.ts_int)) {	//if now has no ts interrupt,then query 
			unsigned int* Pen_buffer = get_pen_buffer();
			/* If Pen_buffer is registered. */
			if(Pen_buffer != NULL){
				if (Pen_buffer[6] == 1) {	//should trigger a interrupt
					*(io.ts_buffer + 0) = Pen_buffer[0];
					*(io.ts_buffer + 1) = Pen_buffer[1];
					*(io.ts_buffer + 4) = Pen_buffer[4];
					*(io.ts_buffer + 6) = Pen_buffer[6];
					//set EINT2 bit to trigger a interrupt,ts driver will clear it
					io.intsr |= io.ts_int;
					Pen_buffer[6] = 0;
				}
			}
		}
	}
}
Esempio n. 2
0
void
ep7312_io_write_word (void  *state, uint32_t addr, uint32_t data)
{
	uint32_t tmp;

	switch (addr - 0x80000000) {
	case SYSCON:
		tmp = io.syscon;
		io.syscon = data;
		//chy 2004-03-11
		if ((tmp & LCDEN) != (data & LCDEN)) {
			// by ywc 2004-07-07
			printf ("\n\n SYSCON:will call ep7312_update_lcd()");
			//ep7312_update_lcd (state);
		}
		break;
	case SYSFLG:
		break;
	case INTSR:
		//DBG_PRINT("write INTSR=0x%x\n", data);
		io.intsr = data;
		//      printf("SKYEYE: write INTSR=0x%x\n", io.intsr);
		break;
	case INTMR:
		//DBG_PRINT("write INTMR=0x%x\n", data);
		//if(data != 0x2000 && data != 0x2200)
		//printf("SKYEYE: write INTMR=0x%x\n", data);
		io.intmr = data;
		ep7312_update_int (state);
		break;
	case TC1D:
		io.tcd[0] = io.tcd_reload[0] = data & 0xffff;
		SKYEYE_DBG ("TC1D 0x%x\n", data & 0xffff);
		break;
	case TC2D:
		io.tcd[1] = io.tcd_reload[1] = data & 0xffff;
		SKYEYE_DBG ("TC2D 0x%x\n", data & 0xffff);
		break;
	case UARTDR:
		/* The UART writes chars to console */
		{
			char c = data;

			/* 2007-01-18 modified by Anthony Lee : for new uart device frame */
			skyeye_uart_write(-1, &c, 1, NULL);
		}
		break;
/*	case BLEOI: printf("BLEOI\n"); break;
	case MCEOI: printf("MCEOI\n"); break;
	case TEOI: printf("TEOI\n"); break;*/
	case TC1EOI:
		io.intsr &= ~TC1OI;
		ep7312_update_int (state);
		SKYEYE_DBG ("TC1EOI\n");
		break;
	case TC2EOI:
		io.intsr &= ~TC2OI;
		ep7312_update_int (state);
		SKYEYE_DBG ("TC2EOI\n");
		break;
		//case RTCEOI: printf("RTCEOI\n"); break;
		//case UMSEOI: printf("UMSEOI\n"); break;
		//case COEOI: printf("COEOI\n"); break;
	case 0x2000:
		/* Not a real register, for debugging only: */
		SKYEYE_DBG ("io_write_word debug: 0x%08lx\n", data);
		break;
	default:
//chy 2003-07-11: sometime has fault, but linux can continue running  !!!!????
		//printf("SKYEYE:unknown io addr, io_write_word(0x%08x, 0x%08x), pc %x \n", addr, data,state->Reg[15]);
		break;
	}
}
Esempio n. 3
0
uint32_t
ep7312_io_read_word (void  *state, uint32_t addr)
{
	uint32_t data = 0;
	uint32_t ts_addr;

	//ywc 2004-04-01 read the touch srceen data buffer,return to the ts device driver
	ts_addr = addr & ~3;	// 1 word==4 byte
	if (ts_addr >= io.ts_addr_begin && ts_addr <= io.ts_addr_end) {
		data = io.ts_buffer[(ts_addr - io.ts_addr_begin) / 4];
		return data;
	}
	switch (addr - 0x80000000) {
	case SYSCON:
		data = io.syscon;
		break;
	case SYSFLG:
		data = io.sysflg;
		break;
/*	case MEMCFG1:
 *	case MEMCFG2:
 *	case DRFPR */
	case INTSR:
		data = io.intsr;
		break;
	case INTMR:
		data = io.intmr;
		break;
	case TC1D:
		data = io.tcd[0];
		break;
	case TC2D:
		data = io.tcd[1];
		break;
/*	case RTCDR:
 *	case RTCMR:
 *	case PMPCON :
 *	case CODR:*/
	case UARTDR:
		data = io.uartdr;
		io.sysflg |= URXFE;
		io.intsr &= ~URXINT;
		ep7312_update_int (state);
		break;
/*	case UBRLCR:		*/
	case SYNCIO:
		/* if we return zero here, the battery voltage calculation
		 *         results in a divide-by-zero that messes up the kernel */
		data = 1;
		break;
/*	case PALLSW:
 *	case PALMSW:*/

		/* write-only: */
	case STFCLR:
	case BLEOI:
	case MCEOI:
	case TEOI:
	case TC1EOI:
	case TC2EOI:
	case RTCEOI:
	case UMSEOI:
	case COEOI:
	case HALT:
	case STDBY:
		break;
	default:
//chy 2003-07-11: sometime has fault, but linux can continue running  !!!!????
		//SKYEYE_DBG("io_read_word(0x%08x) = 0x%08x\n", addr, data);
		break;
	}
	return data;
}