add base 2300_open source on it

This commit is contained in:
dylancaowugang 2022-09-03 11:23:40 +08:00
parent 136f7a43fa
commit cba85a7238
12 changed files with 1717 additions and 200 deletions

View File

@ -604,6 +604,8 @@ extern "C" int app_voice_stop(APP_STATUS_INDICATION_T status, uint8_t device_id)
} }
#endif #endif
#if 1//!defined(BLE_ONLY_ENABLED)
static void app_poweron_normal(APP_KEY_STATUS *status, void *param) static void app_poweron_normal(APP_KEY_STATUS *status, void *param)
{ {
TRACE(3,"%s %d,%d",__func__, status->code, status->event); TRACE(3,"%s %d,%d",__func__, status->code, status->event);
@ -611,7 +613,6 @@ static void app_poweron_normal(APP_KEY_STATUS *status, void *param)
signal_send_to_main_thread(0x2); signal_send_to_main_thread(0x2);
} }
#if 1//!defined(BLE_ONLY_ENABLED)
static void app_poweron_scan(APP_KEY_STATUS *status, void *param) static void app_poweron_scan(APP_KEY_STATUS *status, void *param)
{ {
TRACE(3,"%s %d,%d",__func__, status->code, status->event); TRACE(3,"%s %d,%d",__func__, status->code, status->event);
@ -658,6 +659,7 @@ const APP_KEY_HANDLE pwron_key_handle_cfg[] = {
{{APP_KEY_CODE_PWR,APP_KEY_EVENT_UP}, "power on: shutdown" , app_bt_key_shutdown, NULL}, {{APP_KEY_CODE_PWR,APP_KEY_EVENT_UP}, "power on: shutdown" , app_bt_key_shutdown, NULL},
}; };
#elif defined(__ENGINEER_MODE_SUPPORT__) #elif defined(__ENGINEER_MODE_SUPPORT__)
s
const APP_KEY_HANDLE pwron_key_handle_cfg[] = { const APP_KEY_HANDLE pwron_key_handle_cfg[] = {
{{APP_KEY_CODE_PWR,APP_KEY_EVENT_INITUP}, "power on: normal" , app_poweron_normal, NULL}, {{APP_KEY_CODE_PWR,APP_KEY_EVENT_INITUP}, "power on: normal" , app_poweron_normal, NULL},
#if !defined(BLE_ONLY_ENABLED) #if !defined(BLE_ONLY_ENABLED)
@ -687,11 +689,12 @@ static void app_poweron_key_init(void)
static uint8_t app_poweron_wait_case(void) static uint8_t app_poweron_wait_case(void)
{ {
uint32_t stime = 0, etime = 0;
#ifdef __POWERKEY_CTRL_ONOFF_ONLY__ #ifdef __POWERKEY_CTRL_ONOFF_ONLY__
g_pwron_case = APP_POWERON_CASE_NORMAL; g_pwron_case = APP_POWERON_CASE_NORMAL;
#else #else
uint32_t stime = 0, etime = 0;
TRACE(1,"poweron_wait_case enter:%d", g_pwron_case); TRACE(1,"poweron_wait_case enter:%d", g_pwron_case);
if (g_pwron_case == APP_POWERON_CASE_INVALID){ if (g_pwron_case == APP_POWERON_CASE_INVALID){
stime = hal_sys_timer_get(); stime = hal_sys_timer_get();
@ -1671,7 +1674,6 @@ static void once_delay_event_Timer_fun(const void *)
app_ibrt_sync_volume_info(); app_ibrt_sync_volume_info();
break; break;
case 9: case 9:
touch_reset();
break; break;
default: default:
break; break;
@ -1697,39 +1699,7 @@ void stoponce_delay_event_Timer_(void)
#include "tgt_hardware.h" #include "tgt_hardware.h"
extern struct BT_DEVICE_T app_bt_device; extern struct BT_DEVICE_T app_bt_device;
extern void hal_gpio_pin_set(enum HAL_GPIO_PIN_T pin); extern void hal_gpio_pin_set(enum HAL_GPIO_PIN_T pin);
osTimerId app_mute_timer = NULL;
static void app_mute_timehandler(void const *n);
osTimerDef (APP_MUTE_TIMER, app_mute_timehandler);
/*
static void app_mute_ctrl_init(void)
{
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&MuteOutPwl, 1);
hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)MuteOutPwl.pin, HAL_GPIO_DIR_OUT, 0);
app_mute_timer = osTimerCreate (osTimer(APP_MUTE_TIMER), osTimerOnce, NULL);
}
*/
void app_mute_ctrl(bool Status)
{
if(Status == true)
{
hal_gpio_pin_set((enum HAL_GPIO_PIN_T)MuteOutPwl.pin);
}
else
{
hal_gpio_pin_clr((enum HAL_GPIO_PIN_T)MuteOutPwl.pin);
}
}
void app_mutetimer_start()
{
osTimerStart(app_mute_timer, 190);
}
static void app_mute_timehandler(void const *n)
{
app_mute_ctrl(true);
}
bool Curr_Is_Master(void) bool Curr_Is_Master(void)
{ {
@ -2111,38 +2081,6 @@ void touch_evt_handler(enum HAL_GPIO_PIN_T pin)
} }
void touch_evt_handler_sda(enum HAL_GPIO_PIN_T pin)
{
TRACE(3,"SDA_TOUCH!!!");
}
void tou_io_init(void)
{
TRACE(3,"%s!!!",__func__);
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&TOUCH_I2C_SCL, 1);
hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)TOUCH_I2C_SCL.pin, HAL_GPIO_DIR_IN, 1);
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&TOUCH_I2C_SDA, 1);
hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)TOUCH_I2C_SDA.pin, HAL_GPIO_DIR_IN, 1);
struct HAL_GPIO_IRQ_CFG_T gpiocfg_sda;
gpiocfg_sda.irq_enable = true;
gpiocfg_sda.irq_debounce = true;
gpiocfg_sda.irq_type = HAL_GPIO_IRQ_TYPE_EDGE_SENSITIVE;
gpiocfg_sda.irq_polarity=HAL_GPIO_IRQ_POLARITY_LOW_FALLING ;
gpiocfg_sda.irq_handler = touch_evt_handler;
hal_gpio_setup_irq((enum HAL_GPIO_PIN_T)TOUCH_I2C_SCL.pin, &gpiocfg_sda);
struct HAL_GPIO_IRQ_CFG_T gpiocfg;
gpiocfg.irq_enable = true;
gpiocfg.irq_debounce = true;
gpiocfg.irq_type = HAL_GPIO_IRQ_TYPE_EDGE_SENSITIVE;
gpiocfg.irq_polarity=HAL_GPIO_IRQ_POLARITY_LOW_FALLING ;
gpiocfg.irq_handler = touch_evt_handler_sda;
hal_gpio_setup_irq((enum HAL_GPIO_PIN_T)TOUCH_I2C_SDA.pin, &gpiocfg);
}
/******************************LED_status_timer*********************************************************/ /******************************LED_status_timer*********************************************************/
osTimerId LED_statusid = NULL; osTimerId LED_statusid = NULL;
void startLED_status(int ms); void startLED_status(int ms);
@ -2183,50 +2121,6 @@ void stopLED_status(void)
/********************************LED_status_timer*******************************************************/ /********************************LED_status_timer*******************************************************/
/******************************TOUCH_INT_TEST_timer*********************************************************/
void touch_reset(void);
osTimerId TOUCH_INT_TESTid = NULL;
void startTOUCH_INT_TEST(int ms);
void stopTOUCH_INT_TEST(void);
static void TOUCH_INT_TESTfun(const void *);
osTimerDef(defTOUCH_INT_TEST,TOUCH_INT_TESTfun);
void TOUCH_INT_TESTinit(void)
{
TOUCH_INT_TESTid = osTimerCreate(osTimer(defTOUCH_INT_TEST),osTimerOnce,(void *)0);
//startTOUCH_INT_TEST(100);
//touch_reset();
}
static void TOUCH_INT_TESTfun(const void *)
{
TRACE(3,"\n!!!!!!enter %s\n",__func__);
//app_i2c_demo_init();
//hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&TOUCH_INT, 1);
//hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)TOUCH_INT.pin, HAL_GPIO_DIR_IN, 0);
tou_io_init();
}
void startTOUCH_INT_TEST(int ms)
{
TRACE(3,"\n !!!!!!!!!!start %s\n",__func__);
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&TOUCH_I2C_SCL, 1);
hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)TOUCH_I2C_SCL.pin, HAL_GPIO_DIR_OUT, 0);
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&TOUCH_I2C_SDA, 1);
hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)TOUCH_I2C_SDA.pin, HAL_GPIO_DIR_OUT, 0);
//hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&TOUCH_INT, 1);
//hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)TOUCH_INT.pin, HAL_GPIO_DIR_OUT, 0);
osTimerStart(TOUCH_INT_TESTid,ms);
}
void stopTOUCH_INT_TEST(void)
{
osTimerStop(TOUCH_INT_TESTid);
}
void touch_reset(void)
{
startTOUCH_INT_TEST(50);
}
/********************************TOUCH_INT_TEST_timer*******************************************************/ /********************************TOUCH_INT_TEST_timer*******************************************************/
@ -2238,7 +2132,6 @@ void user_io_timer_init(void)
Auto_Shutdowm_Timerinit(); Auto_Shutdowm_Timerinit();
delay_report_toneinit(); delay_report_toneinit();
once_delay_event_Timer_init(); once_delay_event_Timer_init();
TOUCH_INT_TESTinit();
//app_i2c_demo_init(); //app_i2c_demo_init();
//tou_io_init(); //tou_io_init();
} }
@ -2466,17 +2359,14 @@ extern int rpc_service_setup(void);
nv_record_env_init(); nv_record_env_init();
nvrec_dev_data_open(); nvrec_dev_data_open();
factory_section_open(); factory_section_open();
/******************************************************************************/
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&TOUCH_I2C_SCL, 1);
hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)TOUCH_I2C_SCL.pin, HAL_GPIO_DIR_OUT, 1);
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&TOUCH_I2C_SDA, 1);
hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)TOUCH_I2C_SDA.pin, HAL_GPIO_DIR_OUT, 1);
/*****************************************************************************/ /*****************************************************************************/
// app_bt_connect2tester_init(); // app_bt_connect2tester_init();
nv_record_env_get(&nvrecord_env); nv_record_env_get(&nvrecord_env);
#ifdef AUDIO_LOOPBACK #ifdef AUDIO_LOOPBACK
#ifdef WL_DET #ifdef WL_DET
app_mic_alg_audioloop(true,APP_SYSFREQ_78M); app_mic_alg_audioloop(true,APP_SYSFREQ_78M);
#endif #endif
@ -2558,7 +2448,7 @@ extern int rpc_service_setup(void);
if (pwron_case == APP_POWERON_CASE_REBOOT){ if (pwron_case == APP_POWERON_CASE_REBOOT){
app_status_indication_init(); app_status_indication_init();
user_io_timer_init(); //user_io_timer_init();
app_status_indication_set(APP_STATUS_INDICATION_POWERON); app_status_indication_set(APP_STATUS_INDICATION_POWERON);
#ifdef MEDIA_PLAYER_SUPPORT #ifdef MEDIA_PLAYER_SUPPORT
app_voice_report(APP_STATUS_INDICATION_POWERON, 0); app_voice_report(APP_STATUS_INDICATION_POWERON, 0);
@ -2589,10 +2479,10 @@ extern int rpc_service_setup(void);
TRACE(1,"ibrt_ui_log:power on %d fetch out", nvrecord_env->ibrt_mode.mode); TRACE(1,"ibrt_ui_log:power on %d fetch out", nvrecord_env->ibrt_mode.mode);
app_ibrt_ui_event_entry(IBRT_FETCH_OUT_EVENT); app_ibrt_ui_event_entry(IBRT_FETCH_OUT_EVENT);
} }
startLED_status(1000); //startLED_status(1000);
once_event_case = 9; once_event_case = 9;
startonce_delay_event_Timer_(1000); startonce_delay_event_Timer_(1000);
startpwrkey_det(200); //startpwrkey_det(200);
} }
#elif defined(IS_MULTI_AI_ENABLED) #elif defined(IS_MULTI_AI_ENABLED)
//when ama and bisto switch, earphone need reconnect with peer, master need reconnect with phone //when ama and bisto switch, earphone need reconnect with peer, master need reconnect with phone
@ -2654,7 +2544,7 @@ extern int rpc_service_setup(void);
} }
#endif #endif
else{ else{
user_io_timer_init(); //user_io_timer_init();
app_status_indication_init(); app_status_indication_init();
app_status_indication_set(APP_STATUS_INDICATION_POWERON); app_status_indication_set(APP_STATUS_INDICATION_POWERON);
#ifdef MEDIA_PLAYER_SUPPORT #ifdef MEDIA_PLAYER_SUPPORT
@ -2757,7 +2647,7 @@ extern int rpc_service_setup(void);
// app_status_indication_set(APP_STATUS_INDICATION_CHARGING); // app_status_indication_set(APP_STATUS_INDICATION_CHARGING);
//break; //break;
} }
startpwrkey_det(200); //startpwrkey_det(200);
} }
#elif defined(IS_MULTI_AI_ENABLED) #elif defined(IS_MULTI_AI_ENABLED)
//when ama and bisto switch, earphone need reconnect with peer, master need reconnect with phone //when ama and bisto switch, earphone need reconnect with peer, master need reconnect with phone

View File

@ -0,0 +1,419 @@
CHIP ?= best2300p
DEBUG ?= 1
FPGA ?= 0
MBED ?= 0
RTOS ?= 1
#KERNEL ?= FREERTOS
LIBC_ROM ?= 1
export USER_SECURE_BOOT ?= 0
# enable:1
# disable:0
WATCHER_DOG ?= 1
DEBUG_PORT ?= 1
# 0: usb
# 1: uart0
# 2: uart1
FLASH_CHIP ?= ALL
# GD25Q80C
# GD25Q32C
# ALL
export NO_TRACE_TIME_STAMP ?=1
export FORCE_SIGNALINGMODE ?= 0
export FORCE_NOSIGNALINGMODE ?= 0
export FORCE_SCO_MAX_RETX ?= 0
export FA_RX_GAIN_CTRL ?= 1
export BT_FA_ECC ?= 0
export CONTROLLER_DUMP_ENABLE ?= 0
export CONTROLLER_MEM_LOG_ENABLE ?= 0
export INTERSYS_DEBUG ?= 1
export PROFILE_DEBUG ?= 0
export BTDUMP_ENABLE ?= 0
export BT_DEBUG_TPORTS ?= 0
TPORTS_KEY_COEXIST ?= 0
export SNIFF_MODE_CHECK ?= 0
AUDIO_OUTPUT_MONO ?= 0
AUDIO_OUTPUT_DIFF ?= 0
#### ANC DEFINE START ######
export ANC_APP ?= 0
export ANC_FF_ENABLED ?= 0
export ANC_FB_ENABLED ?= 0
export AUDIO_ANC_FB_MC ?= 0
export AUDIO_SECTION_SUPPT ?= 0
export AUD_SECTION_STRUCT_VERSION ?= 2
export AUDIO_ANC_FB_MC_HW ?=0
export APP_ANC_KEY ?= 0
export ANC_FB_CHECK ?= 0
##### ANC DEFINE END ######
APP_ANC_TEST ?= 0
TEST_OVER_THE_AIR ?= 0
HW_FIR_EQ_PROCESS ?= 0
SW_IIR_EQ_PROCESS ?= 1
HW_DAC_IIR_EQ_PROCESS ?= 0
HW_IIR_EQ_PROCESS ?= 0
HW_DC_FILTER_WITH_IIR ?= 0
AUDIO_DRC ?= 0
AUDIO_DRC2 ?= 0
PC_CMD_UART ?= 0
AUDIO_SECTION_ENABLE ?= 0
AUDIO_RESAMPLE ?= 1
RESAMPLE_ANY_SAMPLE_RATE ?= 1
OSC_26M_X4_AUD2BB ?= 1
AUDIO_OUTPUT_VOLUME_DEFAULT ?= 17
# range:1~16
AUDIO_INPUT_CAPLESSMODE ?= 0
AUDIO_INPUT_LARGEGAIN ?= 0
AUDIO_CODEC_ASYNC_CLOSE ?= 0
AUDIO_SCO_BTPCM_CHANNEL ?= 1
export A2DP_CP_ACCEL ?= 1
export SCO_CP_ACCEL ?= 1
export SCO_TRACE_CP_ACCEL ?= 0
# For TWS SCO DMA snapshot and low delay
export PCM_FAST_MODE ?= 1
export CVSD_BYPASS ?= 1
export LOW_DELAY_SCO ?= 0
SPEECH_TX_DC_FILTER ?= 1
SPEECH_TX_AEC2FLOAT ?= 1
SPEECH_TX_NS3 ?= 0
SPEECH_TX_2MIC_NS2 ?= 0
SPEECH_TX_COMPEXP ?= 1
SPEECH_TX_EQ ?= 0
SPEECH_TX_POST_GAIN ?= 0
SPEECH_RX_NS2FLOAT ?= 0
SPEECH_RX_EQ ?= 0
SPEECH_RX_POST_GAIN ?= 0
LARGE_RAM ?= 1
HSP_ENABLE ?= 0
HFP_1_6_ENABLE ?= 1
BTIF_HID_DEVICE ?= 1
MSBC_PLC_ENABLE ?= 1
MSBC_PLC_ENCODER ?= 1
MSBC_16K_SAMPLE_RATE ?= 1
SBC_FUNC_IN_ROM ?= 0
ROM_UTILS_ON ?= 0
APP_LINEIN_A2DP_SOURCE ?= 0
APP_I2S_A2DP_SOURCE ?= 0
VOICE_PROMPT ?= 1
#### Google related feature ####
# the overall google service switch
# currently, google service includes BISTO and GFPS
export GOOGLE_SERVICE_ENABLE ?= 0
# BISTO is a GVA service on Bluetooth audio device
# BISTO is an isolated service relative to GFPS
export BISTO_ENABLE ?= 0
# GSOUND_HOTWORD is a hotword library running on Bluetooth audio device
# GSOUND_HOTWORD is a subset of BISTO
export GSOUND_HOTWORD_ENABLE ?= 0
# GFPS is google fastpair service
# GFPS is an isolated service relative to BISTO
export GFPS_ENABLE ?= 0
#### Google related feature ####
export BTIF_HID_DEVICE ?= 1
ifeq ($(BTIF_HID_DEVICE),1)
KBUILD_CPPFLAGS += -DBTIF_HID_DEVICE
endif
BLE ?= 0
TOTA ?= 0
OTA_ENABLE ?= 1
TILE_DATAPATH_ENABLED ?= 0
CUSTOM_INFORMATION_TILE_ENABLE ?= 0
INTERCONNECTION ?= 0
INTERACTION ?= 0
INTERACTION_FASTPAIR ?= 0
BT_ONE_BRING_TWO ?= 0
DSD_SUPPORT ?= 0
A2DP_EQ_24BIT ?= 1
A2DP_AAC_ON ?= 1
A2DP_SCALABLE_ON ?= 0
A2DP_LHDC_ON ?= 0
ifeq ($(A2DP_LHDC_ON),1)
A2DP_LHDC_V3 ?= 1
A2DP_LHDC_LARC ?= 0
export FLASH_UNIQUE_ID ?= 1
endif
A2DP_LDAC_ON ?= 0
export TX_RX_PCM_MASK ?= 0
A2DP_SCALABLE_ON ?= 0
FACTORY_MODE ?= 1
ENGINEER_MODE ?= 0
ULTRA_LOW_POWER ?= 1
DAC_CLASSG_ENABLE ?= 1
NO_SLEEP ?= 0
CORE_DUMP ?= 1
CORE_DUMP_TO_FLASH ?= 0
ENHANCED_STACK ?= 1
export SYNC_BT_CTLR_PROFILE ?= 0
export A2DP_DECODER_VER := 2
export IBRT ?= 1
export IBRT_SEARCH_UI ?= 1
export BES_AUD ?= 1
export POWER_MODE ?= DIG_DCDC
export BT_RF_PREFER ?= 2M
export SPEECH_CODEC ?= 1
export TWS_PROMPT_SYNC ?= 0
export MIX_AUDIO_PROMPT_WITH_A2DP_MEDIA_ENABLED ?= 0
export FLASH_SIZE ?= 0x400000
export FLASH_SUSPEND ?= 1
ifeq ($(DSD_SUPPORT),1)
export BTUSB_AUDIO_MODE ?= 1
export AUDIO_INPUT_MONO ?= 1
export USB_ISO ?= 1
export USB_AUDIO_DYN_CFG ?= 1
export DELAY_STREAM_OPEN ?= 0
export KEEP_SAME_LATENCY ?= 1
export HW_FIR_DSD_PROCESS ?= 1
ifeq ($(HW_FIR_DSD_PROCESS),1)
ifeq ($(CHIP),best2300)
export HW_FIR_DSD_BUF_MID_ADDR ?= 0x200A0000
export DATA_BUF_START ?= 0x20040000
endif
endif
export USB_AUDIO_UAC2 ?= 1
export USB_HIGH_SPEED ?= 1
KBUILD_CPPFLAGS += \
-DHW_FIR_DSD_BUF_MID_ADDR=$(HW_FIR_DSD_BUF_MID_ADDR) \
-DDATA_BUF_START=$(DATA_BUF_START)
endif
USE_THIRDPARTY ?= 0
export USE_KNOWLES ?= 0
export USE_CYBERON ?= 0
ifeq ($(CURRENT_TEST),1)
export VCODEC_VOLT ?= 1.6V
export VANA_VOLT ?= 1.35V
else
endif
export LAURENT_ALGORITHM ?= 0
export TX_IQ_CAL ?= 0
export BT_XTAL_SYNC ?= 1
export BTADDR_FOR_DEBUG ?= 1
export POWERKEY_I2C_SWITCH ?=0
AUTO_TEST ?= 0
export DUMP_NORMAL_LOG ?= 0
SUPPORT_BATTERY_REPORT ?= 1
SUPPORT_HF_INDICATORS ?= 0
SUPPORT_SIRI ?= 1
BES_AUDIO_DEV_Main_Board_9v0 ?= 0
APP_USE_LED_INDICATE_IBRT_STATUS ?= 0
export BT_EXT_LNA_PA ?=0
export BT_EXT_LNA ?=0
export BT_EXT_PA ?=0
ifeq ($(A2DP_LHDC_ON),1)
AUDIO_BUFFER_SIZE := 140*1024
else
AUDIO_BUFFER_SIZE := 100*1024
endif
export TRACE_BUF_SIZE := 16*1024
export TRACE_BAUD_RATE := 10*115200
init-y :=
core-y := platform/ services/ apps/ utils/cqueue/ utils/list/ services/multimedia/ utils/intersyshci/
KBUILD_CPPFLAGS += -Iplatform/cmsis/inc \
-Iservices/audioflinger \
-Iplatform/hal \
-Iservices/fs/ \
-Iservices/fs/sd \
-Iservices/fs/fat \
-Iservices/fs/fat/ChaN
KBUILD_CPPFLAGS += \
-DAPP_AUDIO_BUFFER_SIZE=$(AUDIO_BUFFER_SIZE) \
-DCHARGER_PLUGINOUT_RESET=0 \
# -D__A2DP_AVDTP_CP__ \
ifeq ($(BES_AUDIO_DEV_Main_Board_9v0),1)
KBUILD_CPPFLAGS += -DBES_AUDIO_DEV_Main_Board_9v0
endif
ifeq ($(TPORTS_KEY_COEXIST),1)
KBUILD_CPPFLAGS += -DTPORTS_KEY_COEXIST
endif
#-DIBRT_LINK_LOWLAYER_MONITOR
#-D_AUTO_SWITCH_POWER_MODE__
#-D__APP_KEY_FN_STYLE_A__
#-D__APP_KEY_FN_STYLE_B__
#-D__EARPHONE_STAY_BOTH_SCAN__
#-D__POWERKEY_CTRL_ONOFF_ONLY__
#-DAUDIO_LINEIN
ifeq ($(CURRENT_TEST),1)
INTSRAM_RUN ?= 1
endif
ifeq ($(INTSRAM_RUN),1)
LDS_FILE := best1000_intsram.lds
else
LDS_FILE := best1000.lds
endif
ifeq ($(TOTA),1)
ifeq ($(BLE),1)
KBUILD_CPPFLAGS += -DBLE_TOTA_ENABLED
endif
KBUILD_CPPFLAGS += -DSHOW_RSSI
KBUILD_CPPFLAGS += -DTEST_OVER_THE_AIR_ENANBLED
export TEST_OVER_THE_AIR ?= 1
endif
ifneq ($(A2DP_DECODER_VER), )
KBUILD_CPPFLAGS += -DA2DP_DECODER_VER=$(A2DP_DECODER_VER)
endif
ifeq ($(ANC_APP),1)
KBUILD_CPPFLAGS += -DANC_APP
endif
ifeq ($(USE_CYBERON),1)
export THIRDPARTY_LIB ?= cyberon
KBUILD_CPPFLAGS += -D__CYBERON
export KWS_IN_RAM := 1
ifeq ($(KWS_IN_RAM),1)
CPPFLAGS_${LDS_FILE} += -DKWS_IN_RAM
endif #KWS_IN_RAM
endif #USE_CYBERON
KBUILD_CFLAGS +=
LIB_LDFLAGS += -lstdc++ -lsupc++
#CFLAGS_IMAGE += -u _printf_float -u _scanf_float
#LDFLAGS_IMAGE += --wrap main
export BTIF_HID_DEVICE ?= 1
ifeq ($(BTIF_HID_DEVICE),1)
KBUILD_CPPFLAGS += -DBTIF_HID_DEVICE
endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,120 @@
/***************************************************************************
*
* Copyright 2015-2019 BES.
* All rights reserved. All unpublished rights reserved.
*
* No part of this work may be used or reproduced in any form or by any
* means, or stored in a database or retrieval system, without prior written
* permission of BES.
*
* Use of this work is governed by a license granted by BES.
* This work contains confidential and proprietary information of
* BES. which is protected by copyright, trade secret,
* trademark and other intellectual property rights.
*
****************************************************************************/
#ifndef __TGT_HARDWARE__
#define __TGT_HARDWARE__
#ifdef __cplusplus
extern "C" {
#endif
#include "hal_iomux.h"
#include "hal_gpio.h"
#include "hal_key.h"
#include "hal_aud.h"
//config hwardware codec iir.
#define EQ_HW_DAC_IIR_LIST_NUM 1
#define EQ_HW_ADC_IIR_LIST_NUM 1
#define EQ_HW_IIR_LIST_NUM 1
#define EQ_SW_IIR_LIST_NUM 1
#define EQ_HW_FIR_LIST_NUM 3
//pwl
#define CFG_HW_PLW_NUM (2)
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP cfg_hw_pinmux_pwl[CFG_HW_PLW_NUM];
//adckey define
#define CFG_HW_ADCKEY_NUMBER 0
#define CFG_HW_ADCKEY_BASE 0
#define CFG_HW_ADCKEY_ADC_MAXVOLT 1000
#define CFG_HW_ADCKEY_ADC_MINVOLT 0
#define CFG_HW_ADCKEY_ADC_KEYVOLT_BASE 130
extern const uint16_t CFG_HW_ADCKEY_MAP_TABLE[CFG_HW_ADCKEY_NUMBER];
#define BTA_AV_CO_SBC_MAX_BITPOOL 52
//gpiokey define
#ifdef IS_MULTI_AI_ENABLED
#define CFG_HW_GPIOKEY_NUM (3)
#elif BES_AUDIO_DEV_Main_Board_9v0
#define CFG_HW_GPIOKEY_NUM (6)
#else
#define CFG_HW_GPIOKEY_NUM (3)
#endif
extern const struct HAL_KEY_GPIOKEY_CFG_T cfg_hw_gpio_key_cfg[CFG_HW_GPIOKEY_NUM];
// ANC function key
#define ANC_FUNCTION_KEY HAL_KEY_CODE_PWR
// ANC coefficient curve number
#define ANC_COEF_NUM (1)
//#define ANC_TALK_THROUGH
#ifdef ANC_TALK_THROUGH
#define ANC_COEF_LIST_NUM (ANC_COEF_NUM + 1)
#else
#define ANC_COEF_LIST_NUM (ANC_COEF_NUM)
#endif
#define ANC_FF_MIC_CH_L AUD_CHANNEL_MAP_CH0
#define ANC_FF_MIC_CH_R 0
#define ANC_FB_MIC_CH_L AUD_CHANNEL_MAP_CH2
#define ANC_FB_MIC_CH_R 0
#define ANC_VMIC_CFG (AUD_VMIC_MAP_VMIC3)
// audio codec
#define CFG_HW_AUD_INPUT_PATH_NUM 4
extern const struct AUD_IO_PATH_CFG_T cfg_audio_input_path_cfg[CFG_HW_AUD_INPUT_PATH_NUM];
#define CFG_HW_AUD_OUTPUT_PATH_SPEAKER_DEV (AUD_CHANNEL_MAP_CH0)
#define CFG_HW_AUD_SIDETONE_MIC_DEV (AUD_CHANNEL_MAP_CH0)
#define CFG_HW_AUD_SIDETONE_GAIN_DBVAL (-20)
//bt config
extern const char *BT_LOCAL_NAME;
extern const char *BLE_DEFAULT_NAME;
extern uint8_t ble_addr[6];
extern uint8_t bt_addr[6];
#define CODEC_SADC_VOL (12)
extern const struct CODEC_DAC_VOL_T codec_dac_vol[TGT_VOLUME_LEVEL_QTY];
//range -12~+12
#define CFG_HW_AUD_EQ_NUM_BANDS (8)
extern const int8_t cfg_aud_eq_sbc_band_settings[CFG_HW_AUD_EQ_NUM_BANDS];
#define CFG_AUD_EQ_IIR_NUM_BANDS (4)
//battery info
#define APP_BATTERY_MIN_MV (3200)
#define APP_BATTERY_PD_MV (3100)
#define APP_BATTERY_MAX_MV (4200)
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP app_battery_ext_charger_enable_cfg;
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP app_battery_ext_charger_detecter_cfg;
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP app_battery_ext_charger_indicator_cfg;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -140,8 +140,6 @@ extern const struct HAL_IOMUX_PIN_FUNCTION_MAP cfg_hw_tws_channel_cfg;
//extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_INT; //extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_INT;
extern bool tgt_tws_get_channel_is_right(void); extern bool tgt_tws_get_channel_is_right(void);
extern void app_mute_ctrl(bool Status);
extern void app_mutetimer_start();
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SDA; extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SDA;
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SCL; extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SCL;

View File

@ -301,7 +301,7 @@ export BTADDR_FOR_DEBUG ?= 1
export POWERKEY_I2C_SWITCH ?=0 export POWERKEY_I2C_SWITCH ?=0
export WL_DET ?= 1 export WL_DET ?= 0
export AUDIO_LOOPBACK ?= 0 export AUDIO_LOOPBACK ?= 0

View File

@ -135,14 +135,14 @@ const struct CODEC_DAC_VOL_T codec_dac_vol[TGT_VOLUME_LEVEL_QTY] = {
#elif SPEECH_CODEC_CAPTURE_CHANNEL_NUM == 3 #elif SPEECH_CODEC_CAPTURE_CHANNEL_NUM == 3
#define CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV (AUD_CHANNEL_MAP_CH0 | AUD_CHANNEL_MAP_CH1 | AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC1) #define CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV (AUD_CHANNEL_MAP_CH0 | AUD_CHANNEL_MAP_CH1 | AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC1)
#else #else
#define CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV (AUD_CHANNEL_MAP_CH3 | AUD_VMIC_MAP_VMIC4) #define CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV (AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC3)
#endif #endif
#define CFG_HW_AUD_INPUT_PATH_LINEIN_DEV (AUD_CHANNEL_MAP_CH0 | AUD_CHANNEL_MAP_CH1) #define CFG_HW_AUD_INPUT_PATH_LINEIN_DEV (AUD_CHANNEL_MAP_CH0 | AUD_CHANNEL_MAP_CH1)
#ifdef VOICE_DETECTOR_EN #ifdef VOICE_DETECTOR_EN
#define CFG_HW_AUD_INPUT_PATH_VADMIC_DEV (AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC1) #define CFG_HW_AUD_INPUT_PATH_VADMIC_DEV (AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC1)
#else #else
#define CFG_HW_AUD_INPUT_PATH_ASRMIC_DEV (AUD_CHANNEL_MAP_CH0 | AUD_VMIC_MAP_VMIC1) #define CFG_HW_AUD_INPUT_PATH_ASRMIC_DEV (AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC3)
#endif #endif
const struct AUD_IO_PATH_CFG_T cfg_audio_input_path_cfg[CFG_HW_AUD_INPUT_PATH_NUM] = { const struct AUD_IO_PATH_CFG_T cfg_audio_input_path_cfg[CFG_HW_AUD_INPUT_PATH_NUM] = {

View File

@ -140,8 +140,6 @@ extern const struct HAL_IOMUX_PIN_FUNCTION_MAP cfg_hw_tws_channel_cfg;
//extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_INT; //extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_INT;
extern bool tgt_tws_get_channel_is_right(void); extern bool tgt_tws_get_channel_is_right(void);
extern void app_mute_ctrl(bool Status);
extern void app_mutetimer_start();
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SDA; extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SDA;
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SCL; extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SCL;

View File

@ -1985,10 +1985,8 @@ static void analog_aud_codec_config_speaker(void)
ana_spk_enabled = en; ana_spk_enabled = en;
if (en) { if (en) {
analog_aud_enable_dac_pa(CFG_HW_AUD_OUTPUT_PATH_SPEAKER_DEV); analog_aud_enable_dac_pa(CFG_HW_AUD_OUTPUT_PATH_SPEAKER_DEV);
app_mutetimer_start();
} else { } else {
analog_aud_enable_dac_pa(0); analog_aud_enable_dac_pa(0);
app_mute_ctrl(false);
} }
} }
} }

View File

@ -629,12 +629,12 @@ const APP_KEY_HANDLE app_ibrt_ui_test_key_cfg[] =
//{{APP_KEY_CODE_PWR,APP_KEY_EVENT_CLICK},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL}, //{{APP_KEY_CODE_PWR,APP_KEY_EVENT_CLICK},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL},
#endif #endif
// {{APP_KEY_CODE_PWR,APP_KEY_EVENT_UP},"app_ibrt_ui_test_key", app_bt_sleep, NULL}, {{APP_KEY_CODE_PWR,APP_KEY_EVENT_UP},"app_ibrt_ui_test_key", app_bt_sleep, NULL},
//{{APP_KEY_CODE_PWR,APP_KEY_EVENT_LONGLONGPRESS},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL}, {{APP_KEY_CODE_PWR,APP_KEY_EVENT_LONGLONGPRESS},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL},
//{{APP_KEY_CODE_PWR,APP_KEY_EVENT_DOUBLECLICK},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL}, {{APP_KEY_CODE_PWR,APP_KEY_EVENT_DOUBLECLICK},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL},
//{{APP_KEY_CODE_PWR,APP_KEY_EVENT_TRIPLECLICK},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL}, {{APP_KEY_CODE_PWR,APP_KEY_EVENT_TRIPLECLICK},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL},
//{{APP_KEY_CODE_PWR,APP_KEY_EVENT_ULTRACLICK},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL}, {{APP_KEY_CODE_PWR,APP_KEY_EVENT_ULTRACLICK},"app_ibrt_ui_test_key", app_ibrt_ui_test_key, NULL},
// {{APP_KEY_CODE_PWR,APP_KEY_EVENT_DOWN},"app_ibrt_ui_test_key", app_wakeup_sleep, NULL}, //{{APP_KEY_CODE_PWR,APP_KEY_EVENT_DOWN},"app_ibrt_ui_test_key", app_wakeup_sleep, NULL},
//{{APP_KEY_CODE_PWR,APP_KEY_EVENT_LONGPRESS},"app_ibrt_ui_test_key", app_test_key, NULL}, //{{APP_KEY_CODE_PWR,APP_KEY_EVENT_LONGPRESS},"app_ibrt_ui_test_key", app_test_key, NULL},
//{{APP_KEY_CODE_PWR,APP_KEY_EVENT_DOUBLECLICK},"app_ibrt_ui_test_key", app_test_key, NULL}, //{{APP_KEY_CODE_PWR,APP_KEY_EVENT_DOUBLECLICK},"app_ibrt_ui_test_key", app_test_key, NULL},
// {{APP_KEY_CODE_PWR,APP_KEY_EVENT_NONE},"app_ibrt_ui_test_key", app_test_key, NULL}, // {{APP_KEY_CODE_PWR,APP_KEY_EVENT_NONE},"app_ibrt_ui_test_key", app_test_key, NULL},
@ -732,64 +732,67 @@ ibrt_pairing_info_t g_ibrt_pairing_info[] =
}; };
/******************************pwrkey_det_timer*********************************************************/ // /******************************pwrkey_det_timer*********************************************************/
osTimerId pwrkey_detid = NULL; // osTimerId pwrkey_detid = NULL;
void startpwrkey_det(int ms); // void startpwrkey_det(int ms);
void stoppwrkey_det(void); // void stoppwrkey_det(void);
static void pwrkey_detfun(const void *); // static void pwrkey_detfun(const void *);
osTimerDef(defpwrkey_det,pwrkey_detfun); // osTimerDef(defpwrkey_det,pwrkey_detfun);
void pwrkey_detinit(void) // void pwrkey_detinit(void)
{ // {
TRACE(3,"%s",__func__); // TRACE(3,"%s",__func__);
pwrkey_detid = osTimerCreate(osTimer(defpwrkey_det),osTimerOnce,(void *)0); // pwrkey_detid = osTimerCreate(osTimer(defpwrkey_det),osTimerOnce,(void *)0);
} // }
extern void app_ibrt_customif_test1_cmd_send(uint8_t *p_buff, uint16_t length); // extern void app_ibrt_customif_test1_cmd_send(uint8_t *p_buff, uint16_t length);
static void pwrkey_detfun(const void *) // static void pwrkey_detfun(const void *)
{ // {
static ibrt_ctrl_t *p_ibrt_ctrl = app_tws_ibrt_get_bt_ctrl_ctx(); // static ibrt_ctrl_t *p_ibrt_ctrl = app_tws_ibrt_get_bt_ctrl_ctx();
static bool last_pwrkey = false; // static bool last_pwrkey = false;
bool curr_pwrkey_sta; // bool curr_pwrkey_sta;
curr_pwrkey_sta = hal_pwrkey_pressed(); // curr_pwrkey_sta = hal_pwrkey_pressed();
APP_KEY_STATUS inear_status[] = {APP_KEY_CODE_FN3,HAL_KEY_EVENT_CLICK}; // APP_KEY_STATUS inear_status[] = {APP_KEY_CODE_FN3,HAL_KEY_EVENT_CLICK};
APP_KEY_STATUS outear_status[] = {APP_KEY_CODE_FN4,HAL_KEY_EVENT_CLICK}; // APP_KEY_STATUS outear_status[] = {APP_KEY_CODE_FN4,HAL_KEY_EVENT_CLICK};
//TRACE(3,"pwrkey = %d",curr_pwrkey_sta); // //TRACE(3,"pwrkey = %d",curr_pwrkey_sta);
if(curr_pwrkey_sta != last_pwrkey){ // if(curr_pwrkey_sta != last_pwrkey){
if(curr_pwrkey_sta == true){ // if(curr_pwrkey_sta == true){
//app_wakeup_sleep(NULL,NULL); // //app_wakeup_sleep(NULL,NULL);
TRACE(3,"%s PLAY",__func__); // TRACE(3,"%s PLAY",__func__);
if (IBRT_SLAVE == p_ibrt_ctrl->current_role){ // app_bt_accessmode_set(BTIF_BT_DEFAULT_ACCESS_MODE_PAIR);
app_ibrt_customif_test1_cmd_send((uint8_t *)inear_status, sizeof(APP_KEY_STATUS)); // app_voice_report(APP_STATUS_INDICATION_BOTHSCAN,0);
}else{
a2dp_handleKey(AVRCP_KEY_PLAY);
}
}else{
//app_bt_sleep(NULL,NULL);
TRACE(3,"%s PAUSE",__func__);
//a2dp_handleKey(AVRCP_KEY_PAUSE);
if (IBRT_SLAVE == p_ibrt_ctrl->current_role){
app_ibrt_customif_test1_cmd_send((uint8_t *)outear_status, sizeof(APP_KEY_STATUS));
}else{
a2dp_handleKey(AVRCP_KEY_PAUSE);
}
}
last_pwrkey = curr_pwrkey_sta;
}
startpwrkey_det(200);
}
void startpwrkey_det(int ms) // if (IBRT_SLAVE == p_ibrt_ctrl->current_role){
{ // app_ibrt_customif_test1_cmd_send((uint8_t *)inear_status, sizeof(APP_KEY_STATUS));
//TRACE(3,"\n\n !!!!!!!!!!start %s\n\n",__func__); // }else{
osTimerStart(pwrkey_detid,ms); // a2dp_handleKey(AVRCP_KEY_PLAY);
} // }
// }else{
// //app_bt_sleep(NULL,NULL);
// TRACE(3,"%s PAUSE",__func__);
// //a2dp_handleKey(AVRCP_KEY_PAUSE);
// if (IBRT_SLAVE == p_ibrt_ctrl->current_role){
// app_ibrt_customif_test1_cmd_send((uint8_t *)outear_status, sizeof(APP_KEY_STATUS));
// }else{
// a2dp_handleKey(AVRCP_KEY_PAUSE);
// }
// }
// last_pwrkey = curr_pwrkey_sta;
// }
// startpwrkey_det(200);
// }
void stoppwrkey_det(void) // void startpwrkey_det(int ms)
{ // {
//TRACE("\n\n!!!!!!!!!! stop %s\n\n",__func__); // //TRACE(3,"\n\n !!!!!!!!!!start %s\n\n",__func__);
osTimerStop(pwrkey_detid); // osTimerStart(pwrkey_detid,ms);
} // }
// void stoppwrkey_det(void)
// {
// //TRACE("\n\n!!!!!!!!!! stop %s\n\n",__func__);
// osTimerStop(pwrkey_detid);
// }

View File

@ -695,15 +695,7 @@ void app_tws_set_side_from_addr(uint8_t *addr)
void app_tws_set_side_from_gpio(void) void app_tws_set_side_from_gpio(void)
{ {
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&cfg_hw_tws_channel_cfg, 1);
hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)cfg_hw_tws_channel_cfg.pin, HAL_GPIO_DIR_IN, 1);
if (tgt_tws_get_channel_is_right()) {
app_tws_set_side(EAR_SIDE_RIGHT);
TRACE(0, "Right earbud");
} else {
app_tws_set_side(EAR_SIDE_LEFT);
TRACE(0, "Left earbud");
}
} }
#endif #endif

View File

@ -3434,6 +3434,11 @@ int bt_sbc_player(enum PLAYER_OPER_T on, enum APP_SYSFREQ_FREQ_T freq)
start_by_sbc = false; start_by_sbc = false;
#endif #endif
#ifdef WL_DET
app_mic_alg_audioloop(false,APP_SYSFREQ_78M);
#endif
#ifdef PLAYBACK_USE_I2S #ifdef PLAYBACK_USE_I2S
hal_cmu_audio_resample_enable(); hal_cmu_audio_resample_enable();
#endif #endif
@ -4307,6 +4312,10 @@ int bt_sbc_player(enum PLAYER_OPER_T on, enum APP_SYSFREQ_FREQ_T freq)
#endif #endif
#endif #endif
#ifdef WL_DET
app_mic_alg_audioloop(true,APP_SYSFREQ_78M);
#endif
#ifdef __THIRDPARTY #ifdef __THIRDPARTY
//app_thirdparty_specific_lib_event_handle(THIRDPARTY_ID_NO1,THIRDPARTY_OTHER_EVENT); //app_thirdparty_specific_lib_event_handle(THIRDPARTY_ID_NO1,THIRDPARTY_OTHER_EVENT);
#endif #endif