a2mp.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. *
  4. * BlueZ - Bluetooth protocol stack for Linux
  5. *
  6. * Copyright (C) 2012 Intel Corporation. All rights reserved.
  7. * Copyright (c) 2012 Code Aurora Forum. All rights reserved.
  8. *
  9. */
  10. #ifndef __A2MP_H
  11. #define __A2MP_H
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /* A2MP Protocol */
  16. /* A2MP command codes */
  17. #define A2MP_COMMAND_REJ 0x01
  18. #define A2MP_DISCOVER_REQ 0x02
  19. #define A2MP_DISCOVER_RSP 0x03
  20. #define A2MP_CHANGE_NOTIFY 0x04
  21. #define A2MP_CHANGE_RSP 0x05
  22. #define A2MP_INFO_REQ 0x06
  23. #define A2MP_INFO_RSP 0x07
  24. #define A2MP_ASSOC_REQ 0x08
  25. #define A2MP_ASSOC_RSP 0x09
  26. #define A2MP_CREATE_REQ 0x0a
  27. #define A2MP_CREATE_RSP 0x0b
  28. #define A2MP_DISCONN_REQ 0x0c
  29. #define A2MP_DISCONN_RSP 0x0d
  30. struct a2mp_hdr {
  31. uint8_t code;
  32. uint8_t ident;
  33. uint16_t len;
  34. } __attribute__ ((packed));
  35. #define A2MP_HDR_SIZE 4
  36. struct a2mp_command_rej {
  37. uint16_t reason;
  38. } __attribute__ ((packed));
  39. struct a2mp_discover_req {
  40. uint16_t mtu;
  41. uint16_t mask;
  42. } __attribute__ ((packed));
  43. struct a2mp_ctrl {
  44. uint8_t id;
  45. uint8_t type;
  46. uint8_t status;
  47. } __attribute__ ((packed));
  48. struct a2mp_discover_rsp {
  49. uint16_t mtu;
  50. uint16_t mask;
  51. struct a2mp_ctrl ctrl_list[0];
  52. } __attribute__ ((packed));
  53. struct a2mp_info_req {
  54. uint8_t id;
  55. } __attribute__ ((packed));
  56. struct a2mp_info_rsp {
  57. uint8_t id;
  58. uint8_t status;
  59. uint32_t total_bw;
  60. uint32_t max_bw;
  61. uint32_t min_latency;
  62. uint16_t pal_caps;
  63. uint16_t assoc_size;
  64. } __attribute__ ((packed));
  65. struct a2mp_assoc_req {
  66. uint8_t id;
  67. } __attribute__ ((packed));
  68. struct a2mp_assoc_rsp {
  69. uint8_t id;
  70. uint8_t status;
  71. uint8_t assoc_data[0];
  72. } __attribute__ ((packed));
  73. struct a2mp_create_req {
  74. uint8_t local_id;
  75. uint8_t remote_id;
  76. uint8_t assoc_data[0];
  77. } __attribute__ ((packed));
  78. struct a2mp_create_rsp {
  79. uint8_t local_id;
  80. uint8_t remote_id;
  81. uint8_t status;
  82. } __attribute__ ((packed));
  83. struct a2mp_disconn_req {
  84. uint8_t local_id;
  85. uint8_t remote_id;
  86. } __attribute__ ((packed));
  87. struct a2mp_disconn_rsp {
  88. uint8_t local_id;
  89. uint8_t remote_id;
  90. uint8_t status;
  91. } __attribute__ ((packed));
  92. #define A2MP_COMMAND_NOT_RECOGNIZED 0x0000
  93. /* AMP controller status */
  94. #define AMP_CTRL_POWERED_DOWN 0x00
  95. #define AMP_CTRL_BLUETOOTH_ONLY 0x01
  96. #define AMP_CTRL_NO_CAPACITY 0x02
  97. #define AMP_CTRL_LOW_CAPACITY 0x03
  98. #define AMP_CTRL_MEDIUM_CAPACITY 0x04
  99. #define AMP_CTRL_HIGH_CAPACITY 0x05
  100. #define AMP_CTRL_FULL_CAPACITY 0x06
  101. /* A2MP response status */
  102. #define A2MP_STATUS_SUCCESS 0x00
  103. #define A2MP_STATUS_INVALID_CTRL_ID 0x01
  104. #define A2MP_STATUS_UNABLE_START_LINK_CREATION 0x02
  105. #define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
  106. #define A2MP_STATUS_COLLISION_OCCURED 0x03
  107. #define A2MP_STATUS_DISCONN_REQ_RECVD 0x04
  108. #define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
  109. #define A2MP_STATUS_SECURITY_VIOLATION 0x06
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113. #endif /* __A2MP_H */