亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? input.c

?? Genode FX is a composition of hardware and software components that enable the creation of fully fl
?? C
字號:
/* * \brief   DOpE input driver module for Charon's FPGA board * \date    2005-02-04 * \author  Norman Feske <norman.feske@genode-labs.com> *//* * Copyright (C) 2005-2008 Norman Feske <norman.feske@genode-labs.com> * Genode Labs, Feske & Helmuth Systementwicklung GbR * * This file is part of the DOpE-embedded package, which is distributed * under the terms of the GNU General Public License version 2. *//* FPGA includes */#include <stdio.h>     /* for printf */#include <unistd.h>    /* for usleep */#include "xparameters.h"#include "xutil.h"#include "xintc.h"#include "plb_ps2_controller.h"#ifdef __MICROBLAZE__#include "mb_interface.h"#endif /* __MICROBLAZE__ */#ifdef __PPC__#include "xexception_l.h"#endif /* __PPC__ *//* local includes */#include "dopestd.h"#include "event.h"#include "input.h"#include "keycodes.h"#define EV_FIFO_SIZE 200#define INTC_DEVICE_ID         XPAR_INTC_0_DEVICE_ID/* translation table for scancode set 2 to scancode set 1 conversion */static int keyb_translation_table[16][16] = {{0xff,0x43,0x41,0x3f,0x3d,0x3b,0x3c,0x58,0x64,0x44,0x42,0x40,0x3e,0x0f,0x29,0x59},{0x65,0x38,0x2a,0x70,0x1d,0x10,0x02,0x5a,0x66,0x71,0x2c,0x1f,0x1e,0x11,0x03,0x5b},{0x67,0x2e,0x2d,0x20,0x12,0x05,0x04,0x5c,0x68,0x39,0x2f,0x21,0x14,0x13,0x06,0x5d},{0x69,0x31,0x30,0x23,0x22,0x15,0x07,0x5e,0x6a,0x72,0x32,0x24,0x16,0x08,0x09,0x5f},{0x6b,0x33,0x25,0x17,0x18,0x0b,0x0a,0x60,0x6c,0x34,0x35,0x26,0x27,0x19,0x0c,0x61},{0x6d,0x73,0x28,0x74,0x1a,0x0d,0x62,0x6e,0x3a,0x36,0x1c,0x1b,0x75,0x2b,0x63,0x76},{0x55,0x56,0x77,0x78,0x79,0x7a,0x0e,0x7b,0x7c,0x4f,0x7d,0x4b,0x47,0x7e,0x7f,0x6f},{0x52,0x53,0x50,0x4c,0x4d,0x48,0x01,0x45,0x57,0x4e,0x51,0x4a,0x37,0x49,0x46,0x54},{0x80,0x81,0x82,0x41,0x54,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f},{0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f},{0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf},{0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf},{0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf},{0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf},{0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef},{0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff}};int init_input(struct dope_services *d);XStatus SetUpInterruptSystem(XIntc *XIntcInstancePtr);static XIntc InterruptController; /* Instance of the Interrupt Controller *///function returns pointer to XIntc InterruptController structureu32 get_InterruptController(void){	return (u32)&InterruptController;}struct input_event {	u32 type;	u32 code;	u32 rel_x;	u32 rel_y;};static struct input_event evqueue[EV_FIFO_SIZE];static int head = 0, tail = 0;/*********************** ** Utility functions ** ***********************//** * Insert event into event queue */void enqueue_event(int type, int code, int rel_x, int rel_y){	evqueue[head].type  = type;	evqueue[head].code  = code;	evqueue[head].rel_x = rel_x;	evqueue[head].rel_y = rel_y;	head = (head + 1) % EV_FIFO_SIZE;	/* if queue is full, discard old elements */	if (head == tail)		tail = (tail + 1) % EV_FIFO_SIZE;}/*********************** ** Interrupt handler ** ***********************/#define EVENT_FROM_KEYBD      0x1#define EVENT_FROM_MOUSE      0x2#define MOUSE_LEFT            0x1#define MOUSE_RIGHT           0x2#define MOUSE_HOR_MASK   0x00ff00#define MOUSE_VER_MASK   0xff0000#define MOUSE_HOR_SHIFT         8#define MOUSE_VER_SHIFT        16#define MOUSE_HOR_NEG    0x008000#define MOUSE_VER_NEG    0x800000#define KEYBD_TYPE_MASK     0x100#define KEYBD_CODE_MASK      0xff/** * Convert mouse event to dope event */void handle_mouse_event(u32 new_mstate){	static u32 old_mstate;	/* left mouse button pressed */	if (!(old_mstate & MOUSE_LEFT) && (new_mstate & MOUSE_LEFT))		enqueue_event(EVENT_PRESS, DOPE_BTN_LEFT, 0, 0);	/* left mouse button released */	if ((old_mstate & MOUSE_LEFT) && !(new_mstate & MOUSE_LEFT))		enqueue_event(EVENT_RELEASE, DOPE_BTN_LEFT, 0, 0);	/* right mouse button pressed */	if (!(old_mstate & MOUSE_RIGHT) && (new_mstate & MOUSE_RIGHT))		enqueue_event(EVENT_PRESS, DOPE_BTN_RIGHT, 0, 0);	/* right mouse button released */	if ((old_mstate & MOUSE_RIGHT) && !(new_mstate & MOUSE_RIGHT))		enqueue_event(EVENT_RELEASE, DOPE_BTN_RIGHT, 0, 0);	/* check for mouse motion */	if ((new_mstate & MOUSE_HOR_MASK) || (new_mstate & MOUSE_VER_MASK)) {		enqueue_event(EVENT_MOTION, 0,		      (new_mstate & MOUSE_HOR_NEG) ? (((new_mstate & MOUSE_HOR_MASK) >> MOUSE_HOR_SHIFT) | 0xFFFFFF00) : (new_mstate & MOUSE_HOR_MASK) >> MOUSE_HOR_SHIFT,		      (new_mstate & MOUSE_VER_NEG) ?  (int)((new_mstate & MOUSE_VER_MASK) >> MOUSE_VER_SHIFT | 0xFFFFFF00) * -1 : (int)((new_mstate & MOUSE_VER_MASK) >> MOUSE_VER_SHIFT) * -1 );	}	/* remember current mouse state for the next time */	old_mstate = new_mstate;}/** * Convert keyboard event to dope event */static void handle_keybd_event(u32 keystate){	int scancode;	static u32 old_keystate = 0;  //Modified by Lovro -- 26.11.2008	/* translate hardware scancode set 2 to software scancode set 1 */	scancode = keyb_translation_table[(keystate>>4)&0x0F][keystate&0x0F];		//modified by Lovro -- 26.11.2008	//This code works fine (robust) but doesn't allow shift + key...	//We don't care about the release event so when the key is pressed, the	//release event is automatically enqued after the press event.	//This allows us to hold down a key and get multiple characters in terminal.	//With original code it led to strange behaviour - it was impossible to 	//select another window after press and hold a key.	/*if (!(keystate & KEYBD_TYPE_MASK))	{		enqueue_event(EVENT_PRESS, scancode & KEYBD_CODE_MASK, 0, 0);		enqueue_event(EVENT_RELEASE, scancode & KEYBD_CODE_MASK, 0, 0);	}*/		/* key released */	if(old_keystate != keystate) //press	{		// key released		if (keystate & KEYBD_TYPE_MASK)			enqueue_event(EVENT_RELEASE, scancode & KEYBD_CODE_MASK, 0, 0);		// key pressed		else enqueue_event(EVENT_PRESS, scancode & KEYBD_CODE_MASK, 0, 0);	}	else	//press and hold	{			//key has been pressed and is beeing hold down, so we need to release		//and press again to interpret this as new character		enqueue_event(EVENT_RELEASE, scancode & KEYBD_CODE_MASK, 0, 0);		enqueue_event(EVENT_PRESS, scancode & KEYBD_CODE_MASK, 0, 0);	}	old_keystate = keystate;	//original code	/* key released */	//if (keystate & KEYBD_TYPE_MASK)	//	enqueue_event(EVENT_RELEASE, scancode & KEYBD_CODE_MASK, 0, 0);	/* key pressed */	//else enqueue_event(EVENT_PRESS, scancode & KEYBD_CODE_MASK, 0, 0);}/** * Input interrupt handler */void PS2_InterruptHandler(void *CallbackRef){	u32 mouse_state, keybd_state, flags;	Xuint32 baseaddr = (Xuint32) XPAR_PLB_PS2_CONTROLLER_0_BASEADDR;	/* read information from device registers */	keybd_state = ((u32 *)baseaddr)[0];	mouse_state = ((u32 *)baseaddr)[1];	flags       = PLB_PS2_CONTROLLER_mReadReg(baseaddr, PLB_PS2_CONTROLLER_INTR_IPISR_OFFSET);	if (flags & EVENT_FROM_MOUSE)		handle_mouse_event(mouse_state);	if (flags & EVENT_FROM_KEYBD)		handle_keybd_event(keybd_state);	/* clear interrupt flags in PS/2 controller */	PLB_PS2_CONTROLLER_mWriteReg(baseaddr, PLB_PS2_CONTROLLER_INTR_IPISR_OFFSET, flags);}/* VGA INTERRUPT HANDLER *///void NPI_VGA_InterruptHandler(void *CallbackRef) {//	u32 flags;//	Xuint32 baseaddr = (Xuint32) XPAR_PLB_PS2_CONTROLLER_0_BASEADDR;////	/* read interrupt state and clear interrupt *///	flags       = PLB_NPI_VGA_CONTROLLER_mReadReg(baseaddr, PLB_PS2_CONTROLLER_INTR_IPISR_OFFSET);//	PLB_NPI_VGA_CONTROLLER_mWriteReg(baseaddr, PLB_PS2_CONTROLLER_INTR_IPISR_OFFSET, flags);//}/*********************** ** Service functions ** ***********************//** * Get next event of event queue * * \return  0 if there is no pending event *          1 if there an event was returned in out parameter e */static int get_event(EVENT *e){	/* no event in queue */	if (head == tail) return 0;	e->type  = evqueue[tail].type;	e->code  = evqueue[tail].code;	e->rel_x = evqueue[tail].rel_x;	e->rel_y = evqueue[tail].rel_y;	tail = (tail + 1) % EV_FIFO_SIZE;	return 1;}/************************************* * Service structure of this module ** *************************************/static struct input_services input = {	get_event,};/************************ ** Module entry point ** ************************/int init_input(struct dope_services *d){	XStatus Status;	Xuint32 baseaddr = (Xuint32) XPAR_PLB_PS2_CONTROLLER_0_BASEADDR;	/* initialize PS/2 interrupts */	PLB_PS2_CONTROLLER_mWriteReg(baseaddr, PLB_PS2_CONTROLLER_INTR_DIER_OFFSET, 0);	PLB_PS2_CONTROLLER_mWriteReg(baseaddr, PLB_PS2_CONTROLLER_INTR_DGIER_OFFSET, 0xFFFFFFFF);	PLB_PS2_CONTROLLER_mWriteReg(baseaddr, PLB_PS2_CONTROLLER_INTR_IPIER_OFFSET, 0xFFFFFFFF);	PLB_PS2_CONTROLLER_mWriteReg(baseaddr, PLB_PS2_CONTROLLER_INTR_IPISR_OFFSET, 0);	/* initialize Interrupt controller */	Status = XIntc_Initialize(&InterruptController, (Xuint16)INTC_DEVICE_ID);	if (Status != XST_SUCCESS)	{//		print("INTC Interrupt init failed!\n");		return XST_FAILURE;	}//	print("INTC Interrupt init successful!\n");	Status = XIntc_SelfTest(&InterruptController);	if (Status != XST_SUCCESS)	{//		print("INTC Interrupt selftest failed!\n");		return XST_FAILURE;	}//	print("INTC Interrupt selftest successful!\n");    Status = SetUpInterruptSystem(&InterruptController);	if (Status != XST_SUCCESS)	{//		print("INTC Interrupt setup failed!\n");		return XST_FAILURE;	}//	print("INTC Interrupt setup successful!\n");	d->register_module("Input 1.0",&input);	return 1;}XStatus SetUpInterruptSystem(XIntc *XIntcInstancePtr){    XStatus Status;    /*     * Connect a device driver handler that will be called when an interrupt     * for the device occurs, the device driver handler performs the specific     * interrupt processing for the device     *///    Status = XIntc_Connect(XIntcInstancePtr, XPAR_XPS_INTC_0_PLB_NPI_VGA_CONTROLLER_0_IP2INTC_IRPT_INTR,//                           (XInterruptHandler)NPI_VGA_InterruptHandler,//                           (void *)0);//    if (Status != XST_SUCCESS)//    {//        return XST_FAILURE;//    }//	print("Interrupt handler VGA connected!\n");    Status = XIntc_Connect(XIntcInstancePtr, XPAR_XPS_INTC_0_PLB_PS2_CONTROLLER_0_IP2INTC_IRPT_INTR,                           (XInterruptHandler)PS2_InterruptHandler,                           (void *)0);    if (Status != XST_SUCCESS)    {        return XST_FAILURE;    }//	print("Interrupt handler PS/2 connected!\n");    /*     * Start the interrupt controller such that interrupts are enabled for     * all devices that cause interrupts, specify simulation mode so that     * an interrupt can be caused by software rather than a real hardware     * interrupt     */    Status = XIntc_Start(XIntcInstancePtr, XIN_REAL_MODE);    if (Status != XST_SUCCESS)    {        return XST_FAILURE;    }    /*     * Enable the interrupt for the device and then cause (simulate) an     * interrupt so the handlers will be called     */    XIntc_Enable(XIntcInstancePtr, XPAR_XPS_INTC_0_PLB_PS2_CONTROLLER_0_IP2INTC_IRPT_INTR);#ifdef __PPC__//	print("Enabling PPC interrupts!\n");    /*     * Initialize the PPC440 exception table     */    XExc_Init();    /*     * Register the interrupt controller handler with the exception table     */    XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT,                        (XExceptionHandler)XIntc_InterruptHandler,                         XIntcInstancePtr);    /*     * Enable non-critical exceptions     */    XExc_mEnableExceptions(XEXC_NON_CRITICAL);	/* clear the timer status register to prevent timer interrupts */	XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL);#endif /* __PPC__ */#ifdef __MICROBLAZE__    /*     * Enable the Interrupts for the MicroBlaze Processor     *///	print("Enable Microblaze Interrupt!\n");    microblaze_enable_interrupts();#endif /* __MICROBLAZE__ */    return XST_SUCCESS;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品高清在线| 成人在线一区二区三区| 国产精品一区二区黑丝 | 欧美激情综合网| 一区二区不卡在线播放| 国产精品主播直播| 欧美一级片在线| 一区二区三区**美女毛片| 国产成人av一区| 日韩美女视频在线| 视频一区二区三区在线| 欧美亚洲自拍偷拍| 伊人色综合久久天天人手人婷| 国产一区二区三区综合 | 欧美在线观看视频一区二区| 国产亚洲综合在线| 麻豆精品视频在线| 欧美高清www午色夜在线视频| 亚洲男人天堂av| 99国产精品久久久| 国产精品久久夜| 床上的激情91.| 国产丝袜美腿一区二区三区| 韩国三级电影一区二区| 日韩精品一区二区三区视频| 美女视频第一区二区三区免费观看网站 | 亚洲一区二区三区在线| 91丨九色丨尤物| 国产精品福利一区| 波多野结衣亚洲| 国产精品久久久久久久第一福利 | 国产精品久久久一区麻豆最新章节| 老司机精品视频一区二区三区| 在线电影一区二区三区| 午夜精品福利一区二区三区av | 99re成人精品视频| 成人欧美一区二区三区白人 | 亚洲一级在线观看| 欧美日韩免费电影| 首页亚洲欧美制服丝腿| 精品久久久久一区| 国产成人午夜精品影院观看视频| 国产丝袜欧美中文另类| av亚洲精华国产精华精| 一区二区三区色| 欧美日韩大陆一区二区| 日韩av电影免费观看高清完整版在线观看| 欧美日韩在线播放三区四区| 日韩高清在线一区| 日韩免费视频一区二区| 床上的激情91.| 亚洲资源中文字幕| 欧美成人精品高清在线播放| 国产精品一卡二卡在线观看| 国产精品乱码一区二三区小蝌蚪| 91美女在线观看| 亚洲成人动漫精品| 久久老女人爱爱| 日本韩国视频一区二区| 天天色综合成人网| 久久亚洲精品国产精品紫薇| 91免费观看在线| 久久99最新地址| 亚洲欧美日韩中文播放| 日韩精品中文字幕一区| 不卡视频免费播放| 免费看黄色91| 成人免费一区二区三区视频| 欧美酷刑日本凌虐凌虐| 国产精品影视在线观看| 亚洲国产视频一区| 国产色婷婷亚洲99精品小说| 欧美日韩日日摸| 成人国产免费视频| 日韩不卡手机在线v区| 国产精品久久久久久久岛一牛影视 | 性做久久久久久免费观看欧美| 久久免费视频一区| 欧美精品v日韩精品v韩国精品v| 成人黄色国产精品网站大全在线免费观看 | 国产精品一级片在线观看| 一级特黄大欧美久久久| 精品福利一区二区三区| 欧美日韩一卡二卡三卡| av不卡在线观看| 日韩国产欧美在线观看| 亚洲欧美综合色| 精品少妇一区二区三区日产乱码| 91丨国产丨九色丨pron| 国产激情一区二区三区| 久久不见久久见免费视频1| 亚洲综合成人在线视频| 亚洲视频在线观看一区| 国产网红主播福利一区二区| 精品蜜桃在线看| 91麻豆精品国产自产在线 | 日韩欧美亚洲一区二区| 欧美调教femdomvk| 一本大道久久a久久综合婷婷| 国产精品中文字幕一区二区三区| 麻豆成人久久精品二区三区小说| 天天免费综合色| 亚洲在线免费播放| 一区二区三区中文字幕在线观看| 国产精品国产三级国产专播品爱网 | 亚洲伊人伊色伊影伊综合网| 亚洲少妇最新在线视频| 中文字幕精品一区二区三区精品| 亚洲精品在线三区| 精品国产乱码久久久久久老虎| 欧美一区二区三区在线观看视频| 欧美日韩色一区| 欧美日韩免费观看一区三区| 欧美视频一区在线| 欧美三级欧美一级| 欧美性欧美巨大黑白大战| 欧美亚洲自拍偷拍| 欧美精品粉嫩高潮一区二区| 555www色欧美视频| 日韩三级中文字幕| 久久久久久久av麻豆果冻| 国产亚洲综合在线| 亚洲欧洲99久久| 亚洲国产欧美在线| 毛片一区二区三区| 国内精品在线播放| www.66久久| 色欧美88888久久久久久影院| 欧洲亚洲精品在线| 6080亚洲精品一区二区| 日韩你懂的电影在线观看| 国产午夜亚洲精品不卡 | 精品人伦一区二区色婷婷| 精品国产一区二区三区忘忧草 | 亚洲影院久久精品| 秋霞国产午夜精品免费视频| 国产在线观看一区二区| 成人黄色电影在线| 欧美日韩国产综合久久| 欧美精品一区二区三区蜜臀| 国产精品视频免费看| 亚洲午夜av在线| 国产剧情在线观看一区二区| 99国产精品久久久久久久久久| 欧美美女喷水视频| 国产拍揄自揄精品视频麻豆| 亚洲免费在线电影| 久草热8精品视频在线观看| 91在线视频免费91| 日韩欧美国产小视频| 一色桃子久久精品亚洲| 日韩av一二三| 色综合久久88色综合天天6| 欧美日韩免费观看一区二区三区 | 亚洲第一久久影院| 精品一区二区在线看| av电影一区二区| 91精品国产欧美日韩| 国产精品毛片大码女人| 日韩激情av在线| 91日韩精品一区| 久久久久亚洲蜜桃| 视频一区二区三区在线| 91色婷婷久久久久合中文| 久久伊人蜜桃av一区二区| 亚洲成人自拍偷拍| 一本到高清视频免费精品| 久久久久久9999| 手机精品视频在线观看| 91蜜桃在线免费视频| 国产日韩三级在线| 久久99国产精品麻豆| 欧美精品亚洲一区二区在线播放| 一区精品在线播放| 国产精品自拍在线| 精品伦理精品一区| 日韩中文字幕麻豆| 在线观看不卡视频| 亚洲欧美电影院| av激情综合网| 国产精品久久久久久久久图文区| 国产一区二区三区四区五区美女| 欧美一区永久视频免费观看| 一区二区三区四区视频精品免费| 岛国一区二区在线观看| 久久久久国产精品麻豆ai换脸| 日韩高清中文字幕一区| 欧美美女直播网站| 视频一区欧美日韩| 制服丝袜av成人在线看| 亚洲成人免费视频| 欧美在线观看一区| 亚洲成av人片一区二区梦乃| 欧美无砖专区一中文字| 亚洲激情欧美激情| 在线中文字幕不卡| 亚洲一区二区三区激情| 精品1区2区3区| 麻豆91精品视频| 精品日韩欧美在线|