-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathlibmctp-serial.h
42 lines (31 loc) · 1.12 KB
/
libmctp-serial.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
/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
#ifndef _LIBMCTP_SERIAL_H
#define _LIBMCTP_SERIAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libmctp.h>
struct mctp_binding_serial;
struct mctp_binding_serial *mctp_serial_init(void);
void mctp_serial_destroy(struct mctp_binding_serial *serial);
struct mctp_binding *mctp_binding_serial_core(struct mctp_binding_serial *b);
/* file-based IO */
struct pollfd;
int mctp_serial_init_pollfd(struct mctp_binding_serial *serial,
struct pollfd *pollfd);
int mctp_serial_read(struct mctp_binding_serial *serial);
int mctp_serial_open_path(struct mctp_binding_serial *serial, const char *path);
void mctp_serial_open_fd(struct mctp_binding_serial *serial, int fd);
/* direct function call IO */
typedef int
__attribute__((warn_unused_result)) (*mctp_serial_tx_fn)(void *data,
void *buf,
size_t len);
void mctp_serial_set_tx_fn(struct mctp_binding_serial *serial,
mctp_serial_tx_fn fn, void *data);
int mctp_serial_rx(struct mctp_binding_serial *serial, const void *buf,
size_t len);
#ifdef __cplusplus
}
#endif
#endif /* _LIBMCTP_SERIAL_H */