bsp_eq.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef _BSP_EQ_H
  2. #define _BSP_EQ_H
  3. #define little_endian_read_16(buf, ofs) *(uint16_t *)((uint8_t *)buf + (ofs))
  4. #define little_endian_read_32(buf, ofs) *(uint32_t *)((uint8_t *)buf + (ofs))
  5. #define HUART_BUFFER_LEN (390+10)
  6. #define EQ_BUFFER_LEN (390+10)
  7. extern u8 eq_rx_buf[EQ_BUFFER_LEN];
  8. #if EQ_MODE_EN
  9. #define MUSIC_EQ_TBL_LEN 12 //6
  10. #else
  11. #define MUSIC_EQ_TBL_LEN 1
  12. #endif // EQ_MODE_EN
  13. typedef struct {
  14. u32 *addr;
  15. u32 *len;
  16. } eq_param;
  17. typedef struct {
  18. u8 remain : 1; //spp拼包标志
  19. u16 remian_ptr; //拼包长度
  20. u16 rx_size; //拼包长度
  21. }eq_spp_cb_t;
  22. typedef struct {
  23. u8 rx_type;
  24. eq_spp_cb_t eq_spp_cb;
  25. #if ANC_EN
  26. u8 anc_packet;
  27. #endif
  28. }eq_dbg_cb_t;
  29. extern eq_dbg_cb_t eq_dbg_cb;
  30. void sys_set_eq(void);
  31. void bsp_eq_parse_cmd(void);
  32. void eq_dbg_init(void);
  33. void bsp_eq_init(void);
  34. u8 bsp_eq_rx_done(u8* rx_buf);
  35. void bsp_enc_parse_cmd(void);
  36. void bsp_smic_parse_cmd(void);
  37. void mic_bass_treble_set(int mode, int gain); //mode: 0(bass), 1(treble)
  38. void music_bass_treble_set(int mode, int gain);
  39. void music_set_eq_for_index(u8 index, int gain);
  40. void music_set_eq_for_gains(s8 gain[8]);
  41. void music_set_eq_for_index_do(void);
  42. #if ONEMORE_APP_EN
  43. void music_space_set_eq_for_index_do(void);
  44. #endif // ONEMORE_APP_EN
  45. void eq_msc_index_init(u8 flag);
  46. void music_set_eq_overall_gain(int gain);
  47. void bsp_anc_parse_cmd(void);
  48. void huart_tx(const void *buf, uint len);
  49. #define MAX_RESBUF_SIZE 4096
  50. #define RES_BASE 0x11000000 //RES BASE ADDR
  51. #define RES_END (RES_BASE + MAX_RESBUF_SIZE)
  52. enum{
  53. RMK_ERR_RES_LEN = 1,
  54. RMK_ERR_RES_ENTRY_SIG,
  55. RMK_ERR_RES_ENTRY_NAME,
  56. RMK_ERR_RES_ENTRY_ADDR,
  57. RMK_ERR_RES_ENTRY_LEN,
  58. RMK_ERR_RES_CRC_ERR,
  59. };
  60. typedef struct{
  61. u8 *buf;
  62. u8 len;
  63. u8 err;
  64. u8 rescnt; //res2文件夹里eq文件总数 0x20->32个文件
  65. u8 set_param;
  66. u8 file_cnt; //eq指令发出的是第file_cnt个文件的参数,l0_drc.eq对应1;l0_msc.eq对应2...
  67. u16 eqlen; //EQSPFM指令包含的eq字节数计算公式为:16+27*n,n为eq文件中包含的滤波器个数
  68. u16 res2len; //res2中所有参数的总和,若无res2参数 则此值默认为0x420
  69. }rmk_cb_t;
  70. uint os_spiflash_read(void *buf, u32 addr, uint len);
  71. void os_spiflash_erase(u32 addr);
  72. void os_spiflash_program(void *buf, u32 addr, uint len);
  73. void copy_res2flash(void);
  74. #endif