uboot serial console分析
console初始化:
stdio_init ();
->serial_stdio_init ();
->stdio_register (&dev);
->_dev = stdio_clone(dev);
->list_add_tail(&(_dev->list), &(devs.list));
console_init_r ();
->struct list_head *list = stdio_get_list();
->
list_for_each(pos, list) {
dev = list_entry(pos, struct stdio_dev, list);
if ((dev->flags & DEV_FLAGS_INPUT) && (inputdev == NULL)) {
inputdev = dev;
}
if ((dev->flags & DEV_FLAGS_OUTPUT) && (outputdev == NULL)) {
outputdev = dev;
}
if(inputdev && outputdev)
break;
}
->console_setfile(stdout, outputdev);
->error = dev->start();
->stdio_devices[file] = dev;
->console_setfile(stderr, outputdev);
->error = dev->start();
->stdio_devices[file] = dev;
->console_setfile(stdin, inputdev);
->error = dev->start();
->stdio_devices[file] = dev;
字符读取与回显
readline (CONFIG_SYS_PROMPT);
->readline_into_buffer(prompt, console_buffer);
->puts (prompt);
->fputs(stdout, s);
->console_puts(file, s);
->stdio_devices[file]->puts(s);
->c = getc();
->fgetc(stdin);
->console_getc(file);
->stdio_devices[file]->tstc();
阅读(2396) | 评论(0) | 转发(1) |