CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/hcitools/lib/amp.h
Views: 3959
1
/*
2
*
3
* BlueZ - Bluetooth protocol stack for Linux
4
*
5
* Copyright (C) 2010-2011 Code Aurora Forum. All rights reserved.
6
* Copyright (C) 2012 Intel Corporation.
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License version 2 and
10
* only version 2 as published by the Free Software Foundation.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
*/
18
19
#ifndef __AMP_H
20
#define __AMP_H
21
22
#ifdef __cplusplus
23
extern "C" {
24
#endif
25
26
#define AMP_MGR_CID 0x03
27
28
/* AMP manager codes */
29
#define AMP_COMMAND_REJ 0x01
30
#define AMP_DISCOVER_REQ 0x02
31
#define AMP_DISCOVER_RSP 0x03
32
#define AMP_CHANGE_NOTIFY 0x04
33
#define AMP_CHANGE_RSP 0x05
34
#define AMP_INFO_REQ 0x06
35
#define AMP_INFO_RSP 0x07
36
#define AMP_ASSOC_REQ 0x08
37
#define AMP_ASSOC_RSP 0x09
38
#define AMP_LINK_REQ 0x0a
39
#define AMP_LINK_RSP 0x0b
40
#define AMP_DISCONN_REQ 0x0c
41
#define AMP_DISCONN_RSP 0x0d
42
43
typedef struct {
44
uint8_t code;
45
uint8_t ident;
46
uint16_t len;
47
} __attribute__ ((packed)) amp_mgr_hdr;
48
#define AMP_MGR_HDR_SIZE 4
49
50
/* AMP ASSOC structure */
51
typedef struct {
52
uint8_t type_id;
53
uint16_t len;
54
uint8_t data[0];
55
} __attribute__ ((packed)) amp_assoc_tlv;
56
57
typedef struct {
58
uint16_t reason;
59
} __attribute__ ((packed)) amp_cmd_rej_parms;
60
61
typedef struct {
62
uint16_t mtu;
63
uint16_t mask;
64
} __attribute__ ((packed)) amp_discover_req_parms;
65
66
typedef struct {
67
uint16_t mtu;
68
uint16_t mask;
69
uint8_t controller_list[0];
70
} __attribute__ ((packed)) amp_discover_rsp_parms;
71
72
typedef struct {
73
uint8_t id;
74
} __attribute__ ((packed)) amp_info_req_parms;
75
76
typedef struct {
77
uint8_t id;
78
uint8_t status;
79
uint32_t total_bandwidth;
80
uint32_t max_bandwidth;
81
uint32_t min_latency;
82
uint16_t pal_caps;
83
uint16_t assoc_size;
84
} __attribute__ ((packed)) amp_info_rsp_parms;
85
86
typedef struct {
87
uint8_t id;
88
uint8_t status;
89
amp_assoc_tlv assoc;
90
} __attribute__ ((packed)) amp_assoc_rsp_parms;
91
92
typedef struct {
93
uint8_t local_id;
94
uint8_t remote_id;
95
amp_assoc_tlv assoc;
96
} __attribute__ ((packed)) amp_link_req_parms;
97
98
typedef struct {
99
uint8_t local_id;
100
uint8_t remote_id;
101
uint8_t status;
102
} __attribute__ ((packed)) amp_link_rsp_parms;
103
104
typedef struct {
105
uint8_t local_id;
106
uint8_t remote_id;
107
} __attribute__ ((packed)) amp_disconn_req_parms;
108
109
#define A2MP_MAC_ADDR_TYPE 1
110
#define A2MP_PREF_CHANLIST_TYPE 2
111
#define A2MP_CONNECTED_CHAN 3
112
#define A2MP_PAL_CAP_TYPE 4
113
#define A2MP_PAL_VER_INFO 5
114
115
struct amp_tlv {
116
uint8_t type;
117
uint16_t len;
118
uint8_t val[0];
119
} __attribute__ ((packed));
120
121
struct amp_pal_ver {
122
uint8_t ver;
123
uint16_t company_id;
124
uint16_t sub_ver;
125
} __attribute__ ((packed));
126
127
struct amp_country_triplet {
128
union {
129
struct {
130
uint8_t first_channel;
131
uint8_t num_channels;
132
int8_t max_power;
133
} __attribute__ ((packed)) chans;
134
struct {
135
uint8_t reg_extension_id;
136
uint8_t reg_class;
137
uint8_t coverage_class;
138
} __attribute__ ((packed)) ext;
139
};
140
} __attribute__ ((packed));
141
142
struct amp_chan_list {
143
uint8_t country_code[3];
144
struct amp_country_triplet triplets[0];
145
} __attribute__ ((packed));
146
147
#define AMP_COMMAND_NOT_RECOGNIZED 0x0000
148
149
/* AMP controller status */
150
#define AMP_CT_POWERED_DOWN 0x00
151
#define AMP_CT_BLUETOOTH_ONLY 0x01
152
#define AMP_CT_NO_CAPACITY 0x02
153
#define AMP_CT_LOW_CAPACITY 0x03
154
#define AMP_CT_MEDIUM_CAPACITY 0x04
155
#define AMP_CT_HIGH_CAPACITY 0x05
156
#define AMP_CT_FULL_CAPACITY 0x06
157
158
/* AMP response status */
159
#define AMP_STATUS_SUCCESS 0x00
160
#define AMP_STATUS_INVALID_CTRL_ID 0x01
161
#define AMP_STATUS_UNABLE_START_LINK_CREATION 0x02
162
#define AMP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
163
#define AMP_STATUS_COLLISION_OCCURED 0x03
164
#define AMP_STATUS_DISCONN_REQ_RECVD 0x04
165
#define AMP_STATUS_PHYS_LINK_EXISTS 0x05
166
#define AMP_STATUS_SECURITY_VIOLATION 0x06
167
168
#ifdef __cplusplus
169
}
170
#endif
171
172
#endif /* __AMP_H */
173
174