Subversion Repositories shark

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1049 mauro 1
#include <kernel/kern.h>
2
#include <drivers/shark_usbserial26.h>
3
 
4
extern int usb_serial_init();
5
extern void usb_serial_exit(void);
6
 
7
extern int pl2303_init();
8
extern void pl2303_exit();
9
 
10
extern int serial_usbport_open(void *tty, int port_number);
11
extern int serial_usbport_write(void *tty, const unsigned char *buf, int count);
12
extern int serial_usbport_read(void *private, char* data_in);
13
 
14
int shark_usb_serial_init()
15
{
16
        usb_serial_init();
17
        pl2303_init();
18
 
19
        return 0;
20
}
21
 
22
void shark_usb_serial_close()
23
{
24
        usb_serial_exit();
25
        pl2303_exit();
26
}
27
 
28
int shark_usbcom_open(struct shark_tty_usbcom *tty_usb, int port_number)
29
{
30
        int retval;
31
        tty_usb->port_number = port_number;
32
 
33
        retval = serial_usbport_open(&tty_usb->tty, tty_usb->port_number);
34
 
35
        return retval;
36
}
37
 
38
int shark_usbcom_write(struct shark_tty_usbcom *tty_usb, const unsigned char *buf, int count)
39
{
40
        int retval;
41
 
42
        retval = serial_usbport_write(tty_usb->tty, buf, count);
43
 
44
        return retval;
45
}
46
 
47
char shark_usbcom_read(struct shark_tty_usbcom *tty_usb)
48
{
49
        int retval;
50
        char data_in;
51
 
52
        while ((retval = serial_usbport_read(tty_usb->tty, &data_in)) == 0);
53
 
54
        return data_in;
55
        /* do the hard stuff*/
56
}