#define GB_UART_TYPE_SET_BREAK 0x06
#define GB_UART_TYPE_SERIAL_STATE 0x07 /* Unsolicited data */
+/* Represents data from AP -> Module */
struct gb_uart_send_data_request {
__le16 size;
__u8 data[0];
};
-struct gb_serial_line_coding {
+/* Represents data from Module -> AP */
+struct gb_uart_recv_data_request {
+ __le16 size;
+ __u8 data[0];
+};
+
+struct gb_uart_set_line_coding_request {
__le32 rate;
__u8 format;
-#define GB_SERIAL_1_STOP_BITS 0
-#define GB_SERIAL_1_5_STOP_BITS 1
-#define GB_SERIAL_2_STOP_BITS 2
+#define GB_SERIAL_1_STOP_BITS 0
+#define GB_SERIAL_1_5_STOP_BITS 1
+#define GB_SERIAL_2_STOP_BITS 2
__u8 parity;
-#define GB_SERIAL_NO_PARITY 0
-#define GB_SERIAL_ODD_PARITY 1
-#define GB_SERIAL_EVEN_PARITY 2
-#define GB_SERIAL_MARK_PARITY 3
-#define GB_SERIAL_SPACE_PARITY 4
-
- __u8 data;
-};
+#define GB_SERIAL_NO_PARITY 0
+#define GB_SERIAL_ODD_PARITY 1
+#define GB_SERIAL_EVEN_PARITY 2
+#define GB_SERIAL_MARK_PARITY 3
+#define GB_SERIAL_SPACE_PARITY 4
-struct gb_uart_set_line_coding_request {
- struct gb_serial_line_coding line_coding;
+ __u8 data_bits;
};
/* output control lines */
-#define GB_UART_CTRL_DTR 0x01
-#define GB_UART_CTRL_RTS 0x02
+#define GB_UART_CTRL_DTR 0x01
+#define GB_UART_CTRL_RTS 0x02
struct gb_uart_set_control_line_state_request {
__le16 control;
};
/* input control lines and line errors */
-#define GB_UART_CTRL_DCD 0x01
-#define GB_UART_CTRL_DSR 0x02
-#define GB_UART_CTRL_BRK 0x04
-#define GB_UART_CTRL_RI 0x08
-
-#define GB_UART_CTRL_FRAMING 0x10
-#define GB_UART_CTRL_PARITY 0x20
-#define GB_UART_CTRL_OVERRUN 0x40
+#define GB_UART_CTRL_DCD 0x01
+#define GB_UART_CTRL_DSR 0x02
+#define GB_UART_CTRL_BRK 0x04
+#define GB_UART_CTRL_RI 0x08
+
+#define GB_UART_CTRL_FRAMING 0x10
+#define GB_UART_CTRL_PARITY 0x20
+#define GB_UART_CTRL_OVERRUN 0x40
struct gb_uart_serial_state_request {
__u16 control;
#define GB_NUM_MINORS 255 /* 255 is enough for anyone... */
#define GB_NAME "ttyGB"
+struct gb_tty_line_coding {
+ __le32 rate;
+ __u8 format;
+ __u8 parity;
+ __u8 data_bits;
+};
+
struct gb_tty {
struct tty_port port;
struct gb_connection *connection;
u8 version_minor;
unsigned int ctrlin; /* input control lines */
unsigned int ctrlout; /* output control lines */
- struct gb_serial_line_coding line_coding;
+ struct gb_tty_line_coding line_coding;
};
-
static struct tty_driver *gb_tty_driver;
static DEFINE_IDR(tty_minors);
static DEFINE_MUTEX(table_lock);
{
struct gb_uart_set_line_coding_request request;
- memcpy(&request.line_coding, &tty->line_coding,
+ memcpy(&request, &tty->line_coding,
sizeof(tty->line_coding));
return gb_operation_sync(tty->connection, GB_UART_TYPE_SET_LINE_CODING,
&request, sizeof(request), NULL, 0);
{
struct gb_tty *gb_tty = tty->driver_data;
struct ktermios *termios = &tty->termios;
- struct gb_serial_line_coding newline;
+ struct gb_tty_line_coding newline;
int newctrl = gb_tty->ctrlout;
newline.rate = cpu_to_le32(tty_get_baud_rate(tty));
switch (termios->c_cflag & CSIZE) {
case CS5:
- newline.data = 5;
+ newline.data_bits = 5;
break;
case CS6:
- newline.data = 6;
+ newline.data_bits = 6;
break;
case CS7:
- newline.data = 7;
+ newline.data_bits = 7;
break;
case CS8:
default:
- newline.data = 8;
+ newline.data_bits = 8;
break;
}
gb_tty->line_coding.rate = cpu_to_le32(9600);
gb_tty->line_coding.format = GB_SERIAL_1_STOP_BITS;
gb_tty->line_coding.parity = GB_SERIAL_NO_PARITY;
- gb_tty->line_coding.data = 8;
+ gb_tty->line_coding.data_bits = 8;
send_line_coding(gb_tty);
tty_dev = tty_port_register_device(&gb_tty->port, gb_tty_driver, minor,