天嵌二次封装库使用手册  V1.0
amp.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *
4  * BlueZ - Bluetooth protocol stack for Linux
5  *
6  * Copyright (C) 2010-2011 Code Aurora Forum. All rights reserved.
7  * Copyright (C) 2012 Intel Corporation.
8  *
9  */
10 
11 #ifndef __AMP_H
12 #define __AMP_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #define AMP_MGR_CID 0x03
19 
20 /* AMP manager codes */
21 #define AMP_COMMAND_REJ 0x01
22 #define AMP_DISCOVER_REQ 0x02
23 #define AMP_DISCOVER_RSP 0x03
24 #define AMP_CHANGE_NOTIFY 0x04
25 #define AMP_CHANGE_RSP 0x05
26 #define AMP_INFO_REQ 0x06
27 #define AMP_INFO_RSP 0x07
28 #define AMP_ASSOC_REQ 0x08
29 #define AMP_ASSOC_RSP 0x09
30 #define AMP_LINK_REQ 0x0a
31 #define AMP_LINK_RSP 0x0b
32 #define AMP_DISCONN_REQ 0x0c
33 #define AMP_DISCONN_RSP 0x0d
34 
35 typedef struct {
36  uint8_t code;
37  uint8_t ident;
38  uint16_t len;
39 } __attribute__ ((packed)) amp_mgr_hdr;
40 #define AMP_MGR_HDR_SIZE 4
41 
42 /* AMP ASSOC structure */
43 typedef struct {
44  uint8_t type_id;
45  uint16_t len;
46  uint8_t data[0];
47 } __attribute__ ((packed)) amp_assoc_tlv;
48 
49 typedef struct {
50  uint16_t reason;
51 } __attribute__ ((packed)) amp_cmd_rej_parms;
52 
53 typedef struct {
54  uint16_t mtu;
55  uint16_t mask;
56 } __attribute__ ((packed)) amp_discover_req_parms;
57 
58 typedef struct {
59  uint16_t mtu;
60  uint16_t mask;
61  uint8_t controller_list[0];
62 } __attribute__ ((packed)) amp_discover_rsp_parms;
63 
64 typedef struct {
65  uint8_t id;
66 } __attribute__ ((packed)) amp_info_req_parms;
67 
68 typedef struct {
69  uint8_t id;
70  uint8_t status;
71  uint32_t total_bandwidth;
72  uint32_t max_bandwidth;
73  uint32_t min_latency;
74  uint16_t pal_caps;
75  uint16_t assoc_size;
76 } __attribute__ ((packed)) amp_info_rsp_parms;
77 
78 typedef struct {
79  uint8_t id;
80  uint8_t status;
81  amp_assoc_tlv assoc;
82 } __attribute__ ((packed)) amp_assoc_rsp_parms;
83 
84 typedef struct {
85  uint8_t local_id;
86  uint8_t remote_id;
87  amp_assoc_tlv assoc;
88 } __attribute__ ((packed)) amp_link_req_parms;
89 
90 typedef struct {
91  uint8_t local_id;
92  uint8_t remote_id;
93  uint8_t status;
94 } __attribute__ ((packed)) amp_link_rsp_parms;
95 
96 typedef struct {
97  uint8_t local_id;
98  uint8_t remote_id;
99 } __attribute__ ((packed)) amp_disconn_req_parms;
100 
101 #define A2MP_MAC_ADDR_TYPE 1
102 #define A2MP_PREF_CHANLIST_TYPE 2
103 #define A2MP_CONNECTED_CHAN 3
104 #define A2MP_PAL_CAP_TYPE 4
105 #define A2MP_PAL_VER_INFO 5
106 
107 struct amp_tlv {
108  uint8_t type;
109  uint16_t len;
110  uint8_t val[0];
111 } __attribute__ ((packed));
112 
113 struct amp_pal_ver {
114  uint8_t ver;
115  uint16_t company_id;
116  uint16_t sub_ver;
117 } __attribute__ ((packed));
118 
120  union {
121  struct {
122  uint8_t first_channel;
123  uint8_t num_channels;
124  int8_t max_power;
125  } __attribute__ ((packed)) chans;
126  struct {
127  uint8_t reg_extension_id;
128  uint8_t reg_class;
129  uint8_t coverage_class;
130  } __attribute__ ((packed)) ext;
131  };
132 } __attribute__ ((packed));
133 
135  uint8_t country_code[3];
136  struct amp_country_triplet triplets[0];
137 } __attribute__ ((packed));
138 
139 #define AMP_COMMAND_NOT_RECOGNIZED 0x0000
140 
141 /* AMP controller status */
142 #define AMP_CT_POWERED_DOWN 0x00
143 #define AMP_CT_BLUETOOTH_ONLY 0x01
144 #define AMP_CT_NO_CAPACITY 0x02
145 #define AMP_CT_LOW_CAPACITY 0x03
146 #define AMP_CT_MEDIUM_CAPACITY 0x04
147 #define AMP_CT_HIGH_CAPACITY 0x05
148 #define AMP_CT_FULL_CAPACITY 0x06
149 
150 /* AMP response status */
151 #define AMP_STATUS_SUCCESS 0x00
152 #define AMP_STATUS_INVALID_CTRL_ID 0x01
153 #define AMP_STATUS_UNABLE_START_LINK_CREATION 0x02
154 #define AMP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
155 #define AMP_STATUS_COLLISION_OCCURED 0x03
156 #define AMP_STATUS_DISCONN_REQ_RECVD 0x04
157 #define AMP_STATUS_PHYS_LINK_EXISTS 0x05
158 #define AMP_STATUS_SECURITY_VIOLATION 0x06
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif /* __AMP_H */
Definition: amp.h:113
Definition: amp.h:35
Definition: amp.h:119
Definition: amp.h:107
Definition: amp.h:134