-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserial_api.h
More file actions
63 lines (51 loc) · 1.57 KB
/
serial_api.h
File metadata and controls
63 lines (51 loc) · 1.57 KB
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
61
62
#define PORT_PATH_MAX 64
typedef enum
{
SPORT_OK = 0,
SPORT_OPEN_ERROR = 0x100,
SPORT_GET_ERROR = 0x200,
SPORT_GET_PARM_ERROR = 0x201,
SPORT_SET_FAIL = 0x300,
SPORT_SET_BRT_ERROR = 0x301,
SPORT_SET_ICF_ERROR = 0x302,
SPORT_SET_FCT_ERROR = 0x303,
SPORT_READ_ERROR = 0x400,
SPORT_WRITE_ERROR = 0x500,
SPORT_CLOSE_ERROR = 0x600,
SPORT_MAP_ERROR = 0x700,
SPORT_MAP_FCT_ERROR = 0x701,
SPORT_MAP_ICF_ERROR = 0x702,
SPORT_UNKNOWN_ERROR = 0xFFFFFFFF,
}SportErrorCode_e;
typedef enum
{
ICF_8N1 = 0,
ICF_7E1,
ICF_7O1,
ICF_7S1,
ICF_UNKNOWN = 0xFFFFFFFF,
}SportIcf_e;
typedef enum
{
FCT_RTS_CTS = 0,
FCT_XON_XOFF,
FCT_NO,
FCT_UNKNOWN = 0xFFFFFFFF,
}SportFct_e;
typedef struct
{
int hd; /* device handle */
char portName[64];
unsigned int brt; /* baudrate */
SportIcf_e icf; /* char framing */
SportFct_e fct; /* flow control */
}SportObj_t;
SportErrorCode_e SPORT_Get_Opt(SportObj_t *portObj, int argc, char **argv);
SportErrorCode_e SPORT_Open_Port(SportObj_t *portObj);
SportErrorCode_e SPORT_Brt_Set(SportObj_t *portObj);
SportErrorCode_e SPORT_Icf_Set(SportObj_t *portObj);
SportErrorCode_e SPORT_Fct_Set(SportObj_t *portObj);
SportErrorCode_e SPORT_Close_Port(SportObj_t *portObj);
SportErrorCode_e SPORT_Get_Port_Atrribute(SportObj_t *portObj);
SportErrorCode_e SPORT_Write(SportObj_t *portObj, char *data);
SportErrorCode_e SPORT_Read(SportObj_t *portObj);