Debian Codegraph @

lwip-contrib/ports/unix/include/netif/sio.h

raw symbols SCIP
1 #ifndef SIO_H
2 #define SIO_H
3
4 #include "lwip/sys.h"
5 #include "lwip/netif.h"
6 #include "netif/fifo.h"
7 /*#include "netif/pppif.h"*/
8 /* BAUDRATE is defined in sio.c as it is implementation specific */
9
10 typedef struct sio_status_t {
11 int fd;
12 fifo_t myfifo;
13 } sio_status_t;
14
15
16 /** Baudrates */
17 typedef enum sioBaudrates {
18 SIO_BAUD_9600,
19 SIO_BAUD_19200,
20 SIO_BAUD_38400,
21 SIO_BAUD_57600,
22 SIO_BAUD_115200
23 } sioBaudrates;
24
25 /**
26 * Read a char from incoming data stream, this call blocks until data has arrived
27 * @param siostat siostatus struct, contains sio instance data, given by sio_open
28 * @return char read from input stream
29 */
30 u8_t sio_recv( sio_status_t * siostat );
31
32 /**
33 * Poll for a new character from incoming data stream
34 * @param siostat siostatus struct, contains sio instance data, given by sio_open
35 * @return char read from input stream, or < 0 if no char was available
36 */
37 s16_t sio_poll(sio_status_t * siostat);
38
39 /**
40 * Parse incoming characters until a string str is recieved, blocking call
41 * @param str zero terminated string to expect
42 * @param siostat siostatus struct, contains sio instance data, given by sio_open
43 */
44 void sio_expect_string(u8_t *str, sio_status_t * siostat);
45
46 /**
47 * Write a char to output data stream
48 * @param c char to write to output stream
49 * @param siostat siostatus struct, contains sio instance data, given by sio_open
50 */
51 void sio_send( u8_t c, sio_status_t * siostat );
52
53 /**
54 * Write a char to output data stream
55 * @param str pointer to a zero terminated string
56 * @param siostat siostatus struct, contains sio instance data, given by sio_open
57 */
58 void sio_send_string(u8_t *str, sio_status_t * siostat);
59
60 /**
61 * Flush outbuffer (send everything in buffer now), useful if some layer below is
62 * holding on to data, waitng to fill a buffer
63 * @param siostat siostatus struct, contains sio instance data, given by sio_open
64 */
65 void sio_flush( sio_status_t * siostat );
66
67 /**
68 * Open serial port entry point from serial protocol (slipif, pppif)
69 * @param devnum the device number to use, i.e. ttySx, comx:, etc. there x = devnum
70 * @return siostatus struct, contains sio instance data, use when calling sio functions
71 */
72 sio_status_t * sio_open( int devnum );
73
74 /**
75 * Change baudrate of port, may close and reopen port
76 * @param baud new baudrate
77 * @param siostat siostatus struct, contains sio instance data, given by sio_open
78 */
79 void sio_change_baud( sioBaudrates baud, sio_status_t * siostat );
80
81 #endif
82