int main() { while (TRUE) { // print prompt and read into string array input. print_prompt(); char* input[64]; scan_input(input); // perform a fork and process input. int pid = fork(); if (pid != 0) { // code for parent process. int statloc; process_parent(&statloc); } else { // code for forked child process. process_child(input); } } }
static ssize_t rebis_keyscan_read(struct file *filp, char *buff, size_t count, loff_t *offp) { int i; //int key_base[5] = {KEY_MATRIX_BASE5, KEY_MATRIX_BASE4, KEY_MATRIX_BASE3, KEY_MATRIX_BASE2, KEY_MATRIX_BASE1}; cur_key = 0; if(!(filp->f_flags & O_NONBLOCK)){ #if 0 interruptible_sleep_on(&wq); #else wait_event_interruptible(wq, flag != 0); //wait_event_interruptible_timeout(wq, flag != 0, 600); #endif } //for key scan #if 1 cur_key = 0; s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP); for(i=4; i>=0; i--) { writel(readl(S3C2410_GPBDAT) | (0x1f), S3C2410_GPBDAT); writel(readl(S3C2410_GPBDAT) & (~(0x1 << i)), S3C2410_GPBDAT); cur_key = scan_input(); if(cur_key) //cur_key = scan_input(); { cur_key += (i)*2;//key_base[i]; if(cur_key == old_key) goto SameValue; old_key = cur_key; //printk("cur_key = %d \n\n", cur_key); put_user(cur_key,(char *)buff); break; } } SameValue: old_key = 0; flag = 0; // set GPBDAT 0 s3c2410_gpio_setpin(S3C2410_GPB0, 0); s3c2410_gpio_setpin(S3C2410_GPB1, 0); s3c2410_gpio_setpin(S3C2410_GPB2, 0); s3c2410_gpio_setpin(S3C2410_GPB3, 0); s3c2410_gpio_setpin(S3C2410_GPB4, 0); // change External Interrupts s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3); #endif return count; }
int main (int argc, char **argv) { setlocale(LC_ALL,LOCALE); options (argc, argv, "abcdE:efklmo:prstvxX4"); srcs_init (); gdlif_init(); collate_init ("unicode"); scan_input (argc, argv); ++global_col0_maxwidth; /* ensure at least one space after widest col0 */ if (need_vars) iterate (&pf_vars, outer); if (do_align) iterate (&pf_align, outer); else if (do_cmp) iterate (&pf_cmp, outer); else if (do_debug) { iterate (&pf_clear, outer); iterate (&pf_expand, outer); iterate (&pf_debug, outer); } else if (do_lines_in_srcs) srcs_in_lines (); #if 0 else if (do_sf4) iterate (&pf_sf4, outer); #endif else if (do_tex) { iterate (&pf_clear, outer); iterate (&pf_expand, outer); iterate (&pf_clear, outer); iterate (&pf_tex, outer); } else if (do_xml) { iterate (&pf_clear, outer); iterate (&pf_expand, outer); iterate (&pf_clear, outer); iterate (&pf_mtx, outer); } gdlif_term(); if (history) return history; else if (!matrices_found) { warning (NULL, "no matrices found."); return EXIT_WARNING; } return 0; }
static void rebis_keyint_callback(ulong data) { //struct rebis_key_detection *gd = (struct rebis_key_detection *)data; //int state = gd->last_state; //int key_base[5] = {KEY_MATRIX_BASE5, KEY_MATRIX_BASE4, KEY_MATRIX_BASE3, KEY_MATRIX_BASE2, KEY_MATRIX_BASE1}; int i; gprintk("tasklet callback call\n"); //for key scan #if 0 cur_key = 0; s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP); for(i=4; i>=0; i--) { writel(readl(S3C2410_GPBDAT) | (0x1f), S3C2410_GPBDAT); writel(readl(S3C2410_GPBDAT) & (~(0x1 << i)), S3C2410_GPBDAT); cur_key = scan_input(); if(cur_key) //cur_key = scan_input(); { cur_key += (4-i);//key_base[i]; if(cur_key == old_key) goto SameValue; old_key = cur_key; printk("cur_key = %d \n\n", cur_key); //put_user(cur_key,(char *)buff); break; } } SameValue: old_key = 0; flag = 0; // set GPBDAT 0 s3c2410_gpio_setpin(S3C2410_GPB0, 0); s3c2410_gpio_setpin(S3C2410_GPB1, 0); s3c2410_gpio_setpin(S3C2410_GPB2, 0); s3c2410_gpio_setpin(S3C2410_GPB3, 0); s3c2410_gpio_setpin(S3C2410_GPB4, 0); // change External Interrupts s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3); #endif }
int main() { while (TRUE) { // print prompt and read into string array input. print_prompt(); char* input[64]; scan_input(input); int input_len = array_len(input); int option = 0; // if last parameter is an & then run child process in background. /*if (input_len != 0 && !strcmp(input[input_len], "&")) { option = 1; input[input_len] = NULL; }*/ /* pass to change_directory if input is a cd command. Else perform a fork and process input. */ if (input_len != 0 && !strcmp(input[0], "cd")) { change_directory(input); } else if (input_len != 0 && fork() != 0) { // code for parent process. int statloc; process_parent(&statloc, option); } else if (input_len != 0) { // code for forked child process. process_child(input); } } }
gchar *get_input_devices(void) { scan_input(FALSE); return input_list; }