Fun to see the world official blog quiet shooting
ial is a generic abstract input interface, you can enter the structure of a unified data format of the data that is to say in MiniGUI core code input is fixed, regardless of the input device is a mouse or touch screen. Simply put, no matter what MiniGUI ported to the operating system, ial code in MiniGUI is the same, just re-write the code ial interfaces between devices operating system, which is called the transplant, this is similar The following drivers and the operating system. Is connected to the drive system kernel and various hardware, and to connect MiniGU ial and different operating systems, if not required MiniGUI transplantation, there is no need to define ial interface. 2.2 ial in the INPUT data structure
ial in the INPUT data structure is the key to transplant, this structure there are a lot of pointers to functions, ial when sending data to initialize a pointer to a structure from INPUT MiniGUI kernel, I have written a variety of users to assign a function pointer It is so indirect MiniGUI can call the user function, this method is especially prepared lee wee brothers by methods similar to the Linux driver. The data in src / include / ial.h definitions: typedef struct tagINPUT {char * id; / / Initialization and termination BOOL (* init_input) (struct tagINPUT * input, const char * mdev, const char * mtype); void (* term_input) (void); / / Mouse operations lee wee brothers int (* update_mouse) lee wee brothers (void); void (* get_mouse_xy) (int * x, int * y); void (* set_mouse_xy) (int x, int y); int (* get_mouse_button) (void); void (* set_mouse_range) (int minx, int miny, int maxx, int maxy); void (* suspend_mouse) (void); int (* resume_mouse) (void); / / Keyboard operations int (* update_keyboard) (void); const char * (* get_keyboard_state) (void); void (* suspend_keyboard) (void); int (* resume_keyboard) (void); void (* set_leds) (unsigned int leds); / / Event # ifdef _LITE_VERSION int (* wait_event) (int which, int maxfd, fd_set * in, fd_set * out, fd_set * except, struct tim * timeout); # else int (* wait_event) (int which, fd_set lee wee brothers * in, fd_set * out , fd_set * except, char mdev [MAX_PATH + 1];} INPUT;
Here is the source: BOOL Init2410Input (INPUT * input, const char * mdev, const char * mtype) {ts = open (mdev, O_RDONLY); / / open operating system device files, if (ts update_mouse = mouse_update; / / Registration their update_mouse function input-> get_mouse_xy = mouse_getxy; / / register their get_mouse_xy function input-> set_mouse_xy = NULL; / / touch screen does not require this function, so refer to NULL input-> get_mouse_button = mouse_getbutton; / / get the mouse button state input-> set_mouse_range = NULL; / / this is generally useless input-> wait_event = wait_event; / / this is necessary, the kernel is to use this function to receive data mousex = 0;. mousey = 0; ts_event.x = ts_event.y = ts_event.pressure = 0; return TRUE;}
Said: If you open a macro _SMDK2410_IAL and ial_engine as "SMDK2410" will call these two functions, but ial_engine in MiniGUI.cfg years, or is specified in the src / sysres / mgetc-xxx.c file, the former non-embedded The latter is embedded. lee wee brothers 2.4 Functions The functions registered static int wait_event (int which, fd_set * in, fd_set * out, fd_set * except, struct tim * timeout)
Previous Article: realy the article:? Consummation
No comments:
Post a Comment