• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  *  MCAP for BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2010 GSyC/LibreSoft, Universidad Rey Juan Carlos.
6  *  Copyright (C) 2010 Signove
7  *
8  *  Authors:
9  *  Santiago Carot-Nemesio <sancane at gmail.com>
10  *  Jose Antonio Santos-Cadenas <santoscadenas at gmail.com>
11  *  Elvis Pfützenreuter <epx at signove.com>
12  *
13  *  This program is free software; you can redistribute it and/or modify
14  *  it under the terms of the GNU General Public License as published by
15  *  the Free Software Foundation; either version 2 of the License, or
16  *  (at your option) any later version.
17  *
18  *  This program is distributed in the hope that it will be useful,
19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  *  GNU General Public License for more details.
22  *
23  *  You should have received a copy of the GNU General Public License
24  *  along with this program; if not, write to the Free Software
25  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
26  *
27  */
28 
29 #ifndef __MCAP_H
30 #define __MCAP_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #define MCAP_VERSION	0x0100	/* current version 01.00 */
37 
38 /* bytes to get MCAP Supported Procedures */
39 #define MCAP_SUP_PROC	0x06
40 
41 /* maximum transmission unit for channels */
42 #define MCAP_CC_MTU	48
43 #define MCAP_DC_MTU	L2CAP_DEFAULT_MTU
44 
45 /* MCAP Standard Op Codes */
46 #define MCAP_ERROR_RSP			0x00
47 #define MCAP_MD_CREATE_MDL_REQ		0x01
48 #define MCAP_MD_CREATE_MDL_RSP		0x02
49 #define MCAP_MD_RECONNECT_MDL_REQ	0x03
50 #define MCAP_MD_RECONNECT_MDL_RSP	0x04
51 #define MCAP_MD_ABORT_MDL_REQ		0x05
52 #define MCAP_MD_ABORT_MDL_RSP		0x06
53 #define MCAP_MD_DELETE_MDL_REQ		0x07
54 #define MCAP_MD_DELETE_MDL_RSP		0x08
55 
56 /* MCAP Clock Sync Op Codes */
57 #define MCAP_MD_SYNC_CAP_REQ		0x11
58 #define MCAP_MD_SYNC_CAP_RSP		0x12
59 #define MCAP_MD_SYNC_SET_REQ		0x13
60 #define MCAP_MD_SYNC_SET_RSP		0x14
61 #define MCAP_MD_SYNC_INFO_IND		0x15
62 
63 /* MCAP Response codes */
64 #define MCAP_SUCCESS			0x00
65 #define MCAP_INVALID_OP_CODE		0x01
66 #define MCAP_INVALID_PARAM_VALUE	0x02
67 #define MCAP_INVALID_MDEP		0x03
68 #define MCAP_MDEP_BUSY			0x04
69 #define MCAP_INVALID_MDL		0x05
70 #define MCAP_MDL_BUSY			0x06
71 #define MCAP_INVALID_OPERATION		0x07
72 #define MCAP_RESOURCE_UNAVAILABLE	0x08
73 #define MCAP_UNSPECIFIED_ERROR		0x09
74 #define MCAP_REQUEST_NOT_SUPPORTED	0x0A
75 #define MCAP_CONFIGURATION_REJECTED	0x0B
76 
77 /* MDL IDs */
78 #define MCAP_MDLID_RESERVED		0x0000
79 #define MCAP_MDLID_INITIAL		0x0001
80 #define MCAP_MDLID_FINAL		0xFEFF
81 #define MCAP_ALL_MDLIDS			0xFFFF
82 
83 /* MDEP IDs */
84 #define MCAP_MDEPID_INITIAL		0x00
85 #define MCAP_MDEPID_FINAL		0x7F
86 
87 /* CSP special values */
88 #define MCAP_BTCLOCK_IMMEDIATE		0xffffffffUL
89 #define MCAP_TMSTAMP_DONTSET		0xffffffffffffffffULL
90 #define MCAP_BTCLOCK_MAX		0x0fffffff
91 #define MCAP_BTCLOCK_FIELD		(MCAP_BTCLOCK_MAX + 1)
92 
93 /*
94  * MCAP Request Packet Format
95  */
96 
97 typedef struct {
98 	uint8_t		op;
99 	uint16_t	mdl;
100 	uint8_t		mdep;
101 	uint8_t		conf;
102 } __attribute__ ((packed)) mcap_md_create_mdl_req;
103 
104 typedef struct {
105 	uint8_t		op;
106 	uint16_t	mdl;
107 } __attribute__ ((packed)) mcap_md_req;
108 
109 /*
110  * MCAP Response Packet Format
111  */
112 
113 typedef struct {
114 	uint8_t		op;
115 	uint8_t		rc;
116 	uint16_t	mdl;
117 	uint8_t		data[0];
118 } __attribute__ ((packed)) mcap_rsp;
119 
120 /*
121  * MCAP Clock Synchronization Protocol
122  */
123 
124 typedef struct {
125 	uint8_t		op;
126 	uint16_t	timest;
127 } __attribute__ ((packed)) mcap_md_sync_cap_req;
128 
129 typedef struct {
130 	uint8_t		op;
131 	uint8_t		rc;
132 } __attribute__ ((packed)) mcap_md_sync_rsp;
133 
134 typedef struct {
135         uint8_t         op;
136 	uint8_t         rc;
137 	uint8_t         btclock;
138         uint16_t        sltime;
139 	uint16_t        timestnr;
140 	uint16_t        timestna;
141 } __attribute__ ((packed)) mcap_md_sync_cap_rsp;
142 
143 typedef struct {
144 	uint8_t		op;
145 	uint8_t		timestui;
146 	uint32_t	btclock;
147 	uint64_t	timestst;
148 } __attribute__ ((packed)) mcap_md_sync_set_req;
149 
150 typedef struct {
151 	int8_t		op;
152 	uint8_t		rc;
153 	uint32_t	btclock;
154 	uint64_t	timestst;
155 	uint16_t	timestsa;
156 } __attribute__ ((packed)) mcap_md_sync_set_rsp;
157 
158 typedef struct {
159 	uint8_t		op;
160 	uint32_t	btclock;
161 	uint64_t	timestst;
162 	uint16_t	timestsa;
163 } __attribute__ ((packed)) mcap_md_sync_info_ind;
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* __MCAP_H */
170