void puts(const char *s) { #ifdef CONFIG_SANDBOX if (!gd) { os_puts(s); return; } #endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) return; #endif #ifdef CONFIG_DISABLE_CONSOLE if (gd->flags & GD_FLG_DISABLE_CONSOLE) return; #endif #ifdef CONFIG_MV_LOG_BASE /* save the bootloader log to mmplog buffer which shared with kernel */ mmp_log_buf_write(s); #endif if (!gd->have_console) return pre_console_puts(s); if (gd->flags & GD_FLG_DEVINIT) { /* Send to the standard output */ fputs(stdout, s); } else { /* Send directly to the handler */ serial_puts(s); } }
void puts(const char *s) { #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) return; #endif #ifdef CONFIG_DISABLE_CONSOLE if (gd->flags & GD_FLG_DISABLE_CONSOLE) return; #endif if (!gd->have_console) return pre_console_puts(s); if (gd->flags & GD_FLG_DEVINIT) { /* Send to the standard output */ #ifdef CONFIG_LCD serial_puts(s); #endif fputs(stdout, s); } else { /* Send directly to the handler */ serial_puts(s); } }
/* * 这个函数很重要 */ void puts(const char *s) { #ifdef CONFIG_SANDBOX if (!gd) { os_puts(s); return; } #endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) return; #endif #ifdef CONFIG_DISABLE_CONSOLE if (gd->flags & GD_FLG_DISABLE_CONSOLE) return; #endif /* 如果终端初始化不ok的话,调用pre_console_puts */ if (!gd->have_console) return pre_console_puts(s); /* 如果标准输入输出初始化ok,则调用fputs,否则使用serial_puts, 一般情况下, fputs也是使用的串口*/ if (gd->flags & GD_FLG_DEVINIT) { /* Send to the standard output */ fputs(stdout, s); } else { /* Send directly to the handler */ serial_puts(s); } }
void puts(const char *s) { #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) return; #endif #ifdef CONFIG_DISABLE_CONSOLE if (gd->flags & GD_FLG_DISABLE_CONSOLE) return; #endif if (!gd->have_console) #ifdef CONFIG_SPL_SEMIHOSTING_SUPPORT ; /* printf can be done with semihosting */ #else return pre_console_puts(s); #endif if (gd->flags & GD_FLG_DEVINIT) { /* Send to the standard output */ fputs(stdout, s); } else { /* Send directly to the handler */ if (gd->have_console) #if !defined(CONFIG_SPL_BUILD) | defined(CONFIG_SPL_SERIAL_SUPPORT) serial_puts(s); #else ; /* no printout */ #endif #ifdef CONFIG_SPL_SEMIHOSTING_SUPPORT semihosting_write(s); #endif } }