amp.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. #ifndef __AMP_H
  11. #define __AMP_H
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define AMP_MGR_CID 0x03
  16. /* AMP manager codes */
  17. #define AMP_COMMAND_REJ 0x01
  18. #define AMP_DISCOVER_REQ 0x02
  19. #define AMP_DISCOVER_RSP 0x03
  20. #define AMP_CHANGE_NOTIFY 0x04
  21. #define AMP_CHANGE_RSP 0x05
  22. #define AMP_INFO_REQ 0x06
  23. #define AMP_INFO_RSP 0x07
  24. #define AMP_ASSOC_REQ 0x08
  25. #define AMP_ASSOC_RSP 0x09
  26. #define AMP_LINK_REQ 0x0a
  27. #define AMP_LINK_RSP 0x0b
  28. #define AMP_DISCONN_REQ 0x0c
  29. #define AMP_DISCONN_RSP 0x0d
  30. typedef struct {
  31. uint8_t code;
  32. uint8_t ident;
  33. uint16_t len;
  34. } __attribute__ ((packed)) amp_mgr_hdr;
  35. #define AMP_MGR_HDR_SIZE 4
  36. /* AMP ASSOC structure */
  37. typedef struct {
  38. uint8_t type_id;
  39. uint16_t len;
  40. uint8_t data[0];
  41. } __attribute__ ((packed)) amp_assoc_tlv;
  42. typedef struct {
  43. uint16_t reason;
  44. } __attribute__ ((packed)) amp_cmd_rej_parms;
  45. typedef struct {
  46. uint16_t mtu;
  47. uint16_t mask;
  48. } __attribute__ ((packed)) amp_discover_req_parms;
  49. typedef struct {
  50. uint16_t mtu;
  51. uint16_t mask;
  52. uint8_t controller_list[0];
  53. } __attribute__ ((packed)) amp_discover_rsp_parms;
  54. typedef struct {
  55. uint8_t id;
  56. } __attribute__ ((packed)) amp_info_req_parms;
  57. typedef struct {
  58. uint8_t id;
  59. uint8_t status;
  60. uint32_t total_bandwidth;
  61. uint32_t max_bandwidth;
  62. uint32_t min_latency;
  63. uint16_t pal_caps;
  64. uint16_t assoc_size;
  65. } __attribute__ ((packed)) amp_info_rsp_parms;
  66. typedef struct {
  67. uint8_t id;
  68. uint8_t status;
  69. amp_assoc_tlv assoc;
  70. } __attribute__ ((packed)) amp_assoc_rsp_parms;
  71. typedef struct {
  72. uint8_t local_id;
  73. uint8_t remote_id;
  74. amp_assoc_tlv assoc;
  75. } __attribute__ ((packed)) amp_link_req_parms;
  76. typedef struct {
  77. uint8_t local_id;
  78. uint8_t remote_id;
  79. uint8_t status;
  80. } __attribute__ ((packed)) amp_link_rsp_parms;
  81. typedef struct {
  82. uint8_t local_id;
  83. uint8_t remote_id;
  84. } __attribute__ ((packed)) amp_disconn_req_parms;
  85. #define A2MP_MAC_ADDR_TYPE 1
  86. #define A2MP_PREF_CHANLIST_TYPE 2
  87. #define A2MP_CONNECTED_CHAN 3
  88. #define A2MP_PAL_CAP_TYPE 4
  89. #define A2MP_PAL_VER_INFO 5
  90. struct amp_tlv {
  91. uint8_t type;
  92. uint16_t len;
  93. uint8_t val[0];
  94. } __attribute__ ((packed));
  95. struct amp_pal_ver {
  96. uint8_t ver;
  97. uint16_t company_id;
  98. uint16_t sub_ver;
  99. } __attribute__ ((packed));
  100. struct amp_country_triplet {
  101. union {
  102. struct {
  103. uint8_t first_channel;
  104. uint8_t num_channels;
  105. int8_t max_power;
  106. } __attribute__ ((packed)) chans;
  107. struct {
  108. uint8_t reg_extension_id;
  109. uint8_t reg_class;
  110. uint8_t coverage_class;
  111. } __attribute__ ((packed)) ext;
  112. };
  113. } __attribute__ ((packed));
  114. struct amp_chan_list {
  115. uint8_t country_code[3];
  116. struct amp_country_triplet triplets[0];
  117. } __attribute__ ((packed));
  118. #define AMP_COMMAND_NOT_RECOGNIZED 0x0000
  119. /* AMP controller status */
  120. #define AMP_CT_POWERED_DOWN 0x00
  121. #define AMP_CT_BLUETOOTH_ONLY 0x01
  122. #define AMP_CT_NO_CAPACITY 0x02
  123. #define AMP_CT_LOW_CAPACITY 0x03
  124. #define AMP_CT_MEDIUM_CAPACITY 0x04
  125. #define AMP_CT_HIGH_CAPACITY 0x05
  126. #define AMP_CT_FULL_CAPACITY 0x06
  127. /* AMP response status */
  128. #define AMP_STATUS_SUCCESS 0x00
  129. #define AMP_STATUS_INVALID_CTRL_ID 0x01
  130. #define AMP_STATUS_UNABLE_START_LINK_CREATION 0x02
  131. #define AMP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
  132. #define AMP_STATUS_COLLISION_OCCURED 0x03
  133. #define AMP_STATUS_DISCONN_REQ_RECVD 0x04
  134. #define AMP_STATUS_PHYS_LINK_EXISTS 0x05
  135. #define AMP_STATUS_SECURITY_VIOLATION 0x06
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139. #endif /* __AMP_H */