cp210x.c (79828b4fa835f73cdaf4bffa48696abdcbea9d02) | cp210x.c (ebfb319bb601e501f77809a83b0b69b529c22a8d) |
---|---|
1/* 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver 3 * 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. --- 287 unchanged lines hidden (view full) --- 296#define CONTROL_CTS 0x0010 297#define CONTROL_DSR 0x0020 298#define CONTROL_RING 0x0040 299#define CONTROL_DCD 0x0080 300#define CONTROL_WRITE_DTR 0x0100 301#define CONTROL_WRITE_RTS 0x0200 302 303/* | 1/* 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver 3 * 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. --- 287 unchanged lines hidden (view full) --- 296#define CONTROL_CTS 0x0010 297#define CONTROL_DSR 0x0020 298#define CONTROL_RING 0x0040 299#define CONTROL_DCD 0x0080 300#define CONTROL_WRITE_DTR 0x0100 301#define CONTROL_WRITE_RTS 0x0200 302 303/* |
304 * CP210X_PURGE - 16 bits passed in wValue of USB request. 305 * SiLabs app note AN571 gives a strange description of the 4 bits: 306 * bit 0 or bit 2 clears the transmit queue and 1 or 3 receive. 307 * writing 1 to all, however, purges cp2108 well enough to avoid the hang. 308 */ 309#define PURGE_ALL 0x000f 310 311/* |
|
304 * cp210x_get_config 305 * Reads from the CP210x configuration registers 306 * 'size' is specified in bytes. 307 * 'data' is a pointer to a pre-allocated array of integers large 308 * enough to hold 'size' bytes (with 4 bytes to each integer) 309 */ 310static int cp210x_get_config(struct usb_serial_port *port, u8 request, 311 unsigned int *data, int size) --- 158 unchanged lines hidden (view full) --- 470 if (tty) 471 cp210x_change_speed(tty, port, NULL); 472 473 return usb_serial_generic_open(tty, port); 474} 475 476static void cp210x_close(struct usb_serial_port *port) 477{ | 312 * cp210x_get_config 313 * Reads from the CP210x configuration registers 314 * 'size' is specified in bytes. 315 * 'data' is a pointer to a pre-allocated array of integers large 316 * enough to hold 'size' bytes (with 4 bytes to each integer) 317 */ 318static int cp210x_get_config(struct usb_serial_port *port, u8 request, 319 unsigned int *data, int size) --- 158 unchanged lines hidden (view full) --- 478 if (tty) 479 cp210x_change_speed(tty, port, NULL); 480 481 return usb_serial_generic_open(tty, port); 482} 483 484static void cp210x_close(struct usb_serial_port *port) 485{ |
486 unsigned int purge_ctl; 487 |
|
478 usb_serial_generic_close(port); | 488 usb_serial_generic_close(port); |
489 490 /* Clear both queues; cp2108 needs this to avoid an occasional hang */ 491 purge_ctl = PURGE_ALL; 492 cp210x_set_config(port, CP210X_PURGE, &purge_ctl, 2); 493 |
|
479 cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_DISABLE); 480} 481 482/* 483 * cp210x_get_termios 484 * Reads the baud rate, data bits, parity, stop bits and flow control mode 485 * from the device, corrects any unsupported values, and configures the 486 * termios structure to reflect the state of the device --- 408 unchanged lines hidden --- | 494 cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_DISABLE); 495} 496 497/* 498 * cp210x_get_termios 499 * Reads the baud rate, data bits, parity, stop bits and flow control mode 500 * from the device, corrects any unsupported values, and configures the 501 * termios structure to reflect the state of the device --- 408 unchanged lines hidden --- |