コード例 #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;
				}
			}
		}
	}
}
コード例 #2
0
static conf_object_t* new_s3c6410_touchscreen(char* obj_name){
	s3c6410_touchscreen_device* dev_ts = skyeye_mm_zero(sizeof(s3c6410_touchscreen_device));
	touchscreen_reg_t* regs =  skyeye_mm_zero(sizeof(touchscreen_reg_t));
	s3c6410_touchscreen_status* status = skyeye_mm_zero(sizeof(s3c6410_touchscreen_status));
	dev_ts->obj = new_conf_object(obj_name, dev_ts);
	int *Pen_buffer = get_pen_buffer();
	Pen_buffer[5] = 1;
	status->stylus = Pen_buffer[5];
	status->adc_con = -1;
	/* init touchscreen regs */
	regs->adccon = 0x3fc4;
	regs->adctsc = 0x0058;
	regs->adcdly = 0x00ff;
	regs->adcupdn = 0x0000;
	dev_ts->regs = regs;
	dev_ts->status = status;
	/* registe lcd_ts callback functions */
	lcd_touchscreen_t* lcd_ts = skyeye_mm_zero(sizeof(lcd_touchscreen_t));
	lcd_ts->touchscreen_update_status = touchscreen_update_status;
	lcd_ts->obj = dev_ts->obj;
	SKY_register_interface(lcd_ts, obj_name, LCD_TS_INTF_NAME);
	/* Register io function to the object */
	memory_space_intf* io_memory = skyeye_mm_zero(sizeof(memory_space_intf));
	io_memory->conf_obj = dev_ts->obj;
	io_memory->read = s3c6410_touchscreen_read;
	io_memory->write = s3c6410_touchscreen_write;
	SKY_register_interface(io_memory, obj_name, MEMORY_SPACE_INTF_NAME);

	return dev_ts->obj;
}
コード例 #3
0
static void callback_button_release(GtkWidget *w, GdkEventButton *event, gpointer object)
{
	int *Pen_buffer;
	Pen_buffer = get_pen_buffer();
	skPenEvent(Pen_buffer, 0, 1, event->x, event->y);
	touchscreen_update_status((conf_object_t*)object, Pen_buffer);
}
コード例 #4
0
static void callback_motion_notify(GtkWidget *w, GdkEventMotion *event, gpointer object)
{
	int *Pen_buffer;
	Pen_buffer = get_pen_buffer();
	/*
	 * when mouse is moving, generate an skyeye pen motion event
	 * should changed to "when mouse is pressed and moving"
	 */
	if (Pen_buffer[5] == 0){
		skPenEvent(Pen_buffer, 1, 0, event->x, event->y);
		touchscreen_update_status((conf_object_t*)object, Pen_buffer);
		/*
		if(regs->adctsc & TSC_AUTO_PST)
			s3c6410_touchscreen_raise(63);
		*/
	}
}
コード例 #5
0
ファイル: skyeye_mach_pxa250.c プロジェクト: cherry-wb/skyeye
static void
pxa250_io_do_cycle (void  *state)
{

	 /*RTC*/ if (++pxa250_io.rt_scale >= RT_SCALE) {
		pxa250_io.rt_scale = 0;
		if (pxa250_io.rt_count++ == (pxa250_io.rttr & 0xffff)) {
			pxa250_io.rt_count = 0;

			if (pxa250_io.rcnr++ == pxa250_io.rtar) {
				if (pxa250_io.rtsr & 0x4) {
					pxa250_io.rtsr |= 0x1;
				};
			}
			if (pxa250_io.rtsr & 0x8) {
				pxa250_io.rtsr |= 0x2;
			}
		}
		if ((pxa250_io.rtsr & 0x1) && (pxa250_io.rtsr & 0x4))
			pxa250_io.icpr |= RTC_ALARM_IRQ;
		if ((pxa250_io.rtsr & 0x2) && (pxa250_io.rtsr & 0x8))
			pxa250_io.icpr |= RTC_HZ_IRQ;
	}

	/*OS timer */
	if (++pxa250_io.os_scale >= OS_SCALE) {
		u32 mask = 0;
		u32 count;

		pxa250_io.os_scale = 0;
		count = pxa250_io.oscr++;

		if (count == pxa250_io.osmr0)
			mask = 1;
		if (count == pxa250_io.osmr1)
			mask |= 0x2;
		if (count == pxa250_io.osmr2)
			mask |= 0x4;
		if (count == pxa250_io.osmr3) {
			mask |= 0x8;
			if (pxa250_io.ower & 1) {
				/*state->NresetSig = LOW; */
				interrupt_signal_t reset_signal;
				reset_signal.arm_signal.reset = Low_level;
				reset_signal.arm_signal.firq = Prev_level;
				reset_signal.arm_signal.irq = Prev_level;
				send_signal(&reset_signal);
				printf ("************SKYEYE: WatchDog reset!!!!!!!**************\n");
			}
		}
		pxa250_io.ossr |= mask;
		mask = pxa250_io.oier & pxa250_io.ossr;
		pxa250_io.icpr |= (mask << OS_IRQ_SHF);
	}

	/*FF UART */
	//pxa250_io.utsr0 = 1; /*always TFS, no others*/
	//pxa250_io.utsr1 = 0x4; /*TNF*/
	if (++pxa250_io.ff_scale >= FF_SCALE) {
		pxa250_io.ff_scale = 0;
		if (!(FFUART_IRQ & pxa250_io.icpr)) {
			int int_enable = pxa250_io.ffmcr & 0x18;    // UART interrupt enable

			/* 2007-01-18 modified by Anthony Lee : for new uart device frame */
			struct timeval tv;
			unsigned char c;

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

			//pxa250_io.utsr1 |= 0x2;  //RNE
			//pxa250_io.utsr0 |= 0x4; //Rx idle
			//added by ksh,2004-4-25,get uart data and  set the interrupt
			if(skyeye_uart_read(-1, &c, 1, &tv, NULL) > 0)
			{
				pxa250_io.ffrbr = (int) c;
				pxa250_io.ffiir |= 0x4;	//Rx idle
				//printf("SKYEYE: io_do_cycle  set ffiir  or 04, now %x\n",pxa250_io.ffiir);
				pxa250_io.fflsr |= 0x01;	//Data ready
			}

			if ((pxa250_io.ffier & 0x1)
			    && (pxa250_io.ffiir & 0x4)) {
				if (int_enable)
					pxa250_io.icpr |= FFUART_IRQ;
				pxa250_io.ffiir &= ~0x1;
			}
			/*chy 2004-07-21 from luzhetao: produce a IRQ and ox2 should clean by OS driver */
			if (pxa250_io.ffier & 0x2) {
				if (int_enable)
					pxa250_io.icpr |= FFUART_IRQ;
				pxa250_io.ffiir |= 0x2;
				pxa250_io.ffiir &= ~0x1;
				pxa250_io.fflsr |= 0x60;
			}
		}
		//ywc,2004-11-30,check and get the mouse event
		if (!(pxa250_io.icpr & pxa250_io.ts_int)) {	//if now has no ts interrupt,then query
			unsigned int* Pen_buffer = get_pen_buffer();
			if(Pen_buffer != NULL){
				if (Pen_buffer[6] == 1) {	//should trigger a interrupt
					*(pxa250_io.ts_buffer + 0) = Pen_buffer[0];
					*(pxa250_io.ts_buffer + 1) = Pen_buffer[1];
					*(pxa250_io.ts_buffer + 4) = Pen_buffer[4];
					*(pxa250_io.ts_buffer + 6) = Pen_buffer[6];
					//set EINT2 bit to trigger a interrupt,ts driver will clear it
					pxa250_io.icpr |= pxa250_io.ts_int;
					Pen_buffer[6] = 0;
				}
			}
		}
		//ywc,2004-11-30,check and get the mouse event,end
	}

	pxa250_update_int (state);
	/*reset interrupt pin status */
	//refresh_irq (state);
};