Rev 1063 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1063 | tullio | 1 | |
2 | /* |
||
3 | * This program is free software; you can redistribute it and/or modify |
||
4 | * it under the terms of the GNU General Public License as published by |
||
5 | * the Free Software Foundation; either version 2 of the License, or |
||
6 | * (at your option) any later version. |
||
7 | * |
||
8 | * This program is distributed in the hope that it will be useful, |
||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
11 | * GNU General Public License for more details. |
||
12 | * |
||
13 | * You should have received a copy of the GNU General Public License |
||
14 | * along with this program; if not, write to the Free Software |
||
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
16 | * |
||
17 | */ |
||
18 | |||
1049 | mauro | 19 | #include <kernel/kern.h> |
20 | #include <drivers/shark_usbserial26.h> |
||
21 | |||
22 | extern int usb_serial_init(); |
||
23 | extern void usb_serial_exit(void); |
||
24 | |||
25 | extern int pl2303_init(); |
||
26 | extern void pl2303_exit(); |
||
27 | |||
28 | extern int serial_usbport_open(void *tty, int port_number); |
||
29 | extern int serial_usbport_write(void *tty, const unsigned char *buf, int count); |
||
30 | extern int serial_usbport_read(void *private, char* data_in); |
||
31 | |||
32 | int shark_usb_serial_init() |
||
33 | { |
||
34 | usb_serial_init(); |
||
35 | pl2303_init(); |
||
36 | |||
37 | return 0; |
||
38 | } |
||
39 | |||
40 | void shark_usb_serial_close() |
||
41 | { |
||
42 | usb_serial_exit(); |
||
43 | pl2303_exit(); |
||
44 | } |
||
45 | |||
46 | int shark_usbcom_open(struct shark_tty_usbcom *tty_usb, int port_number) |
||
47 | { |
||
48 | int retval; |
||
49 | tty_usb->port_number = port_number; |
||
50 | |||
51 | retval = serial_usbport_open(&tty_usb->tty, tty_usb->port_number); |
||
52 | |||
53 | return retval; |
||
54 | } |
||
55 | |||
56 | int shark_usbcom_write(struct shark_tty_usbcom *tty_usb, const unsigned char *buf, int count) |
||
57 | { |
||
58 | int retval; |
||
59 | |||
60 | retval = serial_usbport_write(tty_usb->tty, buf, count); |
||
61 | |||
62 | return retval; |
||
63 | } |
||
64 | |||
65 | char shark_usbcom_read(struct shark_tty_usbcom *tty_usb) |
||
66 | { |
||
67 | int retval; |
||
68 | char data_in; |
||
69 | |||
70 | while ((retval = serial_usbport_read(tty_usb->tty, &data_in)) == 0); |
||
71 | |||
72 | return data_in; |
||
73 | /* do the hard stuff*/ |
||
74 | } |