File: sio.h

package info (click to toggle)
lwip 2.1.2%2Bdfsg1-8%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,416 kB
  • sloc: ansic: 89,600; perl: 81; sh: 28; makefile: 18
file content (60 lines) | stat: -rw-r--r-- 1,671 bytes parent folder | download | duplicates (2)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef SIO_UNIX_H
#define SIO_UNIX_H

#include "lwip/sys.h"
#include "lwip/netif.h"
#include "netif/fifo.h"
/*#include "netif/pppif.h"*/

struct sio_status_s {
	int fd;
	fifo_t myfifo;
};

/* BAUDRATE is defined in sio.c as it is implementation specific */
/** Baudrates */
typedef enum sioBaudrates {
	SIO_BAUD_9600,
	SIO_BAUD_19200,
	SIO_BAUD_38400,
	SIO_BAUD_57600,	
	SIO_BAUD_115200	
} sioBaudrates;

/**
* Poll for a new character from incoming data stream
* @param 	siostat siostatus struct, contains sio instance data, given by sio_open
* @return 	char read from input stream, or < 0 if no char was available
*/
s16_t sio_poll(sio_status_t * siostat);

/**
*	Parse incoming characters until a string str is recieved, blocking call
* @param	str		zero terminated string to expect
* @param 	siostat siostatus struct, contains sio instance data, given by sio_open
*/
void sio_expect_string(u8_t *str, sio_status_t * siostat);

/**
* Write a char to output data stream
* @param 	str		pointer to a zero terminated string
* @param	siostat siostatus struct, contains sio instance data, given by sio_open
*/
void sio_send_string(u8_t *str, sio_status_t * siostat);

/**
*	Flush outbuffer (send everything in buffer now), useful if some layer below is 
*	holding on to data, waitng to fill a buffer
* @param 	siostat siostatus struct, contains sio instance data, given by sio_open
*/
void sio_flush( sio_status_t * siostat );

/**
*	Change baudrate of port, may close and reopen port
* @param 	baud	new baudrate
* @param 	siostat siostatus struct, contains sio instance data, given by sio_open
*/
void sio_change_baud( sioBaudrates baud, sio_status_t * siostat );

#endif