ll_config.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*********************************************************************************************
  2. * Filename : ll_config.h
  3. * Description : Lto 优化Macro 定义
  4. * Author : Bingquan
  5. * Email : bingquan_cai@zh-jieli.com
  6. * Last modifiled : 2018-12-19 16:12
  7. * Copyright:(c)JIELI 2011-2017 @ , All Rights Reserved.
  8. *********************************************************************************************/
  9. #ifndef _LL_CONFIG_H_
  10. #define _LL_CONFIG_H_
  11. #include <stdint.h> //for UINT64_C
  12. /*
  13. *-------------------LE FEATURE SUPPORT
  14. * brief : 运行时优化(LTO)下,代码空间优化;
  15. */
  16. /* --- Core Spec 4.0 --- */
  17. #define LL_FEAT_ENCRYPTION (UINT64_C(1) << ( 0)) /*!< Encryption supported. */
  18. /* --- Core Spec 4.2 --- */
  19. #define LL_FEAT_CONN_PARAM_REQ_PROC (UINT64_C(1) << ( 1)) /*!< Connection Parameters Request Procedure supported. */
  20. #define LL_FEAT_EXT_REJECT_IND (UINT64_C(1) << ( 2)) /*!< Extended Reject Indication supported. */
  21. #define LL_FEAT_SLV_INIT_FEAT_EXCH (UINT64_C(1) << ( 3)) /*!< Slave-Initiated Features Exchange supported. */
  22. #define LL_FEAT_LE_PING (UINT64_C(1) << ( 4)) /*!< LE Ping supported. */
  23. #define LL_FEAT_DATA_LEN_EXT (UINT64_C(1) << ( 5)) /*!< Data Length Extension supported. */
  24. #define LL_FEAT_PRIVACY (UINT64_C(1) << ( 6)) /*!< LL Privacy supported. */
  25. #define LL_FEAT_EXT_SCAN_FILT_POLICY (UINT64_C(1) << ( 7)) /*!< Extended Scan Filter Policy supported. */
  26. /* --- Core Spec 5.0 --- */
  27. #define LL_FEAT_LE_2M_PHY (UINT64_C(1) << ( 8)) /*!< LE 2M PHY supported. */
  28. #define LL_FEAT_STABLE_MOD_IDX_TRANSMITTER (UINT64_C(1) << ( 9)) /*!< Stable Modulation Index - Transmitter supported. */
  29. #define LL_FEAT_STABLE_MOD_IDX_RECEIVER (UINT64_C(1) << (10)) /*!< Stable Modulation Index - Receiver supported. */
  30. #define LL_FEAT_LE_CODED_PHY (UINT64_C(1) << (11)) /*!< LE Coded PHY supported. */
  31. #define LL_FEAT_LE_EXT_ADV (UINT64_C(1) << (12)) /*!< LE Extended Advertising supported. */
  32. #define LL_FEAT_LE_PER_ADV (UINT64_C(1) << (13)) /*!< LE Periodic Advertising supported. */
  33. #define LL_FEAT_CH_SEL_2 (UINT64_C(1) << (14)) /*!< Channel Selection Algorithm #2 supported. */
  34. #define LL_FEAT_LE_POWER_CLASS_1 (UINT64_C(1) << (15)) /*!< LE Power Class 1 supported. */
  35. #define LL_FEAT_MIN_NUM_USED_CHAN (UINT64_C(1) << (16)) /*!< Minimum Number of Used Channels supported. */
  36. /* --- Core Spec 5.1 --- */
  37. #define LL_FEAT_CONN_CTE_REQ (UINT64_C(1) << (17)) /*!< Connection CTE Request supported */
  38. #define LL_FEAT_CONN_CTE_RSP (UINT64_C(1) << (18)) /*!< Connection CTE Response supported */
  39. #define LL_FEAT_CONNLESS_CTE_TRANS (UINT64_C(1) << (19)) /*!< Connectionless CTE Transmitter supported */
  40. #define LL_FEAT_CONNLESS_CTE_RECV (UINT64_C(1) << (20)) /*!< Connectionless CTE Receiver supported */
  41. #define LL_FEAT_ANTENNA_SWITCH_AOD (UINT64_C(1) << (21)) /*!< Anetenna Switching during CTE Transmission (AoD) supported */
  42. #define LL_FEAT_ANTENNA_SWITCH_AOA (UINT64_C(1) << (22)) /*!< Anetenna Switching during CTE Reception (AoA) supported */
  43. #define LL_FEAT_RECV_CTE (UINT64_C(1) << (23)) /*!< Receive Constant Tone Extension supported */
  44. #define LL_FEAT_PAST_SENDER (UINT64_C(1) << (24)) /*!< Periodic Advertising Sync Transfer – Sender supported. */
  45. #define LL_FEAT_PAST_RECIPIENT (UINT64_C(1) << (25)) /*!< Periodic Advertising Sync Transfer – Recipient supported. */
  46. #define LL_FEAT_SCA_UPDATE (UINT64_C(1) << (26)) /*!< Sleep Clock Accuracy Updates supported. */
  47. #define LL_FEAT_REMOTE_PUB_KEY_VALIDATION (UINT64_C(1) << (27)) /*!< Remote Public Key Validation supported. */
  48. /* --- Core Spec 5.2 --- */
  49. #define LL_FEAT_CIS_MASTER_ROLE (UINT64_C(1) << (28)) /*!< Connected Isochronous Stream Master Role supported. */
  50. #define LL_FEAT_CIS_SLAVE_ROLE (UINT64_C(1) << (29)) /*!< Connected Isochronous Stream Slave Role supported. */
  51. #define LL_FEAT_ISO_BROADCASTER (UINT64_C(1) << (30)) /*!< Isochronous Broadcaster Role supported. */
  52. #define LL_FEAT_ISO_SYNC (UINT64_C(1) << (31)) /*!< Isochronous Synchronizer Role supported. */
  53. #define LL_FEAT_ISO_HOST_SUPPORT (UINT64_C(1) << (32)) /*!< Host support for ISO Channels. */
  54. #define LL_FEAT_POWER_CONTROL_REQUEST (UINT64_C(1) << (33)) /*!< Power control requests supported. */
  55. #define LL_FEAT_POWER_CHANGE_IND (UINT64_C(1) << (34)) /*!< Power control power change indication supported. */
  56. #define LL_FEAT_PATH_LOSS_MONITOR (UINT64_C(1) << (35)) /*!< Path loss monitoring supported. */
  57. #define LL_FEAT_PATH_LOSS_MONITOR (UINT64_C(1) << (35)) /*!< Path loss monitoring supported. */
  58. #define LL_FEAT_PERIODIC_ADV_ADI_SUPPORT (UINT64_C(1) << (36)) /*!< Periodic Advertising ADI supported. */
  59. #define LL_FEAT_CONN_SUBRATE (UINT64_C(1) << (37)) /*!< Connection subrating supported. */
  60. #define LL_FEAT_CONN_SUBRATE_HOST_SUPPORT (UINT64_C(1) << (38)) /*!< Connection subratingHost supported. */
  61. #define LL_FEAT_CHANNEL_CLASSIFICATION (UINT64_C(1) << (39)) /*!< Channel classification supported. */
  62. #define LE_ENCRYPTION LL_FEAT_ENCRYPTION
  63. #define CONNECTION_PARAMETER_REQUEST LL_FEAT_CONN_PARAM_REQ_PROC
  64. #define EXTENDED_REJECT_INDICATION LL_FEAT_EXT_REJECT_IND
  65. #define LE_SLAVE_INIT_FEATURES_EXCHANGE LL_FEAT_SLV_INIT_FEAT_EXCH
  66. #define LE_PING LL_FEAT_LE_PING
  67. #define LE_DATA_PACKET_LENGTH_EXTENSION LL_FEAT_DATA_LEN_EXT
  68. #define LL_PRIVACY LL_FEAT_PRIVACY
  69. #define EXTENDED_SCANNER_FILTER_POLICIES LL_FEAT_EXT_SCAN_FILT_POLICY
  70. #define LE_2M_PHY LL_FEAT_LE_2M_PHY
  71. #define LE_CODED_PHY LL_FEAT_LE_CODED_PHY
  72. #define LE_EXTENDED_ADVERTISING LL_FEAT_LE_EXT_ADV
  73. #define LE_PERIODIC_ADVERTISING LL_FEAT_LE_PER_ADV
  74. #define CHANNEL_SELECTION_ALGORITHM_2 LL_FEAT_CH_SEL_2
  75. #define LE_CORE_V50_FEATURES \
  76. ( \
  77. LE_2M_PHY | \
  78. LE_CODED_PHY | \
  79. LE_EXTENDED_ADVERTISING | \
  80. LE_PERIODIC_ADVERTISING | \
  81. CHANNEL_SELECTION_ALGORITHM_2 | \
  82. 0 \
  83. )
  84. #if (LE_CORE_V50_FEATURES & LE_PERIODIC_ADVERTISING)
  85. #if ((LE_CORE_V50_FEATURES & LE_EXTENDED_ADVERTISING) == 0)
  86. #error "enable <LE_PERIODIC_ADVERTISING> must enable <LE_EXTENDED_ADVERTISING> at the same time"
  87. #endif
  88. #endif
  89. #define LE_FEATURES_CONST_TONE (LL_FEAT_CONN_CTE_REQ | \
  90. LL_FEAT_CONN_CTE_RSP | \
  91. LL_FEAT_CONNLESS_CTE_TRANS | \
  92. LL_FEAT_CONNLESS_CTE_RECV | \
  93. LL_FEAT_ANTENNA_SWITCH_AOD | \
  94. LL_FEAT_ANTENNA_SWITCH_AOA | \
  95. LL_FEAT_RECV_CTE)
  96. #define LE_FEATURES_CIS (LL_FEAT_CIS_MASTER_ROLE | \
  97. LL_FEAT_CIS_SLAVE_ROLE | \
  98. LL_FEAT_ISO_HOST_SUPPORT)
  99. #define LE_FEATURES_BIS (LL_FEAT_ISO_BROADCASTER | \
  100. LL_FEAT_ISO_SYNC | \
  101. LL_FEAT_ISO_HOST_SUPPORT)
  102. #define LE_FEATURES_ISO (LE_FEATURES_BIS|LE_FEATURES_CIS)
  103. #define LE_FEATURES_POWER_CONTROL (LL_FEAT_POWER_CONTROL_REQUEST | \
  104. LL_FEAT_POWER_CHANGE_IND | \
  105. LL_FEAT_PATH_LOSS_MONITOR)
  106. extern const uint64_t config_btctler_le_features;
  107. #define LE_FEATURES_IS_SUPPORT(x) (config_btctler_le_features & (x))
  108. #define LE_FEATURES_IS_SUPPORT_OPTIMIZE(x) if (LE_FEATURES_IS_SUPPORT(x) == 0x0) return
  109. /*-----------------------------------------------------------*/
  110. /*
  111. *-------------------LE ROLES SUPPORT
  112. * brief : 运行时优化(LTO)下,代码空间优化;
  113. */
  114. #define LE_MASTER BIT(0)
  115. #define LE_SLAVE BIT(1)
  116. #define LE_ADV BIT(2)
  117. #define LE_SCAN BIT(3)
  118. #define LE_INIT BIT(4)
  119. /*! \brief Combination */
  120. #define LE_CONN (LE_MASTER|LE_SLAVE)
  121. extern const int config_btctler_le_roles;
  122. #define LE_ROLES_IS_SUPPORT(x) (config_btctler_le_roles & x)
  123. #define LE_ROLES_IS_SUPPORT_OPTIMIZE(x) if (LE_ROLES_IS_SUPPORT(x) == 0x0) return
  124. /*-----------------------------------------------------------*/
  125. extern const int config_btctler_le_tws;
  126. #define LE_TWS_IS_SUPPORT() (config_btctler_le_tws)
  127. /*-----------------------------------------------------------*/
  128. extern const int config_btctler_le_afh_en;
  129. #define LE_AFH_IS_SUPPORT() (config_btctler_le_afh_en)
  130. #define LE_AFH_IS_SUPPORT_OPTIMIZE(x) if (LE_AFH_IS_SUPPORT() == 0x0) return
  131. /*
  132. *-------------------LE PARAM CHECK
  133. * brief : 运行时优化(LTO)下,代码空间优化;
  134. */
  135. // extern const int config_btctler_le_param_check;
  136. #define LE_PARAM_IS_CHECK() TRUE//(config_btctler_le_param_check)
  137. /*
  138. *-------------------LE RAM CONTROL
  139. *
  140. */
  141. extern const int config_btctler_le_hw_nums;
  142. extern const int config_btctler_le_rx_nums;
  143. extern const int config_btctler_le_acl_packet_length;
  144. extern const int config_btctler_le_acl_total_nums;
  145. extern const int config_btctler_le_slave_conn_update_winden;
  146. /*-----------------------------------------------------------*/
  147. /*
  148. *-------------------LE Multi-link CONTROL
  149. */
  150. extern const int config_btctler_le_slave_multilink;
  151. extern const int config_btctler_le_master_multilink;
  152. /*-----------------------------------------------------------*/
  153. /*
  154. *-------------------LE Vendor baseband CONTROL
  155. */
  156. #define VENDOR_BB_PIS_EN BIT(0)
  157. #define VENDOR_BB_PIS_HB BIT(1)
  158. #define VENDOR_BB_PIS_HB_M BIT(2)
  159. #define VENDOR_BB_MD_CLOSE BIT(3)
  160. #define VENDOR_BB_CONNECT_SLOT BIT(4)
  161. #define VENDOR_BB_NEW_SCAN_STRATEGY BIT(5)
  162. #define VENDOR_BB_WL_COEX_ROLE_EN BIT(6)
  163. #define VENDOR_BB_WL_COEX_ROLE BIT(7)
  164. #define VENDOR_BB_ADV_PDU_INT(x) ((x) << 8) /* 4bit */
  165. #define VENDOR_BB_EVT_HOLD_TRIGG(x) ((x) << 12) /* 6bit */
  166. #define VENDOR_BB_RX_PAYLOAD_LEN(x) ((x) << 18) /* 7bit */
  167. #define VENDOR_BB_PIS_TX_PAYLOAD_LEN(x) ((x) << 25) /* 7bit*/
  168. extern u32 config_vendor_le_bb;
  169. extern const int config_rf_oob;
  170. /*-----------------------------------------------------------*/
  171. /*
  172. *-------------------LE close wait
  173. */
  174. extern const int ble_disable_wait_enable;
  175. /*-----------------------------------------------------------*/
  176. #endif //_LL_CONFIG_H_