00001
00044 #ifndef CONSOLE_SERIAL_H_INCLUDED
00045 #define CONSOLE_SERIAL_H_INCLUDED
00046
00047 #include <status-codes.h>
00048 #include <chip/usart.h>
00049
00056 extern void __serial_console_bad_constant_port(unsigned int port);
00057
00058 extern int __serial_console_init(struct console *con, unsigned int port,
00059 void *regs, unsigned long baud_rate, unsigned long flags);
00060
00061 #define SERIAL_ENABLE_TX (1 << 0)
00062 #define SERIAL_ENABLE_RX (1 << 1)
00063
00064
00078 static inline int serial_console_init(struct console *con, unsigned int port,
00079 unsigned long baud_rate, unsigned long flags)
00080 {
00081 void *regs;
00082 int ret;
00083
00084 regs = get_usart_regs(port);
00085 if (!regs) {
00086 if (is_constant(port))
00087 __serial_console_bad_constant_port(port);
00088 return -STATUS_INVALID_PARAM;
00089 }
00090
00091 ret = __serial_console_init(con, port, regs, baud_rate, flags);
00092 if (ret)
00093 return ret;
00094
00095 return 0;
00096 }
00097
00098 #endif