]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/stdio.c
stdio: Pass device pointer to stdio methods
[karo-tx-uboot.git] / common / stdio.c
index 39eef5aa2ebdf8ad864ddf921145ac1803a58510..dd402cc23d51b6ff336ee5435a3ed1e612dec080 100644 (file)
@@ -6,23 +6,7 @@
  * (C) Copyright 2000
  * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <config.h>
@@ -51,23 +35,43 @@ char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
 
 
 #ifdef CONFIG_SYS_DEVICE_NULLDEV
-void nulldev_putc(const char c)
+void nulldev_putc(struct stdio_dev *dev, const char c)
 {
        /* nulldev is empty! */
 }
 
-void nulldev_puts(const char *s)
+void nulldev_puts(struct stdio_dev *dev, const char *s)
 {
        /* nulldev is empty! */
 }
 
-int nulldev_input(void)
+int nulldev_input(struct stdio_dev *dev)
 {
        /* nulldev is empty! */
        return 0;
 }
 #endif
 
+void stdio_serial_putc(struct stdio_dev *dev, const char c)
+{
+       serial_putc(c);
+}
+
+void stdio_serial_puts(struct stdio_dev *dev, const char *s)
+{
+       serial_puts(s);
+}
+
+int stdio_serial_getc(struct stdio_dev *dev)
+{
+       return serial_getc();
+}
+
+int stdio_serial_tstc(struct stdio_dev *dev)
+{
+       return serial_tstc();
+}
+
 /**************************************************************************
  * SYSTEM DRIVERS
  **************************************************************************
@@ -81,10 +85,10 @@ static void drv_system_init (void)
 
        strcpy (dev.name, "serial");
        dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-       dev.putc = serial_putc;
-       dev.puts = serial_puts;
-       dev.getc = serial_getc;
-       dev.tstc = serial_tstc;
+       dev.putc = stdio_serial_putc;
+       dev.puts = stdio_serial_puts;
+       dev.getc = stdio_serial_getc;
+       dev.tstc = stdio_serial_tstc;
        stdio_register (&dev);
 
 #ifdef CONFIG_SYS_DEVICE_NULLDEV
@@ -212,9 +216,6 @@ int stdio_init (void)
        /* Initialize the list */
        INIT_LIST_HEAD(&(devs.list));
 
-#ifdef CONFIG_ARM_DCC
-       drv_arm_dcc_init ();
-#endif
 #ifdef CONFIG_SYS_I2C
        i2c_init_all();
 #else