1 #ifndef SIO_UNIX_H 2 #define SIO_UNIX_H 3 4 #include "lwip/sys.h" 5 #include "lwip/netif.h" 6 #include "netif/fifo.h" 7 /*#include "netif/pppif.h"*/ 8 9 struct sio_status_s { 10 int fd; 11 fifo_t myfifo; 12 }; 13 14 /* BAUDRATE is defined in sio.c as it is implementation specific */ 15 /** Baudrates */ 16 typedef enum sioBaudrates { 17 SIO_BAUD_9600, 18 SIO_BAUD_19200, 19 SIO_BAUD_38400, 20 SIO_BAUD_57600, 21 SIO_BAUD_115200 22 } sioBaudrates; 23 24 /** 25 * Poll for a new character from incoming data stream 26 * @param siostat siostatus struct, contains sio instance data, given by sio_open 27 * @return char read from input stream, or < 0 if no char was available 28 */ 29 s16_t sio_poll(sio_status_t * siostat); 30 31 /** 32 * Parse incoming characters until a string str is received, blocking call 33 * @param str zero terminated string to expect 34 * @param siostat siostatus struct, contains sio instance data, given by sio_open 35 */ 36 void sio_expect_string(u8_t *str, sio_status_t * siostat); 37 38 /** 39 * Write a char to output data stream 40 * @param str pointer to a zero terminated string 41 * @param siostat siostatus struct, contains sio instance data, given by sio_open 42 */ 43 void sio_send_string(u8_t *str, sio_status_t * siostat); 44 45 /** 46 * Flush outbuffer (send everything in buffer now), useful if some layer below is 47 * holding on to data, waitng to fill a buffer 48 * @param siostat siostatus struct, contains sio instance data, given by sio_open 49 */ 50 void sio_flush( sio_status_t * siostat ); 51 52 /** 53 * Change baudrate of port, may close and reopen port 54 * @param baud new baudrate 55 * @param siostat siostatus struct, contains sio instance data, given by sio_open 56 */ 57 void sio_change_baud( sioBaudrates baud, sio_status_t * siostat ); 58 59 #endif 60 61