#include "lwip/arch.h"
#include "lwip/arch.h"
#include "lwip/opt.h"
#include "lwip/opt.h"
#define SIO_H
sio_fd_t sio_open(u8_t devnum);
/** * Opens a serial device for communication. * * @param devnum device number * @return handle to serial device if successful, NULL otherwise */
void sio_send(u8_t c, sio_fd_t fd);
/** * Sends a single character to the serial device. * * @param c character to send * @param fd serial device handle * * @note This function will block until the character can be sent. */
u8_t sio_recv(sio_fd_t fd);
/** * Receives a single character from the serial device. * * @param fd serial device handle * * @note This function will block until a character is received. */
u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len);
/** * Reads from the serial device. * * @param fd serial device handle * @param data pointer to data buffer for receiving * @param len maximum length (in bytes) of data to receive * @return number of bytes actually received - may be 0 if aborted by sio_read_abort * * @note This function will block until data can be received. The blocking * can be cancelled by calling sio_read_abort(). */
u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len);
/** * Tries to read from the serial device. Same as sio_read but returns * immediately if no data is available and never blocks. * * @param fd serial device handle * @param data pointer to data buffer for receiving * @param len maximum length (in bytes) of data to receive * @return number of bytes actually received */
u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len);
/** * Writes to the serial device. * * @param fd serial device handle * @param data pointer to data to send * @param len length (in bytes) of data to send * @return number of bytes actually sent * * @note This function will block until all data can be sent. */
void sio_read_abort(sio_fd_t fd);
/** * Aborts a blocking sio_read() call. * * @param fd serial device handle */
typedef void * sio_fd_t;