1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., 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 * @file plf.h 19 * 20 * @brief This file contains the definitions of the macros and functions that are 21 * platform dependent. The implementation of those is implemented in the 22 * appropriate platform directory. 23 * 24 **************************************************************************************** 25 */ 26 #ifndef _PLF_H_ 27 #define _PLF_H_ 28 /** 29 **************************************************************************************** 30 * @defgroup PLF 31 * @ingroup DRIVERS 32 * 33 * @brief Platform register driver 34 * 35 * @{ 36 * 37 **************************************************************************************** 38 */ 39 40 /* 41 * HW Platform 42 **************************************************************************************** 43 */ 44 #if defined(CFG_HW_PLATFORM) && (CFG_HW_PLATFORM <= 2) 45 #if CFG_HW_PLATFORM == 0 46 #define PLF_HW_PXP 1 47 #define PLF_HW_FPGA 0 48 #define PLF_HW_ASIC 0 49 #elif CFG_HW_PLATFORM == 1 50 #define PLF_HW_PXP 0 51 #define PLF_HW_FPGA 1 52 #define PLF_HW_ASIC 0 53 #elif CFG_HW_PLATFORM == 2 54 #define PLF_HW_PXP 0 55 #define PLF_HW_FPGA 0 56 #define PLF_HW_ASIC 1 57 #endif 58 #else // CFG_HW_PLATFORM 59 #error "Invalid HW platform" 60 #endif // CFG_HW_PLATFORM 61 62 /* 63 * RF Mode 64 **************************************************************************************** 65 */ 66 #if defined(CFG_RF_MODE) && (CFG_RF_MODE <= 3) 67 #if CFG_RF_MODE == 0 68 #define PLF_RF_MODE_NULL 1 69 #define PLF_RF_MODE_BT_ONLY 0 70 #define PLF_RF_MODE_BT_COMBO 0 71 #define PLF_RF_MODE_BTWIFI_COMBO 0 72 #elif CFG_RF_MODE == 1 73 #define PLF_RF_MODE_NULL 0 74 #define PLF_RF_MODE_BT_ONLY 1 75 #define PLF_RF_MODE_BT_COMBO 0 76 #define PLF_RF_MODE_BTWIFI_COMBO 0 77 #elif CFG_RF_MODE == 2 78 #define PLF_RF_MODE_NULL 0 79 #define PLF_RF_MODE_BT_ONLY 0 80 #define PLF_RF_MODE_BT_COMBO 1 81 #define PLF_RF_MODE_BTWIFI_COMBO 0 82 #elif CFG_RF_MODE == 3 83 #define PLF_RF_MODE_NULL 0 84 #define PLF_RF_MODE_BT_ONLY 0 85 #define PLF_RF_MODE_BT_COMBO 0 86 #define PLF_RF_MODE_BTWIFI_COMBO 1 87 #endif 88 #else // CFG_RF_MODE 89 #error "Invalid RF mode" 90 #endif // CFG_RF_MODE 91 92 /* 93 * DAC mixer mode 94 **************************************************************************************** 95 */ 96 #if defined(CFG_DACL_MIXER_MODE) && (CFG_DACL_MIXER_MODE <= 4) 97 #define PLF_DACL_MIXER_MODE CFG_DACL_MIXER_MODE 98 #else // CFG_DACL_MIXER_MODE 99 #error "Invalid DACL MIXER MODE" 100 #endif // CFG_DACL_MIXER_MODE 101 102 #if defined(CFG_DACR_MIXER_MODE) && (CFG_DACR_MIXER_MODE <= 4) 103 #define PLF_DACR_MIXER_MODE CFG_DACR_MIXER_MODE 104 #else // CFG_DACR_MIXER_MODE 105 #error "Invalid DACR MIXER MODE" 106 #endif // CFG_DACR_MIXER_MODE 107 108 /* 109 * DEBUG configuration 110 **************************************************************************************** 111 */ 112 #if defined(CFG_DBG) 113 #define PLF_DEBUG 1 114 #else //CFG_DBG 115 #define PLF_DEBUG 0 116 #endif //CFG_DBG 117 118 /* 119 * CONSOLE 120 **************************************************************************************** 121 */ 122 #ifdef CFG_CONSOLE 123 #define PLF_CONSOLE 1 124 #else // CFG_CONSOLE 125 #define PLF_CONSOLE 0 126 #endif // CFG_CONSOLE 127 128 /* 129 * Letter Shell 130 **************************************************************************************** 131 */ 132 #ifdef CFG_LETTER_SHELL 133 #define PLF_LETTER_SHELL 1 134 #else // CFG_LETTER_SHELL 135 #define PLF_LETTER_SHELL 0 136 #endif // CFG_LETTER_SHELL 137 138 /* 139 * Test Case 140 **************************************************************************************** 141 */ 142 #ifdef CFG_TEST 143 #define PLF_TEST 1 144 #else // CFG_TEST 145 #define PLF_TEST 0 146 #endif // CFG_TEST 147 148 /* 149 * Wi-Fi Stack 150 **************************************************************************************** 151 */ 152 #ifdef CFG_WIFI_STACK 153 #define PLF_WIFI_STACK 1 154 #else // CFG_WIFI_STACK 155 #define PLF_WIFI_STACK 0 156 #endif // CFG_WIFI_STACK 157 158 /* 159 * 5G Band 160 **************************************************************************************** 161 */ 162 #ifdef CFG_BAND5G 163 #define PLF_BAND5G 1 164 #else // CFG_BAND5G 165 #define PLF_BAND5G 0 166 #endif // CFG_BAND5G 167 168 /* 169 * Wi-Fi RSSI of data packet 170 **************************************************************************************** 171 */ 172 173 #ifdef CFG_RSSI_DATAPKT 174 #define PLF_RSSI_DATAPKT 1 175 #else // CFG_RSSI_DATAPKT 176 #define PLF_RSSI_DATAPKT 0 177 #endif // CFG_RSSI_DATAPKT 178 179 /* 180 * Lwip SNTP 181 **************************************************************************************** 182 */ 183 #ifdef CFG_SNTP 184 #define PLF_SNTP 1 185 #else // CFG_SNTP 186 #define PLF_SNTP 0 187 #endif // CFG_SNTP 188 189 /* 190 * Fhost ping 191 **************************************************************************************** 192 */ 193 #ifdef CFG_PING 194 #define PLF_PING 1 195 #else // CFG_PING 196 #define PLF_PING 0 197 #endif // CFG_PING 198 199 /* 200 * Fhost iperf 201 **************************************************************************************** 202 */ 203 #ifdef CFG_IPERF 204 #define PLF_IPERF 1 205 #else // CFG_IPERF 206 #define PLF_IPERF 0 207 #endif // CFG_IPERF 208 209 /* 210 * BT Stack 211 **************************************************************************************** 212 */ 213 #ifdef CFG_BT_STACK 214 #define PLF_BT_STACK 1 215 #else // CFG_BT_STACK 216 #define PLF_BT_STACK 0 217 #endif // CFG_BT_STACK 218 219 /* 220 * BLE Stack 221 **************************************************************************************** 222 */ 223 #ifdef CFG_BLE_STACK 224 #define PLF_BLE_STACK 1 225 #else // CFG_BLE_STACK 226 #define PLF_BLE_STACK 0 227 #endif // CFG_BLE_STACK 228 229 /* 230 * BLE Stack only, not support br task 231 **************************************************************************************** 232 */ 233 #ifdef CFG_BLE_ONLY 234 #define PLF_BLE_ONLY 1 235 #else // CFG_BLE_ONLY 236 #define PLF_BLE_ONLY 0 237 #endif // CFG_BLE_ONLY 238 239 /* 240 * BTDM bt/ble combo 241 **************************************************************************************** 242 */ 243 #ifdef CFG_BTDM 244 #define PLF_BTDM 1 245 #else // CFG_BTDM 246 #define PLF_BTDM 0 247 #endif // CFG_BTDM 248 249 /* 250 * BT Customer 251 **************************************************************************************** 252 */ 253 #ifdef CFG_BT_USER 254 #define PLF_BT_USER 1 255 #else // CFG_BT_USER 256 #define PLF_BT_USER 0 257 #endif // CFG_BT_USER 258 259 /* 260 * BT Ota box 261 **************************************************************************************** 262 */ 263 #ifdef CFG_BT_OTA 264 #define PLF_BT_OTA 1 265 #else // CFG_BT_OTA 266 #define PLF_BT_OTA 0 267 #endif // CFG_BT_OTA 268 269 /* 270 * USB_BT 271 **************************************************************************************** 272 */ 273 #ifdef CFG_USB_BT 274 #define PLF_USB_BT 1 275 #else // CFG_USB_BT 276 #define PLF_USB_BT 0 277 #endif // CFG_USB_BT 278 279 /* 280 * LED support 281 **************************************************************************************** 282 */ 283 #ifdef CFG_LED_MODULE 284 #define PLF_LED_MODULE 1 285 #else // CFG_LED_MODULE 286 #define PLF_LED_MODULE 0 287 #endif // CFG_LED_MODULE 288 289 /* 290 * KEY support 291 **************************************************************************************** 292 */ 293 #ifdef CFG_KEY_MODULE 294 #define PLF_KEY_MODULE 1 295 #else // CFG_LED_MODULE 296 #define PLF_KEY_MODULE 0 297 #endif // CFG_LED_MODULE 298 299 /* 300 * LS support 301 **************************************************************************************** 302 */ 303 #ifdef CFG_LIGHT_SENSOR 304 #define PLF_LS_MODULE 1 305 #else // CFG_LIGHT_SENSOR 306 #define PLF_LS_MODULE 0 307 #endif // CFG_LIGHT_SENSOR 308 309 /* 310 * I2CM_SFT support 311 **************************************************************************************** 312 */ 313 #ifdef CFG_I2CM_SFT 314 #define PLF_I2CM_SFT 1 315 #else // CFG_I2CM_SFT 316 #define PLF_I2CM_SFT 0 317 #endif // CFG_I2CM_SFT 318 319 /* 320 * AON Support 321 **************************************************************************************** 322 */ 323 #ifdef CFG_AON 324 #define PLF_AON_SUPPORT 1 325 #else // CFG_AON 326 #define PLF_AON_SUPPORT 0 327 #endif // CFG_AON 328 329 /* 330 * HFP AG Support 331 **************************************************************************************** 332 */ 333 #ifdef CFG_HFP_AG_SUPPORT 334 #define PLF_HFG_SUPPORT 1 335 #else // CFG_HFP_AG_SUPPORT 336 #define PLF_HFG_SUPPORT 0 337 #endif // CFG_HFP_AG_SUPPORT 338 339 /* 340 * CS_VENDOR_ADV Support 341 **************************************************************************************** 342 */ 343 #ifdef CFG_CS_VENDOR_ADV 344 #define PLF_CS_VENDOR_ADV 1 345 #else // CFG_CS_VENDOR_ADV 346 #define PLF_CS_VENDOR_ADV 0 347 #endif // CFG_CS_VENDOR_ADV 348 /* 349 * Audio 350 **************************************************************************************** 351 */ 352 #ifdef CFG_AUD_USED 353 #define PLF_AUD_USED 1 354 #else 355 #define PLF_AUD_USED 0 356 #endif 357 358 #ifdef CFG_ASIO 359 #define PLF_ASIO 1 360 #else // CFG_ASIO 361 #define PLF_ASIO 0 362 #endif // CFG_ASIO 363 364 #ifdef CFG_AUDIO 365 #define PLF_AUDIO 1 366 #else // CFG_AUDIO 367 #define PLF_AUDIO 0 368 #endif // CFG_AUDIO 369 370 #ifdef CFG_BT_AUDIO 371 #define PLF_BT_AUDIO 1 372 #else // CFG_BT_AUDIO 373 #define PLF_BT_AUDIO 0 374 #endif // CFG_BT_AUDIO 375 376 #ifdef CFG_BT_PROMPT 377 #define PLF_BT_PROMPT 1 378 #else // CFG_BT_PROMPT 379 #define PLF_BT_PROMPT 0 380 #endif // CFG_BT_PROMPT 381 382 #ifdef CFG_WIFI_AUDIO 383 #define PLF_WIFI_AUDIO 1 384 #else // CFG_WIFI_AUDIO 385 #define PLF_WIFI_AUDIO 0 386 #endif // CFG_WIFI_AUDIO 387 388 #if defined(CFG_CS1000_MIC_MATRIX) && (CFG_CS1000_MIC_MATRIX < 6) 389 #define PLF_CS1000_MIC_MATRIX CFG_CS1000_MIC_MATRIX 390 #else // CFG_CS1000_MIC_MATRIX 391 #error "Invalid CS1000 MIC MATRIX" 392 #endif // CFG_CS1000_MIC_MATRIX 393 394 #ifdef CFG_EXT_CS1000 395 #define PLF_EXT_CS1000 1 396 #else // CFG_EXT_CS1000 397 #define PLF_EXT_CS1000 0 398 #endif // CFG_EXT_CS1000 399 400 /* 401 * PMIC is valid or not 402 **************************************************************************************** 403 */ 404 #ifdef CFG_PMIC 405 #define PLF_PMIC 1 406 #else // CFG_PMIC 407 #define PLF_PMIC 0 408 #endif // CFG_PMIC 409 410 /* 411 * PMIC version 412 **************************************************************************************** 413 */ 414 #ifdef CFG_PMIC_VER_FULL 415 #define PLF_PMIC_VER_FULL 1 416 #define PLF_PMIC_VER_LITE 0 417 #define PLF_PMIC_VER_AUD 0 418 #elif defined(CFG_PMIC_VER_LITE) 419 #define PLF_PMIC_VER_FULL 0 420 #define PLF_PMIC_VER_LITE 1 421 #define PLF_PMIC_VER_AUD 0 422 #else 423 #define PLF_PMIC_VER_FULL 0 424 #define PLF_PMIC_VER_LITE 0 425 #define PLF_PMIC_VER_AUD 1 426 #endif 427 428 /* 429 * PMIC interface 430 **************************************************************************************** 431 */ 432 #ifdef CFG_PMIC_ITF_ASDMA 433 #define PLF_PMIC_ITF_ASDMA 1 434 #define PLF_PMIC_ITF_PSIM 0 435 #else // CFG_PMIC_ITF_ASDMA 436 #define PLF_PMIC_ITF_ASDMA 0 437 #define PLF_PMIC_ITF_PSIM 1 438 #endif // CFG_PMIC_ITF_ASDMA 439 440 /* 441 * PMIC option: Low power mode enable 442 **************************************************************************************** 443 */ 444 #ifdef CFG_PMIC_LP 445 #define PLF_PMIC_LP 1 446 #else // CFG_PMIC_LP 447 #define PLF_PMIC_LP 0 448 #endif // CFG_PMIC_LP 449 450 /* 451 * PMIC option: use ldo_vcore09 or not 452 **************************************************************************************** 453 */ 454 #ifdef CFG_PMIC_LDO_VCORE 455 #define PLF_PMIC_LDO_VCORE 1 456 #else // CFG_PMIC_LDO_VCORE 457 #define PLF_PMIC_LDO_VCORE 0 458 #endif // CFG_PMIC_LDO_VCORE 459 460 /* 461 * PMIC option: Vcore calibration 462 **************************************************************************************** 463 */ 464 #ifdef CFG_VCORE_CALIB 465 #define PLF_VCORE_CALIB 1 466 #else // CFG_VCORE_CALIB 467 #define PLF_VCORE_CALIB 0 468 #endif // CFG_VCORE_CALIB 469 470 /* 471 * PMIC option: Low power 128k derived from lpo 512k 472 **************************************************************************************** 473 */ 474 #ifdef CFG_LPO_512K 475 #define PLF_LPO_512K 1 476 #else // PLF_LPO_512K 477 #define PLF_LPO_512K 0 478 #endif // PLF_LPO_512K 479 480 /* 481 * PMIC option: Generate I2S MCLK 482 **************************************************************************************** 483 */ 484 #ifdef CFG_PMIC_MCLK 485 #define PLF_PMIC_MCLK 1 486 #else // CFG_PMIC_MCLK 487 #define PLF_PMIC_MCLK 0 488 #endif // CFG_PMIC_MCLK 489 490 /* 491 * PMIC option: voltage drop 492 **************************************************************************************** 493 */ 494 #ifdef CFG_DCDC_CORE_DROP 495 #define PLF_DCDC_CORE_DROP 1 496 #else // CFG_DCDC_CORE_DROP 497 #define PLF_DCDC_CORE_DROP 0 498 #endif // CFG_DCDC_CORE_DROP 499 500 #ifdef CFG_DCDC_RF_DROP 501 #define PLF_DCDC_RF_DROP 1 502 #else // CFG_DCDC_RF_DROP 503 #define PLF_DCDC_RF_DROP 0 504 #endif // CFG_DCDC_RF_DROP 505 506 #ifdef CFG_LDO_VCORE09_DROP 507 #define PLF_LDO_VCORE09_DROP 1 508 #else // CFG_LDO_VCORE09_DROP 509 #define PLF_LDO_VCORE09_DROP 0 510 #endif // CFG_LDO_VCORE09_DROP 511 512 #ifdef CFG_LDO_VRTC09_DROP 513 #define PLF_LDO_VRTC09_DROP 1 514 #else // CFG_LDO_VRTC09_DROP 515 #define PLF_LDO_VRTC09_DROP 0 516 #endif // CFG_LDO_VRTC09_DROP 517 518 /* 519 * Low power code in RAM 520 **************************************************************************************** 521 */ 522 #ifdef CFG_LPIRAM 523 #define PLF_LPIRAM 1 524 #else // CFG_LPIRAM 525 #define PLF_LPIRAM 0 526 #endif // CFG_LPIRAM 527 528 /* 529 * GSENSOR 530 **************************************************************************************** 531 */ 532 #ifdef CFG_GSENSOR 533 #define PLF_GSENSOR 1 534 #else // CFG_GSENSOR 535 #define PLF_GSENSOR 0 536 #endif // CFG_GSENSOR 537 538 /* 539 * FATFS 540 **************************************************************************************** 541 */ 542 #ifdef CFG_FATFS 543 #define PLF_FATFS 1 544 #else // CFG_FATFS 545 #define PLF_FATFS 0 546 #endif // CFG_FATFS 547 548 /* 549 * DSP 550 **************************************************************************************** 551 */ 552 #ifdef CFG_DSP 553 #define PLF_DSP 1 554 #else // CFG_DSP 555 #define PLF_DSP 0 556 #endif // CFG_DSP 557 558 /* 559 * FUNCTION DECLARATIONS 560 **************************************************************************************** 561 */ 562 563 564 /// @} PLF 565 566 #endif // _PLF_H_ 567