Showing
14 changed files
with
456 additions
and
113 deletions
| ... | ... | @@ -360,3 +360,6 @@ upgrade_bin/binGenerationTools_for_USB_SD_Upgrade/usb_sd_upgrade_base_bin_201909 |
| 360 | 360 | upgrade_bin/binGenerationTools_for_USB_SD_Upgrade/usb_sd_upgrade_base_bin_20191120.zip |
| 361 | 361 | upgrade_bin/binGenerationTools_for_USB_SD_Upgrade/usb_sd_upgrade_base.bin |
| 362 | 362 | upgrade_bin/binGenerationTools_for_USB_SD_Upgrade/xt-objcopy.exe |
| 363 | +bin/Optek_HiFi3_prod/Debug/BlueSea_OPTEK_LINK_SDK | |
| 364 | +BlueSea_OPTEK_LINK_SDK.zip | |
| 365 | +.gitignore | ... | ... |
No preview for this file type
| ... | ... | @@ -219,8 +219,9 @@ lib/optek_lib_freeRTOS.a |
| 219 | 219 | /*lib/optek_lib_freeRTOS_Debug.a*/ |
| 220 | 220 | |
| 221 | 221 | |
| 222 | -lib/optek_link_5ms.a | |
| 222 | +/*lib/optek_link_5ms.a*/ | |
| 223 | 223 | /*lib/optek_link_5ms_for_swf.a*/ |
| 224 | +lib/optek_link_5ms_for_mic.a | |
| 224 | 225 | /* |
| 225 | 226 | lib/optek_link_7p5ms.a |
| 226 | 227 | */ | ... | ... |
link/lib/optek_link_5ms_for_mic.a
0 → 100644
No preview for this file type
| ... | ... | @@ -376,14 +376,29 @@ XA_ERRORCODE xa_lc3_dec_main_process_init(U32 bitrate,U16 samplerate,U8 channels |
| 376 | 376 | |
| 377 | 377 | if (app_main_data.share_link_role == SL_ROLE_MASTER) |
| 378 | 378 | { |
| 379 | - if (frame_Time_ms == 5.0) | |
| 380 | - #ifdef UPSTREAM_SAMPLERATE_48k | |
| 381 | - arg.enc_frame_bytes = 30; | |
| 382 | - #else | |
| 383 | - arg.enc_frame_bytes = 25; | |
| 384 | - #endif | |
| 385 | - else | |
| 386 | - arg.enc_frame_bytes = 37; | |
| 379 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 380 | + if (optek_link_mode == WIRELESS_MIC_PT2P5MS_T7R1 || optek_link_mode == WIRELESS_MIC_48K_PT2P5MS_T7R1M) | |
| 381 | + { | |
| 382 | + arg.enc_frame_bytes = 25; | |
| 383 | + } | |
| 384 | + else if (optek_link_mode == WIRELESS_MIC_PT2P5MS_LP) | |
| 385 | + { | |
| 386 | + arg.enc_frame_bytes = 25; | |
| 387 | + } | |
| 388 | + else | |
| 389 | + { | |
| 390 | + arg.enc_frame_bytes = 50; | |
| 391 | + } | |
| 392 | + #else | |
| 393 | + if (frame_Time_ms == 5.0) | |
| 394 | + #ifdef UPSTREAM_SAMPLERATE_48k | |
| 395 | + arg.enc_frame_bytes = 30; | |
| 396 | + #else | |
| 397 | + arg.enc_frame_bytes = 25; | |
| 398 | + #endif | |
| 399 | + else | |
| 400 | + arg.enc_frame_bytes = 37; | |
| 401 | + #endif | |
| 387 | 402 | |
| 388 | 403 | } |
| 389 | 404 | |
| ... | ... | @@ -775,6 +790,45 @@ void lc3_dec_main_process_init_for_master(void) |
| 775 | 790 | { |
| 776 | 791 | if(app_main_data.share_link_role == SL_ROLE_MASTER) |
| 777 | 792 | { |
| 793 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 794 | + if(app_main_data.share_link_role == SL_ROLE_MASTER) | |
| 795 | + { | |
| 796 | + U32 bitrate; | |
| 797 | + float ptms; | |
| 798 | + | |
| 799 | + if (optek_link_mode == WIRELESS_MIC_PT2P5MS_T7R1 || optek_link_mode == WIRELESS_MIC_48K_PT2P5MS_T7R1M) | |
| 800 | + { | |
| 801 | + app_main_data.playing_stream_chans = 1; | |
| 802 | + ptms = 2.5; | |
| 803 | + bitrate = 80000; | |
| 804 | + } | |
| 805 | + else if (optek_link_mode == WIRELESS_MIC_PT2P5MS_LP) | |
| 806 | + { | |
| 807 | + app_main_data.playing_stream_chans = 1; | |
| 808 | + ptms = 2.5; | |
| 809 | + bitrate = 96000; | |
| 810 | + } | |
| 811 | + else | |
| 812 | + { | |
| 813 | + ptms = 5.0; | |
| 814 | + if (optek_link_mode == WIRELESS_MIC_PT5MS_LP || optek_link_mode == WIRELESS_MIC_PT5MS_T10_R2_LP || optek_link_mode == WIRELESS_MIC_48K_PT5MS_T10_R2M_LP) | |
| 815 | + { | |
| 816 | + app_main_data.playing_stream_chans = 1; | |
| 817 | + bitrate = 80000; | |
| 818 | + } | |
| 819 | + else | |
| 820 | + { | |
| 821 | + app_main_data.playing_stream_chans = 2; | |
| 822 | + bitrate = 160000; | |
| 823 | + } | |
| 824 | + } | |
| 825 | + | |
| 826 | + if (xa_lc3_dec_main_process_init(bitrate,48000,1,ptms) != XA_NO_ERROR) | |
| 827 | + { | |
| 828 | + DBG_Printf("lc3 dec error!--\r\n"); | |
| 829 | + } | |
| 830 | + } | |
| 831 | + #else | |
| 778 | 832 | if (optek_link_mode == GAME_HEADPHONE_PT7P5MS_T7R3E || optek_link_mode == BC_SF48K_PT7P5MS) |
| 779 | 833 | { |
| 780 | 834 | if (xa_lc3_dec_main_process_init(39467,24000,1,7.5) != XA_NO_ERROR) |
| ... | ... | @@ -796,7 +850,7 @@ void lc3_dec_main_process_init_for_master(void) |
| 796 | 850 | } |
| 797 | 851 | #endif |
| 798 | 852 | } |
| 799 | - | |
| 853 | + #endif | |
| 800 | 854 | } |
| 801 | 855 | } |
| 802 | 856 | |
| ... | ... | @@ -888,7 +942,7 @@ XA_ERRORCODE xa_lc3_dec_frame (U8 **pout_buf, U16 *out_byte_len) |
| 888 | 942 | lost_cnt = 0; |
| 889 | 943 | nedd_decode_frames = master_rev_flag-1; |
| 890 | 944 | master_rev_flag = 0; |
| 891 | - memcpy(inp_buf,rx_data_buf,nBytes*2); | |
| 945 | + memcpy(inp_buf,rx_data_buf,nBytes+nBytes*nedd_decode_frames); | |
| 892 | 946 | } |
| 893 | 947 | else |
| 894 | 948 | { | ... | ... |
| ... | ... | @@ -712,6 +712,8 @@ void app_nav_rmt_convert_aux(void) |
| 712 | 712 | #endif |
| 713 | 713 | #elif defined OPL_MODE_SWF |
| 714 | 714 | app_change_mode_req(SUBW_SF48K_PT2P5MS,24,6); |
| 715 | + #elif defined OPL_MODE_WIRELESS_MIC | |
| 716 | + app_change_mode_req(WIRELESS_MIC_48K_PT5MS_T10_R2M_LP,OPTEK_LINK_MASTER_NO_RX_LEN,50); | |
| 715 | 717 | #endif |
| 716 | 718 | |
| 717 | 719 | app_timer_window_time_set(0); | ... | ... |
| ... | ... | @@ -190,7 +190,10 @@ void app_nav_rmt_convert_bt_hci(void) |
| 190 | 190 | { |
| 191 | 191 | #if (defined OPL_MODE_TWO_WAY || defined OPL_MODE_SINGLE_WAY) |
| 192 | 192 | uDecSend(DECODE_SET,DECODE_LC3); |
| 193 | -#else | |
| 193 | +#elif defined OPL_MODE_WIRELESS_MIC | |
| 194 | + uDecSend (DECODE_INIT, 0); | |
| 195 | + uDecSend(DECODE_SET,DECODE_PCM); | |
| 196 | +#else | |
| 194 | 197 | uDecSend(DECODE_SET,DECODE_PCM_DOWNSAMPLE); |
| 195 | 198 | #endif |
| 196 | 199 | } | ... | ... |
| ... | ... | @@ -405,7 +405,7 @@ void app_dac_receive_pcm_enable(U8 con) |
| 405 | 405 | if (optek_link_mode == GAME_HEADPHONE_PT7P5MS_T7R3E || optek_link_mode == BC_SF48K_PT7P5MS) |
| 406 | 406 | DMA_Channel2_Init(pDmaDest, pDmaSrc, 16*11+48, DmaSel); |
| 407 | 407 | else |
| 408 | - DMA_Channel2_Init(pDmaDest, pDmaSrc, 16*7+48, DmaSel); | |
| 408 | + DMA_Channel2_Init(pDmaDest, pDmaSrc, 16*6+48, DmaSel); | |
| 409 | 409 | #endif |
| 410 | 410 | } |
| 411 | 411 | } |
| ... | ... | @@ -436,6 +436,7 @@ void Dma_0_TransmitIsr(void) |
| 436 | 436 | U16 len; |
| 437 | 437 | int *pBuf,i; |
| 438 | 438 | |
| 439 | + #ifndef OPL_MODE_WIRELESS_MIC | |
| 439 | 440 | if (app_main_data.share_link_role == SL_ROLE_SLAVE) |
| 440 | 441 | { |
| 441 | 442 | DMA_8_COUNT = 0; |
| ... | ... | @@ -446,6 +447,7 @@ void Dma_0_TransmitIsr(void) |
| 446 | 447 | DMA_8_COUNT = DMA_UNDERFLOW_DELAY_COUNT; |
| 447 | 448 | } |
| 448 | 449 | else |
| 450 | + #endif | |
| 449 | 451 | { |
| 450 | 452 | //if (decode_type == DECODE_PCM || app_main_data.share_link_role != SL_ROLE_BT) |
| 451 | 453 | // return; | ... | ... |
| ... | ... | @@ -381,6 +381,8 @@ u8 bt_flash_get_multiroom_role (void); |
| 381 | 381 | app_change_mode_req(TEST_MODE,MASTER_MAX_TX_LEN,SLAVE_MAX_TX_LEN); |
| 382 | 382 | #elif defined OPL_MODE_SWF |
| 383 | 383 | app_change_mode_req(SUBW_SF48K_PT2P5MS,24,6); |
| 384 | + #elif defined OPL_MODE_WIRELESS_MIC | |
| 385 | + app_change_mode_req(WIRELESS_MIC_48K_PT5MS_T10_R2M_LP,OPTEK_LINK_MASTER_NO_RX_LEN,50); | |
| 384 | 386 | #endif |
| 385 | 387 | } |
| 386 | 388 | else | ... | ... |
| ... | ... | @@ -130,12 +130,33 @@ int pcm_dec_decode_frame(U8 **pout,U16 *plen) |
| 130 | 130 | U8 *p; |
| 131 | 131 | U16 size,i; |
| 132 | 132 | |
| 133 | - #ifdef LC3_ENCODE_ENABLE | |
| 134 | - int app_lc3_part_encoding_code_text_copy(void); | |
| 135 | - app_lc3_part_encoding_code_text_copy(); | |
| 133 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 134 | + if(app_main_data.share_link_role == SL_ROLE_SLAVE) | |
| 135 | + { | |
| 136 | + #ifdef LC3_ENCODE_ENABLE | |
| 137 | + int app_lc3_part_encoding_code_text_copy(void); | |
| 138 | + app_lc3_part_encoding_code_text_copy(); | |
| 139 | + #endif | |
| 140 | + } | |
| 141 | + #else | |
| 142 | + #ifdef LC3_ENCODE_ENABLE | |
| 143 | + int app_lc3_part_encoding_code_text_copy(void); | |
| 144 | + app_lc3_part_encoding_code_text_copy(); | |
| 145 | + #endif | |
| 136 | 146 | #endif |
| 137 | 147 | |
| 138 | - p = wait_decode_data(); | |
| 148 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 149 | + if(app_main_data.share_link_role == SL_ROLE_SLAVE) | |
| 150 | + { | |
| 151 | + p = wait_decode_data(); | |
| 152 | + } | |
| 153 | + else | |
| 154 | + { | |
| 155 | + p = NULL; | |
| 156 | + } | |
| 157 | + #else | |
| 158 | + p = wait_decode_data(); | |
| 159 | + #endif | |
| 139 | 160 | |
| 140 | 161 | if (discard_frame_cnt) |
| 141 | 162 | { |
| ... | ... | @@ -1348,6 +1369,8 @@ void taskDec(void *pvParameters) |
| 1348 | 1369 | dec_frame_size = 240*4; |
| 1349 | 1370 | #elif defined OPL_MODE_SINGLE_WAY |
| 1350 | 1371 | dec_frame_size = 240*4; |
| 1372 | + #elif defined OPL_MODE_WIRELESS_MIC | |
| 1373 | + dec_frame_size = 240*4; | |
| 1351 | 1374 | #else |
| 1352 | 1375 | dec_frame_size = 120*4; |
| 1353 | 1376 | #endif |
| ... | ... | @@ -1375,12 +1398,22 @@ void taskDec(void *pvParameters) |
| 1375 | 1398 | } |
| 1376 | 1399 | #endif |
| 1377 | 1400 | |
| 1378 | - #ifdef LC3_DECODE_ENABLE | |
| 1379 | - if ((optek_link_mode == GAME_HEADPHONE_PT_5MS_LP || optek_link_mode == GAME_HEADPHONE_PT7P5MS_T7R3E)||(app_main_data.share_link_role == SL_ROLE_SLAVE)) | |
| 1380 | - { | |
| 1381 | - int app_lc3_decoding_code_text_copy(void); | |
| 1382 | - app_lc3_decoding_code_text_copy(); | |
| 1383 | - } | |
| 1401 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 1402 | + #ifdef LC3_DECODE_ENABLE | |
| 1403 | + if (app_main_data.share_link_role == SL_ROLE_MASTER) | |
| 1404 | + { | |
| 1405 | + int app_lc3_decoding_code_text_copy(void); | |
| 1406 | + app_lc3_decoding_code_text_copy(); | |
| 1407 | + } | |
| 1408 | + #endif | |
| 1409 | + #else | |
| 1410 | + #ifdef LC3_DECODE_ENABLE | |
| 1411 | + if ((optek_link_mode == GAME_HEADPHONE_PT_5MS_LP || optek_link_mode == GAME_HEADPHONE_PT7P5MS_T7R3E)||(app_main_data.share_link_role == SL_ROLE_SLAVE)) | |
| 1412 | + { | |
| 1413 | + int app_lc3_decoding_code_text_copy(void); | |
| 1414 | + app_lc3_decoding_code_text_copy(); | |
| 1415 | + } | |
| 1416 | + #endif | |
| 1384 | 1417 | #endif |
| 1385 | 1418 | } |
| 1386 | 1419 | #endif |
| ... | ... | @@ -1583,29 +1616,78 @@ void taskDec(void *pvParameters) |
| 1583 | 1616 | continue; |
| 1584 | 1617 | } |
| 1585 | 1618 | |
| 1586 | - #if (defined OPL_MASTER_ENABLE) | |
| 1587 | - if(app_main_data.share_link_role == SL_ROLE_MASTER) | |
| 1588 | - { | |
| 1589 | - #ifdef LC3_ENCODE_ENABLE | |
| 1590 | - int app_lc3_part_encoding_code_text_copy(void); | |
| 1591 | - app_lc3_part_encoding_code_text_copy(); | |
| 1592 | - #endif | |
| 1619 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 1620 | + if(app_main_data.share_link_role == SL_ROLE_SLAVE) | |
| 1621 | + { | |
| 1622 | + #ifdef LC3_ENCODE_ENABLE | |
| 1623 | + int app_lc3_part_encoding_code_text_copy(void); | |
| 1624 | + app_lc3_part_encoding_code_text_copy(); | |
| 1625 | + #endif | |
| 1626 | + | |
| 1627 | + //optek_hifi2_24b_to_16b(pDacbuf,pDacbuf,(samples<<1)); | |
| 1628 | + if (decode_type == DECODE_PCM) | |
| 1629 | + csbm_put_tx_unencoded_data(pOut,AD_PCM_BLOCK_SIZE); | |
| 1630 | + else | |
| 1631 | + csbm_put_tx_unencoded_data(pOut,len); | |
| 1593 | 1632 | |
| 1594 | - //optek_hifi2_24b_to_16b(pDacbuf,pDacbuf,(samples<<1)); | |
| 1595 | - if (decode_type == DECODE_PCM) | |
| 1596 | - csbm_put_tx_unencoded_data(pOut,AD_PCM_BLOCK_SIZE); | |
| 1633 | + #if 0//(SHARE_LINK_MODE != SL_TWO_WAY_AV && SHARE_LINK_MODE != SL_TWO_WAY_VV) | |
| 1634 | + fifo_put_data(&audio_delay_fifo,pDacbuf,samples<<2); | |
| 1635 | + fifo_get_data(&audio_delay_fifo,pDacbuf,samples<<2); | |
| 1636 | + #endif | |
| 1637 | + | |
| 1638 | + //optek_hifi2_16b_to_24b(pDacbuf,pDacbuf,(samples<<1)); | |
| 1639 | + } | |
| 1597 | 1640 | else |
| 1598 | - csbm_put_tx_unencoded_data(pOut,len); | |
| 1641 | + { | |
| 1642 | + if (app_main_data.share_link_role == SL_ROLE_MASTER) | |
| 1643 | + { | |
| 1644 | + U16 dec_len; | |
| 1645 | + //if (master_rev_flag) | |
| 1646 | + { | |
| 1647 | + | |
| 1648 | + xa_lc3_dec_frame(&pOut_up,&dec_len); | |
| 1599 | 1649 | |
| 1600 | - #if 0//(SHARE_LINK_MODE != SL_TWO_WAY_AV && SHARE_LINK_MODE != SL_TWO_WAY_VV) | |
| 1601 | - fifo_put_data(&audio_delay_fifo,pDacbuf,samples<<2); | |
| 1602 | - fifo_get_data(&audio_delay_fifo,pDacbuf,samples<<2); | |
| 1650 | + if (dec_len == 0) | |
| 1651 | + { | |
| 1652 | + dec_len = len; | |
| 1653 | + | |
| 1654 | + memset(pOut_up,0,dec_len); | |
| 1655 | + } | |
| 1656 | + | |
| 1657 | + //master_rev_flag = 0xff; | |
| 1658 | + if (fifo_put_data(&AdcInFifo, pOut_up,dec_len) != dec_len) | |
| 1659 | + { | |
| 1660 | + //DBG_Printf("usbdev upstream overflow\r\n"); | |
| 1661 | + } | |
| 1662 | + } | |
| 1663 | + } | |
| 1664 | + } | |
| 1665 | + #else | |
| 1666 | + #if (defined OPL_MASTER_ENABLE) | |
| 1667 | + if(app_main_data.share_link_role == SL_ROLE_MASTER) | |
| 1668 | + { | |
| 1669 | + #ifdef LC3_ENCODE_ENABLE | |
| 1670 | + int app_lc3_part_encoding_code_text_copy(void); | |
| 1671 | + app_lc3_part_encoding_code_text_copy(); | |
| 1672 | + #endif | |
| 1673 | + | |
| 1674 | + //optek_hifi2_24b_to_16b(pDacbuf,pDacbuf,(samples<<1)); | |
| 1675 | + if (decode_type == DECODE_PCM) | |
| 1676 | + csbm_put_tx_unencoded_data(pOut,AD_PCM_BLOCK_SIZE); | |
| 1677 | + else | |
| 1678 | + csbm_put_tx_unencoded_data(pOut,len); | |
| 1679 | + | |
| 1680 | + #if 0//(SHARE_LINK_MODE != SL_TWO_WAY_AV && SHARE_LINK_MODE != SL_TWO_WAY_VV) | |
| 1681 | + fifo_put_data(&audio_delay_fifo,pDacbuf,samples<<2); | |
| 1682 | + fifo_get_data(&audio_delay_fifo,pDacbuf,samples<<2); | |
| 1683 | + #endif | |
| 1684 | + | |
| 1685 | + //optek_hifi2_16b_to_24b(pDacbuf,pDacbuf,(samples<<1)); | |
| 1686 | + } | |
| 1603 | 1687 | #endif |
| 1604 | - | |
| 1605 | - //optek_hifi2_16b_to_24b(pDacbuf,pDacbuf,(samples<<1)); | |
| 1606 | - } | |
| 1607 | 1688 | #endif |
| 1608 | - | |
| 1689 | + //DBG_PIN_HIGH; | |
| 1690 | + //DBG_PIN_LOW; | |
| 1609 | 1691 | if (pOut_up != NULL) |
| 1610 | 1692 | { |
| 1611 | 1693 | app_main_data.playing_stream_chans = 1; |
| ... | ... | @@ -2020,4 +2102,5 @@ U8* wait_decode_event(void) |
| 2020 | 2102 | void set_dac_out_size(U16 size) |
| 2021 | 2103 | { |
| 2022 | 2104 | awOut_contrls.awSize = size>>2; |
| 2105 | + //DBG_Printf("size:%d,chan:%d\r\n",awOut_contrls.awSize,app_main_data.playing_stream_chans); | |
| 2023 | 2106 | } | ... | ... |
| ... | ... | @@ -102,13 +102,14 @@ extern U16 dec_frame_size; |
| 102 | 102 | #define SAMPLES2DMACOUNT(xSamples) (xSamples) |
| 103 | 103 | #endif |
| 104 | 104 | |
| 105 | -#if (defined OPL_MODE_TWO_WAY || defined OPL_MODE_SINGLE_WAY) | |
| 105 | +#if (defined OPL_MODE_TWO_WAY || defined OPL_MODE_SINGLE_WAY || defined OPL_MODE_WIRELESS_MIC) | |
| 106 | 106 | #define TRANS_PART1_SAMPLES 160 |
| 107 | 107 | #define TRANS_PART2_SAMPLES 80 |
| 108 | 108 | #else |
| 109 | 109 | #define TRANS_PART1_SAMPLES 80 |
| 110 | 110 | #define TRANS_PART2_SAMPLES 40 |
| 111 | 111 | #endif |
| 112 | + | |
| 112 | 113 | #define TRANS_PART1_COUNT SAMPLES2DMACOUNT(TRANS_PART1_SAMPLES) |
| 113 | 114 | #define TRANS_PART2_COUNT SAMPLES2DMACOUNT(TRANS_PART2_SAMPLES) |
| 114 | 115 | ... | ... |
| ... | ... | @@ -122,7 +122,7 @@ |
| 122 | 122 | #define BT_PA_ENABLE |
| 123 | 123 | |
| 124 | 124 | /***********************OPTEK LINK 2.0******************************/ |
| 125 | -//#define OPTEK_LINK_ENABLE | |
| 125 | +#define OPTEK_LINK_ENABLE | |
| 126 | 126 | |
| 127 | 127 | #ifdef OPTEK_LINK_ENABLE |
| 128 | 128 | |
| ... | ... | @@ -131,20 +131,25 @@ |
| 131 | 131 | |
| 132 | 132 | /*********Choose one*************/ |
| 133 | 133 | //#define OPL_MODE_SINGLE_WAY // use optek link lib:optek_link_5ms.a |
| 134 | -#define OPL_MODE_TWO_WAY // use optek link lib:optek_link_5ms.a | |
| 134 | +//#define OPL_MODE_TWO_WAY // use optek link lib:optek_link_5ms.a | |
| 135 | 135 | //#define OPL_MODE_SWF // use optek link lib:optek_link_5ms_for_swf.a |
| 136 | +#define OPL_MODE_WIRELESS_MIC // use optek link lib:optek_link_5ms_for_mic.a | |
| 136 | 137 | |
| 137 | 138 | #ifdef OPL_MODE_TWO_WAY |
| 138 | 139 | #define UPSTREAM_SAMPLERATE_48k |
| 139 | 140 | #endif |
| 140 | 141 | |
| 141 | -#if (defined OPL_MODE_TWO_WAY || (defined OPL_MODE_SINGLE_WAY && defined OPL_MASTER_ENABLE)) | |
| 142 | +#if ((defined OPL_MODE_TWO_WAY) || \ | |
| 143 | + (defined OPL_MODE_SINGLE_WAY && defined OPL_MASTER_ENABLE)||\ | |
| 144 | + (defined OPL_MODE_WIRELESS_MIC && defined OPL_SLAVE_ENBALE)) | |
| 142 | 145 | #define LC3_ENCODE_ENABLE |
| 143 | 146 | #endif |
| 144 | 147 | |
| 145 | -#if defined OPL_MODE_TWO_WAY || (defined OPL_MODE_SINGLE_WAY && defined OPL_SLAVE_ENBALE) | |
| 148 | +#if ((defined OPL_MODE_TWO_WAY) ||\ | |
| 149 | + (defined OPL_MODE_SINGLE_WAY && defined OPL_SLAVE_ENBALE)||\ | |
| 150 | + (defined OPL_MODE_WIRELESS_MIC && defined OPL_MASTER_ENABLE)) | |
| 146 | 151 | #define LC3_DECODE_ENABLE |
| 147 | -#define LC3_ENCODE_ENABLE | |
| 152 | +//#define LC3_ENCODE_ENABLE | |
| 148 | 153 | #endif |
| 149 | 154 | |
| 150 | 155 | #endif | ... | ... |
| ... | ... | @@ -176,6 +176,7 @@ void csbm_tx_init(U16 sample_rate,U8 bt_src) |
| 176 | 176 | bc_tx_data.last_tx_len = 0; |
| 177 | 177 | |
| 178 | 178 | #ifdef OPL_SLAVE_ENBALE |
| 179 | + #ifndef OPL_MODE_WIRELESS_MIC | |
| 179 | 180 | if (app_main_data.share_link_role == SL_ROLE_SLAVE) |
| 180 | 181 | { |
| 181 | 182 | #ifdef OPL_MODE_TWO_WAY |
| ... | ... | @@ -215,6 +216,7 @@ void csbm_tx_init(U16 sample_rate,U8 bt_src) |
| 215 | 216 | |
| 216 | 217 | return; |
| 217 | 218 | } |
| 219 | + #endif | |
| 218 | 220 | #endif |
| 219 | 221 | |
| 220 | 222 | spk_out_sync_w_tx_status = SPK_AND_TX_NOTSYNC; |
| ... | ... | @@ -278,6 +280,43 @@ extern FIFO audio_delay_fifo; |
| 278 | 280 | } |
| 279 | 281 | } |
| 280 | 282 | |
| 283 | + #elif defined OPL_MODE_WIRELESS_MIC | |
| 284 | + | |
| 285 | + if (app_main_data.share_link_role == SL_ROLE_SLAVE) | |
| 286 | + { | |
| 287 | + XA_ERRORCODE xa_lc3_enc_main_init(U32 bitrate,U16 samplerate,U8 channels,float frame_Time_ms); | |
| 288 | + | |
| 289 | + float ptms; | |
| 290 | + int bitrate; | |
| 291 | + | |
| 292 | + if (optek_link_mode == WIRELESS_MIC_PT2P5MS_T7R1 || optek_link_mode == WIRELESS_MIC_48K_PT2P5MS_T7R1M) | |
| 293 | + { | |
| 294 | + ptms = 2.5; | |
| 295 | + bitrate = 80000; | |
| 296 | + } | |
| 297 | + else if (optek_link_mode == WIRELESS_MIC_PT2P5MS_LP) | |
| 298 | + { | |
| 299 | + ptms = 2.5; | |
| 300 | + bitrate = 96000; | |
| 301 | + } | |
| 302 | + else if (optek_link_mode == WIRELESS_MIC_PT5MS_LP || optek_link_mode == WIRELESS_MIC_PT5MS_T10_R2_LP || optek_link_mode == WIRELESS_MIC_48K_PT5MS_T10_R2M_LP) | |
| 303 | + { | |
| 304 | + ptms = 5; | |
| 305 | + bitrate = 80000; | |
| 306 | + } | |
| 307 | + else | |
| 308 | + { | |
| 309 | + ptms = 2.5; | |
| 310 | + bitrate = 96000; | |
| 311 | + } | |
| 312 | + | |
| 313 | + if (xa_lc3_enc_main_init(bitrate,sample_rate,1,ptms) != XA_NO_ERROR) | |
| 314 | + { | |
| 315 | + DBG_Printf("lc3 enc init error\n\r"); | |
| 316 | + } | |
| 317 | + | |
| 318 | + spk_out_sync_w_tx_status = SPK_AND_TX_SYNCING; | |
| 319 | + } | |
| 281 | 320 | #endif |
| 282 | 321 | |
| 283 | 322 | #ifdef OPL_MODE_TWO_WAY |
| ... | ... | @@ -285,8 +324,9 @@ extern FIFO audio_delay_fifo; |
| 285 | 324 | if (upStreamHandle == NULL) { |
| 286 | 325 | DBG_Assert(FALSE); |
| 287 | 326 | } |
| 327 | + #endif | |
| 288 | 328 | |
| 289 | - | |
| 329 | + #if (defined OPL_MODE_TWO_WAY || defined OPL_MODE_WIRELESS_MIC) | |
| 290 | 330 | lc3_dec_main_process_init_for_master(); |
| 291 | 331 | #endif |
| 292 | 332 | |
| ... | ... | @@ -406,10 +446,10 @@ void csbm_put_tx_unencoded_data(short *ptr,U16 len) |
| 406 | 446 | int xa_lc3_enc_frame(U16 *pInBuf, U32 samples, U8 **pOutBuf, U32 *pOutDataLen); |
| 407 | 447 | U8 *plc3; |
| 408 | 448 | |
| 409 | - #ifdef OPL_MODE_TWO_WAY | |
| 449 | + | |
| 410 | 450 | if (app_main_data.share_link_role == SL_ROLE_SLAVE) |
| 411 | 451 | { |
| 412 | - | |
| 452 | + #ifdef OPL_MODE_TWO_WAY | |
| 413 | 453 | //first step 48K to 24K |
| 414 | 454 | short *pIn = ptr; |
| 415 | 455 | short *pOut = ptr; |
| ... | ... | @@ -456,11 +496,30 @@ void csbm_put_tx_unencoded_data(short *ptr,U16 len) |
| 456 | 496 | bc_tx_data.cur_data_len = pOutDataLen; |
| 457 | 497 | } |
| 458 | 498 | } |
| 499 | + #elif defined OPL_MODE_WIRELESS_MIC | |
| 500 | + | |
| 501 | + short *pIn = ptr; | |
| 502 | + short *pOut = ptr; | |
| 503 | + | |
| 504 | + pIn += 1; | |
| 505 | + | |
| 506 | + len >>= 2; | |
| 507 | + | |
| 508 | + for (i=0;i<len;i++) | |
| 509 | + { | |
| 510 | + *pOut++ = *pIn; | |
| 511 | + pIn += 2; | |
| 512 | + } | |
| 513 | + xa_lc3_enc_frame(ptr,len,&plc3,&pOutDataLen); | |
| 514 | + memcpy(bc_tx_data.tx_data,plc3,pOutDataLen); | |
| 515 | + bc_tx_data.tx_len = pOutDataLen; | |
| 516 | + memset(ptr,0,len<<2);//mute local output | |
| 517 | + #endif | |
| 459 | 518 | } |
| 460 | 519 | else |
| 461 | - #endif | |
| 462 | 520 | { |
| 463 | - #if (defined OPL_MODE_TWO_WAY || defined OPL_MODE_SINGLE_WAY) | |
| 521 | + #if (defined OPL_MODE_TWO_WAY || (defined OPL_MODE_SINGLE_WAY && defined OPL_MASTER_ENABLE)) | |
| 522 | + | |
| 464 | 523 | xa_lc3_enc_frame(ptr,len>>2,&plc3,&pOutDataLen); |
| 465 | 524 | memcpy(bc_tx_data.tx_data,plc3,pOutDataLen); |
| 466 | 525 | bc_tx_data.tx_len = pOutDataLen; |
| ... | ... | @@ -647,13 +706,18 @@ void optek_link_rx_cb(u8 *buf, u16 len, u8 bc_index, u16 pt_end_time, u8 role, u |
| 647 | 706 | // key_value = buf[len-1]; |
| 648 | 707 | |
| 649 | 708 | memcpy(rx_data_buf,buf,len); |
| 650 | - master_rev_flag = 2; | |
| 709 | + | |
| 710 | + if (optek_link_mode == GAME_HEADPHONE_PT7P5MS_T7R3E || optek_link_mode == GAME_HEADPHONE_PT7P5MS_T7R3E) | |
| 711 | + master_rev_flag = 2; | |
| 712 | + else | |
| 713 | + master_rev_flag = 1; | |
| 651 | 714 | } |
| 652 | 715 | else |
| 653 | 716 | { |
| 654 | 717 | |
| 655 | 718 | //DBG_Printf("len:%d,%d,%d\r",len,bc_index,pt_end_time); |
| 656 | 719 | |
| 720 | + //if ((len <= 20)||(optek_link_mode == BC_UNKNOWN_MODE)) | |
| 657 | 721 | if (len <= 20) |
| 658 | 722 | return; |
| 659 | 723 | |
| ... | ... | @@ -766,81 +830,129 @@ void optek_link_slave_rx_end_cb(u8*buf, u16 len, u8 id) |
| 766 | 830 | } |
| 767 | 831 | */ |
| 768 | 832 | |
| 769 | - U32 dma0_count = DMA_0_COUNT; | |
| 770 | - U32 dma8_count = DMA_8_COUNT; | |
| 771 | - U16 ready_tx_size = awOut_contrls.awSize; | |
| 772 | - if (app_main_data.playing_stream_status == STREAM_DEC_SYNC_WAIT) | |
| 833 | + if (app_main_data.share_link_role == SL_ROLE_MASTER) | |
| 773 | 834 | { |
| 774 | - if (adj_outsamples == 0) | |
| 835 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 836 | + /**************for sync********************/ | |
| 837 | + if (spk_out_sync_w_tx_status == SPK_AND_TX_SYNCING) | |
| 775 | 838 | { |
| 776 | - i32 out_dma_cnt; | |
| 777 | - | |
| 778 | - if (dma0_count == 0) | |
| 779 | - { | |
| 780 | - out_dma_cnt = 2 - (((dma8_count + TRANS_PART1_COUNT)>>1)); | |
| 781 | - } | |
| 782 | - else if (dma8_count > (TRANS_PART1_COUNT + TRANS_PART2_COUNT)) | |
| 783 | - { | |
| 784 | - out_dma_cnt = 2 - (i32)(((i32)dma0_count + (i32)(DMA_UNDERFLOW_DELAY_COUNT - TRANS_PART2_COUNT))/2); | |
| 785 | - } | |
| 786 | - else | |
| 839 | + //app_dac_receive_pcm_enable(FALSE); | |
| 840 | + spk_out_sync_w_tx_status = SPK_AND_TX_SYNCING_STEP2; | |
| 841 | + } | |
| 842 | + else if (spk_out_sync_w_tx_status == SPK_AND_TX_SYNCING_STEP2) | |
| 843 | + { | |
| 844 | + U32 dma0_count = DMA_0_COUNT; | |
| 845 | + | |
| 846 | + if (adj_outsamples == 0) | |
| 787 | 847 | { |
| 788 | - out_dma_cnt = 2 - (dma8_count>>1); | |
| 789 | - } | |
| 848 | + i32 out_dma_cnt; | |
| 790 | 849 | |
| 791 | - //if (ready_tx_size != TRANS_PART2_COUNT) | |
| 792 | - // out_dma_cnt -= TRANS_PART1_SAMPLES; | |
| 850 | + out_dma_cnt = 2 - (dma0_count>>1); | |
| 793 | 851 | |
| 794 | - //if ((out_dma_cnt < -1) || (out_dma_cnt > 1)) | |
| 795 | - if (out_dma_cnt == 0) | |
| 796 | - { | |
| 797 | - app_main_data.playing_stream_status = STREAM_DEC_REV_WAIT; | |
| 798 | - } | |
| 799 | - else | |
| 800 | - { | |
| 801 | - adj_outsamples = out_dma_cnt; | |
| 802 | - //DBG_Printf("req adj:%d,%d,%d\r\n",adj_outsamples,dma0_count,dma8_count); | |
| 852 | + //if ((out_dma_cnt < -1) || (out_dma_cnt > 1)) | |
| 853 | + if (out_dma_cnt == 0) | |
| 854 | + { | |
| 855 | + spk_out_sync_w_tx_status = SPK_AND_TX_SYNCING_STEP3; | |
| 856 | + } | |
| 857 | + else | |
| 858 | + { | |
| 859 | + adj_outsamples = out_dma_cnt; | |
| 860 | + //DBG_Printf("req adj:%d,%d,%d\r\n",adj_outsamples,dma0_count,dma8_count); | |
| 861 | + } | |
| 803 | 862 | } |
| 804 | 863 | |
| 805 | 864 | } |
| 806 | - } | |
| 807 | - else if (app_main_data.playing_stream_status == STREAM_DEC_START_WAIT) | |
| 808 | - { | |
| 809 | - if (AUDIO_FIFO_STREAM_DATA_LEN() > 0) | |
| 810 | - { | |
| 811 | - rx_lost_count = 0; | |
| 812 | - if (optek_link_mode == GAME_HEADPHONE_PT7P5MS_T7R3E || optek_link_mode == GAME_HEADPHONE_PT_5MS_LP) | |
| 813 | - app_dac_receive_pcm_enable(TRUE); | |
| 814 | - | |
| 815 | - csb_rx_count = (10000/5); | |
| 816 | - //AUDIO_FIFO_STREAM_DISCARD_ALL_DATA(); | |
| 817 | - //AUDIO_FIFO_STREAM_PUT_DATA(buf, len); | |
| 818 | - uiDecSend(DECODE_FRAME,FALSE); | |
| 819 | - app_main_data.playing_stream_status = STREAM_MEDIA; | |
| 820 | - first_dma_count = 0xffffffff; | |
| 821 | - frame_count = 0; | |
| 822 | - diff_sample = 0; | |
| 865 | + else if (spk_out_sync_w_tx_status == SPK_AND_TX_SYNCING_STEP3) | |
| 866 | + { | |
| 867 | + //app_dac_receive_pcm_enable(TRUE); | |
| 868 | + spk_out_sync_w_tx_status = SPK_AND_TX_SYNCED; | |
| 869 | + uiDecSend (DECODE_FRAME, FALSE); | |
| 823 | 870 | } |
| 871 | + #endif | |
| 824 | 872 | } |
| 825 | 873 | else |
| 826 | 874 | { |
| 827 | - if (dma0_count == 0) | |
| 875 | + #ifndef OPL_MODE_WIRELESS_MIC | |
| 876 | + U32 dma0_count = DMA_0_COUNT; | |
| 877 | + U32 dma8_count = DMA_8_COUNT; | |
| 878 | + U16 ready_tx_size = awOut_contrls.awSize; | |
| 879 | + if (app_main_data.playing_stream_status == STREAM_DEC_SYNC_WAIT) | |
| 828 | 880 | { |
| 829 | - diff_sample = ((dma8_count + TRANS_PART1_COUNT)>>1) - 2; | |
| 830 | - } | |
| 831 | - else if (dma8_count > (TRANS_PART1_COUNT + TRANS_PART2_COUNT)) | |
| 881 | + if (adj_outsamples == 0) | |
| 882 | + { | |
| 883 | + i32 out_dma_cnt; | |
| 884 | + | |
| 885 | + if (dma0_count == 0) | |
| 886 | + { | |
| 887 | + out_dma_cnt = 2 - (((dma8_count + TRANS_PART1_COUNT)>>1)); | |
| 888 | + } | |
| 889 | + else if (dma8_count > (TRANS_PART1_COUNT + TRANS_PART2_COUNT)) | |
| 890 | + { | |
| 891 | + out_dma_cnt = 2 - (i32)(((i32)dma0_count + (i32)(DMA_UNDERFLOW_DELAY_COUNT - TRANS_PART2_COUNT))/2); | |
| 892 | + } | |
| 893 | + else | |
| 894 | + { | |
| 895 | + out_dma_cnt = 2 - (dma8_count>>1); | |
| 896 | + } | |
| 897 | + | |
| 898 | + //if (ready_tx_size != TRANS_PART2_COUNT) | |
| 899 | + // out_dma_cnt -= TRANS_PART1_SAMPLES; | |
| 900 | + | |
| 901 | + //if ((out_dma_cnt < -1) || (out_dma_cnt > 1)) | |
| 902 | + if (out_dma_cnt == 0) | |
| 903 | + { | |
| 904 | + app_main_data.playing_stream_status = STREAM_DEC_REV_WAIT; | |
| 905 | + } | |
| 906 | + else | |
| 907 | + { | |
| 908 | + adj_outsamples = out_dma_cnt; | |
| 909 | + //DBG_Printf("req adj:%d,%d,%d\r\n",adj_outsamples,dma0_count,dma8_count); | |
| 910 | + } | |
| 911 | + | |
| 912 | + } | |
| 913 | + } | |
| 914 | + else if (app_main_data.playing_stream_status == STREAM_DEC_START_WAIT) | |
| 832 | 915 | { |
| 833 | - diff_sample = (i32)(((i32)dma0_count + (i32)(DMA_UNDERFLOW_DELAY_COUNT - TRANS_PART2_COUNT))/2) - 2; | |
| 916 | + if (AUDIO_FIFO_STREAM_DATA_LEN() > 0) | |
| 917 | + { | |
| 918 | + rx_lost_count = 0; | |
| 919 | + if (optek_link_mode == GAME_HEADPHONE_PT7P5MS_T7R3E || optek_link_mode == GAME_HEADPHONE_PT_5MS_LP) | |
| 920 | + app_dac_receive_pcm_enable(TRUE); | |
| 921 | + | |
| 922 | + csb_rx_count = (10000/5); | |
| 923 | + //AUDIO_FIFO_STREAM_DISCARD_ALL_DATA(); | |
| 924 | + //AUDIO_FIFO_STREAM_PUT_DATA(buf, len); | |
| 925 | + uiDecSend(DECODE_FRAME,FALSE); | |
| 926 | + app_main_data.playing_stream_status = STREAM_MEDIA; | |
| 927 | + first_dma_count = 0xffffffff; | |
| 928 | + frame_count = 0; | |
| 929 | + diff_sample = 0; | |
| 930 | + } | |
| 834 | 931 | } |
| 835 | 932 | else |
| 836 | 933 | { |
| 837 | - diff_sample = (dma8_count>>1) - 2; | |
| 838 | - } | |
| 934 | + if (dma0_count == 0) | |
| 935 | + { | |
| 936 | + diff_sample = ((dma8_count + TRANS_PART1_COUNT)>>1) - 2; | |
| 937 | + } | |
| 938 | + else if (dma8_count > (TRANS_PART1_COUNT + TRANS_PART2_COUNT)) | |
| 939 | + { | |
| 940 | + diff_sample = (i32)(((i32)dma0_count + (i32)(DMA_UNDERFLOW_DELAY_COUNT - TRANS_PART2_COUNT))/2) - 2; | |
| 941 | + } | |
| 942 | + else | |
| 943 | + { | |
| 944 | + diff_sample = (dma8_count>>1) - 2; | |
| 945 | + } | |
| 839 | 946 | |
| 840 | - //if (ready_tx_size != TRANS_PART2_COUNT) | |
| 841 | - // diff_sample += TRANS_PART1_SAMPLES; | |
| 947 | + //if (ready_tx_size != TRANS_PART2_COUNT) | |
| 948 | + // diff_sample += TRANS_PART1_SAMPLES; | |
| 842 | 949 | |
| 950 | + } | |
| 951 | + #endif | |
| 843 | 952 | } |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 844 | 956 | //DBG_PIN_HIGH; |
| 845 | 957 | //DBG_PIN_LOW; |
| 846 | 958 | //SOFT3_INT_SET; |
| ... | ... | @@ -878,9 +990,14 @@ u8 optek_link_tx_data_len(u8 role, u8 id) |
| 878 | 990 | if (role == OPTEK_LINK_MASTER) |
| 879 | 991 | { |
| 880 | 992 | len = bc_tx_data.last_tx_len; |
| 993 | + if (len == 0) | |
| 994 | + len = 6; | |
| 881 | 995 | } |
| 882 | 996 | else |
| 883 | 997 | { |
| 998 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 999 | + len = bc_tx_data.last_tx_len; | |
| 1000 | + #else | |
| 884 | 1001 | if (optek_link_mode == GAME_HEADPHONE_PT_5MS_LP) |
| 885 | 1002 | { |
| 886 | 1003 | len = bc_tx_data.last_tx_len; |
| ... | ... | @@ -888,7 +1005,8 @@ u8 optek_link_tx_data_len(u8 role, u8 id) |
| 888 | 1005 | else |
| 889 | 1006 | { |
| 890 | 1007 | len = OPTEK_LINK_MASTER_NO_RX_LEN; |
| 891 | - } | |
| 1008 | + } | |
| 1009 | + #endif | |
| 892 | 1010 | } |
| 893 | 1011 | return len; |
| 894 | 1012 | } |
| ... | ... | @@ -966,6 +1084,7 @@ u8 optek_link_tx_data_cb(u8 cpy, u8 *buf, u8 role, u8 ext_frame, u8 id) |
| 966 | 1084 | |
| 967 | 1085 | if (role == OPTEK_LINK_MASTER) |
| 968 | 1086 | { |
| 1087 | + #ifndef OPL_MODE_WIRELESS_MIC | |
| 969 | 1088 | /**************for sync********************/ |
| 970 | 1089 | if (spk_out_sync_w_tx_status == SPK_AND_TX_SYNCING) |
| 971 | 1090 | { |
| ... | ... | @@ -1002,7 +1121,57 @@ u8 optek_link_tx_data_cb(u8 cpy, u8 *buf, u8 role, u8 ext_frame, u8 id) |
| 1002 | 1121 | uiDecSend (DECODE_FRAME, FALSE); |
| 1003 | 1122 | } |
| 1004 | 1123 | //SOFT3_INT_SET; |
| 1124 | + #endif | |
| 1005 | 1125 | } |
| 1126 | + else | |
| 1127 | + { | |
| 1128 | + #ifdef OPL_MODE_WIRELESS_MIC | |
| 1129 | + /**************for sync********************/ | |
| 1130 | + if (spk_out_sync_w_tx_status == SPK_AND_TX_SYNCING) | |
| 1131 | + { | |
| 1132 | + app_dac_receive_pcm_enable(FALSE); | |
| 1133 | + spk_out_sync_w_tx_status = SPK_AND_TX_SYNCING_STEP2; | |
| 1134 | + } | |
| 1135 | + else if (spk_out_sync_w_tx_status == SPK_AND_TX_SYNCING_STEP2) | |
| 1136 | + { | |
| 1137 | + U32 dma0_count = DMA_0_COUNT; | |
| 1138 | + | |
| 1139 | + if (adj_outsamples == 0) | |
| 1140 | + { | |
| 1141 | + i32 out_dma_cnt; | |
| 1142 | + | |
| 1143 | + out_dma_cnt = 10 - (dma0_count>>1); | |
| 1144 | + | |
| 1145 | + //if ((out_dma_cnt < -1) || (out_dma_cnt > 1)) | |
| 1146 | + if (out_dma_cnt == 0) | |
| 1147 | + { | |
| 1148 | + spk_out_sync_w_tx_status = SPK_AND_TX_SYNCING_STEP3; | |
| 1149 | + } | |
| 1150 | + else | |
| 1151 | + { | |
| 1152 | + adj_outsamples = out_dma_cnt; | |
| 1153 | + //DBG_Printf("req adj:%d,%d\r\n",adj_outsamples,dma0_count); | |
| 1154 | + } | |
| 1155 | + } | |
| 1156 | + } | |
| 1157 | + else if (spk_out_sync_w_tx_status == SPK_AND_TX_SYNCING_STEP3) | |
| 1158 | + { | |
| 1159 | + app_dac_receive_pcm_enable(TRUE); | |
| 1160 | + spk_out_sync_w_tx_status = SPK_AND_TX_SYNCED; | |
| 1161 | + uiDecSend (DECODE_FRAME, FALSE); | |
| 1162 | + app_main_data.playing_stream_status = STREAM_MEDIA; | |
| 1163 | + first_dma_count = 0xffffffff; | |
| 1164 | + csb_rx_count = (20000/5); | |
| 1165 | + } | |
| 1166 | + else | |
| 1167 | + { | |
| 1168 | + U32 dma0_count = DMA_0_COUNT; | |
| 1169 | + | |
| 1170 | + //if (dma0_count > ) study later | |
| 1171 | + diff_sample = (dma0_count>>1) - 10; | |
| 1172 | + } | |
| 1173 | + #endif | |
| 1174 | + } | |
| 1006 | 1175 | |
| 1007 | 1176 | return len; |
| 1008 | 1177 | } |
| ... | ... | @@ -1085,6 +1254,18 @@ u8 optek_link_slave_conn_cb (u8 mode, u8 *slave_max_tx_len, u8 *slave_max_rx_len |
| 1085 | 1254 | *slave_max_rx_len = 150; |
| 1086 | 1255 | } |
| 1087 | 1256 | #endif |
| 1257 | + #if (defined OPL_MODE_WIRELESS_MIC) | |
| 1258 | + else if (mode == WIRELESS_MIC_48K_PT2P5MS_T7R1M) | |
| 1259 | + { | |
| 1260 | + *slave_max_tx_len = 25; | |
| 1261 | + *slave_max_rx_len = 6; | |
| 1262 | + } | |
| 1263 | + else if (mode == WIRELESS_MIC_48K_PT5MS_T10_R2M_LP) | |
| 1264 | + { | |
| 1265 | + *slave_max_tx_len = 50; | |
| 1266 | + *slave_max_rx_len = 6; | |
| 1267 | + } | |
| 1268 | + #endif | |
| 1088 | 1269 | #if (defined OPL_MODE_SWF) |
| 1089 | 1270 | else if (mode == TWS_SUBW_SF48K_PT5MS || mode == TWS_SUBW_SF44K_PT5MS) |
| 1090 | 1271 | { |
| ... | ... | @@ -1134,12 +1315,19 @@ u8 optek_link_slave_conn_cb (u8 mode, u8 *slave_max_tx_len, u8 *slave_max_rx_len |
| 1134 | 1315 | void optek_link_slave_link_loss_cb (u8 id) __attribute__ ((section (".internal_ram_1_text"))); |
| 1135 | 1316 | void optek_link_slave_link_loss_cb (u8 id) |
| 1136 | 1317 | { |
| 1318 | + #ifndef OPL_MODE_WIRELESS_MIC | |
| 1319 | + app_dac_receive_pcm_enable(FALSE); | |
| 1320 | + //app_main_data.playing_stream_status = STREAM_WAITING_DATA; | |
| 1321 | + AUDIO_FIFO_STREAM_DISCARD_ALL_DATA(); | |
| 1322 | + #else | |
| 1323 | + spk_out_sync_w_tx_status = SPK_AND_TX_SYNCING; | |
| 1324 | + ukiMsgSend(app_cmd_DecoderExit); | |
| 1325 | + #endif | |
| 1326 | + | |
| 1137 | 1327 | //DBG_Printf("slave loss\r"); |
| 1138 | 1328 | csb_rx_count = 0; |
| 1139 | - app_dac_receive_pcm_enable(FALSE); | |
| 1140 | 1329 | //app_main_data.playing_stream_status = STREAM_WAITING_DATA; |
| 1141 | 1330 | conn_rej_count = 1; |
| 1142 | - AUDIO_FIFO_STREAM_DISCARD_ALL_DATA(); | |
| 1143 | 1331 | |
| 1144 | 1332 | //SOFT2_INT_SET; |
| 1145 | 1333 | //SOFT3_INT_SET; | ... | ... |
| ... | ... | @@ -295,7 +295,6 @@ uint8_t optek_link_role_change_slave_to_scan (uint8_t act_id); |
| 295 | 295 | |
| 296 | 296 | |
| 297 | 297 | |
| 298 | - | |
| 299 | 298 | /* |
| 300 | 299 | //#define TEST_MODE SUBW_SF44K_PT2P5MS //(120/10) * 2 |
| 301 | 300 | //#define TEST_MODE SUBW_SF48K_PT2P5MS //(120/10) * 2 |
| ... | ... | @@ -476,7 +475,7 @@ uint8_t optek_link_role_change_slave_to_scan (uint8_t act_id); |
| 476 | 475 | |
| 477 | 476 | /* |
| 478 | 477 | #define TEST_MODE WIRELESS_MIC_48K_PT5MS_T10_R2M_LP |
| 479 | -#define MASTER_MAX_TX_LEN 7 //6 bytes for paring, one byte for rx resp | |
| 478 | +#define MASTER_MAX_TX_LEN 6 //6 bytes for paring, one byte for rx resp | |
| 480 | 479 | #define SLAVE_MAX_TX_LEN 50 //80k |
| 481 | 480 | */ |
| 482 | 481 | ... | ... |
Please
register
or
login
to post a comment