1 /* 2 * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 **************************************************************************************** 18 * 19 * @file ($HEADER_FILENAME) 20 * 21 * @brief 22 * 23 **************************************************************************************** 24 */ 25 #ifndef _SONATA_CONFIG_H_ 26 #define _SONATA_CONFIG_H_ 27 28 /* 29 * INCLUDE FILES 30 **************************************************************************************** 31 */ 32 #include "sonata_stack_fixed_config.h" 33 34 /* 35 * MACRO DEFINES 36 **************************************************************************************** 37 */ 38 #define UTIL_BIT(pos) (1UL<<(pos)) 39 40 #define SONATA_KEY_LEN (0x10) 41 #define SONATA_RAND_NB_LEN (0x08) 42 #define SONATA_BD_ADDR_LEN (6) 43 44 /* 45 * VARIABLE DECLARATIONS 46 **************************************************************************************** 47 */ 48 49 /// BD address type 50 enum sonata_addr_type { 51 /// Public BD address 52 SONATA_ADDR_PUBLIC = 0x00, 53 /// Random BD Address 54 SONATA_ADDR_RAND, 55 /// Controller generates Resolvable Private Address based on the 56 /// local IRK from resolving list. If resolving list contains no matching 57 /// entry, use public address. 58 SONATA_ADDR_RPA_OR_PUBLIC, 59 /// Controller generates Resolvable Private Address based on the 60 /// local IRK from resolving list. If resolving list contains no matching 61 /// entry, use random address. 62 SONATA_ADDR_RPA_OR_RAND, 63 /// mask used to determine Address type in the air 64 SONATA_ADDR_MASK = 0x01, 65 /// mask used to determine if an address is an RPA 66 SONATA_ADDR_RPA_MASK = 0x02, 67 /// Random device address (controller unable to resolve) 68 SONATA_ADDR_RAND_UNRESOLVED = 0xFE, 69 /// No address provided (anonymous advertisement) 70 SONATA_ADDR_NONE = 0xFF, 71 }; 72 73 /// Advertising filter policy 74 enum stack_adv_filter_policy { 75 /// Allow both scan and connection requests from anyone 76 SONATA_ADV_ALLOW_SCAN_ANY_CON_ANY = 0x00, 77 /// Allow both scan req from White List devices only and connection req from anyone 78 SONATA_ADV_ALLOW_SCAN_WLST_CON_ANY, 79 /// Allow both scan req from anyone and connection req from White List devices only 80 SONATA_ADV_ALLOW_SCAN_ANY_CON_WLST, 81 /// Allow scan and connection requests from White List devices only 82 SONATA_ADV_ALLOW_SCAN_WLST_CON_WLST, 83 }; 84 85 /// Random Address type 86 enum stack_random_addr_type { 87 /// Mask over the 2 MSBs 88 SONATA_BD_ADDR_RND_ADDR_TYPE_MSK = 0xC0, 89 90 /// Static random address - 11 (MSB->LSB) 91 SONATA_BD_ADDR_STATIC = 0xC0, 92 /// Private non resolvable address - 00 (MSB->LSB) 93 SONATA_BD_ADDR_NON_RSLV = 0x00, 94 /// Private resolvable address - 01 (MSB->LSB) 95 SONATA_BD_ADDR_RSLV = 0x40, 96 }; 97 98 /// Constant defining the role 99 enum { 100 /// Master role 101 SONATA_ROLE_MASTER, 102 /// Slave role 103 SONATA_ROLE_SLAVE, 104 }; 105 106 /// Privacy mode type 107 enum { 108 /// Network privacy mode 109 SONATA_PRIV_TYPE_NETWORK = 0x00, 110 /// Device privacy mode 111 SONATA_PRIV_TYPE_DEVICE = 0x01, 112 }; 113 114 /* 115 * FUNCTION DECLARATIONS 116 **************************************************************************************** 117 */ 118 119 #if defined(CFG_BLE) && defined(CFG_HOST) 120 #define STACK_BLE_HOST_PRESENT 1 121 #else // defined(CFG_BLE) && defined(CFG_HOST) 122 #define STACK_BLE_HOST_PRESENT 0 123 #endif // defined(CFG_BLE) && defined(CFG_HOST) 124 125 #define SONATA_TASK_ID_APP (15) 126 #define SONATA_TASK_ID_BASS (36) 127 #define SONATA_TASK_ID_HOGPD (38) 128 129 #define SONATA_GAP_MAX_NAME_SIZE (0x20) 130 131 #define STACK_TASK_FIRST_MSG(task) ((uint16_t)((task) << 8)) 132 133 #endif // _SONATA_CONFIG_H_ 134