-
Notifications
You must be signed in to change notification settings - Fork 1
/
driver.h
71 lines (61 loc) · 2.03 KB
/
driver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* libusbserial
*
* Copyright (C) 2019 Anton Prozorov <[email protected]>
* Copyright (c) 2014-2015 Felix Hädicke
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef LIBUSBSERIAL_DRIVER_H
#define LIBUSBSERIAL_DRIVER_H
#include "libusbserial.h"
struct usbserial_driver
{
int (*check_supported_by_vid_pid)(uint16_t vid, uint16_t pid);
int (*check_supported_by_class)(
uint8_t class,
uint8_t subclass);
const char* (*get_device_name)(
uint16_t vid,
uint16_t pid,
uint8_t classs,
uint8_t subclass);
unsigned int (*get_ports_count)(uint16_t vid, uint16_t pid);
int (*port_init)(struct usbserial_port *port);
int (*port_deinit)(struct usbserial_port *port);
int (*port_set_config)(
struct usbserial_port *port,
const struct usbserial_config* config);
int (*start_reader)(struct usbserial_port *port);
int (*stop_reader)(struct usbserial_port *port);
int (*read)(
struct usbserial_port *port,
void *data,
size_t size,
int timeout);
int (*write)(
struct usbserial_port *port,
const void *data,
size_t size);
int (*purge)(
struct usbserial_port *port,
int rx,
int tx);
void (*read_data_process)(
struct usbserial_port *port,
void *data,
size_t *size);
int (*set_dtr_rts)(
struct usbserial_port *port,
int dtr,
int rts);
};
#endif // LIBUSBSERIAL_DRIVER_H