config.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #include "include.h"
  2. AT(.rodata.func.table)
  3. const u8 func_sort_table[] = {
  4. #if FUNC_MUSIC_EN
  5. FUNC_MUSIC,
  6. #endif // FUNC_MUSIC_EN
  7. #if FUNC_BT_EN
  8. FUNC_BT,
  9. #endif
  10. #if FUNC_BTHID_EN
  11. FUNC_BTHID,
  12. #endif // FUNC_BTHID
  13. #if FUNC_AUX_EN
  14. FUNC_AUX,
  15. #endif // FUNC_AUX_EN
  16. #if FUNC_CLOCK_EN
  17. FUNC_CLOCK,
  18. #endif
  19. #if FUNC_USBDEV_EN
  20. FUNC_USBDEV,
  21. #endif // FUNC_USBDEV_EN
  22. #if FUNC_SPEAKER_EN
  23. FUNC_SPEAKER,
  24. #endif // FUNC_SPEAKER_EN
  25. #if FUNC_IDLE_EN
  26. FUNC_IDLE,
  27. #endif
  28. };
  29. AT(.text.func)
  30. u8 get_funcs_total(void)
  31. {
  32. return sizeof(func_sort_table);
  33. }
  34. u32 getcfg_vddio_sel(void)
  35. {
  36. return xcfg_cb.vddio_sel;
  37. }
  38. u32 getcfg_vddbt_capless_en(void)
  39. {
  40. return xcfg_cb.vddbt_capless_en;
  41. }
  42. u32 getcfg_buck_mode_en(void)
  43. {
  44. uint8_t buck_mode_en = 0;
  45. if (BUCK_MODE_EN) {
  46. buck_mode_en |= BIT(0);
  47. if (xcfg_cb.vddcore_buck_en) {
  48. buck_mode_en |= BIT(1);
  49. }
  50. }
  51. return buck_mode_en;
  52. }
  53. u32 getcfg_mic_bias_method(u8 mic_ch)
  54. {
  55. if (mic_ch == MIC0) {
  56. return xcfg_cb.mic0_pwr_sel << 4 | xcfg_cb.mic0_bias_method;
  57. }
  58. if (mic_ch == MIC1) {
  59. return xcfg_cb.mic1_pwr_sel << 4 | xcfg_cb.mic1_bias_method;
  60. }
  61. if (mic_ch == MIC2) {
  62. return xcfg_cb.mic2_pwr_sel << 4 | xcfg_cb.mic2_bias_method;
  63. }
  64. if (mic_ch == MIC3) {
  65. return xcfg_cb.mic3_pwr_sel << 4 | xcfg_cb.mic3_bias_method;
  66. }
  67. if (mic_ch == MIC4) {
  68. return xcfg_cb.mic4_pwr_sel << 4 | xcfg_cb.mic4_bias_method;
  69. }
  70. return 0;
  71. }
  72. u32 getcfg_mic_gain(u8 mic_ch)
  73. {
  74. if (mic_ch == MIC0) {
  75. return xcfg_cb.mic0_anl_gain << 8 | xcfg_cb.bt_mic0_dig_gain;
  76. }
  77. if (mic_ch == MIC1) {
  78. return xcfg_cb.mic1_anl_gain << 8 | xcfg_cb.bt_mic1_dig_gain;
  79. }
  80. if (mic_ch == MIC2) {
  81. return xcfg_cb.mic2_anl_gain << 8 | xcfg_cb.bt_mic2_dig_gain;
  82. }
  83. if (mic_ch == MIC3) {
  84. return xcfg_cb.mic3_anl_gain << 8 | xcfg_cb.bt_mic3_dig_gain;
  85. }
  86. if (mic_ch == MIC4) {
  87. return xcfg_cb.mic4_anl_gain << 8 | xcfg_cb.bt_mic4_dig_gain;
  88. }
  89. return 0;
  90. }
  91. u32 getcfg_mic_power_level(void)
  92. {
  93. return xcfg_cb.mic_pwr_level;
  94. }
  95. #if BT_A2DP_LDAC_AUDIO_EN
  96. u8 *getcfg_soft_key(void)
  97. {
  98. return xcfg_cb.soft_key;
  99. }
  100. #endif