Root/target/linux/generic-2.6/image/lzma-loader/src/printf.c

1/*
2 * Copyright (C) 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 */
11
12#include "printf.h"
13#include "print.h"
14#include "uart16550.h"
15
16static void myoutput(void *arg, char *s, int l)
17{
18    int i;
19
20    // special termination call
21    if ((l==1) && (s[0] == '\0')) return;
22    
23    for (i=0; i< l; i++) {
24    Uart16550Put(s[i]);
25    if (s[i] == '\n') Uart16550Put('\r');
26    }
27}
28
29void printf(char *fmt, ...)
30{
31    va_list ap;
32    va_start(ap, fmt);
33    lp_Print(myoutput, 0, fmt, ap);
34    va_end(ap);
35}
36

Archive Download this file



interactive