serial.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef __SERIAL_H__
  2. #define __SERIAL_H__
  3. #include <post.h>
  4. struct serial_device {
  5. /* enough bytes to match alignment of following func pointer */
  6. char name[16];
  7. int (*start)(void);
  8. int (*stop)(void);
  9. void (*setbrg)(void);
  10. int (*getc)(void);
  11. int (*tstc)(void);
  12. void (*putc)(const char c);
  13. void (*puts)(const char *s);
  14. #if CONFIG_POST & CONFIG_SYS_POST_UART
  15. void (*loop)(int);
  16. #endif
  17. struct serial_device *next;
  18. };
  19. void default_serial_puts(const char *s);
  20. extern struct serial_device serial_smc_device;
  21. extern struct serial_device serial_scc_device;
  22. extern struct serial_device *default_serial_console(void);
  23. #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
  24. defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
  25. defined(CONFIG_405EX) || defined(CONFIG_440) || \
  26. defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) || \
  27. defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
  28. defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) || \
  29. defined(CONFIG_TEGRA) || defined(CONFIG_SYS_COREBOOT) || \
  30. defined(CONFIG_MICROBLAZE)
  31. extern struct serial_device serial0_device;
  32. extern struct serial_device serial1_device;
  33. #endif
  34. extern struct serial_device eserial1_device;
  35. extern struct serial_device eserial2_device;
  36. extern void serial_register(struct serial_device *);
  37. extern void serial_initialize(void);
  38. extern void serial_stdio_init(void);
  39. extern int serial_assign(const char *name);
  40. extern void serial_reinit_all(void);
  41. /* For usbtty */
  42. #ifdef CONFIG_USB_TTY
  43. extern int usbtty_getc(void);
  44. extern void usbtty_putc(const char c);
  45. extern void usbtty_puts(const char *str);
  46. extern int usbtty_tstc(void);
  47. #else
  48. /* stubs */
  49. #define usbtty_getc() 0
  50. #define usbtty_putc(a)
  51. #define usbtty_puts(a)
  52. #define usbtty_tstc() 0
  53. #endif /* CONFIG_USB_TTY */
  54. #if defined(CONFIG_MPC512X)
  55. extern struct stdio_dev *open_port(int num, int baudrate);
  56. extern int close_port(int num);
  57. extern int write_port(struct stdio_dev *port, char *buf);
  58. extern int read_port(struct stdio_dev *port, char *buf, int size);
  59. #endif
  60. #endif