making if fail if there is no libusb-devel
[webos-internals:precomd.git] / src / pmux.h
1 /*
2  * pmux.h
3  *
4  *  Created on: Jun 24, 2009
5  *      Author: mike.gaffney
6  */
7
8 #ifndef PMUX_H_
9 #define PMUX_H_
10
11 #define uint32 unsigned int
12 #define uint16 short
13
14 #include "novacom.h"
15
16 #define PMUX_HEADER_VERSION         1
17
18 #define PMUX_HEADER_TYPE_DATA       0
19 #define PMUX_HEADER_TYPE_ERR        1
20 #define PMUX_HEADER_TYPE_OOB        2
21
22 #define PMUX_OOB_EOF                0
23 #define PMUX_OOB_SIGNAL             1
24 #define PMUX_OOB_RETURN             2
25 #define PMUX_OOB_RESIZE             3
26
27 #define PMUX_FILENO_STDIN           0
28 #define PMUX_FILENO_STDOUT          1
29 #define PMUX_FILENO_STDERR          2
30
31 typedef struct {
32     uint32 type ;
33     uint32 payload ;
34     uint32 zero[3]
35 } pmux_oob_t ;
36
37 // Structure to open the tty
38 typedef struct {
39     uint32 three ;
40     uint32 ten ;
41     uint32 dee ;
42 } pmux_channel_open_t ;
43
44 typedef struct {
45     char request[0] ;
46 } pmux_cmd_request_t ;
47
48 typedef struct {
49     char reply[0] ;
50 } pmux_cmd_reply_t ;
51
52 // Structure for the tty
53 typedef struct {
54     uint32 magic ;
55     uint32 version ;
56     uint32 length ;
57     uint32 type ;
58     char payload[0] ;
59 } pmux_data_payload_t ;
60
61 typedef struct {
62     uint32 magic ;
63     char mode ;
64     char direction ;
65     uint16 ack_synx ;
66     uint16 status ;
67     uint32 sequence_num ;
68     uint32 length_payload ;
69     uint32 length_pmux_packet ;
70     uint32 zero ;
71     char payload[0] ;
72 } pmux_packet_t ;
73
74 int pmux_packet_process( novacom_device_t *);
75 int pmux_file_put( novacom_device_t *);
76 int pmux_file_get( novacom_device_t *);
77
78 int pmux_terminal_open( novacom_device_t *);
79 int pmux_terminal_close( novacom_device_t *);
80 int pmux_terminal_send( novacom_device_t *, char *);
81 int pmux_terminal_receive( novacom_device_t *, char *);
82
83 int pmux_program_run( novacom_device_t *, uint32 , char **);
84
85 int pmux_mem_put( novacom_device_t *, uint32 , uint32);
86 int pmux_mem_boot( novacom_device_t *, uint32);
87
88 #endif /* PMUX_H_ */