Compare commits
18 Commits
main
...
青马_AC6956C
| Author | SHA1 | Date | |
|---|---|---|---|
| 2158fd06d1 | |||
| b6aeaac51b | |||
| df714a6bf5 | |||
| ab7e23f756 | |||
| f0a5144043 | |||
| dd546b5ee6 | |||
| 2e7f6bca54 | |||
| 907fb0aed3 | |||
| f6387d0ef5 | |||
| 60a43b6d42 | |||
| ecca2a8e94 | |||
| 9a361cd5c2 | |||
| 3e57a00c29 | |||
| bcdf1af495 | |||
| 1a0d74bdfe | |||
| 59905ee18c | |||
| 729a2a0eec | |||
| 782a77c9b8 |
5
.vscode/c_cpp_properties.json
vendored
5
.vscode/c_cpp_properties.json
vendored
@ -77,6 +77,9 @@
|
||||
"${workspaceFolder}/apps/soundbox/include",
|
||||
"${workspaceFolder}/apps/soundbox/include/task_manager",
|
||||
"${workspaceFolder}/apps/soundbox/include/task_manager/bt",
|
||||
"${workspaceFolder}/apps/soundbox/include/task_manager/lp",
|
||||
"${workspaceFolder}/apps/soundbox/include/task_manager/linein",
|
||||
"${workspaceFolder}/apps/soundbox/include/task_manager/music",
|
||||
"${workspaceFolder}/apps/soundbox/include/user_api",
|
||||
"${workspaceFolder}/apps/common",
|
||||
"${workspaceFolder}/apps/common/device",
|
||||
@ -100,6 +103,8 @@
|
||||
"${workspaceFolder}/apps/common/include",
|
||||
"${workspaceFolder}/apps/common/config/include",
|
||||
"${workspaceFolder}/apps/soundbox/board/br23",
|
||||
"${workspaceFolder}/apps/soundbox/board/br23/board_ac695x_demo",
|
||||
"${workspaceFolder}/apps/kaotings",
|
||||
"${workspaceFolder}/cpu/br23",
|
||||
"${workspaceFolder}/cpu/br23/audio_common",
|
||||
"${workspaceFolder}/cpu/br23/audio_dec",
|
||||
|
||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"lp_dev.h": "c"
|
||||
}
|
||||
}
|
||||
BIN
EQ/JM207_20260313/JM207_LP_EQ+.rar
Normal file
BIN
EQ/JM207_20260313/JM207_LP_EQ+.rar
Normal file
Binary file not shown.
BIN
EQ/JM207_20260518/JM207.BT-EQ.2605-16.bin
Normal file
BIN
EQ/JM207_20260518/JM207.BT-EQ.2605-16.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260518/JM207.LP-EQ.2605-16.bin
Normal file
BIN
EQ/JM207_20260518/JM207.LP-EQ.2605-16.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260518/eq_cfg_bt.bin
Normal file
BIN
EQ/JM207_20260518/eq_cfg_bt.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260518/eq_cfg_lp.bin
Normal file
BIN
EQ/JM207_20260518/eq_cfg_lp.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260520/JM207-BT-260520.bin
Normal file
BIN
EQ/JM207_20260520/JM207-BT-260520.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260520/JM207-LP-260520.bin
Normal file
BIN
EQ/JM207_20260520/JM207-LP-260520.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260520/eq_cfg_bt.bin
Normal file
BIN
EQ/JM207_20260520/eq_cfg_bt.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260520/eq_cfg_lp.bin
Normal file
BIN
EQ/JM207_20260520/eq_cfg_lp.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260613/JM207.BTEQ.2026.06.13(1).bin
Normal file
BIN
EQ/JM207_20260613/JM207.BTEQ.2026.06.13(1).bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260613/JM207.LPEQ.2026.06.13.bin
Normal file
BIN
EQ/JM207_20260613/JM207.LPEQ.2026.06.13.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260613/eq_cfg_bt.bin
Normal file
BIN
EQ/JM207_20260613/eq_cfg_bt.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260613/eq_cfg_lp.bin
Normal file
BIN
EQ/JM207_20260613/eq_cfg_lp.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260615/JM207.BTEQ.2026.06.15.bin
Normal file
BIN
EQ/JM207_20260615/JM207.BTEQ.2026.06.15.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260615/JM207.LPEQ.2026.06.13(1).bin
Normal file
BIN
EQ/JM207_20260615/JM207.LPEQ.2026.06.13(1).bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260615/eq_cfg_bt.bin
Normal file
BIN
EQ/JM207_20260615/eq_cfg_bt.bin
Normal file
Binary file not shown.
BIN
EQ/JM207_20260615/eq_cfg_lp.bin
Normal file
BIN
EQ/JM207_20260615/eq_cfg_lp.bin
Normal file
Binary file not shown.
BIN
FW/KT26-0520_JM207/KT26-0520_56C-JM207_BB8F.fw
Normal file
BIN
FW/KT26-0520_JM207/KT26-0520_56C-JM207_BB8F.fw
Normal file
Binary file not shown.
BIN
FW/KT26-0520_JM207/jl_isd.fw
Normal file
BIN
FW/KT26-0520_JM207/jl_isd.fw
Normal file
Binary file not shown.
BIN
FW/KT26-0520_JM207/update.ufw
Normal file
BIN
FW/KT26-0520_JM207/update.ufw
Normal file
Binary file not shown.
7
Makefile
7
Makefile
@ -76,6 +76,7 @@ CFLAGS := \
|
||||
-Wno-shift-negative-value \
|
||||
-Wundef \
|
||||
-fms-extensions \
|
||||
-w \
|
||||
|
||||
|
||||
# 宏定义
|
||||
@ -155,6 +156,7 @@ INCLUDES := \
|
||||
-Iapps/soundbox/include \
|
||||
-Iapps/soundbox/include/task_manager \
|
||||
-Iapps/soundbox/include/task_manager/bt \
|
||||
-Iapps/soundbox/include/task_manager/lp \
|
||||
-Iapps/soundbox/include/user_api \
|
||||
-Iapps/common \
|
||||
-Iapps/common/device \
|
||||
@ -196,6 +198,7 @@ INCLUDES := \
|
||||
-Iapps/common/usb \
|
||||
-Iapps/common/usb/device \
|
||||
-Iapps/common/usb/host \
|
||||
-Iapps/kaotings \
|
||||
-Iapps/soundbox/smartbox \
|
||||
-Iapps/soundbox/smartbox/bt_manage/bt_trans_data \
|
||||
-Iapps/soundbox/smartbox/bt_manage \
|
||||
@ -564,6 +567,7 @@ c_SRC_FILES := \
|
||||
apps/soundbox/soundcard/notice.c \
|
||||
apps/soundbox/soundcard/peripheral.c \
|
||||
apps/soundbox/soundcard/soundcard.c \
|
||||
apps/kaotings/kt.c \
|
||||
apps/soundbox/task_manager/app_common.c \
|
||||
apps/soundbox/task_manager/app_task_switch.c \
|
||||
apps/soundbox/task_manager/bt/bt.c \
|
||||
@ -582,6 +586,9 @@ c_SRC_FILES := \
|
||||
apps/soundbox/task_manager/linein/linein.c \
|
||||
apps/soundbox/task_manager/linein/linein_api.c \
|
||||
apps/soundbox/task_manager/linein/linein_dev.c \
|
||||
apps/soundbox/task_manager/lp/lp.c \
|
||||
apps/soundbox/task_manager/lp/lp_dev.c \
|
||||
apps/soundbox/task_manager/lp/lp_api.c \
|
||||
apps/soundbox/task_manager/music/music.c \
|
||||
apps/soundbox/task_manager/pc/pc.c \
|
||||
apps/soundbox/task_manager/power_off/power_off.c \
|
||||
|
||||
139
apps/kaotings/kt.c
Normal file
139
apps/kaotings/kt.c
Normal file
@ -0,0 +1,139 @@
|
||||
#include "kt.h"
|
||||
#include "app_task.h"
|
||||
#include "avctp_user.h"
|
||||
|
||||
extern void kt_auto_mute_pa_init(void);
|
||||
|
||||
static u16 led_timer_id = 0;
|
||||
static int led_cnt = 0;
|
||||
|
||||
/* static int mute_test = 0;
|
||||
static u8 mute_test_flag = 0; */
|
||||
|
||||
void kt_boot_init(void)
|
||||
{
|
||||
// mute pin
|
||||
gpio_set_pull_up(KT_CFG_MUTE_PIN, 0);
|
||||
gpio_set_pull_down(KT_CFG_MUTE_PIN, 0);
|
||||
gpio_set_direction(KT_CFG_MUTE_PIN, 0);
|
||||
gpio_set_output_value(KT_CFG_MUTE_PIN, 0);
|
||||
PA_MUTE();
|
||||
// b led pin
|
||||
gpio_set_pull_up(KT_CFG_B_LED_PIN, 0);
|
||||
gpio_set_pull_down(KT_CFG_B_LED_PIN, 0);
|
||||
gpio_set_direction(KT_CFG_B_LED_PIN, 0);
|
||||
KT_CFG_B_LED_OFF();
|
||||
// r led pin
|
||||
gpio_set_pull_up(KT_CFG_R_LED_PIN, 0);
|
||||
gpio_set_pull_down(KT_CFG_R_LED_PIN, 0);
|
||||
gpio_set_direction(KT_CFG_R_LED_PIN, 0);
|
||||
KT_CFG_R_LED_OFF();
|
||||
}
|
||||
|
||||
extern void eff_file_switch(u8 *path);
|
||||
/**
|
||||
* @brief 切换EQ
|
||||
* @param eq_idx EQ索引,0:NORMAL 1:LP
|
||||
*/
|
||||
void kt_eq_switch_to(u8 eq_idx)
|
||||
{
|
||||
if (eq_idx == KT_EQ_IDX_LP)
|
||||
{
|
||||
// LP EQ
|
||||
// strcpy(EFF_CFG_FILE_NAME, EQ_FILE_BT);
|
||||
printf("kt_eq_switch_to: LP\n");
|
||||
eff_file_switch(EQ_FILE_LP);
|
||||
}
|
||||
else
|
||||
{
|
||||
// BT EQ
|
||||
// strcpy(EFF_CFG_FILE_NAME, EQ_FILE_BT);
|
||||
printf("kt_eq_switch_to: BT\n");
|
||||
eff_file_switch(EQ_FILE_BT);
|
||||
}
|
||||
}
|
||||
|
||||
static void led_timer_callback(void *priv)
|
||||
{
|
||||
/* mute_test++;
|
||||
if (mute_test > 100)
|
||||
{
|
||||
mute_test = 0;
|
||||
if (mute_test_flag)
|
||||
{
|
||||
PA_MUTE();
|
||||
mute_test_flag = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PA_UNMUTE();
|
||||
mute_test_flag = 1;
|
||||
}
|
||||
} */
|
||||
|
||||
if (app_get_curr_task() == APP_BT_TASK)
|
||||
{
|
||||
KT_CFG_R_LED_OFF();
|
||||
if (get_bt_connect_status() >= BT_STATUS_CONNECTING)
|
||||
{
|
||||
KT_CFG_B_LED_ON();
|
||||
}
|
||||
else
|
||||
{
|
||||
led_cnt++;
|
||||
if (led_cnt < 4)
|
||||
{
|
||||
KT_CFG_B_LED_ON();
|
||||
}
|
||||
else if (led_cnt < 8)
|
||||
{
|
||||
KT_CFG_B_LED_OFF();
|
||||
}
|
||||
else
|
||||
{
|
||||
led_cnt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (app_get_curr_task() == APP_MUSIC_TASK)
|
||||
{
|
||||
KT_CFG_R_LED_OFF();
|
||||
led_cnt++;
|
||||
if (led_cnt < 10)
|
||||
{
|
||||
KT_CFG_B_LED_ON();
|
||||
}
|
||||
else if (led_cnt < 20)
|
||||
{
|
||||
KT_CFG_B_LED_OFF();
|
||||
}
|
||||
else
|
||||
{
|
||||
led_cnt = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
KT_CFG_R_LED_ON();
|
||||
KT_CFG_B_LED_OFF();
|
||||
}
|
||||
}
|
||||
static void start_led_timer(void)
|
||||
{
|
||||
if (led_timer_id)
|
||||
{
|
||||
sys_timer_del(led_timer_id);
|
||||
led_timer_id = 0;
|
||||
}
|
||||
|
||||
sys_timer_add(NULL, led_timer_callback, 50);
|
||||
}
|
||||
|
||||
void kt_init(void)
|
||||
{
|
||||
printf("kt_init\n");
|
||||
kt_auto_mute_pa_init();
|
||||
start_led_timer();
|
||||
|
||||
//gpio_set_output_value(KT_CFG_MUTE_PIN, 1);
|
||||
}
|
||||
58
apps/kaotings/kt.h
Normal file
58
apps/kaotings/kt.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef __KT_H__
|
||||
#define __KT_H__
|
||||
|
||||
|
||||
#include "system/includes.h"
|
||||
/**
|
||||
* LINEIN IN AUX2 PB9 & PB10
|
||||
* LP IN AUX0 PA0 & PA1
|
||||
* LP_DET IN PB2
|
||||
*/
|
||||
|
||||
#define KT_CFG_B_LED_PIN IO_PORTC_02
|
||||
#define KT_CFG_B_LED_ON() gpio_set_output_value(KT_CFG_B_LED_PIN, 1)
|
||||
#define KT_CFG_B_LED_OFF() gpio_set_output_value(KT_CFG_B_LED_PIN, 0)
|
||||
|
||||
#define KT_CFG_R_LED_PIN IO_PORTC_03
|
||||
#define KT_CFG_R_LED_ON() gpio_set_output_value(KT_CFG_R_LED_PIN, 1)
|
||||
#define KT_CFG_R_LED_OFF() gpio_set_output_value(KT_CFG_R_LED_PIN, 0)
|
||||
|
||||
#define KT_CFG_MUTE_PIN IO_PORTB_00
|
||||
#define PA_MUTE() do { printf("[<"); gpio_set_output_value(KT_CFG_MUTE_PIN, 0); } while(0)
|
||||
#define PA_UNMUTE() do { printf(">]"); gpio_set_output_value(KT_CFG_MUTE_PIN, 1); } while(0)
|
||||
|
||||
//#define PA_MUTE()
|
||||
//#define PA_UNMUTE()
|
||||
|
||||
//#define KT_CFG_AUX_IDX_LINEIN 0
|
||||
//#define KT_CFG_AUX_IDX_LP 1
|
||||
//void kt_aux_switch_to(u8 aux_idx);
|
||||
|
||||
//SDFILE_RES_ROOT_PATH
|
||||
#define EQ_FILE_BT SDFILE_RES_ROOT_PATH"eq_cfg_bt.bin"
|
||||
#define EQ_FILE_MUSIC SDFILE_RES_ROOT_PATH"eq_cfg_music.bin"
|
||||
#define EQ_FILE_LINEIN SDFILE_RES_ROOT_PATH"eq_cfg_linein.bin"
|
||||
#define EQ_FILE_LP SDFILE_RES_ROOT_PATH"eq_cfg_lp.bin"
|
||||
|
||||
#define KT_EQ_IDX_BT 0
|
||||
#define KT_EQ_IDX_MUSIC 1
|
||||
#define KT_EQ_IDX_LINEIN 2
|
||||
#define KT_EQ_IDX_LP 3
|
||||
//#define KT_EQ_IDX_NORMAL 4
|
||||
|
||||
typedef struct __PA_MUTE_VAR {
|
||||
u8 mute_flag;
|
||||
u8 unmute_flag;
|
||||
u16 mute_cnt;
|
||||
u16 unmute_cnt;
|
||||
u16 pa_mute_tid;
|
||||
} PA_MUTE_VAR;
|
||||
|
||||
|
||||
|
||||
void kt_eq_switch_to(u8 eq_idx);
|
||||
|
||||
void kt_boot_init(void);
|
||||
void kt_init(void);
|
||||
|
||||
#endif
|
||||
@ -93,6 +93,12 @@ void app_task_loop()
|
||||
log_info("APP_SMARTBOX_ACTION_TASK \n");
|
||||
app_smartbox_task();
|
||||
break;
|
||||
#if TCFG_APP_LP_EN
|
||||
case APP_LP_TASK:
|
||||
log_info("APP_LP_TASK \n");
|
||||
app_lp_task();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
app_task_clear_key_msg();//清理按键消息
|
||||
//检查整理VM
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include "key_event_deal.h"
|
||||
#include "user_cfg.h"
|
||||
#include "linein/linein_dev.h"
|
||||
#include "lp/lp_dev.h"
|
||||
#include "usb/otg.h"
|
||||
#include "ui/ui_api.h"
|
||||
#include "dev_manager.h"
|
||||
@ -259,7 +260,7 @@ struct adc_platform_data adc_data = {
|
||||
0:2.3v 1:2.5v 2:2.7v 3:3.0v */
|
||||
.mic_ldo_vsel = 2,
|
||||
/*MIC电容隔直模式使用内部mic偏置(PC7)*/
|
||||
.mic_bias_inside = 1,
|
||||
.mic_bias_inside = 0,
|
||||
/*保持内部mic偏置输出*/
|
||||
.mic_bias_keep = 0,
|
||||
};
|
||||
@ -412,6 +413,17 @@ struct linein_dev_data linein_data = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if TCFG_LP_ENABLE
|
||||
struct lp_dev_data lp_data = {
|
||||
.enable = TCFG_LP_ENABLE,
|
||||
.port = TCFG_LP_CHECK_PORT,
|
||||
.up = TCFG_LP_PORT_UP_ENABLE,
|
||||
.down = TCFG_LP_PORT_DOWN_ENABLE,
|
||||
.ad_channel = TCFG_LP_AD_CHANNEL,
|
||||
.ad_vol = TCFG_LP_VOLTAGE,
|
||||
};
|
||||
#endif
|
||||
|
||||
/************************** RDEC_KEY ****************************/
|
||||
#if TCFG_RDEC_KEY_ENABLE
|
||||
const struct rdec_device rdeckey_list[] = {
|
||||
@ -740,6 +752,9 @@ REGISTER_DEVICES(device_table) = {
|
||||
#if TCFG_LINEIN_ENABLE
|
||||
{ "linein", &linein_dev_ops, (void *)&linein_data},
|
||||
#endif
|
||||
#if TCFG_LP_ENABLE
|
||||
{ "lp", &lp_dev_ops, (void *) &lp_data},
|
||||
#endif
|
||||
#if TCFG_OTG_MODE
|
||||
{ "otg", &usb_dev_ops, (void *) &otg_data},
|
||||
#endif
|
||||
@ -798,7 +813,7 @@ struct port_wakeup port0 = {
|
||||
.pullup_down_enable = ENABLE, //配置I/O 内部上下拉是否使能
|
||||
.edge = FALLING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
.attribute = BLUETOOTH_RESUME, //保留参数
|
||||
.iomap = IO_PORTA_10, //唤醒口选择
|
||||
.iomap = IO_PORTB_03, //唤醒口选择
|
||||
};
|
||||
|
||||
/* RTC PR0 PR1 唤醒 */
|
||||
|
||||
@ -28,11 +28,12 @@
|
||||
#define TCFG_APP_BT_EN 1
|
||||
#define TCFG_APP_MUSIC_EN 1
|
||||
#define TCFG_APP_LINEIN_EN 1
|
||||
#define TCFG_APP_FM_EN 1
|
||||
#define TCFG_APP_PC_EN 1
|
||||
#define TCFG_APP_RTC_EN 1
|
||||
#define TCFG_APP_RECORD_EN 1
|
||||
#define TCFG_APP_FM_EN 0
|
||||
#define TCFG_APP_PC_EN 0
|
||||
#define TCFG_APP_RTC_EN 0
|
||||
#define TCFG_APP_RECORD_EN 0
|
||||
#define TCFG_APP_SPDIF_EN 0
|
||||
#define TCFG_APP_LP_EN 1
|
||||
//*********************************************************************************//
|
||||
// PCM_DEBUG调试配置 //
|
||||
//*********************************************************************************//
|
||||
@ -42,9 +43,9 @@
|
||||
//*********************************************************************************//
|
||||
// UART配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_UART0_ENABLE ENABLE_THIS_MOUDLE //串口打印模块使能
|
||||
#define TCFG_UART0_ENABLE DISABLE_THIS_MOUDLE //串口打印模块使能
|
||||
#define TCFG_UART0_RX_PORT NO_CONFIG_PORT //串口接收脚配置(用于打印可以选择NO_CONFIG_PORT)
|
||||
#define TCFG_UART0_TX_PORT IO_PORTA_05 //串口发送脚配置
|
||||
#define TCFG_UART0_TX_PORT IO_PORT_DP //串口发送脚配置
|
||||
#define TCFG_UART0_BAUDRATE 1000000 //串口波特率配置
|
||||
|
||||
//*********************************************************************************//
|
||||
@ -65,7 +66,7 @@
|
||||
//*********************************************************************************//
|
||||
// 硬件SPI 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_HW_SPI1_ENABLE ENABLE_THIS_MOUDLE
|
||||
#define TCFG_HW_SPI1_ENABLE DISABLE_THIS_MOUDLE
|
||||
//A组IO: DI: PB2 DO: PB1 CLK: PB0
|
||||
//B组IO: DI: PC3 DO: PC5 CLK: PC4
|
||||
#define TCFG_HW_SPI1_PORT 'A'
|
||||
@ -73,7 +74,7 @@
|
||||
#define TCFG_HW_SPI1_MODE SPI_MODE_BIDIR_1BIT
|
||||
#define TCFG_HW_SPI1_ROLE SPI_ROLE_MASTER
|
||||
|
||||
#define TCFG_HW_SPI2_ENABLE ENABLE_THIS_MOUDLE
|
||||
#define TCFG_HW_SPI2_ENABLE DISABLE_THIS_MOUDLE
|
||||
//A组IO: DI: PB8 DO: PB10 CLK: PB9
|
||||
//B组IO: DI: PA13 DO: DM CLK: DP
|
||||
#define TCFG_HW_SPI2_PORT 'A'
|
||||
@ -84,7 +85,7 @@
|
||||
//*********************************************************************************//
|
||||
// FLASH 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_NORFLASH_DEV_ENABLE DISABLE_THIS_MOUDLE
|
||||
#define TCFG_NORFLASH_DEV_ENABLE DISABLE_THIS_MOUDLE
|
||||
#define TCFG_NANDFLASH_DEV_ENABLE DISABLE_THIS_MOUDLE
|
||||
#define TCFG_FLASH_DEV_SPI_HW_NUM 1// 1: SPI1 2: SPI2
|
||||
#define TCFG_FLASH_DEV_SPI_CS_PORT IO_PORTA_03
|
||||
@ -118,7 +119,7 @@
|
||||
#define SD_CMD_DECT 0
|
||||
#define SD_CLK_DECT 1
|
||||
#define SD_IO_DECT 2
|
||||
#define TCFG_SD0_ENABLE ENABLE_THIS_MOUDLE
|
||||
#define TCFG_SD0_ENABLE DISABLE_THIS_MOUDLE
|
||||
//A组IO: CMD:PA9 CLK:PA10 DAT0:PA5 DAT1:PA6 DAT2:PA7 DAT3:PA8
|
||||
//B组IO: CMD:PB10 CLK:PB9 DAT0:PB8 DAT1:PB6 DAT2:PB5 DAT3:PB4
|
||||
#define TCFG_SD0_PORTS 'B'
|
||||
@ -228,9 +229,9 @@
|
||||
//*********************************************************************************//
|
||||
#define TCFG_ADKEY_ENABLE ENABLE_THIS_MOUDLE//是否使能AD按键
|
||||
#define TCFG_ADKEY_LED_IO_REUSE DISABLE_THIS_MOUDLE //ADKEY 和 LED IO复用,led只能设置蓝灯显示
|
||||
#define TCFG_ADKEY_PORT IO_PORTA_10 //AD按键端口(需要注意选择的IO口是否支持AD功能)
|
||||
#define TCFG_ADKEY_AD_CHANNEL AD_CH_PA10
|
||||
#define TCFG_ADKEY_EXTERN_UP_ENABLE ENABLE_THIS_MOUDLE //是否使用外部上拉
|
||||
#define TCFG_ADKEY_PORT IO_PORTB_03 //AD按键端口(需要注意选择的IO口是否支持AD功能)
|
||||
#define TCFG_ADKEY_AD_CHANNEL AD_CH_PB3
|
||||
#define TCFG_ADKEY_EXTERN_UP_ENABLE DISABLE_THIS_MOUDLE //是否使用外部上拉
|
||||
|
||||
#if TCFG_ADKEY_EXTERN_UP_ENABLE
|
||||
#define R_UP 220 //22K,外部上拉阻值在此自行设置
|
||||
@ -395,8 +396,8 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define AUDIO_OUTPUT_WAY AUDIO_OUTPUT_WAY_DAC
|
||||
#define LINEIN_INPUT_WAY LINEIN_INPUT_WAY_ADC //LINEIN_INPUT_WAY_ANALOG
|
||||
|
||||
#define AUDIO_OUTPUT_AUTOMUTE 0//ENABLE
|
||||
#define DAC_AUTO_HIGH_Z_EN DISABLE //处理直推串音问题, 隔直不要开
|
||||
#define AUDIO_OUTPUT_AUTOMUTE 1//ENABLE
|
||||
#define DAC_AUTO_HIGH_Z_EN 0 //DISABLE //处理直推串音问题, 隔直不要开
|
||||
|
||||
/*
|
||||
*系统音量类型选择
|
||||
@ -421,9 +422,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_CALL_USE_DIGITAL_VOLUME 0
|
||||
|
||||
// 使能改宏,提示音音量使用music音量
|
||||
#define APP_AUDIO_STATE_WTONE_BY_MUSIC (1)
|
||||
#define APP_AUDIO_STATE_WTONE_BY_MUSIC (0)
|
||||
// 0:提示音不使用默认音量; 1:默认提示音音量值
|
||||
#define TONE_MODE_DEFAULE_VOLUME (0)
|
||||
#define TONE_MODE_DEFAULE_VOLUME (18)
|
||||
|
||||
//AudioEffects代码链接管理
|
||||
#define AUDIO_EFFECTS_DRC_AT_RAM 0
|
||||
@ -470,9 +471,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
// UI 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_UI_ENABLE ENABLE_THIS_MOUDLE //UI总开关
|
||||
#define CONFIG_UI_STYLE STYLE_JL_LED7
|
||||
#define TCFG_UI_LED7_ENABLE ENABLE_THIS_MOUDLE //UI使用LED7显示
|
||||
#define TCFG_UI_ENABLE DISABLE_THIS_MOUDLE //UI总开关
|
||||
//#define CONFIG_UI_STYLE STYLE_JL_LED7
|
||||
#define TCFG_UI_LED7_ENABLE DISABLE_THIS_MOUDLE //UI使用LED7显示
|
||||
// #define TCFG_UI_LCD_SEG3X9_ENABLE ENABLE_THIS_MOUDLE //UI使用LCD段码屏显示
|
||||
// #define TCFG_LCD_ST7735S_ENABLE ENABLE_THIS_MOUDLE
|
||||
// #define TCFG_LCD_ST7789VW_ENABLE ENABLE_THIS_MOUDLE
|
||||
@ -505,20 +506,21 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
// EQ配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_USE_EQ_FILE 1 //使用eq_cfg_xxx.bin文件(需与EQ_FILE_SWITCH_EN配合实现BT/LP等切换)
|
||||
#define TCFG_EQ_ENABLE 1 //支持EQ功能,EQ总使能
|
||||
#if TCFG_EQ_ENABLE
|
||||
#define TCFG_BT_MUSIC_EQ_ENABLE 1 //支持蓝牙音乐EQ
|
||||
#define TCFG_PHONE_EQ_ENABLE 1 //支持通话近端EQ
|
||||
#define TCFG_PHONE_EQ_ENABLE 0 //支持通话近端EQ
|
||||
#define TCFG_MUSIC_MODE_EQ_ENABLE 1 //支持音乐模式EQ
|
||||
#define TCFG_LINEIN_MODE_EQ_ENABLE 1 //支持linein近端EQ
|
||||
#define TCFG_FM_MODE_EQ_ENABLE 1 //支持fm模式EQ
|
||||
#define TCFG_SPDIF_MODE_EQ_ENABLE 1 //支持SPDIF模式EQ
|
||||
#define TCFG_PC_MODE_EQ_ENABLE 1 //支持pc模式EQ
|
||||
#define TCFG_FM_MODE_EQ_ENABLE 0 //支持fm模式EQ
|
||||
#define TCFG_SPDIF_MODE_EQ_ENABLE 0 //支持SPDIF模式EQ
|
||||
#define TCFG_PC_MODE_EQ_ENABLE 0 //支持pc模式EQ
|
||||
#define TCFG_AUDIO_OUT_EQ_ENABLE 0 //高低音EQ
|
||||
#define TCFG_AUDIO_MIC_EFFECT_POST_EQ_ENABLE 0 //MIC音效后置EQ使能(includes DRC)
|
||||
|
||||
|
||||
#define EQ_SECTION_MAX 20//eq 段数
|
||||
#define EQ_SECTION_MAX 10//eq 段数
|
||||
#define TCFG_DYNAMIC_EQ_ENABLE 0 //动态eq使能,接在eq后,需输入32bit位宽数据
|
||||
#endif//TCFG_EQ_ENABLE
|
||||
|
||||
@ -529,9 +531,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_BT_MUSIC_DRC_ENABLE 1 //支持蓝牙音乐DRC
|
||||
#define TCFG_MUSIC_MODE_DRC_ENABLE 1 //支持音乐模式DRC
|
||||
#define TCFG_LINEIN_MODE_DRC_ENABLE 1 //支持LINEIN模式DRC
|
||||
#define TCFG_FM_MODE_DRC_ENABLE 1 //支持FM模式DRC
|
||||
#define TCFG_SPDIF_MODE_DRC_ENABLE 1 //支持SPDIF模式DRC
|
||||
#define TCFG_PC_MODE_DRC_ENABLE 1 //支持PC模式DRC
|
||||
#define TCFG_FM_MODE_DRC_ENABLE 0 //支持FM模式DRC
|
||||
#define TCFG_SPDIF_MODE_DRC_ENABLE 0 //支持SPDIF模式DRC
|
||||
#define TCFG_PC_MODE_DRC_ENABLE 0 //支持PC模式DRC
|
||||
#define TCFG_AUDIO_OUT_DRC_ENABLE 0 //高低音EQ后的drc
|
||||
#endif//TCFG_DRC_ENABLE
|
||||
|
||||
@ -540,8 +542,8 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
// 新音箱配置工具 && 调音工具 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_SOUNDBOX_TOOL_ENABLE DISABLE //是否支持音箱在线配置工具
|
||||
#define TCFG_EFFECT_TOOL_ENABLE DISABLE //是否支持在线音效调试,使能该项还需使能EQ总使能TCFG_EQ_ENABL,
|
||||
#define TCFG_SOUNDBOX_TOOL_ENABLE 0 //是否支持音箱在线配置工具
|
||||
#define TCFG_EFFECT_TOOL_ENABLE 0 //是否支持在线音效调试,使能该项还需使能EQ总使能TCFG_EQ_ENABL,
|
||||
#define TCFG_NULL_COMM 0 //不支持通信
|
||||
#define TCFG_UART_COMM 1 //串口通信
|
||||
#define TCFG_USB_COMM 2 //USB通信
|
||||
@ -661,9 +663,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
// 系统配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_AUTO_SHUT_DOWN_TIME 0 //没有蓝牙连接自动关机时间
|
||||
#define TCFG_SYS_LVD_EN 1 //电量检测使能
|
||||
#define TCFG_SYS_LVD_EN 0 //电量检测使能
|
||||
#define TCFG_POWER_ON_NEED_KEY 0 //是否需要按按键开机配置
|
||||
#define TWFG_APP_POWERON_IGNORE_DEV 4000//上电忽略挂载设备,0时不忽略,非0则n毫秒忽略
|
||||
#define TWFG_APP_POWERON_IGNORE_DEV 0 //4000//上电忽略挂载设备,0时不忽略,非0则n毫秒忽略
|
||||
|
||||
#define TCFG_AUDIO_DEC_OUT_TASK 0 // 解码使用单独任务做输出
|
||||
|
||||
@ -677,8 +679,8 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_USER_EMITTER_ENABLE 0 //emitter功能使能
|
||||
#define TCFG_BT_SNIFF_ENABLE 0 //bt sniff 功能使能
|
||||
|
||||
#define USER_SUPPORT_PROFILE_SPP 1
|
||||
#define USER_SUPPORT_PROFILE_HFP 1
|
||||
#define USER_SUPPORT_PROFILE_SPP 0
|
||||
#define USER_SUPPORT_PROFILE_HFP 0
|
||||
#define USER_SUPPORT_PROFILE_A2DP 1
|
||||
#define USER_SUPPORT_PROFILE_AVCTP 1
|
||||
#define USER_SUPPORT_PROFILE_HID 1
|
||||
@ -698,12 +700,12 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#endif
|
||||
|
||||
#define BT_INBAND_RINGTONE 0 //是否播放手机自带来电铃声
|
||||
#define BT_PHONE_NUMBER 1 //是否播放来电报号
|
||||
#define BT_PHONE_NUMBER 0 //是否播放来电报号
|
||||
#define BT_SYNC_PHONE_RING 0 //是否TWS同步播放来电铃声
|
||||
#define BT_SUPPORT_DISPLAY_BAT 1 //是否使能电量检测
|
||||
#define BT_SUPPORT_MUSIC_VOL_SYNC 1 //是否使能音量同步
|
||||
#define BT_SUPPORT_DISPLAY_BAT 0 //是否使能电量检测
|
||||
#define BT_SUPPORT_MUSIC_VOL_SYNC 0 //是否使能音量同步
|
||||
|
||||
#define TCFG_BLUETOOTH_BACK_MODE 1 //后台模式
|
||||
#define TCFG_BLUETOOTH_BACK_MODE 0 //后台模式
|
||||
|
||||
#if (TCFG_USER_TWS_ENABLE && TCFG_BLUETOOTH_BACK_MODE) && (TCFG_BT_SNIFF_ENABLE==0) && defined(CONFIG_LOCAL_TWS_ENABLE)
|
||||
#define TCFG_DEC2TWS_ENABLE 1 // 本地解码转发
|
||||
@ -743,7 +745,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_LINEIN_ENABLE TCFG_APP_LINEIN_EN // linein使能
|
||||
// #define TCFG_LINEIN_LADC_IDX 0 // linein使用的ladc通道,对应ladc_list
|
||||
#define TCFG_LINEIN_LR_CH AUDIO_LIN0_LR
|
||||
#define TCFG_LINEIN_CHECK_PORT IO_PORTB_03 // linein检测IO
|
||||
#define TCFG_LINEIN_CHECK_PORT IO_PORTC_07 // linein检测IO
|
||||
#define TCFG_LINEIN_PORT_UP_ENABLE 1 // 检测IO上拉使能
|
||||
#define TCFG_LINEIN_PORT_DOWN_ENABLE 0 // 检测IO下拉使能
|
||||
#define TCFG_LINEIN_AD_CHANNEL NO_CONFIG_PORT // 检测IO是否使用AD检测
|
||||
@ -751,7 +753,21 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_LINEIN_INPUT_WAY LINEIN_INPUT_WAY
|
||||
#define TCFG_LINEIN_MULTIPLEX_WITH_SD DISABLE // linein 检测与 SD cmd 复用
|
||||
#define TCFG_LINEIN_SD_PORT 0// 0:sd0 1:sd1 //选择复用的sd口
|
||||
#define TCFG_LINEIN_DETECT_ENABLE 0
|
||||
#define TCFG_LINEIN_DETECT_ENABLE 1
|
||||
|
||||
//*********************************************************************************//
|
||||
#define TCFG_LP_ENABLE TCFG_APP_LP_EN // lp使能
|
||||
// #define TCFG_LINEIN_LADC_IDX 0 // lp使用的ladc通道,对应ladc_list
|
||||
#define TCFG_LP_LR_CH AUDIO_LIN2_LR
|
||||
#define TCFG_LP_CHECK_PORT IO_PORTB_02 // lp检测IO
|
||||
#define TCFG_LP_PORT_UP_ENABLE 1 // 检测IO上拉使能
|
||||
#define TCFG_LP_PORT_DOWN_ENABLE 0 // 检测IO下拉使能
|
||||
#define TCFG_LP_AD_CHANNEL NO_CONFIG_PORT // 检测IO是否使用AD检测
|
||||
#define TCFG_LP_VOLTAGE 0 // AD检测时的阀值
|
||||
#define TCFG_LP_INPUT_WAY LINEIN_INPUT_WAY
|
||||
#define TCFG_LP_MULTIPLEX_WITH_SD DISABLE // lp 检测与 SD cmd 复用
|
||||
#define TCFG_LP_SD_PORT 0// 0:sd0 1:sd1 //选择复用的sd口
|
||||
#define TCFG_LP_DETECT_ENABLE 1
|
||||
//*********************************************************************************//
|
||||
// music 配置 //
|
||||
//*********************************************************************************//
|
||||
@ -759,18 +775,18 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_DEC_MP3_ENABLE ENABLE
|
||||
#define TCFG_DEC_WMA_ENABLE ENABLE
|
||||
#define TCFG_DEC_WAV_ENABLE ENABLE
|
||||
#define TCFG_DEC_FLAC_ENABLE ENABLE
|
||||
#define TCFG_DEC_APE_ENABLE ENABLE
|
||||
#define TCFG_DEC_M4A_ENABLE ENABLE
|
||||
#define TCFG_DEC_ALAC_ENABLE ENABLE
|
||||
#define TCFG_DEC_AMR_ENABLE ENABLE
|
||||
#define TCFG_DEC_DTS_ENABLE ENABLE
|
||||
#define TCFG_DEC_FLAC_ENABLE 0
|
||||
#define TCFG_DEC_APE_ENABLE 0
|
||||
#define TCFG_DEC_M4A_ENABLE 0
|
||||
#define TCFG_DEC_ALAC_ENABLE 0
|
||||
#define TCFG_DEC_AMR_ENABLE 0
|
||||
#define TCFG_DEC_DTS_ENABLE 0
|
||||
#define TCFG_DEC_G726_ENABLE DISABLE
|
||||
#define TCFG_DEC_MIDI_ENABLE DISABLE
|
||||
#define TCFG_DEC_MTY_ENABLE DISABLE
|
||||
#define TCFG_DEC_SBC_ENABLE ENABLE
|
||||
#define TCFG_DEC_PCM_ENABLE ENABLE
|
||||
#define TCFG_DEC_CVSD_ENABLE ENABLE
|
||||
#define TCFG_DEC_SBC_ENABLE 1
|
||||
#define TCFG_DEC_PCM_ENABLE 1
|
||||
#define TCFG_DEC_CVSD_ENABLE 1
|
||||
#define TCFG_DEC_WTGV2_ENABLE DISABLE
|
||||
|
||||
#define TCFG_DEC_ID3_V1_ENABLE DISABLE
|
||||
@ -868,10 +884,10 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
#define TCFG_ENC_CVSD_ENABLE ENABLE
|
||||
#define TCFG_ENC_MSBC_ENABLE ENABLE
|
||||
#define TCFG_ENC_G726_ENABLE ENABLE
|
||||
#define TCFG_ENC_MP3_ENABLE ENABLE
|
||||
#define TCFG_ENC_ADPCM_ENABLE ENABLE
|
||||
#define TCFG_ENC_PCM_ENABLE ENABLE
|
||||
#define TCFG_ENC_G726_ENABLE 0
|
||||
#define TCFG_ENC_MP3_ENABLE 0
|
||||
#define TCFG_ENC_ADPCM_ENABLE 0
|
||||
#define TCFG_ENC_PCM_ENABLE 1
|
||||
#define TCFG_ENC_SBC_ENABLE ENABLE
|
||||
#define TCFG_ENC_OPUS_ENABLE DISABLE
|
||||
#define TCFG_ENC_SPEEX_ENABLE DISABLE
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
const u16 bt_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
//单击 //长按 //hold //抬起 //双击 //三击
|
||||
[0] = {
|
||||
KEY_CHANGE_MODE, KEY_POWEROFF, KEY_POWEROFF_HOLD, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_TEST_DEMO_0, KEY_POWEROFF, KEY_POWEROFF_HOLD, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[1] = {
|
||||
KEY_MUSIC_PREV, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
@ -122,6 +122,45 @@ const u16 linein_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
/***********************************************************
|
||||
* lp 模式的 adkey table
|
||||
***********************************************************/
|
||||
#if TCFG_APP_LP_EN
|
||||
const u16 lp_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
//单击 //长按 //hold //抬起 //双击 //三击
|
||||
[0] = {
|
||||
KEY_MUSIC_PP, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[1] = {
|
||||
KEY_MUSIC_PREV, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[2] = {
|
||||
KEY_MUSIC_NEXT, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[3] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[4] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_REVERB_OPEN, KEY_NULL
|
||||
},
|
||||
[5] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_ENC_START, KEY_NULL
|
||||
},
|
||||
[6] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[7] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[8] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[9] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
/***********************************************************
|
||||
* music 模式的 adkey table
|
||||
***********************************************************/
|
||||
|
||||
@ -85,6 +85,32 @@ const u16 linein_key_io_table[KEY_IO_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
},
|
||||
};
|
||||
#endif
|
||||
/***********************************************************
|
||||
* lp 模式的 iokey table
|
||||
***********************************************************/
|
||||
#if TCFG_APP_LP_EN
|
||||
const u16 lp_key_io_table[KEY_IO_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
//单击 //长按 //hold //抬起 //双击 //三击
|
||||
[0] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[1] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[2] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[3] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[4] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[5] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
/***********************************************************
|
||||
* music 模式的 iokey table
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include "app_charge.h"
|
||||
#include "chgbox_ctrl.h"
|
||||
#include "update_loader_download.h"
|
||||
#include "kt.h"
|
||||
|
||||
|
||||
extern void setup_arch();
|
||||
@ -103,6 +104,8 @@ static void app_init()
|
||||
|
||||
board_init();
|
||||
|
||||
kt_boot_init();
|
||||
|
||||
do_initcall();
|
||||
|
||||
do_module_initcall();
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#define CONFIG_DEBUG_LIB(x) (x & LIB_DEBUG)
|
||||
|
||||
#define CONFIG_DEBUG_ENABLE
|
||||
//#define CONFIG_DEBUG_ENABLE
|
||||
|
||||
#ifndef CONFIG_DEBUG_ENABLE
|
||||
//#define CONFIG_DEBUG_LITE_ENABLE //轻量级打印开关, 默认关闭
|
||||
|
||||
@ -21,6 +21,7 @@ enum {
|
||||
APP_SPDIF_TASK = 12,
|
||||
APP_WATCH_UPDATE_TASK = 13,
|
||||
APP_SMARTBOX_ACTION_TASK = 14,
|
||||
APP_LP_TASK = 15,
|
||||
APP_TASK_MAX_INDEX,
|
||||
};
|
||||
|
||||
@ -60,6 +61,7 @@ extern u8 app_prev_task;
|
||||
//*********************************************************************************//
|
||||
extern int music_app_check(void);
|
||||
extern int linein_app_check(void);
|
||||
extern int lp_app_check(void);
|
||||
extern int pc_app_check(void);
|
||||
extern int record_app_check(void);
|
||||
|
||||
@ -74,6 +76,7 @@ extern u8 bt_app_exit_check();
|
||||
extern void app_bt_task();
|
||||
extern void app_music_task();
|
||||
extern void app_linein_task();
|
||||
extern void app_lp_task();
|
||||
extern void app_pc_task();
|
||||
extern void app_record_task();
|
||||
extern void app_spdif_task();
|
||||
|
||||
3317
apps/soundbox/include/cq.txt
Normal file
3317
apps/soundbox/include/cq.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -172,6 +172,7 @@ enum {
|
||||
KEY_IR_NUM_8,
|
||||
KEY_IR_NUM_9,//中间不允许插入
|
||||
//在这里增加元素
|
||||
KEY_LP_START,
|
||||
//
|
||||
KEY_HID_MODE_SWITCH,
|
||||
KEY_HID_TAKE_PICTURE,
|
||||
|
||||
22
apps/soundbox/include/task_manager/lp/lp.h
Normal file
22
apps/soundbox/include/task_manager/lp/lp.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef _LP_H_
|
||||
#define _LP_H_
|
||||
|
||||
#include "system/event.h"
|
||||
|
||||
int lp_device_event_handler(struct sys_event *event);
|
||||
void app_lp_tone_play_start(u8 mix);
|
||||
|
||||
int lp_start(void);
|
||||
void lp_stop(void);
|
||||
void lp_key_vol_up();
|
||||
void lp_key_vol_down();
|
||||
u8 lp_get_status(void);
|
||||
int lp_volume_pp(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
21
apps/soundbox/include/task_manager/lp/lp_dev.h
Normal file
21
apps/soundbox/include/task_manager/lp/lp_dev.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef _LP_DEV_H_
|
||||
#define _LP_DEV_H_
|
||||
|
||||
#include "typedef.h"
|
||||
#include "device/device.h"
|
||||
|
||||
struct lp_dev_data {
|
||||
u8 enable;
|
||||
u8 port;
|
||||
u8 up : 1;
|
||||
u8 down : 1;
|
||||
u8 ad_channel;
|
||||
u16 ad_vol;
|
||||
};
|
||||
|
||||
u8 lp_is_online(void);
|
||||
void lp_set_online(u8 online);
|
||||
|
||||
extern const struct device_operations lp_dev_ops;
|
||||
|
||||
#endif
|
||||
@ -150,6 +150,12 @@ const char log_tag_const_d_APP_LINEIN AT(.LOG_TAG_CONST) = FALSE;
|
||||
const char log_tag_const_w_APP_LINEIN AT(.LOG_TAG_CONST) = TRUE;
|
||||
const char log_tag_const_e_APP_LINEIN AT(.LOG_TAG_CONST) = TRUE;
|
||||
|
||||
const char log_tag_const_v_APP_LP AT(.LOG_TAG_CONST) = FALSE;
|
||||
const char log_tag_const_i_APP_LP AT(.LOG_TAG_CONST) = TRUE;
|
||||
const char log_tag_const_d_APP_LP AT(.LOG_TAG_CONST) = FALSE;
|
||||
const char log_tag_const_w_APP_LP AT(.LOG_TAG_CONST) = TRUE;
|
||||
const char log_tag_const_e_APP_LP AT(.LOG_TAG_CONST) = TRUE;
|
||||
|
||||
const char log_tag_const_v_APP_FM AT(.LOG_TAG_CONST) = FALSE;
|
||||
const char log_tag_const_i_APP_FM AT(.LOG_TAG_CONST) = TRUE;
|
||||
const char log_tag_const_d_APP_FM AT(.LOG_TAG_CONST) = FALSE;
|
||||
|
||||
@ -35,7 +35,7 @@ const int config_audio_eq_en = 0
|
||||
#endif/*TCFG_AUDIO_OUT_EQ_ENABLE*/
|
||||
#if TCFG_USE_EQ_FILE
|
||||
| EQ_FILE_EN //使用eq_cfg_hw.bin文件效果
|
||||
//|EQ_FILE_SWITCH_EN //使能eq_cfg_hw.bin多文件切换,对应旧版config_audio_eq_file_sw_en
|
||||
| EQ_FILE_SWITCH_EN //使能eq_cfg_hw.bin多文件切换,对应旧版config_audio_eq_file_sw_en
|
||||
#endif/*TCFG_USE_EQ_FILE*/
|
||||
#if TCFG_AUDIO_OUT_EQ_ENABLE
|
||||
| EQ_HIGH_BASS_EN //高低音接口使能
|
||||
|
||||
@ -420,6 +420,15 @@ static void app_common_device_event_handler(struct sys_event *event)
|
||||
break;
|
||||
#endif//TCFG_APP_LINEIN_EN
|
||||
|
||||
#if TCFG_APP_LP_EN
|
||||
case DEVICE_EVENT_FROM_LP:
|
||||
ret = lp_device_event_handler(event);
|
||||
if (ret == true) {
|
||||
app = APP_LP_TASK;
|
||||
}
|
||||
break;
|
||||
#endif//TCFG_APP_LP_EN
|
||||
|
||||
#if TCFG_APP_RTC_EN
|
||||
case DEVICE_EVENT_FROM_ALM:
|
||||
ret = alarm_sys_event_handler(event);
|
||||
|
||||
@ -7,12 +7,18 @@
|
||||
|
||||
///模式配置表,这里可以配置切换模式的顺序,方案根据需求定义
|
||||
static const u8 app_task_list[] = {
|
||||
#if TCFG_APP_BT_EN
|
||||
APP_BT_TASK,
|
||||
#if TCFG_APP_MUSIC_EN
|
||||
APP_MUSIC_TASK,
|
||||
#endif
|
||||
#if TCFG_APP_LP_EN
|
||||
APP_LP_TASK,
|
||||
#endif
|
||||
#if TCFG_APP_MUSIC_EN
|
||||
APP_MUSIC_TASK,
|
||||
#endif
|
||||
#if TCFG_APP_BT_EN
|
||||
APP_BT_TASK,
|
||||
#endif
|
||||
#if TCFG_APP_FM_EN
|
||||
APP_FM_TASK,
|
||||
#endif
|
||||
@ -22,6 +28,9 @@ static const u8 app_task_list[] = {
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
APP_LINEIN_TASK,
|
||||
#endif
|
||||
#if TCFG_APP_LP_EN
|
||||
APP_LP_TASK,
|
||||
#endif
|
||||
#if TCFG_APP_RTC_EN
|
||||
APP_RTC_TASK,
|
||||
#endif
|
||||
@ -140,6 +149,11 @@ static int app_task_switch_check(u8 app_task)
|
||||
ret = linein_app_check();
|
||||
break;
|
||||
#endif
|
||||
#if TCFG_APP_LP_EN
|
||||
case APP_LP_TASK:
|
||||
ret = lp_app_check();
|
||||
break;
|
||||
#endif
|
||||
#if TCFG_APP_PC_EN
|
||||
case APP_PC_TASK:
|
||||
ret = pc_app_check();
|
||||
|
||||
@ -2,45 +2,43 @@
|
||||
/*************************************************************
|
||||
此文件函数主要是蓝牙模式各种状态处理
|
||||
|
||||
void app_bt_task()
|
||||
void app_bt_task()
|
||||
bt模式主函数
|
||||
|
||||
static int bt_sys_event_handler(struct sys_event *event)
|
||||
static int bt_sys_event_handler(struct sys_event *event)
|
||||
bt模式系统事件所有处理入口
|
||||
|
||||
static void bt_task_close(void)
|
||||
bt模式退出
|
||||
static void bt_task_close(void)
|
||||
bt模式退出
|
||||
|
||||
|
||||
void bt_function_select_init()
|
||||
void bt_function_select_init()
|
||||
蓝牙功能配置
|
||||
|
||||
void bredr_handle_register()
|
||||
蓝牙协议栈回调函数
|
||||
void bredr_handle_register()
|
||||
蓝牙协议栈回调函数
|
||||
|
||||
static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
蓝牙状态事件处理函数
|
||||
static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
蓝牙状态事件处理函数
|
||||
|
||||
static int bt_hci_event_handler(struct bt_event *bt)
|
||||
蓝牙协议栈事件回调,app处理函数
|
||||
static int bt_hci_event_handler(struct bt_event *bt)
|
||||
蓝牙协议栈事件回调,app处理函数
|
||||
|
||||
static int bt_ai_event_handler(struct bt_event *bt)
|
||||
蓝牙ai事件处理函数
|
||||
static int bt_ai_event_handler(struct bt_event *bt)
|
||||
蓝牙ai事件处理函数
|
||||
|
||||
int bt_background_event_handler_filter(struct sys_event *event)
|
||||
蓝牙后台事件过滤处理
|
||||
int bt_background_event_handler(struct sys_event *event)
|
||||
蓝牙后台事件处理函数
|
||||
int bt_background_event_handler_filter(struct sys_event *event)
|
||||
蓝牙后台事件过滤处理
|
||||
int bt_background_event_handler(struct sys_event *event)
|
||||
蓝牙后台事件处理函数
|
||||
|
||||
int bt_key_event_handler(struct sys_event *event)
|
||||
蓝牙按键处理函数
|
||||
int bt_key_event_handler(struct sys_event *event)
|
||||
蓝牙按键处理函数
|
||||
|
||||
avctp_user.h 有蓝牙支持的命令介绍
|
||||
avctp_user.h 有蓝牙支持的命令介绍
|
||||
|
||||
**************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "system/includes.h"
|
||||
#include "media/includes.h"
|
||||
|
||||
@ -65,7 +63,6 @@
|
||||
#include "math.h"
|
||||
#include "spp_user.h"
|
||||
|
||||
|
||||
#include "app_protocol_common.h"
|
||||
|
||||
#include "app_chargestore.h"
|
||||
@ -96,9 +93,8 @@
|
||||
#include "tuya_multi/tuya_le_multi_common.h"
|
||||
#include "multi_demo/le_multi_common.h"
|
||||
|
||||
|
||||
#define LOG_TAG_CONST BT
|
||||
#define LOG_TAG "[BT]"
|
||||
#define LOG_TAG_CONST BT
|
||||
#define LOG_TAG "[BT]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
#define LOG_DEBUG_ENABLE
|
||||
#define LOG_INFO_ENABLE
|
||||
@ -106,6 +102,7 @@
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
#include "kt.h"
|
||||
|
||||
#if TCFG_APP_BT_EN
|
||||
|
||||
@ -117,12 +114,10 @@ struct app_bt_opr app_bt_hdl = {
|
||||
.wait_exit = 0,
|
||||
};
|
||||
|
||||
#define __this (&app_bt_hdl)
|
||||
#define __this (&app_bt_hdl)
|
||||
|
||||
BT_USER_PRIV_VAR bt_user_priv_var;
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式变量初始化
|
||||
@param 无
|
||||
@ -135,7 +130,6 @@ void bt_var_init()
|
||||
memset((u8 *)&bt_user_priv_var, 0, sizeof(BT_USER_PRIV_VAR));
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈回调函数
|
||||
@param 无
|
||||
@ -145,7 +139,7 @@ void bt_var_init()
|
||||
/*----------------------------------------------------------------------------*/
|
||||
void bredr_handle_register()
|
||||
{
|
||||
#if (USER_SUPPORT_PROFILE_SPP==1)
|
||||
#if (USER_SUPPORT_PROFILE_SPP == 1)
|
||||
#if APP_ONLINE_DEBUG
|
||||
extern void online_spp_init(void);
|
||||
spp_data_deal_handle_register(user_spp_data_handler);
|
||||
@ -156,22 +150,22 @@ void bredr_handle_register()
|
||||
#endif
|
||||
|
||||
#if BT_SUPPORT_MUSIC_VOL_SYNC
|
||||
///蓝牙音乐和通话音量同步
|
||||
/// 蓝牙音乐和通话音量同步
|
||||
music_vol_change_handle_register(bt_set_music_device_volume, phone_get_device_vol);
|
||||
#endif
|
||||
|
||||
#if BT_SUPPORT_DISPLAY_BAT
|
||||
///电量显示获取电量的接口
|
||||
/// 电量显示获取电量的接口
|
||||
get_battery_value_register(bt_get_battery_value);
|
||||
#endif
|
||||
|
||||
///被测试盒链接上进入快速测试回调
|
||||
/// 被测试盒链接上进入快速测试回调
|
||||
bt_fast_test_handle_register(bt_fast_test_api);
|
||||
|
||||
///样机进入dut被测试仪器链接上回调
|
||||
/// 样机进入dut被测试仪器链接上回调
|
||||
bt_dut_test_handle_register(bt_dut_api);
|
||||
|
||||
///获取远端设备蓝牙名字回调
|
||||
/// 获取远端设备蓝牙名字回调
|
||||
read_remote_name_handle_register(bt_read_remote_name);
|
||||
|
||||
////获取歌曲信息回调
|
||||
@ -180,11 +174,10 @@ void bredr_handle_register()
|
||||
BT_BREDR_HANDLE_REG();
|
||||
}
|
||||
|
||||
|
||||
#if (TRANS_MULTI_BLE_EN || TUYA_MULTI_BLE_EN) && TRANS_MULTI_BLE_MASTER_NUMS
|
||||
//指定搜索uuid
|
||||
//指定搜索uuid
|
||||
static const target_uuid_t jl_search_uuid_table[] = {
|
||||
// 指定搜索uuid
|
||||
// 指定搜索uuid
|
||||
static const target_uuid_t jl_search_uuid_table[] = {
|
||||
|
||||
// for uuid16
|
||||
// PRIMARY_SERVICE, ae30
|
||||
@ -203,7 +196,7 @@ static const target_uuid_t jl_search_uuid_table[] = {
|
||||
.opt_type = ATT_PROPERTY_NOTIFY,
|
||||
},
|
||||
|
||||
//for uuid128,sample
|
||||
// for uuid128,sample
|
||||
// PRIMARY_SERVICE, 0000F530-1212-EFDE-1523-785FEABCD123
|
||||
// CHARACTERISTIC, 0000F531-1212-EFDE-1523-785FEABCD123, NOTIFY,
|
||||
// CHARACTERISTIC, 0000F532-1212-EFDE-1523-785FEABCD123, WRITE_WITHOUT_RESPONSE | DYNAMIC,
|
||||
@ -227,7 +220,6 @@ static const target_uuid_t jl_search_uuid_table[] = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
static void ble_report_data_deal(att_data_report_t *report_data, target_uuid_t *search_uuid)
|
||||
{
|
||||
log_info("conn_handle:%04x,report_data:%02x,%02x,%d,len(%d)", report_data->conn_handle, report_data->packet_type,
|
||||
@ -240,15 +232,16 @@ static void ble_report_data_deal(att_data_report_t *report_data, target_uuid_t *
|
||||
/* return; */
|
||||
/* } */
|
||||
|
||||
switch (report_data->packet_type) {
|
||||
case GATT_EVENT_NOTIFICATION: //notify
|
||||
switch (report_data->packet_type)
|
||||
{
|
||||
case GATT_EVENT_NOTIFICATION: // notify
|
||||
break;
|
||||
|
||||
case GATT_EVENT_INDICATION://indicate
|
||||
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT://read
|
||||
case GATT_EVENT_INDICATION: // indicate
|
||||
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT: // read
|
||||
break;
|
||||
|
||||
case GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT://read long
|
||||
case GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT: // read long
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -257,14 +250,14 @@ static void ble_report_data_deal(att_data_report_t *report_data, target_uuid_t *
|
||||
}
|
||||
|
||||
static struct ble_client_operation_t *ble_client_api;
|
||||
static const u8 test_remoter_name1[] = "AC897N_MX(BLE)";//
|
||||
static const u8 test_remoter_name1[] = "AC897N_MX(BLE)"; //
|
||||
/* static const u8 test_remoter_name2[] = "AC630N_HID567(BLE)";// */
|
||||
static u16 ble_client_write_handle;
|
||||
static u16 ble_client_timer = 0;
|
||||
|
||||
static const client_match_cfg_t match_dev01 = {
|
||||
.create_conn_mode = BIT(CLI_CREAT_BY_NAME),
|
||||
.compare_data_len = sizeof(test_remoter_name1) - 1, //去结束符
|
||||
.compare_data_len = sizeof(test_remoter_name1) - 1, // 去结束符
|
||||
.compare_data = test_remoter_name1,
|
||||
.bonding_flag = 0,
|
||||
};
|
||||
@ -283,10 +276,12 @@ static void client_test_write(void)
|
||||
u16 tmp_handle;
|
||||
|
||||
count++;
|
||||
for (i = 0; i < TRANS_MULTI_BLE_MASTER_NUMS; i++) {
|
||||
for (i = 0; i < TRANS_MULTI_BLE_MASTER_NUMS; i++)
|
||||
{
|
||||
tmp_handle = mul_dev_get_conn_handle(i, MULTI_ROLE_CLIENT);
|
||||
|
||||
if (tmp_handle && ble_client_write_handle) {
|
||||
if (tmp_handle && ble_client_write_handle)
|
||||
{
|
||||
ret = ble_client_api->opt_comm_send_ext(tmp_handle, ble_client_write_handle, &count, 16, ATT_OP_WRITE_WITHOUT_RESPOND);
|
||||
log_info("test_write:%04x,%d", tmp_handle, ret);
|
||||
}
|
||||
@ -296,19 +291,22 @@ static void client_test_write(void)
|
||||
/* log_info("test_write:%x", ret); */
|
||||
}
|
||||
|
||||
|
||||
static void client_event_callback(le_client_event_e event, u8 *packet, int size)
|
||||
{
|
||||
switch (event) {
|
||||
case CLI_EVENT_MATCH_DEV: {
|
||||
switch (event)
|
||||
{
|
||||
case CLI_EVENT_MATCH_DEV:
|
||||
{
|
||||
client_match_cfg_t *match_dev = packet;
|
||||
log_info("match_name:%s\n", match_dev->compare_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case CLI_EVENT_MATCH_UUID: {
|
||||
case CLI_EVENT_MATCH_UUID:
|
||||
{
|
||||
opt_handle_t *opt_hdl = packet;
|
||||
if (opt_hdl->search_uuid == &jl_search_uuid_table[0]) {
|
||||
if (opt_hdl->search_uuid == &jl_search_uuid_table[0])
|
||||
{
|
||||
ble_client_write_handle = opt_hdl->value_handle;
|
||||
log_info("match_uuid22\n");
|
||||
}
|
||||
@ -317,7 +315,8 @@ static void client_event_callback(le_client_event_e event, u8 *packet, int size)
|
||||
|
||||
case CLI_EVENT_SEARCH_PROFILE_COMPLETE:
|
||||
log_info("CLI_EVENT_SEARCH_PROFILE_COMPLETE\n");
|
||||
if ((!ble_client_timer) && ble_client_write_handle) {
|
||||
if ((!ble_client_timer) && ble_client_write_handle)
|
||||
{
|
||||
log_info("test timer_add\n");
|
||||
ble_client_timer = sys_timer_add(0, client_test_write, 500);
|
||||
}
|
||||
@ -327,7 +326,8 @@ static void client_event_callback(le_client_event_e event, u8 *packet, int size)
|
||||
break;
|
||||
|
||||
case CLI_EVENT_DISCONNECT:
|
||||
if (ble_client_timer && TRANS_MULTI_BLE_MASTER_NUMS == 1) {
|
||||
if (ble_client_timer && TRANS_MULTI_BLE_MASTER_NUMS == 1)
|
||||
{
|
||||
sys_timeout_del(ble_client_timer);
|
||||
ble_client_write_handle = 0;
|
||||
ble_client_timer = 0;
|
||||
@ -339,7 +339,6 @@ static void client_event_callback(le_client_event_e event, u8 *packet, int size)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const client_conn_cfg_t client_conn_config = {
|
||||
.match_dev_cfg[0] = &match_dev01,
|
||||
.match_dev_cfg[1] = NULL,
|
||||
@ -349,7 +348,7 @@ static const client_conn_cfg_t client_conn_config = {
|
||||
/* .search_uuid_cnt = 0, //配置不搜索profile,加快回连速度 */
|
||||
.search_uuid_cnt = (sizeof(jl_search_uuid_table) / sizeof(target_uuid_t)),
|
||||
.search_uuid_table = jl_search_uuid_table,
|
||||
.security_en = 0, //支持加密使能,对应配置 config_le_sm_support_enable
|
||||
.security_en = 0, // 支持加密使能,对应配置 config_le_sm_support_enable
|
||||
.event_callback = client_event_callback,
|
||||
};
|
||||
|
||||
@ -402,9 +401,9 @@ void bt_function_select_init()
|
||||
#endif
|
||||
|
||||
#if (TCFG_SPI_LCD_ENABLE)
|
||||
#if TCFG_USER_EMITTER_ENABLE//带有屏幕的方案根据UI选项连接
|
||||
#if TCFG_USER_EMITTER_ENABLE // 带有屏幕的方案根据UI选项连接
|
||||
////设置开机回链的设备个数
|
||||
__set_auto_conn_device_num(10);//彩屏方案支持10个设备的连接
|
||||
__set_auto_conn_device_num(10); // 彩屏方案支持10个设备的连接
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -417,12 +416,11 @@ void bt_function_select_init()
|
||||
__set_user_background_goback(BACKGROUND_GOBACK); // 后台链接是否跳回蓝牙 1:跳回
|
||||
|
||||
////设置蓝牙加密的level
|
||||
//io_capabilities ; /*0: Display only 1: Display YesNo 2: KeyboardOnly 3: NoInputNoOutput*/
|
||||
//authentication_requirements: 0:not protect 1 :protect
|
||||
// io_capabilities ; /*0: Display only 1: Display YesNo 2: KeyboardOnly 3: NoInputNoOutput*/
|
||||
// authentication_requirements: 0:not protect 1 :protect
|
||||
__set_simple_pair_param(3, 0, 2);
|
||||
|
||||
|
||||
#if (USER_SUPPORT_PROFILE_PBAP==1)
|
||||
#if (USER_SUPPORT_PROFILE_PBAP == 1)
|
||||
////设置蓝牙设备类型
|
||||
__change_hci_class_type(BD_CLASS_CAR_AUDIO);
|
||||
#endif
|
||||
@ -432,7 +430,6 @@ void bt_function_select_init()
|
||||
lmp_set_sniff_disable();
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TX RX
|
||||
AI800x PA13 PA12
|
||||
@ -451,8 +448,7 @@ void bt_function_select_init()
|
||||
#if TCFG_USER_BLE_ENABLE
|
||||
{
|
||||
u8 tmp_ble_addr[6];
|
||||
#if (TCFG_BLE_DEMO_SELECT == DEF_BLE_DEMO_ADV \
|
||||
|| TCFG_BLE_DEMO_SELECT == DEF_BLE_DEMO_GMA)
|
||||
#if (TCFG_BLE_DEMO_SELECT == DEF_BLE_DEMO_ADV || TCFG_BLE_DEMO_SELECT == DEF_BLE_DEMO_GMA)
|
||||
/* bt_set_tx_power(9);//ble txpwer level:0~9 */
|
||||
memcpy(tmp_ble_addr, (void *)bt_get_mac_addr(), 6);
|
||||
#else
|
||||
@ -468,7 +464,6 @@ void bt_function_select_init()
|
||||
ble_client_config_init();
|
||||
#endif
|
||||
|
||||
|
||||
#endif // TCFG_USER_BLE_ENABLE
|
||||
|
||||
#if (CONFIG_BT_MODE != BT_NORMAL)
|
||||
@ -476,7 +471,6 @@ void bt_function_select_init()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈对应状态处理函数
|
||||
@param bt:事件
|
||||
@ -489,18 +483,20 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
|
||||
log_debug("-----------------------bt_connction_status_event_handler %d", bt->event);
|
||||
|
||||
if (bt_status_event_filter(bt) == false) {
|
||||
if (bt_status_event_filter(bt) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (bt->event) {
|
||||
switch (bt->event)
|
||||
{
|
||||
case BT_STATUS_EXIT_OK:
|
||||
log_info("BT_STATUS_EXIT_OK\n");
|
||||
break;
|
||||
case BT_STATUS_INIT_OK:
|
||||
log_info("BT_STATUS_INIT_OK\n");
|
||||
bt_status_init_ok(bt);
|
||||
#if(TCFG_TEST_BOX_ENABLE || TCFG_CHARGESTORE_ENABLE)
|
||||
#if (TCFG_TEST_BOX_ENABLE || TCFG_CHARGESTORE_ENABLE)
|
||||
chargestore_set_bt_init_ok(1);
|
||||
#endif
|
||||
break;
|
||||
@ -570,7 +566,7 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
bt_status_call_vol_change(bt);
|
||||
break;
|
||||
case BT_STATUS_SNIFF_STATE_UPDATE:
|
||||
log_info(" BT_STATUS_SNIFF_STATE_UPDATE \n"); //0退出SNIFF
|
||||
log_info(" BT_STATUS_SNIFF_STATE_UPDATE \n"); // 0退出SNIFF
|
||||
bt_status_sniff_state_update(bt);
|
||||
break;
|
||||
case BT_STATUS_LAST_CALL_TYPE_CHANGE:
|
||||
@ -595,7 +591,7 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
log_info(" BT_STATUS_AVRCP_INCOME_OPID \n");
|
||||
bt_status_avrcp_income_opid(bt);
|
||||
break;
|
||||
case BT_STATUS_RECONN_OR_CONN:
|
||||
case BT_STATUS_RECONN_OR_CONN:
|
||||
log_info(" BT_STATUS_RECONN_OR_CONN \n");
|
||||
break;
|
||||
default:
|
||||
@ -605,12 +601,6 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈事件
|
||||
@param bt:事件
|
||||
@ -620,14 +610,16 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int bt_hci_event_handler(struct bt_event *bt)
|
||||
{
|
||||
//对应原来的蓝牙连接上断开处理函数 ,bt->value=reason
|
||||
// 对应原来的蓝牙连接上断开处理函数 ,bt->value=reason
|
||||
log_debug("------------------------bt_hci_event_handler reason %x %x", bt->event, bt->value);
|
||||
|
||||
if (bt_hci_event_filter(bt) == 0) {
|
||||
if (bt_hci_event_filter(bt) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (bt->event) {
|
||||
switch (bt->event)
|
||||
{
|
||||
case HCI_EVENT_INQUIRY_COMPLETE:
|
||||
log_info(" HCI_EVENT_INQUIRY_COMPLETE \n");
|
||||
bt_hci_event_inquiry(bt);
|
||||
@ -638,51 +630,52 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
break;
|
||||
case HCI_EVENT_USER_CONFIRMATION_REQUEST:
|
||||
log_info(" HCI_EVENT_USER_CONFIRMATION_REQUEST %d \n", bt->value);
|
||||
///<可通过按键来确认是否配对 1:配对 0:取消
|
||||
///< 可通过按键来确认是否配对 1:配对 0:取消
|
||||
bt_send_pair(1);
|
||||
clock_remove_set(BT_CONN_CLK);
|
||||
break;
|
||||
case HCI_EVENT_USER_PASSKEY_REQUEST:
|
||||
log_info(" HCI_EVENT_USER_PASSKEY_REQUEST \n");
|
||||
///<可以开始输入6位passkey
|
||||
///< 可以开始输入6位passkey
|
||||
break;
|
||||
case HCI_EVENT_USER_PRESSKEY_NOTIFICATION:
|
||||
log_info(" HCI_EVENT_USER_PRESSKEY_NOTIFICATION %x\n", bt->value);
|
||||
///<可用于显示输入passkey位置 value 0:start 1:enrer 2:earse 3:clear 4:complete
|
||||
///< 可用于显示输入passkey位置 value 0:start 1:enrer 2:earse 3:clear 4:complete
|
||||
break;
|
||||
case HCI_EVENT_PIN_CODE_REQUEST :
|
||||
case HCI_EVENT_PIN_CODE_REQUEST:
|
||||
log_info("HCI_EVENT_PIN_CODE_REQUEST \n");
|
||||
bt_send_pair(1);
|
||||
break;
|
||||
case HCI_EVENT_VENDOR_NO_RECONN_ADDR :
|
||||
case HCI_EVENT_VENDOR_NO_RECONN_ADDR:
|
||||
log_info("HCI_EVENT_VENDOR_NO_RECONN_ADDR \n");
|
||||
bt_hci_event_disconnect(bt) ;
|
||||
bt_hci_event_disconnect(bt);
|
||||
break;
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE :
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||
log_info("HCI_EVENT_DISCONNECTION_COMPLETE \n");
|
||||
bt_hci_event_disconnect(bt) ;
|
||||
bt_hci_event_disconnect(bt);
|
||||
clock_remove_set(BT_CONN_CLK);
|
||||
break;
|
||||
case BTSTACK_EVENT_HCI_CONNECTIONS_DELETE:
|
||||
case HCI_EVENT_CONNECTION_COMPLETE:
|
||||
log_info(" HCI_EVENT_CONNECTION_COMPLETE \n");
|
||||
switch (bt->value) {
|
||||
case ERROR_CODE_SUCCESS :
|
||||
switch (bt->value)
|
||||
{
|
||||
case ERROR_CODE_SUCCESS:
|
||||
log_info("ERROR_CODE_SUCCESS \n");
|
||||
bt_hci_event_connection(bt);
|
||||
break;
|
||||
case ERROR_CODE_PIN_OR_KEY_MISSING:
|
||||
log_info(" ERROR_CODE_PIN_OR_KEY_MISSING \n");
|
||||
bt_hci_event_linkkey_missing(bt);
|
||||
case ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED :
|
||||
case ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED:
|
||||
case ERROR_CODE_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES:
|
||||
case ERROR_CODE_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR:
|
||||
case ERROR_CODE_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED :
|
||||
case ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION :
|
||||
case ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST :
|
||||
case ERROR_CODE_AUTHENTICATION_FAILURE :
|
||||
case ERROR_CODE_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED:
|
||||
case ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION:
|
||||
case ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST:
|
||||
case ERROR_CODE_AUTHENTICATION_FAILURE:
|
||||
case CUSTOM_BB_AUTO_CANCEL_PAGE:
|
||||
bt_hci_event_disconnect(bt) ;
|
||||
bt_hci_event_disconnect(bt);
|
||||
break;
|
||||
case ERROR_CODE_PAGE_TIMEOUT:
|
||||
log_info(" ERROR_CODE_PAGE_TIMEOUT \n");
|
||||
@ -692,7 +685,7 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
log_info(" ERROR_CODE_CONNECTION_TIMEOUT \n");
|
||||
bt_hci_event_connection_timeout(bt);
|
||||
break;
|
||||
case ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS :
|
||||
case ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS:
|
||||
log_info("ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS \n");
|
||||
bt_hci_event_connection_exist(bt);
|
||||
break;
|
||||
@ -706,8 +699,6 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙后台事件过滤处理
|
||||
@param event: 事件
|
||||
@ -719,20 +710,24 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
{
|
||||
u8 ret = 0;
|
||||
#if TCFG_BLUETOOTH_BACK_MODE
|
||||
if ((u32)event->arg == SYS_BT_EVENT_TYPE_CON_STATUS) {
|
||||
if ((u32)event->arg == SYS_BT_EVENT_TYPE_CON_STATUS)
|
||||
{
|
||||
log_info("bt con event: %d \n", event->u.bt.event);
|
||||
switch (event->u.bt.event) {
|
||||
switch (event->u.bt.event)
|
||||
{
|
||||
// 需要切换蓝牙的命令
|
||||
case BT_STATUS_A2DP_MEDIA_START:
|
||||
if (__this->sbc_packet_step != 0) {
|
||||
if (__this->sbc_packet_step != 0)
|
||||
{
|
||||
/* log_info("sbc_packet_step : %d \n", __this->sbc_packet_step); */
|
||||
break;
|
||||
}
|
||||
|
||||
case BT_STATUS_FIRST_DISCONNECT:
|
||||
case BT_STATUS_SECOND_DISCONNECT:
|
||||
//关机导致的断开不可以回去蓝牙,否则后台关机会有问题
|
||||
if (app_var.goto_poweroff_flag) {
|
||||
// 关机导致的断开不可以回去蓝牙,否则后台关机会有问题
|
||||
if (app_var.goto_poweroff_flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#if BACKGROUND_GOBACK
|
||||
@ -743,11 +738,13 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
#endif
|
||||
|
||||
#else
|
||||
//判断断开的是sink设备,默认切换蓝牙
|
||||
if (event->u.bt.value) {
|
||||
// 判断断开的是sink设备,默认切换蓝牙
|
||||
if (event->u.bt.value)
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
if (ret == 0) {
|
||||
if (ret == 0)
|
||||
{
|
||||
bt_status_disconnect_background(&event->u.bt);
|
||||
}
|
||||
#endif
|
||||
@ -776,7 +773,7 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
#endif
|
||||
break;
|
||||
|
||||
case BT_STATUS_ENCRY_COMPLETE:
|
||||
case BT_STATUS_ENCRY_COMPLETE:
|
||||
break;
|
||||
case BT_STATUS_SCO_STATUS_CHANGE:
|
||||
ret = 1;
|
||||
@ -805,9 +802,12 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
bt_connction_status_event_handler(&event->u.bt);
|
||||
break;
|
||||
}
|
||||
} else if ((u32)event->arg == SYS_BT_EVENT_TYPE_HCI_STATUS) {
|
||||
}
|
||||
else if ((u32)event->arg == SYS_BT_EVENT_TYPE_HCI_STATUS)
|
||||
{
|
||||
/* log_info("bt hci event: %d \n", event->u.bt.event); */
|
||||
switch (event->u.bt.event) {
|
||||
switch (event->u.bt.event)
|
||||
{
|
||||
case HCI_EVENT_IO_CAPABILITY_REQUEST:
|
||||
clock_add_set(BT_CONN_CLK);
|
||||
#if BACKGROUND_GOBACK
|
||||
@ -824,9 +824,11 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
}
|
||||
}
|
||||
#if TCFG_USER_TWS_ENABLE
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_TWS)) {
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_TWS))
|
||||
{
|
||||
/* log_info("bt tws event: %d \n", event->u.bt.event); */
|
||||
switch (event->u.bt.event) {
|
||||
switch (event->u.bt.event)
|
||||
{
|
||||
/* case TWS_EVENT_CONNECTED: */
|
||||
/* ret = 1; */
|
||||
/* break; */
|
||||
@ -839,9 +841,11 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if ((u32)event->arg == SYS_EVENT_FROM_CTRLER) {
|
||||
switch (event->u.bt.event) {
|
||||
case BTCTRLER_EVENT_RESUME_REQ:
|
||||
else if ((u32)event->arg == SYS_EVENT_FROM_CTRLER)
|
||||
{
|
||||
switch (event->u.bt.event)
|
||||
{
|
||||
case BTCTRLER_EVENT_RESUME_REQ:
|
||||
/*log_info("------- BTCTRLER_EVENT_RESUME_REQ \n"); */
|
||||
ret = 2;
|
||||
break;
|
||||
@ -861,12 +865,17 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
int bt_background_event_handler(struct sys_event *event)
|
||||
{
|
||||
int ret = bt_background_event_handler_filter(event);
|
||||
if (ret) {
|
||||
if (false == app_check_curr_task(APP_BT_TASK)) {
|
||||
if (ret)
|
||||
{
|
||||
if (false == app_check_curr_task(APP_BT_TASK))
|
||||
{
|
||||
__this->cmd_flag = 1;
|
||||
if (ret == 2) {
|
||||
if (ret == 2)
|
||||
{
|
||||
__this->call_flag = 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->call_flag = 0;
|
||||
}
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
@ -876,14 +885,15 @@ int bt_background_event_handler(struct sys_event *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#if (USER_SUPPORT_PROFILE_HID==1)
|
||||
// #if (USER_SUPPORT_PROFILE_HID==1)
|
||||
////重写bt_get_hid_name
|
||||
//const char * bt_get_hid_name()
|
||||
// const char * bt_get_hid_name()
|
||||
//{
|
||||
// return "HID_USER";
|
||||
//}
|
||||
//#endif
|
||||
// }
|
||||
// #endif
|
||||
|
||||
static u8 eq_idx = KT_EQ_IDX_BT;
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式按键响应处理
|
||||
@ -897,59 +907,74 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
int ret = true;
|
||||
struct key_event *key = &event->u.key;
|
||||
|
||||
if (bt_key_event_filter_before() == false) {
|
||||
if (bt_key_event_filter_before() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int key_event = event->u.key.event;
|
||||
int key_value = event->u.key.value;
|
||||
|
||||
|
||||
log_debug("bt key_event:%d %d %d %d\n", key_event, key->value, key->event, key->init);
|
||||
|
||||
if (bt_key_event_filter_after(key_event) == true) {
|
||||
if (bt_key_event_filter_after(key_event) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (key_event) {
|
||||
switch (key_event)
|
||||
{
|
||||
case KEY_TEST_DEMO_0:
|
||||
printf(" KEY_TEST_DEMO_0 \n");
|
||||
if (eq_idx == KT_EQ_IDX_BT)
|
||||
{
|
||||
eq_idx = KT_EQ_IDX_LP;
|
||||
}
|
||||
else
|
||||
{
|
||||
eq_idx = KT_EQ_IDX_BT;
|
||||
}
|
||||
kt_eq_switch_to(eq_idx);
|
||||
//bt_key_test_demo_0();
|
||||
break;
|
||||
|
||||
case KEY_MUSIC_PP:
|
||||
case KEY_MUSIC_PP:
|
||||
log_info(" KEY_MUSIC_PP \n");
|
||||
bt_key_music_pp();
|
||||
break;
|
||||
case KEY_MUSIC_PREV:
|
||||
case KEY_MUSIC_PREV:
|
||||
log_info(" KEY_MUSIC_PREV \n");
|
||||
bt_key_music_prev();
|
||||
break;
|
||||
case KEY_MUSIC_NEXT:
|
||||
case KEY_MUSIC_NEXT:
|
||||
log_info(" KEY_MUSIC_NEXT \n");
|
||||
bt_key_music_next();
|
||||
break;
|
||||
case KEY_VOL_UP:
|
||||
case KEY_VOL_UP:
|
||||
log_info(" KEY_VOL_UP \n");
|
||||
bt_key_vol_up();
|
||||
break;
|
||||
case KEY_VOL_DOWN:
|
||||
case KEY_VOL_DOWN:
|
||||
log_info(" KEY_VOL_DOWN \n");
|
||||
bt_key_vol_down();
|
||||
break;
|
||||
case KEY_CALL_LAST_NO:
|
||||
case KEY_CALL_LAST_NO:
|
||||
log_info(" KEY_CALL_LAST_NO \n");
|
||||
bt_key_call_last_on();
|
||||
break;
|
||||
case KEY_CALL_HANG_UP:
|
||||
case KEY_CALL_HANG_UP:
|
||||
log_info(" KEY_CALL_HANG_UP \n");
|
||||
bt_key_call_hand_up();
|
||||
break;
|
||||
case KEY_CALL_ANSWER:
|
||||
case KEY_CALL_ANSWER:
|
||||
log_info(" KEY_CALL_ANSWER \n");
|
||||
bt_key_call_answer();
|
||||
break;
|
||||
case KEY_OPEN_SIRI:
|
||||
case KEY_OPEN_SIRI:
|
||||
log_info(" KEY_OPEN_SIRI \n");
|
||||
bt_key_call_siri();
|
||||
break;
|
||||
case KEY_HID_CONTROL:
|
||||
case KEY_HID_CONTROL:
|
||||
log_info(" KEY_HID_CONTROL \n");
|
||||
bt_key_hid_control();
|
||||
break;
|
||||
@ -961,27 +986,29 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
log_info(" KEY_LOW_LANTECY \n");
|
||||
bt_key_low_lantecy();
|
||||
break;
|
||||
case KEY_NULL:
|
||||
case KEY_NULL:
|
||||
log_info(" KEY_NULL \n");
|
||||
ret = false;
|
||||
#if TCFG_USER_TWS_ENABLE
|
||||
if ((u32)event->arg == KEY_EVENT_FROM_TWS) {
|
||||
if ((u32)event->arg == KEY_EVENT_FROM_TWS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case KEY_HID_MODE_SWITCH:
|
||||
#if (USER_SUPPORT_PROFILE_HID==1)
|
||||
#if (USER_SUPPORT_PROFILE_HID == 1)
|
||||
__this->hid_mode = !__this->hid_mode;
|
||||
printf("KEY_HID_TAKE_PICTURE, %d\n", __this->hid_mode);
|
||||
user_change_profile_mode(__this->hid_mode);///HID设备名称, 默认蓝牙名称追加_HID
|
||||
//如果要修改名称, 可以重写重写这个函数,上面有重写例子
|
||||
//const char *__attribute__((weak)) bt_get_hid_name()
|
||||
user_change_profile_mode(__this->hid_mode); /// HID设备名称, 默认蓝牙名称追加_HID
|
||||
// 如果要修改名称, 可以重写重写这个函数,上面有重写例子
|
||||
// const char *__attribute__((weak)) bt_get_hid_name()
|
||||
#endif
|
||||
break;
|
||||
case KEY_HID_TAKE_PICTURE:
|
||||
if (__this->hid_mode) {
|
||||
if (__this->hid_mode)
|
||||
{
|
||||
printf("KEY_HID_TAKE_PICTURE\n");
|
||||
user_send_cmd_prepare(USER_CTRL_HID_BOTH, 0, NULL);
|
||||
}
|
||||
@ -992,11 +1019,15 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
#if (TCFG_DEC2TWS_ENABLE)
|
||||
ret = false;
|
||||
#else
|
||||
if (tws_api_get_tws_state() & TWS_STA_SIBLING_CONNECTED) {
|
||||
if (tws_api_get_role() == TWS_ROLE_MASTER) {
|
||||
if (tws_api_get_tws_state() & TWS_STA_SIBLING_CONNECTED)
|
||||
{
|
||||
if (tws_api_get_role() == TWS_ROLE_MASTER)
|
||||
{
|
||||
bt_tws_api_push_cmd(SYNC_CMD_MODE_CHANGE, 400);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
@ -1016,7 +1047,6 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈状态事件、hci事件、对箱事件
|
||||
@param event: 事件
|
||||
@ -1027,20 +1057,28 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
int bt_sys_event_office(struct sys_event *event)
|
||||
{
|
||||
u8 ret = false;
|
||||
if ((u32)event->arg == SYS_BT_EVENT_TYPE_CON_STATUS) {
|
||||
if ((u32)event->arg == SYS_BT_EVENT_TYPE_CON_STATUS)
|
||||
{
|
||||
bt_connction_status_event_handler(&event->u.bt);
|
||||
} else if ((u32)event->arg == SYS_BT_EVENT_TYPE_HCI_STATUS) {
|
||||
}
|
||||
else if ((u32)event->arg == SYS_BT_EVENT_TYPE_HCI_STATUS)
|
||||
{
|
||||
bt_hci_event_handler(&event->u.bt);
|
||||
} else if ((u32)event->arg == SYS_BT_EVENT_FORM_SELF) {
|
||||
}
|
||||
else if ((u32)event->arg == SYS_BT_EVENT_FORM_SELF)
|
||||
{
|
||||
bt_reverb_status_change(&event->u.bt);
|
||||
}
|
||||
#if TCFG_USER_TWS_ENABLE
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_TWS)) {
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_TWS))
|
||||
{
|
||||
ret = bt_tws_connction_status_event_handler(&event->u.bt);
|
||||
}
|
||||
#endif
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_KEY)) {
|
||||
switch (event->u.key.event) {
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_KEY))
|
||||
{
|
||||
switch (event->u.key.event)
|
||||
{
|
||||
case KEY_CHANGE_MODE:
|
||||
app_task_switch_next();
|
||||
break;
|
||||
@ -1049,7 +1087,6 @@ int bt_sys_event_office(struct sys_event *event)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式事件消息处理
|
||||
@param event: 事件
|
||||
@ -1060,7 +1097,8 @@ int bt_sys_event_office(struct sys_event *event)
|
||||
static int bt_sys_event_handler(struct sys_event *event)
|
||||
{
|
||||
int ret = false;
|
||||
switch (event->type) {
|
||||
switch (event->type)
|
||||
{
|
||||
case SYS_KEY_EVENT:
|
||||
ret = bt_key_event_handler(event);
|
||||
break;
|
||||
@ -1069,8 +1107,9 @@ static int bt_sys_event_handler(struct sys_event *event)
|
||||
break;
|
||||
case SYS_DEVICE_EVENT:
|
||||
#if APP_ONLINE_DEBUG
|
||||
if ((u32)event->arg == DEVICE_EVENT_ONLINE_DATA) {
|
||||
//putchar('%');
|
||||
if ((u32)event->arg == DEVICE_EVENT_ONLINE_DATA)
|
||||
{
|
||||
// putchar('%');
|
||||
extern void app_online_event_handle(int evt_value);
|
||||
app_online_event_handle(event->u.dev.value);
|
||||
}
|
||||
@ -1091,18 +1130,20 @@ static int bt_sys_event_handler(struct sys_event *event)
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void bt_tone_play_end_callback(void *priv, int flag)
|
||||
static void bt_tone_play_end_callback(void *priv, int flag)
|
||||
{
|
||||
u32 index = (u32)priv;
|
||||
|
||||
if (APP_BT_TASK != app_get_curr_task()) {
|
||||
if (APP_BT_TASK != app_get_curr_task())
|
||||
{
|
||||
log_error("tone callback task out \n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
switch (index)
|
||||
{
|
||||
case IDEX_TONE_BT_MODE:
|
||||
///提示音播放结束, 启动播放器播放
|
||||
/// 提示音播放结束, 启动播放器播放
|
||||
bt_task_start();
|
||||
break;
|
||||
default:
|
||||
@ -1122,8 +1163,12 @@ void app_bt_task()
|
||||
int res;
|
||||
int msg[32];
|
||||
ui_update_status(STATUS_EXIT_LOWPOWER);
|
||||
|
||||
|
||||
bt_task_init();//初始化变量、时钟、显示(未进行协议栈初始化)
|
||||
|
||||
bt_task_init(); // 初始化变量、时钟、显示(未进行协议栈初始化)
|
||||
|
||||
kt_eq_switch_to(KT_EQ_IDX_BT);
|
||||
|
||||
#if TCFG_TONE2TWS_ENABLE
|
||||
extern void tone2tws_bt_task_start(u8 tone_play);
|
||||
@ -1131,33 +1176,45 @@ void app_bt_task()
|
||||
#endif
|
||||
|
||||
extern u8 get_tws_background_connected_flag();
|
||||
if (!__this->cmd_flag && (!get_tws_background_connected_flag())) { //蓝牙后台拉回蓝牙模式不播放提示音
|
||||
tone_play_with_callback_by_name(tone_table[IDEX_TONE_BT_MODE], 1, bt_tone_play_end_callback, (void *)IDEX_TONE_BT_MODE);
|
||||
//协议栈初始化在提示音结束进行
|
||||
} else {
|
||||
//后台返回的情况没有播放提示音,需要在这里进行协议栈的resume
|
||||
if (!__this->cmd_flag && (!get_tws_background_connected_flag()))
|
||||
{ // 蓝牙后台拉回蓝牙模式不播放提示音
|
||||
//tone_play_with_callback_by_name(tone_table[IDEX_TONE_BT_MODE], 1, bt_tone_play_end_callback, (void *)IDEX_TONE_BT_MODE);
|
||||
// 协议栈初始化在提示音结束进行
|
||||
bt_task_start();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 后台返回的情况没有播放提示音,需要在这里进行协议栈的resume
|
||||
bt_task_start();
|
||||
}
|
||||
#if TCFG_DEC2TWS_ENABLE
|
||||
extern void set_tws_background_connected_flag(u8 flag);
|
||||
if (get_tws_background_connected_flag()) {
|
||||
if (get_tws_background_connected_flag())
|
||||
{
|
||||
int state = tws_api_get_tws_state();
|
||||
if (state & TWS_STA_SIBLING_CONNECTED) {
|
||||
if (tws_api_get_role() == TWS_ROLE_MASTER) {
|
||||
if (state & TWS_STA_SIBLING_CONNECTED)
|
||||
{
|
||||
if (tws_api_get_role() == TWS_ROLE_MASTER)
|
||||
{
|
||||
app_task_switch_back();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
set_tws_background_connected_flag(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
|
||||
switch (msg[0]) {
|
||||
switch (msg[0])
|
||||
{
|
||||
case APP_MSG_SYS_EVENT:
|
||||
if (bt_sys_event_handler((struct sys_event *)(msg + 1)) == false) {
|
||||
if (bt_sys_event_handler((struct sys_event *)(msg + 1)) == false)
|
||||
{
|
||||
app_default_event_deal((struct sys_event *)(&msg[1]));
|
||||
}
|
||||
break;
|
||||
@ -1165,32 +1222,39 @@ void app_bt_task()
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if TCFG_BLUETOOTH_BACK_MODE
|
||||
if (!__this->init_ok && !app_var.goto_poweroff_flag) {
|
||||
//蓝牙后台方案必须要等待协议栈初始化完成
|
||||
if (!__this->init_ok && !app_var.goto_poweroff_flag)
|
||||
{
|
||||
// 蓝牙后台方案必须要等待协议栈初始化完成
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
if (__this->init_start && (!__this->init_ok)) { //协议栈已经初始化 但没有初始化完成
|
||||
//需要等待初始化完成才可以走退出流程
|
||||
if (__this->init_start && (!__this->init_ok))
|
||||
{ // 协议栈已经初始化 但没有初始化完成
|
||||
// 需要等待初始化完成才可以走退出流程
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (app_task_exitting()) {
|
||||
if (__this->init_start) {
|
||||
if (app_task_exitting())
|
||||
{
|
||||
if (__this->init_start)
|
||||
{
|
||||
bt_task_close();
|
||||
__this->wait_exit = 1;
|
||||
} else { //蓝牙协议栈没有初始化,可以直接退出
|
||||
}
|
||||
else
|
||||
{ // 蓝牙协议栈没有初始化,可以直接退出
|
||||
bt_task_close();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (__this->wait_exit) { //开始退出
|
||||
if (!__this->exiting) { ///等待蓝牙退出处理完成
|
||||
if (__this->wait_exit)
|
||||
{ // 开始退出
|
||||
if (!__this->exiting)
|
||||
{ /// 等待蓝牙退出处理完成
|
||||
__this->wait_exit = 0;
|
||||
return;
|
||||
}
|
||||
@ -1200,7 +1264,7 @@ void app_bt_task()
|
||||
|
||||
u8 bt_app_exit_check()
|
||||
{
|
||||
return bt_app_switch_exit_check();
|
||||
return bt_app_switch_exit_check();
|
||||
}
|
||||
|
||||
#else
|
||||
@ -1219,7 +1283,6 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
u8 get_call_status()
|
||||
{
|
||||
return BT_CALL_HANGUP;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,18 +2,17 @@
|
||||
/*************************************************************
|
||||
此文件函数主要是linein模式按键处理和事件处理
|
||||
|
||||
void app_linein_task()
|
||||
void app_linein_task()
|
||||
linein模式主函数
|
||||
|
||||
static int linein_sys_event_handler(struct sys_event *event)
|
||||
static int linein_sys_event_handler(struct sys_event *event)
|
||||
linein模式系统事件所有处理入口
|
||||
|
||||
static void linein_task_close(void)
|
||||
linein模式退出
|
||||
static void linein_task_close(void)
|
||||
linein模式退出
|
||||
|
||||
**************************************************************/
|
||||
|
||||
|
||||
#include "system/app_core.h"
|
||||
#include "system/includes.h"
|
||||
#include "server/server_core.h"
|
||||
@ -51,11 +50,12 @@
|
||||
#include "bt.h"
|
||||
#include "bt_tws.h"
|
||||
|
||||
#include "kt.h"
|
||||
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
|
||||
#define LOG_TAG_CONST APP_LINEIN
|
||||
#define LOG_TAG "[APP_LINEIN]"
|
||||
#define LOG_TAG_CONST APP_LINEIN
|
||||
#define LOG_TAG "[APP_LINEIN]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
#define LOG_DEBUG_ENABLE
|
||||
#define LOG_INFO_ENABLE
|
||||
@ -63,8 +63,7 @@
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
static u8 linein_last_onoff = (u8) - 1;
|
||||
static u8 linein_last_onoff = (u8)-1;
|
||||
static u8 linein_bt_back_flag = 0;
|
||||
static u8 linein_idle_flag = 1;
|
||||
|
||||
@ -77,23 +76,27 @@ static u8 linein_idle_flag = 1;
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int linein_device_event_handler(struct sys_event *event)
|
||||
{
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LINEIN) {
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN) {
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LINEIN)
|
||||
{
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN)
|
||||
{
|
||||
log_info("linein online \n");
|
||||
return true;
|
||||
} else if (event->u.dev.event == DEVICE_EVENT_OUT) {
|
||||
}
|
||||
else if (event->u.dev.event == DEVICE_EVENT_OUT)
|
||||
{
|
||||
log_info("linein offline \n");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int linein_key_event_filter_before()
|
||||
{
|
||||
#if TCFG_UI_ENABLE
|
||||
#if (TCFG_APP_FM_EMITTER_EN == ENABLE_THIS_MOUDLE)
|
||||
if (ui_get_app_menu(GRT_CUR_MENU) == MENU_FM_SET_FRE) {
|
||||
if (ui_get_app_menu(GRT_CUR_MENU) == MENU_FM_SET_FRE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -101,7 +104,6 @@ static int linein_key_event_filter_before()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 按键消息入口
|
||||
@param 无
|
||||
@ -115,47 +117,50 @@ static int linein_key_msg_deal(struct sys_event *event)
|
||||
int err = 0;
|
||||
u8 vol;
|
||||
int key_event = event->u.key.event;
|
||||
int key_value = event->u.key.value;//
|
||||
int key_value = event->u.key.value; //
|
||||
|
||||
if (linein_key_event_filter_before() == false) {
|
||||
if (linein_key_event_filter_before() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
log_info("key_event:%d \n", key_event);
|
||||
#if (SMART_BOX_EN)
|
||||
extern bool smartbox_key_event_filter_before(int key_event);
|
||||
if (smartbox_key_event_filter_before(key_event)) {
|
||||
if (smartbox_key_event_filter_before(key_event))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (key_event) {
|
||||
switch (key_event)
|
||||
{
|
||||
case KEY_LINEIN_START:
|
||||
linein_start();
|
||||
linein_last_onoff = 1;
|
||||
UI_REFLASH_WINDOW(true);//刷新主页并且支持打断显示
|
||||
UI_REFLASH_WINDOW(true); // 刷新主页并且支持打断显示
|
||||
break;
|
||||
case KEY_TEST_DEMO_0:
|
||||
log_info("KEY_TEST_DEMO_0 = %d \n", key_value);
|
||||
app_task_put_key_msg(KEY_TEST_DEMO_1, 5678); //test demo
|
||||
app_task_put_key_msg(KEY_TEST_DEMO_1, 5678); // test demo
|
||||
break;
|
||||
case KEY_TEST_DEMO_1:
|
||||
log_info("KEY_TEST_DEMO_1 = %d \n", key_value); //test demo
|
||||
log_info("KEY_TEST_DEMO_1 = %d \n", key_value); // test demo
|
||||
break;
|
||||
|
||||
case KEY_MUSIC_PP:
|
||||
case KEY_MUSIC_PP:
|
||||
log_info("KEY_MUSIC_PP\n");
|
||||
/* app_task_put_key_msg(KEY_TEST_DEMO_0,1234); //test demo// */
|
||||
linein_last_onoff = linein_volume_pp();
|
||||
linein_last_onoff ? ui_update_status(STATUS_LINEIN_PLAY)\
|
||||
: ui_update_status(STATUS_LINEIN_PAUSE);
|
||||
linein_last_onoff ? ui_update_status(STATUS_LINEIN_PLAY)
|
||||
: ui_update_status(STATUS_LINEIN_PAUSE);
|
||||
break;
|
||||
case KEY_VOL_UP:
|
||||
case KEY_VOL_UP:
|
||||
log_info(" KEY_VOL_UP\n");
|
||||
linein_key_vol_up();
|
||||
break;
|
||||
|
||||
case KEY_VOL_DOWN:
|
||||
case KEY_VOL_DOWN:
|
||||
log_info(" KEY_VOL_DOWN\n");
|
||||
linein_key_vol_down();
|
||||
break;
|
||||
@ -179,18 +184,20 @@ static int linein_key_msg_deal(struct sys_event *event)
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void line_tone_play_end_callback(void *priv, int flag)
|
||||
static void line_tone_play_end_callback(void *priv, int flag)
|
||||
{
|
||||
u32 index = (u32)priv;
|
||||
|
||||
if (APP_LINEIN_TASK != app_get_curr_task()) {
|
||||
if (APP_LINEIN_TASK != app_get_curr_task())
|
||||
{
|
||||
log_error("tone callback task out \n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
switch (index)
|
||||
{
|
||||
case IDEX_TONE_LINEIN:
|
||||
///提示音播放结束, 启动播放器播放
|
||||
/// 提示音播放结束, 启动播放器播放
|
||||
app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
break;
|
||||
default:
|
||||
@ -198,7 +205,6 @@ static void line_tone_play_end_callback(void *priv, int flag)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 入口
|
||||
@param 无
|
||||
@ -209,12 +215,11 @@ static void line_tone_play_end_callback(void *priv, int flag)
|
||||
static void linein_app_init(void)
|
||||
{
|
||||
linein_idle_flag = 0;
|
||||
UI_SHOW_WINDOW(ID_WINDOW_LINEIN);//打开ui主页
|
||||
UI_SHOW_WINDOW(ID_WINDOW_LINEIN); // 打开ui主页
|
||||
UI_SHOW_MENU(MENU_AUX, 0, 0, NULL);
|
||||
sys_key_event_enable();//开启按键
|
||||
sys_key_event_enable(); // 开启按键
|
||||
ui_update_status(STATUS_LINEIN_MODE);
|
||||
clock_idle(LINEIN_IDLE_CLOCK);
|
||||
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
@ -234,7 +239,6 @@ static void linein_task_close(void)
|
||||
linein_idle_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 模式活跃状态 所有消息入口
|
||||
@param 无
|
||||
@ -245,15 +249,20 @@ static void linein_task_close(void)
|
||||
static int linein_sys_event_handler(struct sys_event *event)
|
||||
{
|
||||
int ret = TRUE;
|
||||
switch (event->type) {
|
||||
switch (event->type)
|
||||
{
|
||||
case SYS_KEY_EVENT:
|
||||
return linein_key_msg_deal(event);
|
||||
break;
|
||||
case SYS_DEVICE_EVENT:
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LINEIN) {
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN) {
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LINEIN)
|
||||
{
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN)
|
||||
{
|
||||
log_info("linein online \n");
|
||||
} else if (event->u.dev.event == DEVICE_EVENT_OUT) {
|
||||
}
|
||||
else if (event->u.dev.event == DEVICE_EVENT_OUT)
|
||||
{
|
||||
log_info("linein offline \n");
|
||||
app_task_switch_next();
|
||||
}
|
||||
@ -267,7 +276,6 @@ static int linein_sys_event_handler(struct sys_event *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 在线检测 切换模式判断使用
|
||||
@param 无
|
||||
@ -277,7 +285,8 @@ static int linein_sys_event_handler(struct sys_event *event)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int linein_app_check(void)
|
||||
{
|
||||
if (linein_is_online()) {
|
||||
if (linein_is_online())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -295,49 +304,57 @@ void app_linein_task()
|
||||
int res;
|
||||
int err = 0;
|
||||
int msg[32];
|
||||
|
||||
#if TCFG_APP_BT_EN
|
||||
linein_bt_back_flag = get_bt_back_flag();//从蓝牙后台返回标志
|
||||
linein_bt_back_flag = get_bt_back_flag(); // 从蓝牙后台返回标志
|
||||
set_bt_back_flag(0);
|
||||
#else
|
||||
linein_bt_back_flag = 0;
|
||||
#endif
|
||||
log_info("linein_bt_back_flag == %d linein_last_onoff = %d\n", \
|
||||
log_info("linein_bt_back_flag == %d linein_last_onoff = %d\n",
|
||||
linein_bt_back_flag, linein_last_onoff);
|
||||
|
||||
linein_app_init();//初始化时钟和开启ui
|
||||
linein_app_init(); // 初始化时钟和开启ui
|
||||
|
||||
kt_eq_switch_to(KT_EQ_IDX_LINEIN);
|
||||
|
||||
#if TCFG_DEC2TWS_ENABLE
|
||||
extern void set_tws_background_connected_flag(u8 flag);
|
||||
extern u8 get_tws_background_connected_flag();
|
||||
if (get_tws_background_connected_flag()) { //不播放提示音
|
||||
if (get_tws_background_connected_flag())
|
||||
{ // 不播放提示音
|
||||
app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
set_tws_background_connected_flag(0);
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_LINEIN], 1,
|
||||
line_tone_play_end_callback, (void *)IDEX_TONE_LINEIN);
|
||||
//err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_LINEIN], 1,
|
||||
// line_tone_play_end_callback, (void *)IDEX_TONE_LINEIN);
|
||||
app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
}
|
||||
// if (err) { //
|
||||
// ///提示音播放失败,直接推送KEY_MUSIC_PLAYER_START启动播放
|
||||
// app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
// }
|
||||
// if (err) { //
|
||||
// ///提示音播放失败,直接推送KEY_MUSIC_PLAYER_START启动播放
|
||||
// app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
// }
|
||||
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
|
||||
switch (msg[0]) {
|
||||
switch (msg[0])
|
||||
{
|
||||
case APP_MSG_SYS_EVENT:
|
||||
if (linein_sys_event_handler((struct sys_event *)(&msg[1])) == false) {
|
||||
app_default_event_deal((struct sys_event *)(&msg[1])); //由common统一处理
|
||||
if (linein_sys_event_handler((struct sys_event *)(&msg[1])) == false)
|
||||
{
|
||||
app_default_event_deal((struct sys_event *)(&msg[1])); // 由common统一处理
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (app_task_exitting()) {
|
||||
if (app_task_exitting())
|
||||
{
|
||||
linein_task_close();
|
||||
return;
|
||||
}
|
||||
@ -362,9 +379,6 @@ int linein_app_check(void)
|
||||
|
||||
void app_linein_task()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -25,11 +25,10 @@
|
||||
此文件函数主要是linein实现api
|
||||
**************************************************************/
|
||||
|
||||
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
|
||||
#define LOG_TAG_CONST APP_LINEIN
|
||||
#define LOG_TAG "[APP_LINEIN]"
|
||||
#define LOG_TAG_CONST APP_LINEIN
|
||||
#define LOG_TAG "[APP_LINEIN]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
#define LOG_DEBUG_ENABLE
|
||||
#define LOG_INFO_ENABLE
|
||||
@ -37,16 +36,15 @@
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
struct linein_opr {
|
||||
struct linein_opr
|
||||
{
|
||||
void *rec_dev;
|
||||
u8 volume : 7;
|
||||
u8 onoff : 1;
|
||||
u8 onoff : 1;
|
||||
u8 audio_state; /*判断linein模式使用模拟音量还是数字音量*/
|
||||
};
|
||||
static struct linein_opr linein_hdl = {0};
|
||||
#define __this (&linein_hdl)
|
||||
|
||||
#define __this (&linein_hdl)
|
||||
|
||||
/**@brief linein 音量设置函数
|
||||
@param 需要设置的音量
|
||||
@ -56,10 +54,13 @@ static struct linein_opr linein_hdl = {0};
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int linein_volume_set(u8 vol)
|
||||
{
|
||||
if (TCFG_LINEIN_LR_CH == AUDIO_LIN_DACL_CH) {
|
||||
if (TCFG_LINEIN_LR_CH == AUDIO_LIN_DACL_CH)
|
||||
{
|
||||
app_audio_output_ch_analog_gain_set(BIT(0), 0);
|
||||
/* app_audio_output_ch_analog_gain_set(BIT(1), vol); */
|
||||
} else if (TCFG_LINEIN_LR_CH == AUDIO_LIN_DACR_CH) {
|
||||
}
|
||||
else if (TCFG_LINEIN_LR_CH == AUDIO_LIN_DACR_CH)
|
||||
{
|
||||
app_audio_output_ch_analog_gain_set(BIT(1), 0);
|
||||
/* app_audio_output_ch_analog_gain_set(BIT(0), vol); */
|
||||
}
|
||||
@ -72,9 +73,12 @@ int linein_volume_set(u8 vol)
|
||||
#endif
|
||||
|
||||
#if (TCFG_LINEIN_INPUT_WAY != LINEIN_INPUT_WAY_ADC)
|
||||
if (__this->volume) {
|
||||
if (__this->volume)
|
||||
{
|
||||
audio_linein_mute(0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_linein_mute(1);
|
||||
}
|
||||
#endif
|
||||
@ -82,9 +86,6 @@ int linein_volume_set(u8 vol)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 使用模拟直通方式
|
||||
@param 无
|
||||
@ -94,30 +95,38 @@ int linein_volume_set(u8 vol)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static inline void __linein_way_analog_start()
|
||||
{
|
||||
app_audio_state_switch(__this->audio_state, get_max_sys_vol());//
|
||||
app_audio_state_switch(__this->audio_state, get_max_sys_vol()); //
|
||||
app_audio_set_volume(__this->audio_state, __this->volume, 1);
|
||||
if (!app_audio_get_volume(__this->audio_state)) {
|
||||
audio_linein_mute(1); //模拟输出时候,dac为0也有数据
|
||||
if (!app_audio_get_volume(__this->audio_state))
|
||||
{
|
||||
audio_linein_mute(1); // 模拟输出时候,dac为0也有数据
|
||||
}
|
||||
|
||||
if (TCFG_LINEIN_LR_CH & (BIT(0) | BIT(1))) {
|
||||
if (TCFG_LINEIN_LR_CH & (BIT(0) | BIT(1)))
|
||||
{
|
||||
audio_linein0_open(TCFG_LINEIN_LR_CH, 1);
|
||||
} else if (TCFG_LINEIN_LR_CH & (BIT(2) | BIT(3))) {
|
||||
}
|
||||
else if (TCFG_LINEIN_LR_CH & (BIT(2) | BIT(3)))
|
||||
{
|
||||
audio_linein1_open(TCFG_LINEIN_LR_CH, 1);
|
||||
} else if (TCFG_LINEIN_LR_CH & (BIT(4) | BIT(5))) {
|
||||
}
|
||||
else if (TCFG_LINEIN_LR_CH & (BIT(4) | BIT(5)))
|
||||
{
|
||||
audio_linein2_open(TCFG_LINEIN_LR_CH, 1);
|
||||
}
|
||||
|
||||
if (TCFG_LINEIN_LR_CH != AUDIO_LIN0_LR && TCFG_LINEIN_LR_CH != AUDIO_LIN1_LR && TCFG_LINEIN_LR_CH != AUDIO_LIN2_LR) {
|
||||
if (TCFG_LINEIN_LR_CH != AUDIO_LIN0_LR && TCFG_LINEIN_LR_CH != AUDIO_LIN1_LR && TCFG_LINEIN_LR_CH != AUDIO_LIN2_LR)
|
||||
{
|
||||
audio_linein_ch_combine(1, 1);
|
||||
}
|
||||
|
||||
audio_linein_gain(1); // high gain
|
||||
if (app_audio_get_volume(__this->audio_state)) {
|
||||
audio_linein_gain(1); // high gain
|
||||
if (app_audio_get_volume(__this->audio_state))
|
||||
{
|
||||
audio_linein_mute(0);
|
||||
app_audio_set_volume(__this->audio_state, app_audio_get_volume(__this->audio_state), 1);//防止无法调整
|
||||
app_audio_set_volume(__this->audio_state, app_audio_get_volume(__this->audio_state), 1); // 防止无法调整
|
||||
}
|
||||
//模拟输出时候,dac为0也有数据
|
||||
// 模拟输出时候,dac为0也有数据
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -133,15 +142,15 @@ static inline void __linein_way_dac_analog_start()
|
||||
|
||||
app_audio_set_volume(__this->audio_state, __this->volume, 1);
|
||||
|
||||
|
||||
if ((TCFG_LINEIN_LR_CH == AUDIO_LIN_DACL_CH) \
|
||||
|| (TCFG_LINEIN_LR_CH == AUDIO_LIN_DACR_CH)) {
|
||||
if ((TCFG_LINEIN_LR_CH == AUDIO_LIN_DACL_CH) || (TCFG_LINEIN_LR_CH == AUDIO_LIN_DACR_CH))
|
||||
{
|
||||
audio_linein_via_dac_open(TCFG_LINEIN_LR_CH, 1);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(0, "linein ch err\n");
|
||||
}
|
||||
linein_volume_set(app_audio_get_volume(__this->audio_state));
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -155,14 +164,13 @@ static inline void __linein_way_adc_start()
|
||||
{
|
||||
|
||||
#if (TCFG_LINEIN_MULTIPLEX_WITH_FM && (defined(CONFIG_CPU_BR25)))
|
||||
linein_dec_open(AUDIO_LIN1R_CH, 44100); //696X 系列FM 与 LINEIN复用脚,绑定选择AUDIO_LIN1R_CH
|
||||
#elif ((TCFG_LINEIN_LR_CH & AUDIO_LIN1R_CH ) && (defined(CONFIG_CPU_BR25))) //FM 与 LINEIN 复用未使能,不可选择AUDIO_LIN1R_CH
|
||||
linein_dec_open(AUDIO_LIN1R_CH, 44100); // 696X 系列FM 与 LINEIN复用脚,绑定选择AUDIO_LIN1R_CH
|
||||
#elif ((TCFG_LINEIN_LR_CH & AUDIO_LIN1R_CH) && (defined(CONFIG_CPU_BR25))) // FM 与 LINEIN 复用未使能,不可选择AUDIO_LIN1R_CH
|
||||
log_e("FM is not multiplexed with linein. channel selection err\n");
|
||||
ASSERT(0, "err\n");
|
||||
#else
|
||||
linein_dec_open(TCFG_LINEIN_LR_CH, 44100);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
///*----------------------------------------------------------------------------*/
|
||||
@ -174,7 +182,8 @@ static inline void __linein_way_adc_start()
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int linein_start(void)
|
||||
{
|
||||
if (__this->onoff == 1) {
|
||||
if (__this->onoff == 1)
|
||||
{
|
||||
log_info("linein is aleady start\n");
|
||||
return true;
|
||||
}
|
||||
@ -192,7 +201,7 @@ int linein_start(void)
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_skip(u8 skip);
|
||||
mix_out_automute_skip(1);
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
|
||||
#elif (TCFG_LINEIN_INPUT_WAY == LINEIN_INPUT_WAY_DAC)
|
||||
@ -206,19 +215,16 @@ int linein_start(void)
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_skip(u8 skip);
|
||||
mix_out_automute_skip(1);
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
__this->volume = app_audio_get_volume(__this->audio_state);
|
||||
__this->onoff = 1;
|
||||
UI_REFLASH_WINDOW(false);//刷新主页并且支持打断显示
|
||||
UI_REFLASH_WINDOW(false); // 刷新主页并且支持打断显示
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief linein stop
|
||||
@param 无
|
||||
@ -229,7 +235,8 @@ int linein_start(void)
|
||||
void linein_stop(void)
|
||||
{
|
||||
|
||||
if (__this->onoff == 0) {
|
||||
if (__this->onoff == 0)
|
||||
{
|
||||
log_info("linein is aleady stop\n");
|
||||
return;
|
||||
}
|
||||
@ -237,11 +244,16 @@ void linein_stop(void)
|
||||
linein_dec_close();
|
||||
#elif (TCFG_LINEIN_INPUT_WAY == LINEIN_INPUT_WAY_ANALOG)
|
||||
|
||||
if (TCFG_LINEIN_LR_CH & (BIT(0) | BIT(1))) {
|
||||
if (TCFG_LINEIN_LR_CH & (BIT(0) | BIT(1)))
|
||||
{
|
||||
audio_linein0_close(TCFG_LINEIN_LR_CH, 0);
|
||||
} else if (TCFG_LINEIN_LR_CH & (BIT(2) | BIT(3))) {
|
||||
}
|
||||
else if (TCFG_LINEIN_LR_CH & (BIT(2) | BIT(3)))
|
||||
{
|
||||
audio_linein1_close(TCFG_LINEIN_LR_CH, 0);
|
||||
} else if (TCFG_LINEIN_LR_CH & (BIT(4) | BIT(5))) {
|
||||
}
|
||||
else if (TCFG_LINEIN_LR_CH & (BIT(4) | BIT(5)))
|
||||
{
|
||||
audio_linein2_close(TCFG_LINEIN_LR_CH, 0);
|
||||
}
|
||||
audio_dac_vol_mute_lock(0);
|
||||
@ -249,7 +261,7 @@ void linein_stop(void)
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_skip(u8 skip);
|
||||
mix_out_automute_skip(0);
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
|
||||
#elif (TCFG_LINEIN_INPUT_WAY == LINEIN_INPUT_WAY_DAC)
|
||||
@ -277,22 +289,19 @@ void linein_stop(void)
|
||||
|
||||
int linein_volume_pp(void)
|
||||
{
|
||||
if (__this->onoff) {
|
||||
if (__this->onoff)
|
||||
{
|
||||
linein_stop();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
linein_start();
|
||||
}
|
||||
log_info("pp:%d \n", __this->onoff);
|
||||
UI_REFLASH_WINDOW(true);
|
||||
return __this->onoff;
|
||||
return __this->onoff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**@brief 获取linein 播放状态
|
||||
@param 无
|
||||
@return 1:当前正在打开 0:当前正在关闭
|
||||
@ -305,53 +314,43 @@ u8 linein_get_status(void)
|
||||
return __this->onoff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@note 在linein 情况下针对了某些情景进行了处理,设置音量需要使用独立接口
|
||||
*/
|
||||
|
||||
void linein_tone_play_callback(void *priv, int flag) //模拟linein用数字音量调节播提示音要用这个回调
|
||||
void linein_tone_play_callback(void *priv, int flag) // 模拟linein用数字音量调节播提示音要用这个回调
|
||||
{
|
||||
linein_volume_pp();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void linein_tone_play(u8 index, u8 preemption)
|
||||
{
|
||||
if (preemption) { //抢断播放
|
||||
if (preemption)
|
||||
{ // 抢断播放
|
||||
linein_volume_pp();
|
||||
|
||||
tone_play_index_with_callback(index, preemption, linein_tone_play_callback, NULL);
|
||||
}
|
||||
|
||||
else {
|
||||
else
|
||||
{
|
||||
tone_play_index_with_callback(index, preemption, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void linein_key_vol_up()
|
||||
{
|
||||
u8 vol;
|
||||
if (__this->volume < get_max_sys_vol()) {
|
||||
__this->volume ++;
|
||||
if (__this->volume < get_max_sys_vol())
|
||||
{
|
||||
__this->volume++;
|
||||
linein_volume_set(__this->volume);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
linein_volume_set(__this->volume);
|
||||
if (tone_get_status() == 0) {
|
||||
if (tone_get_status() == 0)
|
||||
{
|
||||
/* tone_play(TONE_MAX_VOL); */
|
||||
#if TCFG_MAX_VOL_PROMPT
|
||||
tone_play_by_path(tone_table[IDEX_TONE_MAX_VOL], 0);
|
||||
@ -363,16 +362,15 @@ void linein_key_vol_up()
|
||||
log_info("vol+:%d\n", __this->volume);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@note 在linein 情况下针对了某些情景进行了处理,设置音量需要使用独立接口
|
||||
*/
|
||||
void linein_key_vol_down()
|
||||
{
|
||||
u8 vol;
|
||||
if (__this->volume) {
|
||||
__this->volume --;
|
||||
if (__this->volume)
|
||||
{
|
||||
__this->volume--;
|
||||
linein_volume_set(__this->volume);
|
||||
}
|
||||
vol = __this->volume;
|
||||
@ -380,13 +378,4 @@ void linein_key_vol_down()
|
||||
log_info("vol-:%d\n", __this->volume);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
417
apps/soundbox/task_manager/lp/lp.c
Normal file
417
apps/soundbox/task_manager/lp/lp.c
Normal file
@ -0,0 +1,417 @@
|
||||
|
||||
/*************************************************************
|
||||
此文件函数主要是lp模式按键处理和事件处理
|
||||
|
||||
void app_lp_task()
|
||||
lp模式主函数
|
||||
|
||||
static int lp_sys_event_handler(struct sys_event *event)
|
||||
lp模式系统事件所有处理入口
|
||||
|
||||
static void lp_task_close(void)
|
||||
lp模式退出
|
||||
|
||||
**************************************************************/
|
||||
|
||||
#include "system/app_core.h"
|
||||
#include "system/includes.h"
|
||||
#include "server/server_core.h"
|
||||
|
||||
#include "app_config.h"
|
||||
#include "app_task.h"
|
||||
|
||||
#include "media/includes.h"
|
||||
#include "tone_player.h"
|
||||
#include "audio_dec_linein.h"
|
||||
|
||||
#include "asm/audio_linein.h"
|
||||
#include "asm/pwm_led.h"
|
||||
#include "asm/charge.h"
|
||||
|
||||
#include "app_charge.h"
|
||||
#include "app_main.h"
|
||||
#include "app_online_cfg.h"
|
||||
#include "app_power_manage.h"
|
||||
|
||||
#include "app_chargestore.h"
|
||||
#include "gSensor/gSensor_manage.h"
|
||||
#include "ui_manage.h"
|
||||
#include "vm.h"
|
||||
|
||||
#include "lp/lp_dev.h"
|
||||
#include "lp/lp.h"
|
||||
|
||||
#include "key_event_deal.h"
|
||||
#include "user_cfg.h"
|
||||
#include "ui/ui_api.h"
|
||||
#include "fm_emitter/fm_emitter_manage.h"
|
||||
#include "clock_cfg.h"
|
||||
|
||||
#include "bt.h"
|
||||
#include "bt_tws.h"
|
||||
|
||||
#include "kt.h"
|
||||
|
||||
#if TCFG_APP_LP_EN
|
||||
|
||||
#if (SMART_BOX_EN)
|
||||
__attribute__((weak)) void smartbox_lp_msg_deal(int msg, u8 ret)
|
||||
{
|
||||
(void)msg;
|
||||
(void)ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define LOG_TAG_CONST APP_LP
|
||||
#define LOG_TAG "[APP_LP]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
#define LOG_DEBUG_ENABLE
|
||||
#define LOG_INFO_ENABLE
|
||||
/* #define LOG_DUMP_ENABLE */
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
static u8 lp_last_onoff = (u8)-1;
|
||||
static u8 lp_bt_back_flag = 0;
|
||||
static u8 lp_idle_flag = 1;
|
||||
|
||||
///*----------------------------------------------------------------------------*/
|
||||
/**@brief 当前出于非lp 模式时候lp的在common消息处理
|
||||
@param 无
|
||||
@return 1:需要切换回lp 模式 0:无
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int lp_device_event_handler(struct sys_event *event)
|
||||
{
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LP)
|
||||
{
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN)
|
||||
{
|
||||
printf("lp online \n");
|
||||
return true;
|
||||
}
|
||||
else if (event->u.dev.event == DEVICE_EVENT_OUT)
|
||||
{
|
||||
printf("lp offline \n");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int lp_key_event_filter_before()
|
||||
{
|
||||
#if TCFG_UI_ENABLE
|
||||
#if (TCFG_APP_FM_EMITTER_EN == ENABLE_THIS_MOUDLE)
|
||||
if (ui_get_app_menu(GRT_CUR_MENU) == MENU_FM_SET_FRE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 按键消息入口
|
||||
@param 无
|
||||
@return 1、消息已经处理,不需要发送到common 0、消息发送到common处理
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int lp_key_msg_deal(struct sys_event *event)
|
||||
{
|
||||
int ret = true;
|
||||
int err = 0;
|
||||
u8 vol;
|
||||
int key_event = event->u.key.event;
|
||||
int key_value = event->u.key.value; //
|
||||
|
||||
if (lp_key_event_filter_before() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
log_info("key_event:%d \n", key_event);
|
||||
#if (SMART_BOX_EN)
|
||||
extern bool smartbox_key_event_filter_before(int key_event);
|
||||
if (smartbox_key_event_filter_before(key_event))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (key_event)
|
||||
{
|
||||
case KEY_LP_START:
|
||||
printf("KEY_LP_START\n");
|
||||
lp_start();
|
||||
lp_last_onoff = 1;
|
||||
UI_REFLASH_WINDOW(true); // 刷新主页并且支持打断显示
|
||||
break;
|
||||
case KEY_TEST_DEMO_0:
|
||||
log_info("KEY_TEST_DEMO_0 = %d \n", key_value);
|
||||
app_task_put_key_msg(KEY_TEST_DEMO_1, 5678); // test demo
|
||||
break;
|
||||
case KEY_TEST_DEMO_1:
|
||||
log_info("KEY_TEST_DEMO_1 = %d \n", key_value); // test demo
|
||||
break;
|
||||
/* case KEY_USER_CHANGE_MODE:
|
||||
printf(" KEY_USER_CHANGE_MODE \n");
|
||||
if (linein_app_check())
|
||||
{
|
||||
app_task_switch_to(APP_LINEIN_TASK);
|
||||
}
|
||||
else if (music_app_check())
|
||||
{
|
||||
app_task_switch_to(APP_MUSIC_TASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
}
|
||||
break; */
|
||||
|
||||
case KEY_MUSIC_PP:
|
||||
log_info("KEY_MUSIC_PP\n");
|
||||
/* app_task_put_key_msg(KEY_TEST_DEMO_0,1234); //test demo// */
|
||||
lp_last_onoff = lp_volume_pp();
|
||||
//lp_last_onoff ? ui_update_status(STATUS_LP_PLAY)
|
||||
// : ui_update_status(STATUS_LP_PAUSE);
|
||||
break;
|
||||
case KEY_VOL_UP:
|
||||
log_info(" KEY_VOL_UP\n");
|
||||
lp_key_vol_up();
|
||||
break;
|
||||
|
||||
case KEY_VOL_DOWN:
|
||||
log_info(" KEY_VOL_DOWN\n");
|
||||
lp_key_vol_down();
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
#if (SMART_BOX_EN)
|
||||
smartbox_lp_msg_deal(key_event, ret);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief 音乐播放结束回调函数
|
||||
@param 无
|
||||
@return
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void line_tone_play_end_callback(void *priv, int flag)
|
||||
{
|
||||
u32 index = (u32)priv;
|
||||
|
||||
if (APP_LP_TASK != app_get_curr_task())
|
||||
{
|
||||
log_error("tone callback task out \n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (index)
|
||||
{
|
||||
//case IDEX_TONE_LP:
|
||||
/// 提示音播放结束, 启动播放器播放
|
||||
// app_task_put_key_msg(KEY_LP_START, 0);
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 入口
|
||||
@param 无
|
||||
@return
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void lp_app_init(void)
|
||||
{
|
||||
lp_idle_flag = 0;
|
||||
UI_SHOW_WINDOW(ID_WINDOW_LINEIN); // LP 与 Linein 共用 AUX 界面
|
||||
UI_SHOW_MENU(MENU_AUX, 0, 0, NULL);
|
||||
sys_key_event_enable(); // 开启按键
|
||||
//ui_update_status(STATUS_LP_MODE);
|
||||
clock_idle(LINEIN_IDLE_CLOCK);
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 退出
|
||||
@param 无
|
||||
@return
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
static void lp_task_close(void)
|
||||
{
|
||||
UI_HIDE_CURR_WINDOW();
|
||||
lp_stop();
|
||||
/* tone_play_stop(); */
|
||||
//tone_play_stop_by_path(tone_table[IDEX_TONE_LP]);
|
||||
lp_idle_flag = 1;
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 模式活跃状态 所有消息入口
|
||||
@param 无
|
||||
@return 1、当前消息已经处理,不需要发送comomon 0、当前消息不是lp处理的,发送到common统一处理
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int lp_sys_event_handler(struct sys_event *event)
|
||||
{
|
||||
int ret = TRUE;
|
||||
switch (event->type)
|
||||
{
|
||||
case SYS_KEY_EVENT:
|
||||
return lp_key_msg_deal(event);
|
||||
break;
|
||||
case SYS_DEVICE_EVENT:
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LP)
|
||||
{
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN)
|
||||
{
|
||||
log_info("lp online \n");
|
||||
}
|
||||
else if (event->u.dev.event == DEVICE_EVENT_OUT)
|
||||
{
|
||||
log_info("lp offline \n");
|
||||
if (music_app_check())
|
||||
{
|
||||
app_task_switch_to(APP_MUSIC_TASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
app_task_switch_next();
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 在线检测 切换模式判断使用
|
||||
@param 无
|
||||
@return 1 lp设备在线 0 设备不在线
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int lp_app_check(void)
|
||||
{
|
||||
if (lp_is_online())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 主任务
|
||||
@param 无
|
||||
@return 无
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
void app_lp_task()
|
||||
{
|
||||
int res;
|
||||
int err = 0;
|
||||
int msg[32];
|
||||
|
||||
#if TCFG_APP_BT_EN
|
||||
lp_bt_back_flag = get_bt_back_flag(); // 从蓝牙后台返回标志
|
||||
set_bt_back_flag(0);
|
||||
#else
|
||||
lp_bt_back_flag = 0;
|
||||
#endif
|
||||
log_info("lp_bt_back_flag == %d lp_last_onoff = %d\n",
|
||||
lp_bt_back_flag, lp_last_onoff);
|
||||
|
||||
lp_app_init(); // 初始化时钟和开启ui
|
||||
|
||||
kt_eq_switch_to(KT_EQ_IDX_LP);
|
||||
|
||||
#if TCFG_DEC2TWS_ENABLE
|
||||
extern void set_tws_background_connected_flag(u8 flag);
|
||||
extern u8 get_tws_background_connected_flag();
|
||||
if (get_tws_background_connected_flag())
|
||||
{ // 不播放提示音
|
||||
app_task_put_key_msg(KEY_LP_START, 0);
|
||||
set_tws_background_connected_flag(0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
//err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_LP], 1,
|
||||
// line_tone_play_end_callback, (void *)IDEX_TONE_LP);
|
||||
|
||||
}
|
||||
// if (err) { //
|
||||
// ///提示音播放失败,直接推送KEY_MUSIC_PLAYER_START启动播放
|
||||
// app_task_put_key_msg(KEY_LP_START, 0);
|
||||
// }
|
||||
app_task_put_key_msg(KEY_LP_START, 0);
|
||||
|
||||
while (1)
|
||||
{
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
|
||||
switch (msg[0])
|
||||
{
|
||||
case APP_MSG_SYS_EVENT:
|
||||
if (lp_sys_event_handler((struct sys_event *)(&msg[1])) == false)
|
||||
{
|
||||
app_default_event_deal((struct sys_event *)(&msg[1])); // 由common统一处理
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (app_task_exitting())
|
||||
{
|
||||
lp_task_close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static u8 lp_idle_query(void)
|
||||
{
|
||||
return lp_idle_flag;
|
||||
}
|
||||
REGISTER_LP_TARGET(lp_lp_target) = {
|
||||
.name = "lp",
|
||||
.is_idle = lp_idle_query,
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
int lp_app_check(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void app_lp_task()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
396
apps/soundbox/task_manager/lp/lp_api.c
Normal file
396
apps/soundbox/task_manager/lp/lp_api.c
Normal file
@ -0,0 +1,396 @@
|
||||
#include "system/includes.h"
|
||||
#include "app_config.h"
|
||||
#include "app_task.h"
|
||||
#include "media/includes.h"
|
||||
#include "tone_player.h"
|
||||
#include "audio_dec_linein.h"
|
||||
#include "asm/audio_linein.h"
|
||||
#include "app_main.h"
|
||||
#include "ui_manage.h"
|
||||
#include "vm.h"
|
||||
#include "lp/lp_dev.h"
|
||||
#include "lp/lp.h"
|
||||
#include "key_event_deal.h"
|
||||
#include "user_cfg.h"
|
||||
#include "ui/ui_api.h"
|
||||
#include "fm_emitter/fm_emitter_manage.h"
|
||||
#include "clock_cfg.h"
|
||||
#include "bt.h"
|
||||
#include "bt_tws.h"
|
||||
#ifndef CONFIG_MEDIA_NEW_ENABLE
|
||||
#include "application/audio_output_dac.h"
|
||||
#endif
|
||||
|
||||
/*************************************************************
|
||||
此文件函数主要是lp实现api
|
||||
**************************************************************/
|
||||
|
||||
#if TCFG_APP_LP_EN
|
||||
|
||||
#define LOG_TAG_CONST APP_LP
|
||||
#define LOG_TAG "[APP_LP]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
#define LOG_DEBUG_ENABLE
|
||||
#define LOG_INFO_ENABLE
|
||||
/* #define LOG_DUMP_ENABLE */
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
struct lp_opr
|
||||
{
|
||||
void *rec_dev;
|
||||
u8 volume : 7;
|
||||
u8 onoff : 1;
|
||||
u8 audio_state; /*判断lp模式使用模拟音量还是数字音量*/
|
||||
};
|
||||
static struct lp_opr lp_hdl = {0};
|
||||
#define __this (&lp_hdl)
|
||||
|
||||
/**@brief lp 音量设置函数
|
||||
@param 需要设置的音量
|
||||
@return
|
||||
@note 在lp 情况下针对了某些情景进行了处理,设置音量需要使用独立接口
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int lp_volume_set(u8 vol)
|
||||
{
|
||||
if (TCFG_LP_LR_CH == AUDIO_LIN_DACL_CH)
|
||||
{
|
||||
app_audio_output_ch_analog_gain_set(BIT(0), 0);
|
||||
/* app_audio_output_ch_analog_gain_set(BIT(1), vol); */
|
||||
}
|
||||
else if (TCFG_LP_LR_CH == AUDIO_LIN_DACR_CH)
|
||||
{
|
||||
app_audio_output_ch_analog_gain_set(BIT(1), 0);
|
||||
/* app_audio_output_ch_analog_gain_set(BIT(0), vol); */
|
||||
}
|
||||
app_audio_set_volume(__this->audio_state, vol, 1);
|
||||
log_info("lp vol: %d", __this->volume);
|
||||
__this->volume = vol;
|
||||
|
||||
#if (TCFG_DEC2TWS_ENABLE)
|
||||
bt_tws_sync_volume();
|
||||
#endif
|
||||
|
||||
#if (TCFG_LP_INPUT_WAY != LINEIN_INPUT_WAY_ADC)
|
||||
if (__this->volume)
|
||||
{
|
||||
audio_linein_mute(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_linein_mute(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 使用模拟直通方式
|
||||
@param 无
|
||||
@return 无
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static inline void __lp_way_analog_start()
|
||||
{
|
||||
app_audio_state_switch(__this->audio_state, get_max_sys_vol()); //
|
||||
app_audio_set_volume(__this->audio_state, __this->volume, 1);
|
||||
if (!app_audio_get_volume(__this->audio_state))
|
||||
{
|
||||
audio_lp_mute(1); // 模拟输出时候,dac为0也有数据
|
||||
}
|
||||
|
||||
if (TCFG_LP_LR_CH & (BIT(0) | BIT(1)))
|
||||
{
|
||||
audio_lp0_open(TCFG_LP_LR_CH, 1);
|
||||
}
|
||||
else if (TCFG_LP_LR_CH & (BIT(2) | BIT(3)))
|
||||
{
|
||||
audio_lp1_open(TCFG_LP_LR_CH, 1);
|
||||
}
|
||||
else if (TCFG_LP_LR_CH & (BIT(4) | BIT(5)))
|
||||
{
|
||||
audio_lp2_open(TCFG_LP_LR_CH, 1);
|
||||
}
|
||||
|
||||
if (TCFG_LP_LR_CH != AUDIO_LIN0_LR && TCFG_LP_LR_CH != AUDIO_LIN1_LR && TCFG_LP_LR_CH != AUDIO_LIN2_LR)
|
||||
{
|
||||
audio_lp_ch_combine(1, 1);
|
||||
}
|
||||
|
||||
audio_lp_gain(1); // high gain
|
||||
if (app_audio_get_volume(__this->audio_state))
|
||||
{
|
||||
audio_lp_mute(0);
|
||||
app_audio_set_volume(__this->audio_state, app_audio_get_volume(__this->audio_state), 1); // 防止无法调整
|
||||
}
|
||||
// 模拟输出时候,dac为0也有数据
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 使用dac IO输入方式
|
||||
@param 无
|
||||
@return 无
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static inline void __lp_way_dac_analog_start()
|
||||
{
|
||||
app_audio_state_switch(__this->audio_state, get_max_sys_vol());
|
||||
|
||||
app_audio_set_volume(__this->audio_state, __this->volume, 1);
|
||||
|
||||
if ((TCFG_LP_LR_CH == AUDIO_LIN_DACL_CH) || (TCFG_LP_LR_CH == AUDIO_LIN_DACR_CH))
|
||||
{
|
||||
audio_lp_via_dac_open(TCFG_LP_LR_CH, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(0, "lp ch err\n");
|
||||
}
|
||||
lp_volume_set(app_audio_get_volume(__this->audio_state));
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 使用采集adc输入方式
|
||||
@param 无
|
||||
@return 无
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static inline void __lp_way_adc_start()
|
||||
{
|
||||
printf("__lp_way_adc_start\n");
|
||||
#if (TCFG_LP_MULTIPLEX_WITH_FM && (defined(CONFIG_CPU_BR25)))
|
||||
linein_dec_open(AUDIO_LIN1R_CH, 44100); // 696X 系列FM 与 LP复用脚,绑定选择AUDIO_LIN1R_CH
|
||||
#elif ((TCFG_LP_LR_CH & AUDIO_LIN1R_CH) && (defined(CONFIG_CPU_BR25))) // FM 与 LP 复用未使能,不可选择AUDIO_LIN1R_CH
|
||||
log_e("FM is not multiplexed with lp. channel selection err\n");
|
||||
ASSERT(0, "err\n");
|
||||
#else
|
||||
//printf("linein_dec_open(TCFG_LP_LR_CH, 44100);\n");
|
||||
printf("linein_dec_open(TCFG_LP_LR_CH, 44100) = %d\n", linein_dec_open(TCFG_LP_LR_CH, 44100));
|
||||
#endif
|
||||
}
|
||||
|
||||
///*----------------------------------------------------------------------------*/
|
||||
/**@brief lp 设置硬件
|
||||
@param 无
|
||||
@return 无
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int lp_start(void)
|
||||
{
|
||||
if (__this->onoff == 1)
|
||||
{
|
||||
log_info("lp is aleady start\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
#if (TCFG_LP_INPUT_WAY == LINEIN_INPUT_WAY_ADC)
|
||||
printf("__lp_way_adc_start\n");
|
||||
#ifndef CONFIG_MEDIA_NEW_ENABLE
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_lp_start(void);
|
||||
mix_out_automute_lp_start();
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
__lp_way_adc_start();
|
||||
__this->audio_state = APP_AUDIO_STATE_MUSIC;
|
||||
#elif (TCFG_LP_INPUT_WAY == LINEIN_INPUT_WAY_ANALOG)
|
||||
__this->volume = app_audio_get_volume(__this->audio_state);
|
||||
log_info("current sys vol:%d\n", __this->volume);
|
||||
__this->audio_state = APP_AUDIO_STATE_LINEIN;
|
||||
__lp_way_analog_start();
|
||||
audio_dac_vol_mute_lock(1);
|
||||
#ifndef CONFIG_MEDIA_NEW_ENABLE
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_lp_start(void);
|
||||
mix_out_automute_lp_start();
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
|
||||
#elif (TCFG_LP_INPUT_WAY == LINEIN_INPUT_WAY_DAC)
|
||||
__this->volume = app_audio_get_volume(__this->audio_state);
|
||||
log_info("current sys vol:%d\n", __this->volume);
|
||||
__this->audio_state = APP_AUDIO_STATE_LINEIN;
|
||||
|
||||
__lp_way_dac_analog_start();
|
||||
audio_dac_vol_mute_lock(1);
|
||||
#ifndef CONFIG_MEDIA_NEW_ENABLE
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_lp_start(void);
|
||||
mix_out_automute_lp_start();
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
__this->volume = app_audio_get_volume(__this->audio_state);
|
||||
printf("__this->volume = %d\n", __this->volume);
|
||||
__this->onoff = 1;
|
||||
UI_REFLASH_WINDOW(false); // 刷新主页并且支持打断显示
|
||||
return true;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief lp stop
|
||||
@param 无
|
||||
@return 无
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
void lp_stop(void)
|
||||
{
|
||||
|
||||
if (__this->onoff == 0)
|
||||
{
|
||||
log_info("lp is aleady stop\n");
|
||||
return;
|
||||
}
|
||||
#ifndef CONFIG_MEDIA_NEW_ENABLE
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_lp_stop(void);
|
||||
mix_out_automute_lp_stop();
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
#if (TCFG_LP_INPUT_WAY == LINEIN_INPUT_WAY_ADC)
|
||||
linein_dec_close();
|
||||
#elif (TCFG_LP_INPUT_WAY == LINEIN_INPUT_WAY_ANALOG)
|
||||
|
||||
if (TCFG_LP_LR_CH & (BIT(0) | BIT(1)))
|
||||
{
|
||||
audio_lp0_close(TCFG_LP_LR_CH, 0);
|
||||
}
|
||||
else if (TCFG_LP_LR_CH & (BIT(2) | BIT(3)))
|
||||
{
|
||||
audio_lp1_close(TCFG_LP_LR_CH, 0);
|
||||
}
|
||||
else if (TCFG_LP_LR_CH & (BIT(4) | BIT(5)))
|
||||
{
|
||||
audio_lp2_close(TCFG_LP_LR_CH, 0);
|
||||
}
|
||||
audio_dac_vol_mute_lock(0);
|
||||
#ifndef CONFIG_MEDIA_NEW_ENABLE
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_skip(u8 skip);
|
||||
mix_out_automute_skip(0);
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
|
||||
#elif (TCFG_LP_INPUT_WAY == LINEIN_INPUT_WAY_DAC)
|
||||
audio_lp_via_dac_close(TCFG_LP_LR_CH, 0);
|
||||
audio_dac_vol_mute_lock(0);
|
||||
#ifndef CONFIG_MEDIA_NEW_ENABLE
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
extern void mix_out_automute_skip(u8 skip);
|
||||
mix_out_automute_skip(0);
|
||||
#endif // #if AUDIO_OUTPUT_AUTOMUTE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
app_audio_set_volume(APP_AUDIO_STATE_MUSIC, __this->volume, 1);
|
||||
__this->onoff = 0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief lp start stop 播放暂停切换
|
||||
@param 无
|
||||
@return 无
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int lp_volume_pp(void)
|
||||
{
|
||||
if (__this->onoff)
|
||||
{
|
||||
lp_stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
lp_start();
|
||||
}
|
||||
log_info("pp:%d \n", __this->onoff);
|
||||
UI_REFLASH_WINDOW(true);
|
||||
return __this->onoff;
|
||||
}
|
||||
|
||||
/**@brief 获取lp 播放状态
|
||||
@param 无
|
||||
@return 1:当前正在打开 0:当前正在关闭
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
u8 lp_get_status(void)
|
||||
{
|
||||
return __this->onoff;
|
||||
}
|
||||
|
||||
/*
|
||||
@note 在lp 情况下针对了某些情景进行了处理,设置音量需要使用独立接口
|
||||
*/
|
||||
|
||||
void lp_tone_play_callback(void *priv, int flag) // 模拟lp用数字音量调节播提示音要用这个回调
|
||||
{
|
||||
lp_volume_pp();
|
||||
}
|
||||
|
||||
void lp_tone_play(u8 index, u8 preemption)
|
||||
{
|
||||
if (preemption)
|
||||
{ // 抢断播放
|
||||
lp_volume_pp();
|
||||
|
||||
tone_play_index_with_callback(index, preemption, lp_tone_play_callback, NULL);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
tone_play_index_with_callback(index, preemption, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void lp_key_vol_up()
|
||||
{
|
||||
u8 vol;
|
||||
if (__this->volume < get_max_sys_vol())
|
||||
{
|
||||
__this->volume++;
|
||||
lp_volume_set(__this->volume);
|
||||
}
|
||||
else
|
||||
{
|
||||
lp_volume_set(__this->volume);
|
||||
if (tone_get_status() == 0)
|
||||
{
|
||||
/* tone_play(TONE_MAX_VOL); */
|
||||
#if TCFG_MAX_VOL_PROMPT
|
||||
tone_play_by_path(tone_table[IDEX_TONE_MAX_VOL], 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
vol = __this->volume;
|
||||
UI_SHOW_MENU(MENU_MAIN_VOL, 1000, vol, NULL);
|
||||
log_info("vol+:%d\n", __this->volume);
|
||||
}
|
||||
|
||||
/*
|
||||
@note 在lp 情况下针对了某些情景进行了处理,设置音量需要使用独立接口
|
||||
*/
|
||||
void lp_key_vol_down()
|
||||
{
|
||||
u8 vol;
|
||||
if (__this->volume)
|
||||
{
|
||||
__this->volume--;
|
||||
lp_volume_set(__this->volume);
|
||||
}
|
||||
vol = __this->volume;
|
||||
UI_SHOW_MENU(MENU_MAIN_VOL, 1000, vol, NULL);
|
||||
log_info("vol-:%d\n", __this->volume);
|
||||
}
|
||||
|
||||
#endif
|
||||
392
apps/soundbox/task_manager/lp/lp_dev.c
Normal file
392
apps/soundbox/task_manager/lp/lp_dev.c
Normal file
@ -0,0 +1,392 @@
|
||||
|
||||
/*************************************************************
|
||||
此文件函数主要是linein 插入检测
|
||||
|
||||
支持和sd卡 io复用检测
|
||||
|
||||
|
||||
|
||||
**************************************************************/
|
||||
#include "app_config.h"
|
||||
#include "system/event.h"
|
||||
#include "system/init.h"
|
||||
#include "system/timer.h"
|
||||
#include "asm/power_interface.h"
|
||||
#include "asm/adc_api.h"
|
||||
#include "lp/lp.h"
|
||||
#include "lp/lp_dev.h"
|
||||
#include "gpio.h"
|
||||
#include "asm/sdmmc.h"
|
||||
|
||||
#if TCFG_APP_LP_EN
|
||||
|
||||
#define LP_STU_HOLD 0
|
||||
#define LP_STU_ON 1
|
||||
#define LP_STU_OFF 2
|
||||
|
||||
#define LP_DETECT_CNT 3 // 滤波计算
|
||||
|
||||
#define LOG_TAG_CONST APP_LP
|
||||
#define LOG_TAG "[APP_LP_DEV]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
#define LOG_DEBUG_ENABLE
|
||||
#define LOG_INFO_ENABLE
|
||||
/*#define LOG_DUMP_ENABLE */
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
struct lp_dev_opr
|
||||
{
|
||||
struct lp_dev_data *dev;
|
||||
u8 cnt; // 滤波计算
|
||||
u8 stu; // 当前状态
|
||||
u16 timer; // 定时器句柄
|
||||
u8 online : 1; // 是否在线
|
||||
u8 active : 1; // 进入sniff的判断标志
|
||||
u8 init : 1; // 初始化完成标志
|
||||
u8 step : 3; // 检测阶段
|
||||
};
|
||||
static struct lp_dev_opr lp_dev_hdl = {0};
|
||||
#define __this (&lp_dev_hdl)
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief 获取lp是否在线
|
||||
@param
|
||||
@return 1:在线 0:不在线
|
||||
@note app通过这个接口判断lp是否在线
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
u8 lp_is_online(void)
|
||||
{
|
||||
#if ((defined TCFG_LP_DETECT_ENABLE) && (TCFG_LP_DETECT_ENABLE == 0))
|
||||
return 1;
|
||||
#else
|
||||
return __this->online;
|
||||
#endif // TCFG_LP_DETECT_ENABLE
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief 设置lp是否在线
|
||||
@param 1:在线 0:不在线
|
||||
@return null
|
||||
@note 检测驱动通过这个接口判断lp是否在线
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
void lp_set_online(u8 online)
|
||||
{
|
||||
__this->online = !!online;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief 发布设备上下线消息
|
||||
@param 上下线消息
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
void lp_event_notify(u8 arg)
|
||||
{
|
||||
struct sys_event event = {0};
|
||||
event.arg = (void *)DEVICE_EVENT_FROM_LP;
|
||||
event.type = SYS_DEVICE_EVENT;
|
||||
|
||||
if (arg == DEVICE_EVENT_IN)
|
||||
{
|
||||
event.u.dev.event = DEVICE_EVENT_IN;
|
||||
}
|
||||
else if (arg == DEVICE_EVENT_OUT)
|
||||
{
|
||||
event.u.dev.event = DEVICE_EVENT_OUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
sys_event_notify(&event);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief 检测前使能io
|
||||
@param null
|
||||
@return null
|
||||
@note 检测驱动检测前使能io ,检测完成后设为高阻 可以节约功耗
|
||||
(io检测、sd复用ad检测动态使用,单独ad检测不动态修改)
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void lp_io_start(void)
|
||||
{
|
||||
/* printf("<<<lp_io_start\n"); */
|
||||
struct lp_dev_data *lp_dev = (struct lp_dev_data *)__this->dev;
|
||||
if (__this->init)
|
||||
{
|
||||
return;
|
||||
}
|
||||
__this->init = 1;
|
||||
if (lp_dev->down)
|
||||
{
|
||||
gpio_set_pull_down(lp_dev->port, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_set_pull_down(lp_dev->port, 0);
|
||||
}
|
||||
if (lp_dev->up)
|
||||
{
|
||||
gpio_set_pull_up(lp_dev->port, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_set_pull_up(lp_dev->port, 0);
|
||||
}
|
||||
if (lp_dev->ad_channel == (u8)NO_CONFIG_PORT)
|
||||
{
|
||||
gpio_set_die(lp_dev->port, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_set_die(lp_dev->port, 0);
|
||||
}
|
||||
gpio_set_hd(lp_dev->port, 0);
|
||||
gpio_set_hd0(lp_dev->port, 0);
|
||||
gpio_direction_input(lp_dev->port);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief 检测完成关闭使能io
|
||||
@param null
|
||||
@return null
|
||||
@note 检测驱动检测前使能io ,检测完成后设为高阻 可以节约功耗
|
||||
(io检测、sd复用ad检测动态使用,单独ad检测不动态修改)
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void lp_io_stop(void)
|
||||
{
|
||||
/* printf("<<<lp_io_stop\n"); */
|
||||
struct lp_dev_data *lp_dev = (struct lp_dev_data *)__this->dev;
|
||||
if (!__this->init)
|
||||
{
|
||||
return;
|
||||
}
|
||||
__this->init = 0;
|
||||
gpio_direction_input(lp_dev->port);
|
||||
gpio_set_pull_up(lp_dev->port, 0);
|
||||
gpio_set_pull_down(lp_dev->port, 0);
|
||||
gpio_set_hd(lp_dev->port, 0);
|
||||
gpio_set_hd0(lp_dev->port, 0);
|
||||
gpio_set_die(lp_dev->port, 0);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief 检测是否在线
|
||||
@param 驱动句柄
|
||||
@return 1:有设备插入 0:没有设备插入
|
||||
@note 检测驱动检测前使能io ,检测完成后设为高阻 可以节约功耗
|
||||
(io检测、sd复用ad检测动态使用,单独ad检测不动态修改)
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int lp_sample_detect(void *arg)
|
||||
{
|
||||
struct lp_dev_data *lp_dev = (struct lp_dev_data *)arg;
|
||||
u8 cur_stu;
|
||||
|
||||
if (lp_dev->ad_channel == (u8)NO_CONFIG_PORT)
|
||||
{
|
||||
lp_io_start();
|
||||
cur_stu = gpio_read(lp_dev->port) ? false : true;
|
||||
lp_io_stop();
|
||||
if (!lp_dev->up)
|
||||
{
|
||||
cur_stu = !cur_stu;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_stu = adc_get_value(lp_dev->ad_channel) > lp_dev->ad_vol ? false : true;
|
||||
/* printf("<%d> ", adc_get_value(lp_dev->ad_channel)); */
|
||||
}
|
||||
/* putchar('A' + cur_stu); */
|
||||
return cur_stu;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief sd cmd 复用检测是否在线
|
||||
@param 驱动句柄
|
||||
@return 1:有设备插入 0:没有设备插入
|
||||
@note 检测驱动检测前使能io ,检测完成后设为高阻 可以节约功耗
|
||||
(io检测、sd复用ad检测动态使用,单独ad检测不动态修改)
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int lp_sample_mult_sd(void *arg)
|
||||
{
|
||||
struct lp_dev_data *lp_dev = (struct lp_dev_data *)arg;
|
||||
lp_io_start();
|
||||
u16 ad_value = 0;
|
||||
u8 cur_stu;
|
||||
if (lp_dev->ad_channel == (u8)NO_CONFIG_PORT)
|
||||
{
|
||||
cur_stu = gpio_read(lp_dev->port) ? false : true;
|
||||
}
|
||||
else
|
||||
{
|
||||
adc_enter_occupy_mode(lp_dev->ad_channel);
|
||||
if (adc_occupy_run())
|
||||
{
|
||||
ad_value = adc_get_occupy_value();
|
||||
cur_stu = ad_value > lp_dev->ad_vol ? false : true;
|
||||
/* printf("\n<%d>\n", ad_value); */
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_stu = __this->stu;
|
||||
}
|
||||
adc_exit_occupy_mode();
|
||||
}
|
||||
|
||||
/* putchar('A'+cur_stu); */
|
||||
/* putchar(cur_stu); */
|
||||
lp_io_stop();
|
||||
return cur_stu;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief 注册的定时器回调检测函数
|
||||
@param 驱动句柄
|
||||
@return null
|
||||
@note 定时进行检测
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void lp_detect(void *arg)
|
||||
{
|
||||
int cur_stu;
|
||||
struct sys_event event = {0};
|
||||
#if ((TCFG_LP_MULTIPLEX_WITH_SD == ENABLE))
|
||||
if (sd_io_suspend(TCFG_LP_SD_PORT, 0) == 0)
|
||||
{ // 判断sd 看是否空闲
|
||||
cur_stu = lp_sample_mult_sd(arg);
|
||||
sd_io_resume(TCFG_LP_SD_PORT, 0); // 使用完,回复sd
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (__this->step == 0)
|
||||
{
|
||||
__this->step = 1;
|
||||
sys_timer_modify(__this->timer, 10); // 猜测是检测状态变化的时候改变定时器回调时间
|
||||
return;
|
||||
}
|
||||
cur_stu = lp_sample_detect(arg);
|
||||
if (!__this->active)
|
||||
{
|
||||
__this->step = 0;
|
||||
sys_timer_modify(__this->timer, 500); // 猜测是检测状态不变化的时候改变定时器回调时间
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cur_stu != __this->stu)
|
||||
{
|
||||
__this->stu = cur_stu;
|
||||
__this->cnt = 0;
|
||||
__this->active = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->cnt++;
|
||||
}
|
||||
|
||||
if (__this->cnt < LP_DETECT_CNT)
|
||||
{ // 滤波计算
|
||||
return;
|
||||
}
|
||||
|
||||
__this->active = 0; // 检测一次完成
|
||||
|
||||
/* putchar(cur_stu); */
|
||||
|
||||
if ((lp_is_online()) && (!__this->stu))
|
||||
{
|
||||
lp_set_online(false);
|
||||
lp_event_notify(DEVICE_EVENT_OUT); // 发布下线消息
|
||||
}
|
||||
else if ((!lp_is_online()) && (__this->stu))
|
||||
{
|
||||
lp_set_online(true);
|
||||
lp_event_notify(DEVICE_EVENT_IN); // 发布上线消息
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void lp_detect_timer_add()
|
||||
{
|
||||
if (!__this || !(__this->dev))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (__this->timer == 0)
|
||||
{
|
||||
__this->timer = sys_timer_add(__this->dev, lp_detect, 25);
|
||||
}
|
||||
}
|
||||
void lp_detect_timer_del()
|
||||
{
|
||||
if (__this && __this->timer)
|
||||
{
|
||||
sys_timer_del(__this->timer);
|
||||
__this->timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int lp_driver_init(const struct dev_node *node, void *arg)
|
||||
{
|
||||
struct lp_dev_data *lp_dev = (struct lp_dev_data *)arg;
|
||||
if (!lp_dev->enable)
|
||||
{
|
||||
lp_set_online(true);
|
||||
return 0;
|
||||
}
|
||||
#if ((defined TCFG_LP_DETECT_ENABLE) && (TCFG_LP_DETECT_ENABLE == 0))
|
||||
lp_set_online(true); // 没有配置detcct 默认在线
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
if (lp_dev->port == (u8)NO_CONFIG_PORT)
|
||||
{
|
||||
lp_set_online(true); // 配置的io 不在范围 ,默认在线
|
||||
return 0;
|
||||
}
|
||||
lp_set_online(false);
|
||||
|
||||
#if (!(TCFG_LP_MULTIPLEX_WITH_SD)) // 复用情况和io检测仅在使用的时候配置io
|
||||
if (lp_dev->ad_channel != (u8)NO_CONFIG_PORT)
|
||||
{
|
||||
lp_io_start(); // 初始化io
|
||||
adc_add_sample_ch(lp_dev->ad_channel);
|
||||
}
|
||||
#endif
|
||||
|
||||
__this->dev = lp_dev;
|
||||
__this->timer = sys_timer_add(arg, lp_detect, 50);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct device_operations lp_dev_ops = {
|
||||
.init = lp_driver_init,
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*@brief 注册的定功耗检测函数
|
||||
@param
|
||||
@return null
|
||||
@note 用于防止检测一次未完成进入了低功耗
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static u8 lp_dev_idle_query(void)
|
||||
{
|
||||
return !__this->active;
|
||||
}
|
||||
|
||||
REGISTER_LP_TARGET(lp_dev_lp_target) = {
|
||||
.name = "lp_dev",
|
||||
.is_idle = lp_dev_idle_query,
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@
|
||||
#include "ui/ui_api.h"
|
||||
#include "app_task.h"
|
||||
#include "key_event_deal.h"
|
||||
#include "kt.h"
|
||||
|
||||
|
||||
#define LOG_TAG_CONST APP_IDLE
|
||||
@ -130,11 +131,13 @@ void app_poweron_task()
|
||||
{
|
||||
int msg[32];
|
||||
|
||||
kt_init();
|
||||
|
||||
UI_SHOW_MENU(MENU_POWER_UP, 0, 0, NULL);
|
||||
|
||||
int err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_ON], 1, tone_play_end_callback, (void *)IDEX_TONE_POWER_ON);
|
||||
//int err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_ON], 1, tone_play_end_callback, (void *)IDEX_TONE_POWER_ON);
|
||||
/* if (err) { //提示音没有,播放失败,直接init流程 */
|
||||
/* power_on_init(); */
|
||||
power_on_init(); /* */
|
||||
/* } */
|
||||
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ extern const u16 rtc_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 pc_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 spdif_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 idle_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 lp_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX];
|
||||
/***********************************************************
|
||||
* adkey table 映射管理
|
||||
***********************************************************/
|
||||
@ -34,6 +35,9 @@ static const type_key_ad_table ad_table[APP_TASK_MAX_INDEX] = {
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
[APP_LINEIN_TASK] = linein_key_ad_table,
|
||||
#endif
|
||||
#if TCFG_APP_LP_EN
|
||||
[APP_LP_TASK] = lp_key_ad_table,
|
||||
#endif
|
||||
#if TCFG_APP_RTC_EN
|
||||
[APP_RTC_TASK] = rtc_key_ad_table,
|
||||
#endif
|
||||
@ -66,6 +70,7 @@ extern const u16 rtc_key_io_table[KEY_IO_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 pc_key_io_table[KEY_IO_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 spdif_key_io_table[KEY_IO_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 idle_key_io_table[KEY_IO_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 lp_key_io_table[KEY_IO_NUM_MAX][KEY_EVENT_MAX];
|
||||
/***********************************************************
|
||||
* iokey table 映射管理
|
||||
***********************************************************/
|
||||
@ -86,6 +91,9 @@ static const type_key_io_table io_table[APP_TASK_MAX_INDEX] = {
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
[APP_LINEIN_TASK] = linein_key_io_table,
|
||||
#endif
|
||||
#if TCFG_APP_LP_EN
|
||||
[APP_LP_TASK] = lp_key_io_table,
|
||||
#endif
|
||||
#if TCFG_APP_RTC_EN
|
||||
[APP_RTC_TASK] = rtc_key_io_table,
|
||||
#endif
|
||||
@ -118,6 +126,7 @@ extern const u16 rtc_key_ir_table[KEY_IR_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 pc_key_ir_table[KEY_IR_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 spdif_key_ir_table[KEY_IR_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 idle_key_ir_table[KEY_IR_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 lp_key_ir_table[KEY_IR_NUM_MAX][KEY_EVENT_MAX];
|
||||
/***********************************************************
|
||||
* irkey table 映射管理
|
||||
***********************************************************/
|
||||
@ -138,6 +147,9 @@ static const type_key_ir_table ir_table[APP_TASK_MAX_INDEX] = {
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
[APP_LINEIN_TASK] = linein_key_ir_table,
|
||||
#endif
|
||||
#if TCFG_APP_LP_EN
|
||||
[APP_LP_TASK] = lp_key_ir_table,
|
||||
#endif
|
||||
#if TCFG_APP_RTC_EN
|
||||
[APP_RTC_TASK] = rtc_key_ir_table,
|
||||
#endif
|
||||
@ -170,7 +182,7 @@ extern const u16 rtc_key_rdec_table[KEY_RDEC_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 pc_key_rdec_table[KEY_RDEC_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 spdif_key_rdec_table[KEY_RDEC_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 idle_key_rdec_table[KEY_RDEC_NUM_MAX][KEY_EVENT_MAX];
|
||||
|
||||
extern const u16 lp_key_rdec_table[KEY_RDEC_NUM_MAX][KEY_EVENT_MAX];
|
||||
/***********************************************************
|
||||
* rdec_key table 映射管理
|
||||
***********************************************************/
|
||||
@ -191,6 +203,9 @@ static const type_key_rdec_table rdec_table[APP_TASK_MAX_INDEX] = {
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
[APP_LINEIN_TASK] = linein_key_rdec_table,
|
||||
#endif
|
||||
#if TCFG_APP_LP_EN
|
||||
[APP_LP_TASK] = lp_key_rdec_table,
|
||||
#endif
|
||||
#if TCFG_APP_RTC_EN
|
||||
[APP_RTC_TASK] = rtc_key_rdec_table,
|
||||
#endif
|
||||
@ -223,6 +238,7 @@ extern const u16 rtc_key_touch_table[KEY_TOUCH_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 pc_key_touch_table[KEY_TOUCH_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 spdif_key_touch_table[KEY_TOUCH_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 idle_key_touch_table[KEY_TOUCH_NUM_MAX][KEY_EVENT_MAX];
|
||||
extern const u16 lp_key_touch_table[KEY_TOUCH_NUM_MAX][KEY_EVENT_MAX];
|
||||
/***********************************************************
|
||||
* touch_key table 映射管理
|
||||
***********************************************************/
|
||||
@ -243,6 +259,9 @@ static const type_key_touch_table touch_table[APP_TASK_MAX_INDEX] = {
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
[APP_LINEIN_TASK] = linein_key_touch_table,
|
||||
#endif
|
||||
#if TCFG_APP_LP_EN
|
||||
[APP_LP_TASK] = lp_key_touch_table,
|
||||
#endif
|
||||
#if TCFG_APP_RTC_EN
|
||||
[APP_RTC_TASK] = rtc_key_touch_table,
|
||||
#endif
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
TCFG_AUDIO_DAC_CONNECT_MODE == DAC_OUTPUT_DUAL_LR_DIFF)
|
||||
#define MAX_ANA_VOL (21)
|
||||
#else
|
||||
#define MAX_ANA_VOL (28)
|
||||
#define MAX_ANA_VOL (30)
|
||||
#endif/*TCFG_AUDIO_DAC_CONNECT_MODE*/
|
||||
|
||||
#define MAX_COM_VOL (22) // 具体数值应小于联合音量等级的数组大小 (combined_vol_list)
|
||||
@ -96,7 +96,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define SYS_DEFAULT_VOL 0//SYS_MAX_VOL //(SYS_MAX_VOL/2)
|
||||
#define SYS_DEFAULT_VOL SYS_MAX_VOL//SYS_MAX_VOL //(SYS_MAX_VOL/2)
|
||||
#define SYS_DEFAULT_TONE_VOL 18 //(SYS_MAX_VOL)
|
||||
#define SYS_DEFAULT_SIN_VOL 17
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -773,6 +773,7 @@ int linein_dec_open(u8 source, u32 sample_rate)
|
||||
if (!dec) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
printf("linein_dec_open: dec = %p\n", dec);
|
||||
linein_dec = dec;
|
||||
dec->id = rand32();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -7,179 +7,187 @@
|
||||
#include "online_db/online_db_deal.h"
|
||||
#include "media/audio_eq_drc_apply.h"
|
||||
#include "config/config_interface.h"
|
||||
#include "media/eq_config.h"
|
||||
#include "audio_effect/audio_eff_default_parm.h"
|
||||
|
||||
|
||||
//eq_cfg_hw.bin中播歌eq曲线,当作用户自定义模式,参与效果切换.
|
||||
#define EQ_FILE_CP_TO_CUSTOM 0
|
||||
// eq_cfg_hw.bin中播歌eq曲线,当作用户自定义模式,参与效果切换.
|
||||
#define EQ_FILE_CP_TO_CUSTOM 1
|
||||
|
||||
#if (TCFG_EQ_ENABLE != 0)
|
||||
|
||||
const struct eq_seg_info eq_tab_normal[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 0, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 0, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 0, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 0, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 0, 0.7f},
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_rock[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, -2, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 2, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, -2, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, -2, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 4, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, -2, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 2, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, -2, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, -2, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 4, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_pop[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 3, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 1, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, -2, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, -4, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, -4, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, -2, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 1, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 2, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 3, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 1, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, -2, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, -4, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, -4, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, -2, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 1, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 2, 0.7f},
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_classic[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 8, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 8, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 2, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 2, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 8, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 8, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 2, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 2, 0.7f},
|
||||
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_country[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, -2, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 2, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 2, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 4, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, -2, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 2, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 2, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 4, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_jazz[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 4, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 4, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 2, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 3, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 4, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 4, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 2, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 3, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
};
|
||||
struct eq_seg_info eq_tab_custom[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 0, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 0, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 0, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 0, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 0, 0.7f},
|
||||
};
|
||||
|
||||
// 默认系数表,用户可修改
|
||||
const struct eq_seg_info *eq_type_tab[EQ_MODE_MAX] = {
|
||||
eq_tab_normal, eq_tab_rock, eq_tab_pop, eq_tab_classic, eq_tab_jazz, eq_tab_country, eq_tab_custom
|
||||
};
|
||||
eq_tab_normal, eq_tab_rock, eq_tab_pop, eq_tab_classic, eq_tab_jazz, eq_tab_country, eq_tab_custom};
|
||||
// 默认系数表,每个表对应的总增益,用户可修改
|
||||
float globa_gain_tab[EQ_MODE_MAX] = {0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
|
||||
/*
|
||||
*通话下行eq系数表
|
||||
* */
|
||||
|
||||
const struct eq_seg_info phone_eq_tab_normal[] = {
|
||||
{0, EQ_IIR_TYPE_HIGH_PASS, 200, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 300, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 400, 0, 0.7f},
|
||||
{0, EQ_IIR_TYPE_HIGH_PASS, 200, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 300, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 400, 0, 0.7f},
|
||||
};
|
||||
|
||||
/*
|
||||
*通话上行eq系数表
|
||||
* */
|
||||
const struct eq_seg_info ul_eq_tab_normal[] = {
|
||||
{0, EQ_IIR_TYPE_HIGH_PASS, 200, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 300, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 400, 0, 0.7f},
|
||||
{0, EQ_IIR_TYPE_HIGH_PASS, 200, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 300, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 400, 0, 0.7f},
|
||||
};
|
||||
|
||||
static u8 eq_mode = 0;
|
||||
//eq效果表切换
|
||||
// eq效果表切换
|
||||
int eq_mode_sw(void)
|
||||
{
|
||||
eq_mode++;
|
||||
if (eq_mode >= ARRAY_SIZE(eq_type_tab)) {
|
||||
if (eq_mode >= ARRAY_SIZE(eq_type_tab))
|
||||
{
|
||||
eq_mode = 0;
|
||||
}
|
||||
struct eq_seg_info *seg = eq_type_tab[eq_mode];
|
||||
|
||||
u8 nsection = ARRAY_SIZE(eq_tab_normal);
|
||||
if (nsection > mSECTION_MAX) {
|
||||
if (nsection > mSECTION_MAX)
|
||||
{
|
||||
log_e("ERROR nsection:%d > mSECTION_MAX:%d ", nsection, mSECTION_MAX);
|
||||
return -1;//
|
||||
return -1; //
|
||||
}
|
||||
/* music_mode.eq_parm.seg_num = nsection; */
|
||||
/* music_mode.eq_parm.global_gain = globa_gain_tab[eq_mode]; */
|
||||
cur_eq_set_global_gain(AEID_MUSIC_EQ, globa_gain_tab[eq_mode]);
|
||||
for (int i = 0; i < nsection; i++) {
|
||||
for (int i = 0; i < nsection; i++)
|
||||
{
|
||||
/* memcpy(&music_mode.eq_parm.seg[i], &seg[i], sizeof(struct eq_seg_info)); */
|
||||
cur_eq_set_update(AEID_MUSIC_EQ, &seg[i], nsection, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//指定设置某个eq效果表
|
||||
// 指定设置某个eq效果表
|
||||
int eq_mode_set(EQ_MODE mode)
|
||||
{
|
||||
if (eq_mode >= ARRAY_SIZE(eq_type_tab)) {
|
||||
eq_mode = mode;
|
||||
if (eq_mode >= ARRAY_SIZE(eq_type_tab))
|
||||
{
|
||||
eq_mode = 0;
|
||||
}
|
||||
struct eq_seg_info *seg = eq_type_tab[eq_mode];
|
||||
u8 nsection = ARRAY_SIZE(eq_tab_normal);
|
||||
if (nsection > mSECTION_MAX) {
|
||||
if (nsection > mSECTION_MAX)
|
||||
{
|
||||
log_e("ERROR nsection:%d > mSECTION_MAX:%d ", nsection, mSECTION_MAX);
|
||||
return -1;//
|
||||
return -1; //
|
||||
}
|
||||
|
||||
u32 design = 1;
|
||||
/* music_mode.eq_parm.seg_num = nsection; */
|
||||
/* music_mode.eq_parm.global_gain = globa_gain_tab[eq_mode]; */
|
||||
cur_eq_set_global_gain(AEID_MUSIC_EQ, globa_gain_tab[eq_mode]);
|
||||
for (int i = 0; i < nsection; i++) {
|
||||
for (int i = 0; i < nsection; i++)
|
||||
{
|
||||
/* memcpy(&music_mode.eq_parm.seg[i], &seg[i], sizeof(struct eq_seg_info)); */
|
||||
cur_eq_set_update(AEID_MUSIC_EQ, &seg[i], nsection, 1);
|
||||
cur_eq_set_update(AEID_MUSIC_EQ, &seg[i], nsection, design);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//返回某个eq效果模式标号
|
||||
// 返回某个eq效果模式标号
|
||||
EQ_MODE eq_mode_get_cur(void)
|
||||
{
|
||||
return eq_mode;
|
||||
@ -197,7 +205,8 @@ int eq_mode_set_custom_seg(struct eq_seg_info *seg)
|
||||
{
|
||||
struct eq_seg_info *tar_seg = eq_tab_custom;
|
||||
u8 index = seg->index;
|
||||
if (index > ARRAY_SIZE(eq_tab_custom)) {
|
||||
if (index > ARRAY_SIZE(eq_tab_custom))
|
||||
{
|
||||
log_e("index %d > max_nsection %d", index, ARRAY_SIZE(eq_tab_custom));
|
||||
return -1;
|
||||
}
|
||||
@ -214,7 +223,8 @@ int eq_mode_set_custom_seg(struct eq_seg_info *seg)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
struct eq_seg_info *eq_mode_get_seg(EQ_MODE mode, u8 index)
|
||||
{
|
||||
if (mode >= ARRAY_SIZE(eq_type_tab)) {
|
||||
if (mode >= ARRAY_SIZE(eq_type_tab))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
struct eq_seg_info *seg = eq_type_tab[mode];
|
||||
@ -226,32 +236,37 @@ struct eq_seg_info *eq_mode_get_seg(EQ_MODE mode, u8 index)
|
||||
* */
|
||||
int eq_mode_set_custom_info(u16 index, int freq, float gain)
|
||||
{
|
||||
struct eq_seg_info *seg = eq_mode_get_seg(EQ_MODE_CUSTOM, index);//获取某段eq系数
|
||||
if (!seg) {
|
||||
struct eq_seg_info *seg = eq_mode_get_seg(EQ_MODE_CUSTOM, index); // 获取某段eq系数
|
||||
if (!seg)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
seg->freq = freq;//修改freq gain
|
||||
seg->freq = freq; // 修改freq gain
|
||||
seg->gain = gain;
|
||||
eq_mode_set_custom_seg(seg);//重设系数
|
||||
eq_mode_set_custom_seg(seg); // 重设系数
|
||||
|
||||
eq_mode_set(EQ_MODE_CUSTOM);//设置更新系数
|
||||
eq_mode_set(EQ_MODE_CUSTOM); // 设置更新系数
|
||||
return 0;
|
||||
}
|
||||
void cp_eq_file_seg_to_custom_tab()
|
||||
{
|
||||
printf("[%s]------------Row[%d]", __FUNCTION__, __LINE__);
|
||||
#if EQ_FILE_CP_TO_CUSTOM
|
||||
u8 nsection = music_mode.eq_parm.seg_num;
|
||||
struct eq_seg_info *seg = eq_tab_custom;
|
||||
for (nsection > ARRAY_SIZE(eq_tab_custom)) {
|
||||
if (nsection > ARRAY_SIZE(eq_tab_custom))
|
||||
{
|
||||
log_e("music nsection:%d > custom nsection:%d\n", nsection, ARRAY_SIZE(eq_tab_custom));
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
printf("music_mode.eq_parm.global_gain == %d\n", (int)((int)(music_mode.eq_parm.global_gain * 100) / 100));
|
||||
globa_gain_tab[EQ_MODE_CUSTOM] = music_mode.eq_parm.global_gain;
|
||||
memcpy(seg, music_mode.eq_parm.seg, sizeof(struct eq_seg_info)*nsection);
|
||||
memcpy(seg, music_mode.eq_parm.seg, sizeof(struct eq_seg_info) * nsection);
|
||||
|
||||
eq_mode = EQ_MODE_CUSTOM;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int eq_init(void)
|
||||
{
|
||||
audio_eq_init();
|
||||
@ -260,5 +275,4 @@ int eq_init(void)
|
||||
}
|
||||
__initcall(eq_init);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -878,12 +878,17 @@ void audio_mic_set_gain(u8 gain)
|
||||
#endif
|
||||
}
|
||||
//------------------
|
||||
int audio_linein_open(struct audio_adc_ch *linein, u16 sample_rate, int gain)
|
||||
/* [修改] LP使用AUDIO_LIN2_LR无声音修复: 支持传入通道参数,lr_ch非0时使用传入通道而非固定TCFG_LINEIN_LR_CH */
|
||||
int audio_linein_open(struct audio_adc_ch *linein, u16 sample_rate, int gain, u8 lr_ch)
|
||||
{
|
||||
u16 irq_point_unit = LADC_IRQ_POINTS;
|
||||
u8 linein_lr_ch;
|
||||
if (ladc_irq_point_unit != 0) {
|
||||
irq_point_unit = ladc_irq_point_unit;
|
||||
}
|
||||
/* lr_ch=0时使用TCFG_LINEIN_LR_CH,非0时使用传入的通道(支持LP使用不同通道如AUDIO_LIN2_LR) */
|
||||
linein_lr_ch = lr_ch ? lr_ch : TCFG_LINEIN_LR_CH;
|
||||
/* 老代码: 下面判断和audio_adc_linein_open均直接使用TCFG_LINEIN_LR_CH,LP时错误打开LIN0导致无声音 */
|
||||
|
||||
#if (TCFG_LINEIN_ENABLE&&(LINEIN_INPUT_WAY == LINEIN_INPUT_WAY_ADC))
|
||||
os_mutex_pend(&ladc_var.mutex, 0);
|
||||
@ -898,11 +903,11 @@ int audio_linein_open(struct audio_adc_ch *linein, u16 sample_rate, int gain)
|
||||
ladc_var.ladc_ch_num = 0;
|
||||
#endif
|
||||
/* if (TCFG_LINEIN_LR_CH & (0x15)) { */
|
||||
if (TCFG_LINEIN_LR_CH & (AUDIO_LIN0L_CH | AUDIO_LIN1L_CH | AUDIO_LIN2L_CH)) { //判断Line0L Line1L Line2L 是否有打开
|
||||
if (linein_lr_ch & (AUDIO_LIN0L_CH | AUDIO_LIN1L_CH | AUDIO_LIN2L_CH)) { //判断Line0L Line1L Line2L 是否有打开
|
||||
ladc_var.ladc_ch_mark |= LADC_LINE_L_MASK;
|
||||
ladc_var.ladc_ch_num++;
|
||||
}
|
||||
if (TCFG_LINEIN_LR_CH & (AUDIO_LIN0R_CH | AUDIO_LIN1R_CH | AUDIO_LIN2R_CH)) { //判断Line0R Line1R Line2R 是否有打开
|
||||
if (linein_lr_ch & (AUDIO_LIN0R_CH | AUDIO_LIN1R_CH | AUDIO_LIN2R_CH)) { //判断Line0R Line1R Line2R 是否有打开
|
||||
ladc_var.ladc_ch_mark |= LADC_LINE_R_MASK;
|
||||
ladc_var.ladc_ch_num++;
|
||||
}
|
||||
@ -921,8 +926,9 @@ int audio_linein_open(struct audio_adc_ch *linein, u16 sample_rate, int gain)
|
||||
#endif
|
||||
ladc_var.mic_gain = -1 ;
|
||||
|
||||
|
||||
audio_adc_linein_open(&ladc_var.linein_ch, TCFG_LINEIN_LR_CH << 2, &adc_hdl);
|
||||
/* [修改] 使用linein_lr_ch(支持LP通道),老代码: TCFG_LINEIN_LR_CH << 2 */
|
||||
/* audio_adc_linein_open(&ladc_var.linein_ch, TCFG_LINEIN_LR_CH << 2, &adc_hdl); // 老: 固定用LINEIN配置 */
|
||||
audio_adc_linein_open(&ladc_var.linein_ch, linein_lr_ch << 2, &adc_hdl);
|
||||
audio_adc_linein_set_sample_rate(&ladc_var.linein_ch, sample_rate);
|
||||
audio_adc_linein_set_gain(&ladc_var.linein_ch, gain);
|
||||
ladc_var.linein_gain = gain;
|
||||
|
||||
@ -63,7 +63,9 @@ void audio_mic_start(struct adc_mic_ch *mic);
|
||||
void audio_mic_close(struct adc_mic_ch *mic, struct audio_adc_output_hdl *output);
|
||||
void audio_mic_set_gain(u8 gain);
|
||||
|
||||
int audio_linein_open(struct audio_adc_ch *linein, u16 sample_rate, int gain);
|
||||
/* [修改] 新增lr_ch参数: 0=使用TCFG_LINEIN_LR_CH, 非0=使用传入通道(支持LP用AUDIO_LIN2_LR) */
|
||||
/* int audio_linein_open(struct audio_adc_ch *linein, u16 sample_rate, int gain); // 老接口 */
|
||||
int audio_linein_open(struct audio_adc_ch *linein, u16 sample_rate, int gain, u8 lr_ch);
|
||||
void audio_linein_add_output(struct audio_adc_output_hdl *output);
|
||||
void audio_linein_start(struct audio_adc_ch *linein);
|
||||
void audio_linein_close(struct audio_adc_ch *linein, struct audio_adc_output_hdl *output);
|
||||
|
||||
@ -636,8 +636,9 @@ void *linein_sample_open(u8 source, u16 sample_rate)
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
|
||||
if (audio_linein_open(&linein->linein_ch, sample_rate, 3) == 0) {
|
||||
/* [修改] LP用AUDIO_LIN2_LR无声音: 传入source让audio_linein_open使用正确通道,老代码不传source */
|
||||
/* if (audio_linein_open(&linein->linein_ch, sample_rate, 3) == 0) { // 老: 未传通道,内部用TCFG_LINEIN_LR_CH */
|
||||
if (audio_linein_open(&linein->linein_ch, sample_rate, 3, source) == 0) {
|
||||
linein->sample_output.handler = linein_sample_output_handler;
|
||||
linein->sample_output.priv = linein;
|
||||
linein->channel_num = get_audio_linein_ch_num();
|
||||
|
||||
@ -69,7 +69,9 @@ struct __effect_linein *effect_linein_open(void)
|
||||
if (linein) {
|
||||
linein->stream = stream_entry_open(linein, effect_linein_mix_callback, 0);
|
||||
if (linein->stream) {
|
||||
if (audio_linein_open(&linein->ch, MIC_EFFECT_SAMPLERATE, 3) == 0) {
|
||||
/* [修改] 混响用默认TCFG_LINEIN_LR_CH,传0即可,老接口无第4参数 */
|
||||
/* if (audio_linein_open(&linein->ch, MIC_EFFECT_SAMPLERATE, 3) == 0) { // 老: 3参数 */
|
||||
if (audio_linein_open(&linein->ch, MIC_EFFECT_SAMPLERATE, 3, 0) == 0) {
|
||||
#if SYS_DIGVOL_GROUP_EN
|
||||
audio_dig_vol_param linein_digvol_param = {
|
||||
.vol_start = 0,
|
||||
|
||||
@ -31,39 +31,6 @@ mp3_decoder
|
||||
|
||||
|
||||
wma_decoder
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
flac_decoder
|
||||
|
||||
|
||||
|
||||
ape_decoder
|
||||
|
||||
|
||||
|
||||
m4a_decoder
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
alac_decoder
|
||||
|
||||
|
||||
|
||||
amr_decoder
|
||||
|
||||
|
||||
|
||||
dts_decoder
|
||||
|
||||
|
||||
|
||||
g729_decoder
|
||||
wav_decoder
|
||||
cvsd_encoder
|
||||
@ -71,21 +38,6 @@ cvsd_encoder
|
||||
|
||||
|
||||
msbc_encoder
|
||||
|
||||
|
||||
|
||||
mp3_encoder
|
||||
|
||||
|
||||
|
||||
g726_encoder
|
||||
|
||||
|
||||
|
||||
adpcm_encoder
|
||||
|
||||
|
||||
|
||||
pcm_encoder
|
||||
sbc_encoder
|
||||
|
||||
|
||||
Binary file not shown.
BIN
cpu/br23/tools/autosave.bin
Normal file
BIN
cpu/br23/tools/autosave.bin
Normal file
Binary file not shown.
Binary file not shown.
1
cpu/br23/tools/cfg_tool_state_complete.lua
Normal file
1
cpu/br23/tools/cfg_tool_state_complete.lua
Normal file
File diff suppressed because one or more lines are too long
@ -1,67 +1,68 @@
|
||||
|
||||
|
||||
|
||||
rem @echo off
|
||||
|
||||
@echo *****************************************************************
|
||||
@echo SDK BR23
|
||||
@echo *****************************************************************
|
||||
@echo %date%
|
||||
|
||||
cd %~dp0
|
||||
|
||||
|
||||
set OBJDUMP=C:\JL\pi32\bin\llvm-objdump.exe
|
||||
set OBJCOPY=C:\JL\pi32\bin\llvm-objcopy.exe
|
||||
set ELFFILE=sdk.elf
|
||||
|
||||
REM %OBJDUMP% -D -address-mask=0x1ffffff -print-dbg %ELFFILE% > sdk.lst
|
||||
%OBJCOPY% -O binary -j .text %ELFFILE% text.bin
|
||||
%OBJCOPY% -O binary -j .data %ELFFILE% data.bin
|
||||
%OBJCOPY% -O binary -j .data_code %ELFFILE% data_code.bin
|
||||
|
||||
|
||||
%OBJCOPY% -O binary -j .overlay_aec %ELFFILE% aeco.bin
|
||||
%OBJCOPY% -O binary -j .overlay_wav %ELFFILE% wav.bin
|
||||
%OBJCOPY% -O binary -j .overlay_ape %ELFFILE% ape.bin
|
||||
%OBJCOPY% -O binary -j .overlay_flac %ELFFILE% flac.bin
|
||||
%OBJCOPY% -O binary -j .overlay_m4a %ELFFILE% m4a.bin
|
||||
%OBJCOPY% -O binary -j .overlay_amr %ELFFILE% amr.bin
|
||||
%OBJCOPY% -O binary -j .overlay_dts %ELFFILE% dts.bin
|
||||
%OBJCOPY% -O binary -j .overlay_fm %ELFFILE% fmo.bin
|
||||
%OBJCOPY% -O binary -j .overlay_mp3 %ELFFILE% mp3o.bin
|
||||
%OBJCOPY% -O binary -j .overlay_wma %ELFFILE% wmao.bin
|
||||
|
||||
|
||||
remove_tailing_zeros -i aeco.bin -o aec.bin -mark ff
|
||||
remove_tailing_zeros -i fmo.bin -o fm.bin -mark ff
|
||||
remove_tailing_zeros -i mp3o.bin -o mp3.bin -mark ff
|
||||
remove_tailing_zeros -i wmao.bin -o wma.bin -mark ff
|
||||
|
||||
|
||||
|
||||
%OBJDUMP% -section-headers -address-mask=0x1ffffff %ELFFILE%
|
||||
%OBJDUMP% -t %ELFFILE% > symbol_tbl.txt
|
||||
copy /b text.bin+data.bin+data_code.bin+aec.bin+wav.bin+ape.bin+flac.bin+m4a.bin+amr.bin+dts.bin+fm.bin+mp3.bin+wma.bin+bank.bin app.bin
|
||||
|
||||
|
||||
del aeco.bin
|
||||
del wav.bin
|
||||
del ape.bin
|
||||
del flac.bin
|
||||
del m4a.bin
|
||||
del amr.bin
|
||||
del dts.bin
|
||||
del fmo.bin
|
||||
del mp3o.bin
|
||||
del wmao.bin
|
||||
del aec.bin
|
||||
del fm.bin
|
||||
del mp3.bin
|
||||
del wma.bin
|
||||
del data.bin
|
||||
del data_code.bin
|
||||
del text.bin
|
||||
del *.bc
|
||||
copy .\effect_file\music_base.bin eq_cfg_hw.bin
|
||||
download\standard\download.bat
|
||||
|
||||
|
||||
|
||||
rem @echo off
|
||||
|
||||
@echo *****************************************************************
|
||||
@echo SDK BR23
|
||||
@echo *****************************************************************
|
||||
@echo %date%
|
||||
|
||||
cd %~dp0
|
||||
|
||||
|
||||
set OBJDUMP=C:\JL\pi32\bin\llvm-objdump.exe
|
||||
set OBJCOPY=C:\JL\pi32\bin\llvm-objcopy.exe
|
||||
set ELFFILE=sdk.elf
|
||||
|
||||
REM %OBJDUMP% -D -address-mask=0x1ffffff -print-dbg %ELFFILE% > sdk.lst
|
||||
%OBJCOPY% -O binary -j .text %ELFFILE% text.bin
|
||||
%OBJCOPY% -O binary -j .data %ELFFILE% data.bin
|
||||
%OBJCOPY% -O binary -j .data_code %ELFFILE% data_code.bin
|
||||
|
||||
|
||||
%OBJCOPY% -O binary -j .overlay_aec %ELFFILE% aeco.bin
|
||||
%OBJCOPY% -O binary -j .overlay_wav %ELFFILE% wav.bin
|
||||
%OBJCOPY% -O binary -j .overlay_ape %ELFFILE% ape.bin
|
||||
%OBJCOPY% -O binary -j .overlay_flac %ELFFILE% flac.bin
|
||||
%OBJCOPY% -O binary -j .overlay_m4a %ELFFILE% m4a.bin
|
||||
%OBJCOPY% -O binary -j .overlay_amr %ELFFILE% amr.bin
|
||||
%OBJCOPY% -O binary -j .overlay_dts %ELFFILE% dts.bin
|
||||
%OBJCOPY% -O binary -j .overlay_fm %ELFFILE% fmo.bin
|
||||
%OBJCOPY% -O binary -j .overlay_mp3 %ELFFILE% mp3o.bin
|
||||
%OBJCOPY% -O binary -j .overlay_wma %ELFFILE% wmao.bin
|
||||
|
||||
|
||||
remove_tailing_zeros -i aeco.bin -o aec.bin -mark ff
|
||||
remove_tailing_zeros -i fmo.bin -o fm.bin -mark ff
|
||||
remove_tailing_zeros -i mp3o.bin -o mp3.bin -mark ff
|
||||
remove_tailing_zeros -i wmao.bin -o wma.bin -mark ff
|
||||
|
||||
|
||||
|
||||
%OBJDUMP% -section-headers -address-mask=0x1ffffff %ELFFILE%
|
||||
%OBJDUMP% -t %ELFFILE% > symbol_tbl.txt
|
||||
copy /b text.bin+data.bin+data_code.bin+aec.bin+wav.bin+ape.bin+flac.bin+m4a.bin+amr.bin+dts.bin+fm.bin+mp3.bin+wma.bin+bank.bin app.bin
|
||||
|
||||
|
||||
del aeco.bin
|
||||
del wav.bin
|
||||
del ape.bin
|
||||
del flac.bin
|
||||
del m4a.bin
|
||||
del amr.bin
|
||||
del dts.bin
|
||||
del fmo.bin
|
||||
del mp3o.bin
|
||||
del wmao.bin
|
||||
del aec.bin
|
||||
del fm.bin
|
||||
del mp3.bin
|
||||
del wma.bin
|
||||
del data.bin
|
||||
del data_code.bin
|
||||
del text.bin
|
||||
del *.bc
|
||||
copy .\effect_file\eq_cfg_bt.bin eq_cfg_bt.bin
|
||||
copy .\effect_file\eq_cfg_lp.bin eq_cfg_lp.bin
|
||||
download\standard\download.bat
|
||||
|
||||
@ -211,7 +211,9 @@ copy .\effect_file\music_2to1_2to2.bin eq_cfg_hw.bin
|
||||
#elif defined(LINEIN_MODE_SOLE_EQ_EN) && LINEIN_MODE_SOLE_EQ_EN
|
||||
copy .\effect_file\music_base_linein.bin eq_cfg_hw.bin
|
||||
#else
|
||||
copy .\effect_file\music_base.bin eq_cfg_hw.bin
|
||||
//copy .\effect_file\music_base.bin eq_cfg_hw.bin
|
||||
copy .\effect_file\eq_cfg_bt.bin eq_cfg_bt.bin
|
||||
copy .\effect_file\eq_cfg_lp.bin eq_cfg_lp.bin
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
1
cpu/br23/tools/download/standard/KTS-AC69xx_5458.key
Normal file
1
cpu/br23/tools/download/standard/KTS-AC69xx_5458.key
Normal file
@ -0,0 +1 @@
|
||||
44b10a8a9a97a7ea8795ce48fe8bb180954fc20c5763ded5954fc20c5763ded5399f4f1d
|
||||
Binary file not shown.
Binary file not shown.
67
cpu/br23/tools/download/standard/download - 副本.bat
Normal file
67
cpu/br23/tools/download/standard/download - 副本.bat
Normal file
@ -0,0 +1,67 @@
|
||||
@echo off
|
||||
|
||||
cd %~dp0
|
||||
|
||||
copy ..\..\script.ver .
|
||||
copy ..\..\uboot.boot .
|
||||
copy ..\..\tone.cfg .
|
||||
copy ..\..\cfg_tool.bin .
|
||||
copy ..\..\app.bin .
|
||||
copy ..\..\br23loader.bin .
|
||||
copy ..\..\eq_cfg_bt.bin .
|
||||
copy ..\..\eq_cfg_lp.bin .
|
||||
copy ..\..\ota_all.bin .
|
||||
copy ..\..\ota_nor.bin .
|
||||
|
||||
|
||||
::..\..\isd_download.exe -tonorflash -dev br23 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_bt.bin eq_cfg_lp.bin %1
|
||||
|
||||
..\..\isd_download.exe -tonorflash -dev br23 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_bt.bin eq_cfg_lp.bin -format all %1 -key KTS-AC69xx_5458.key
|
||||
:: -format all
|
||||
::-reboot 2500
|
||||
|
||||
|
||||
|
||||
@rem ɾ<><C9BE><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD>-format all
|
||||
if exist *.mp3 del *.mp3
|
||||
if exist *.PIX del *.PIX
|
||||
if exist *.TAB del *.TAB
|
||||
if exist *.res del *.res
|
||||
if exist *.sty del *.sty
|
||||
|
||||
|
||||
|
||||
@rem <20><><EFBFBD>ɹ̼<C9B9><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
copy ota_all.bin ota.bin
|
||||
..\..\fw_add.exe -noenc -fw jl_isd.fw -add ota.bin -type 100 -out jl_isd_all.fw
|
||||
copy ota_nor.bin ota.bin
|
||||
..\..\fw_add.exe -noenc -fw jl_isd.fw -add ota.bin -type 100 -out jl_isd_nor.fw
|
||||
|
||||
@rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ýű<C3BD><C5B1>İ汾<C4B0><E6B1BE>Ϣ<EFBFBD><CFA2> FW <20>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
..\..\fw_add.exe -noenc -fw jl_isd_all.fw -add script.ver -out jl_isd_all.fw
|
||||
..\..\fw_add.exe -noenc -fw jl_isd_nor.fw -add script.ver -out jl_isd_nor.fw
|
||||
|
||||
|
||||
|
||||
..\..\ufw_maker.exe -fw_to_ufw jl_isd_all.fw
|
||||
..\..\ufw_maker.exe -fw_to_ufw jl_isd_nor.fw
|
||||
copy jl_isd_all.ufw update.ufw
|
||||
copy jl_isd_nor.ufw nor_update.ufw
|
||||
copy jl_isd_all.fw jl_isd.fw
|
||||
del jl_isd_all.ufw jl_isd_nor.ufw jl_isd_all.fw jl_isd_nor.fw
|
||||
|
||||
|
||||
@REM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
::ufw_maker.exe -chip AC800X %ADD_KEY% -output config.ufw -res bt_cfg.cfg
|
||||
|
||||
::IF EXIST jl_696x.bin del jl_696x.bin
|
||||
|
||||
|
||||
@rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>
|
||||
@rem -format vm //<2F><><EFBFBD><EFBFBD>VM <20><><EFBFBD><EFBFBD>
|
||||
@rem -format cfg //<2F><><EFBFBD><EFBFBD>BT CFG <20><><EFBFBD><EFBFBD>
|
||||
@rem -format 0x3f0-2 //<2F><>ʾ<EFBFBD>ӵ<EFBFBD> 0x3f0 <20><> sector <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><> sector(<28><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16<31><36><EFBFBD>ƻ<EFBFBD>10<31><30><EFBFBD>ƶ<EFBFBD><C6B6>ɣ<EFBFBD><C9A3>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<31><30><EFBFBD><EFBFBD>)
|
||||
|
||||
ping /n 2 127.1>null
|
||||
IF EXIST null del null
|
||||
|
||||
@ -1,64 +1,67 @@
|
||||
@echo off
|
||||
|
||||
cd %~dp0
|
||||
|
||||
copy ..\..\script.ver .
|
||||
copy ..\..\uboot.boot .
|
||||
copy ..\..\tone.cfg .
|
||||
copy ..\..\cfg_tool.bin .
|
||||
copy ..\..\app.bin .
|
||||
copy ..\..\br23loader.bin .
|
||||
copy ..\..\eq_cfg_hw.bin .
|
||||
copy ..\..\ota_all.bin .
|
||||
copy ..\..\ota_nor.bin .
|
||||
|
||||
|
||||
..\..\isd_download.exe -tonorflash -dev br23 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_hw.bin -format all %1
|
||||
:: -format all
|
||||
::-reboot 2500
|
||||
|
||||
|
||||
|
||||
@rem 删除临时文件-format all
|
||||
if exist *.mp3 del *.mp3
|
||||
if exist *.PIX del *.PIX
|
||||
if exist *.TAB del *.TAB
|
||||
if exist *.res del *.res
|
||||
if exist *.sty del *.sty
|
||||
|
||||
|
||||
|
||||
@rem 生成固件升级文件
|
||||
copy ota_all.bin ota.bin
|
||||
..\..\fw_add.exe -noenc -fw jl_isd.fw -add ota.bin -type 100 -out jl_isd_all.fw
|
||||
copy ota_nor.bin ota.bin
|
||||
..\..\fw_add.exe -noenc -fw jl_isd.fw -add ota.bin -type 100 -out jl_isd_nor.fw
|
||||
|
||||
@rem 添加配置脚本的版本信息到 FW 文件中
|
||||
..\..\fw_add.exe -noenc -fw jl_isd_all.fw -add script.ver -out jl_isd_all.fw
|
||||
..\..\fw_add.exe -noenc -fw jl_isd_nor.fw -add script.ver -out jl_isd_nor.fw
|
||||
|
||||
|
||||
|
||||
..\..\ufw_maker.exe -fw_to_ufw jl_isd_all.fw
|
||||
..\..\ufw_maker.exe -fw_to_ufw jl_isd_nor.fw
|
||||
copy jl_isd_all.ufw update.ufw
|
||||
copy jl_isd_nor.ufw nor_update.ufw
|
||||
copy jl_isd_all.fw jl_isd.fw
|
||||
del jl_isd_all.ufw jl_isd_nor.ufw jl_isd_all.fw jl_isd_nor.fw
|
||||
|
||||
|
||||
@REM 生成配置文件升级文件
|
||||
::ufw_maker.exe -chip AC800X %ADD_KEY% -output config.ufw -res bt_cfg.cfg
|
||||
|
||||
::IF EXIST jl_696x.bin del jl_696x.bin
|
||||
|
||||
|
||||
@rem 常用命令说明
|
||||
@rem -format vm //擦除VM 区域
|
||||
@rem -format cfg //擦除BT CFG 区域
|
||||
@rem -format 0x3f0-2 //表示从第 0x3f0 个 sector 开始连续擦除 2 个 sector(第一个参数为16进制或10进制都可,第二个参数必须是10进制)
|
||||
|
||||
ping /n 2 127.1>null
|
||||
IF EXIST null del null
|
||||
|
||||
@echo off
|
||||
|
||||
cd %~dp0
|
||||
|
||||
copy ..\..\script.ver .
|
||||
copy ..\..\uboot.boot .
|
||||
copy ..\..\tone.cfg .
|
||||
copy ..\..\cfg_tool.bin .
|
||||
copy ..\..\app.bin .
|
||||
copy ..\..\br23loader.bin .
|
||||
copy ..\..\eq_cfg_bt.bin .
|
||||
copy ..\..\eq_cfg_lp.bin .
|
||||
copy ..\..\ota_all.bin .
|
||||
copy ..\..\ota_nor.bin .
|
||||
|
||||
|
||||
::..\..\isd_download.exe -tonorflash -dev br23 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_bt.bin eq_cfg_lp.bin %1
|
||||
|
||||
..\..\isd_download.exe -tonorflash -dev br23 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_bt.bin eq_cfg_lp.bin -format all %1 -key KTS-AC69xx_5458.key
|
||||
:: -format all
|
||||
::-reboot 2500
|
||||
|
||||
|
||||
|
||||
@rem ɾ<><C9BE><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD>-format all
|
||||
if exist *.mp3 del *.mp3
|
||||
if exist *.PIX del *.PIX
|
||||
if exist *.TAB del *.TAB
|
||||
if exist *.res del *.res
|
||||
if exist *.sty del *.sty
|
||||
|
||||
|
||||
|
||||
@rem <20><><EFBFBD>ɹ̼<C9B9><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
copy ota_all.bin ota.bin
|
||||
..\..\fw_add.exe -noenc -fw jl_isd.fw -add ota.bin -type 100 -out jl_isd_all.fw
|
||||
copy ota_nor.bin ota.bin
|
||||
..\..\fw_add.exe -noenc -fw jl_isd.fw -add ota.bin -type 100 -out jl_isd_nor.fw
|
||||
|
||||
@rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ýű<C3BD><C5B1>İ汾<C4B0><E6B1BE>Ϣ<EFBFBD><CFA2> FW <20>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
..\..\fw_add.exe -noenc -fw jl_isd_all.fw -add script.ver -out jl_isd_all.fw
|
||||
..\..\fw_add.exe -noenc -fw jl_isd_nor.fw -add script.ver -out jl_isd_nor.fw
|
||||
|
||||
|
||||
|
||||
..\..\ufw_maker.exe -fw_to_ufw jl_isd_all.fw
|
||||
..\..\ufw_maker.exe -fw_to_ufw jl_isd_nor.fw
|
||||
copy jl_isd_all.ufw update.ufw
|
||||
copy jl_isd_nor.ufw nor_update.ufw
|
||||
copy jl_isd_all.fw jl_isd.fw
|
||||
del jl_isd_all.ufw jl_isd_nor.ufw jl_isd_all.fw jl_isd_nor.fw
|
||||
|
||||
|
||||
@REM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
::ufw_maker.exe -chip AC800X %ADD_KEY% -output config.ufw -res bt_cfg.cfg
|
||||
|
||||
::IF EXIST jl_696x.bin del jl_696x.bin
|
||||
|
||||
|
||||
@rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>
|
||||
@rem -format vm //<2F><><EFBFBD><EFBFBD>VM <20><><EFBFBD><EFBFBD>
|
||||
@rem -format cfg //<2F><><EFBFBD><EFBFBD>BT CFG <20><><EFBFBD><EFBFBD>
|
||||
@rem -format 0x3f0-2 //<2F><>ʾ<EFBFBD>ӵ<EFBFBD> 0x3f0 <20><> sector <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><> sector(<28><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16<31><36><EFBFBD>ƻ<EFBFBD>10<31><30><EFBFBD>ƶ<EFBFBD><C6B6>ɣ<EFBFBD><C9A3>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<31><30><EFBFBD><EFBFBD>)
|
||||
|
||||
ping /n 2 127.1>null
|
||||
IF EXIST null del null
|
||||
|
||||
|
||||
BIN
cpu/br23/tools/download/standard/eq_cfg_bt.bin
Normal file
BIN
cpu/br23/tools/download/standard/eq_cfg_bt.bin
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/eq_cfg_lp.bin
Normal file
BIN
cpu/br23/tools/download/standard/eq_cfg_lp.bin
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_0FD6.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_0FD6.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_1A39.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_1A39.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_93CE.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_93CE.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_9673.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_9673.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_9771.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_9771.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_B5DD.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_B5DD.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_EQ_6915.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_EQ_6915.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_EQ_6F0E.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_EQ_6F0E.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_EQ_9934.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_EQ_9934.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_EQ_C230.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_EQ_C230.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_JM207_F296.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM207_F296.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/effect_file/JM207.BTEQ.2026.06.13.bin
Normal file
BIN
cpu/br23/tools/effect_file/JM207.BTEQ.2026.06.13.bin
Normal file
Binary file not shown.
BIN
cpu/br23/tools/effect_file/eq_cfg_bt.bin
Normal file
BIN
cpu/br23/tools/effect_file/eq_cfg_bt.bin
Normal file
Binary file not shown.
BIN
cpu/br23/tools/effect_file/eq_cfg_lp.bin
Normal file
BIN
cpu/br23/tools/effect_file/eq_cfg_lp.bin
Normal file
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/efftool.autosave.eas
Normal file
BIN
cpu/br23/tools/efftool.autosave.eas
Normal file
Binary file not shown.
BIN
cpu/br23/tools/eq_cfg_bt.bin
Normal file
BIN
cpu/br23/tools/eq_cfg_bt.bin
Normal file
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/eq_cfg_hw_h.bin
Normal file
BIN
cpu/br23/tools/eq_cfg_hw_h.bin
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user