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