新增.gitignore文件以排除构建产物和临时文件,同时删除不再需要的AC701N依赖文件和多个工具及输出文件,优化项目结构。

新增BLE MAC地址上报功能
This commit is contained in:
2026-09-08 18:04:54 +08:00
parent 59361cd9d5
commit 20629fd537
404 changed files with 119 additions and 168630 deletions
+36
View File
@@ -0,0 +1,36 @@
# Code::Blocks / IDE
*.depend
*.layout
*.cbTemp
AC701N.depend
# Build objects
obj/
*.o
*.d
*.a
*.lib
# Auto-generated link artifacts
cpu/br28/sdk.ld
cpu/br28/sdk_used_list.used
*.map
*.elf
*.bc
*.resolution.txt
# Firmware / download outputs
cpu/br28/tools/app.bin
cpu/br28/tools/data_code.bin
cpu/br28/tools/download.bat
cpu/br28/tools/sdk.elf
cpu/br28/tools/sdk.elf.*
cpu/br28/tools/sdk.map
cpu/br28/tools/download/
# Misc
*.log
*.tmp
*~
.DS_Store
Thumbs.db
-142889
View File
File diff suppressed because it is too large Load Diff
+79 -1
View File
@@ -3,8 +3,9 @@
* @brief USB CDC 见宝帧解析:校验后写入产品码并重广播
* @author cyWu <1917507415@qq.com>
* @date 2026.07.24
* @version V1.0.2
* @version V1.0.3
* @history
* - V1.0.3, 2026.09.08, cyWu, 0x65 成功应答后延时 1s 主动上报 BLE MAC(0x68)
* - V1.0.2, 2026.07.28, cyWu, 非产品码命令整帧透传 BLE REPORTCMD_V2
* - V1.0.1, 2026.07.24, cyWu, CDC 中断内禁止 syscfg_write,改延时到任务上下文
* - V1.0.0, 2026.07.24, cyWu, 首次发布
@@ -86,6 +87,8 @@ static uint8_t s_pending_sn;
static uint8_t s_pending_prod[USR_PRODCODE_LEN];
static uint8_t s_pending_pcode[USR_PCODE_LEN];
static int s_process_timer;
static int s_mac_rpt_timer; /* 0x65 后延时上报 0x68 */
static uint8_t s_mac_rpt_sn; /* 待上报 MAC 复用的 SN */
static uint8_t s_ble_txbuf[USR_JB_BLE_TX_SZ];
static uint8_t s_last_ble_msgid; /* 最近一次 BLE RX 的 msgid */
static uint8_t s_rsp_buf[JB_RSP_BUF_SZ];
@@ -366,6 +369,7 @@ void usr_prodcode_init(void)
usr_jb_rb_init(&s_rb);
s_pending_save = 0;
s_process_timer = 0;
s_mac_rpt_timer = 0;
usr_prodcode_set_default();
memset(&info, 0, sizeof(info));
@@ -510,6 +514,73 @@ static void usr_jb_send_rsp(uint8_t cmd, uint8_t sn,
printf("usr_jb rsp cmd=0x%02x plen=%u total=%u\n", cmd + 1, payload_len, total);
}
/**
* @brief 定时器回调:发送 0x68 BLE MAC 上报帧
* @note le_controller_get_mac 为小端存储,需反转为手机扫码显示顺序后再上报
*/
static void usr_jb_mac_rpt_timeout(void *priv)
{
uint8_t mac_le[6];
uint8_t mac[6];
uint8_t body[1 + 6];
uint16_t len_field;
uint16_t total;
uint8_t sn;
uint8_t i;
extern int le_controller_get_mac(void *addr);
extern u8 usr_mac_addr[6];
(void)priv;
s_mac_rpt_timer = 0;
sn = s_mac_rpt_sn;
if (le_controller_get_mac(mac_le) != 0) {
memcpy(mac_le, usr_mac_addr, 6);
}
/* 小端 → 手机显示序:AA:BB:CC:DD:EE:FF */
for (i = 0; i < 6; i++) {
mac[i] = mac_le[5 - i];
}
/* TLV:与产品码字段风格一致 [len=6][MAC 6B] */
body[0] = 6;
memcpy(&body[1], mac, 6);
len_field = (uint16_t)(2 + sizeof(body) + 1); /* CMD+SN+payload+CKSUM */
total = (uint16_t)(len_field + 4);
s_rsp_buf[0] = PKT_HEAD_0;
s_rsp_buf[1] = PKT_HEAD_1;
s_rsp_buf[2] = (uint8_t)(len_field >> 8);
s_rsp_buf[3] = (uint8_t)(len_field & 0xFF);
s_rsp_buf[4] = USR_JB_CMD_RPT_BLE_MAC;
s_rsp_buf[5] = sn;
memcpy(&s_rsp_buf[6], body, sizeof(body));
s_rsp_buf[total - 1] = usr_jb_checksum(s_rsp_buf, total);
cdc_write_data(0, s_rsp_buf, total);
printf("usr_jb rpt mac sn=%u disp=%02X:%02X:%02X:%02X:%02X:%02X le=",
sn, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
printf_buf(mac_le, 6);
printf_buf(s_rsp_buf, total);
}
/**
* @brief 0x65 成功应答后,延时 1s 再主动上报 BLE MACCMD=0x68
* @param sn 复用本次 0x64/0x65 的流水号
*/
static void usr_jb_schedule_ble_mac_report(uint8_t sn)
{
s_mac_rpt_sn = sn;
if (s_mac_rpt_timer) {
sys_timeout_del(s_mac_rpt_timer);
s_mac_rpt_timer = 0;
}
s_mac_rpt_timer = sys_timeout_add(NULL, usr_jb_mac_rpt_timeout, 1000);
printf("usr_jb mac rpt scheduled sn=%u delay=1000ms\n", sn);
}
/**
* @brief Dengle 查询:空/0xFF=全部;单字节槽位=查一条
* @note 应答 0x75
@@ -664,6 +735,11 @@ static void usr_jb_process_timeout(void *priv)
#endif
break;
case (USR_JB_CMD_RPT_BLE_MAC + 1): /* 0x69:上位机对 0x68 的 ACK,仅消费 */
printf("usr_jb mac rpt ack sn=%u result=0x%02x\n",
sn, (payload_len >= 1) ? pkt[6] : 0xFF);
break;
default:
/*
* COM 未打开:0x03/0x05 等需本地自动应答回 BLE;
@@ -695,6 +771,7 @@ static void usr_jb_process_timeout(void *priv)
memcmp(s_pcode, s_pending_pcode, USR_PCODE_LEN) == 0) {
#if TCFG_USB_SLAVE_CDC_ENABLE
usr_jb_send_ack(s_pending_cmd, s_pending_sn, 0x00);
usr_jb_schedule_ble_mac_report(s_pending_sn);
#endif
printf("prodcode unchanged, skip adv rebuild\n");
return;
@@ -703,6 +780,7 @@ static void usr_jb_process_timeout(void *priv)
if (usr_prodcode_save(s_pending_prod, s_pending_pcode) == 0) {
#if TCFG_USB_SLAVE_CDC_ENABLE
usr_jb_send_ack(s_pending_cmd, s_pending_sn, 0x00);
usr_jb_schedule_ble_mac_report(s_pending_sn);
#endif
extern void usr_goto_pair_mode(void);
usr_goto_pair_mode();
+4 -2
View File
@@ -2,9 +2,10 @@
* @file usr_usb_jb.h
* @brief USB CDC 见宝帧解析:设置 ProdtCode / productCode 并落盘重广播
* @author cyWu <1917507415@qq.com>
* @date 2026.07.24
* @version V1.0.0
* @date 2026.09.08
* @version V1.0.1
* @history
* - V1.0.1, 2026.09.08, cyWu, 增加 0x68 BLE MAC 主动上报命令定义
* - V1.0.0, 2026.07.24, cyWu, 首次发布
******************************************************************************/
@@ -21,6 +22,7 @@
#define USR_PCODE_LEN (6)
#define USR_JB_CMD_SET_PRODCODE (0x64) /**< USB 设置产品码;ACK=0x65 */
#define USR_JB_CMD_GET_PRODCODE (0x66) /**< USB 查询产品码;RSP=0x67 */
#define USR_JB_CMD_RPT_BLE_MAC (0x68) /**< 设备主动上报 BLE MACACK=0x69 */
#define USR_JB_CMD_DENGLE_SET (0x70) /**< USB 设置 Dengle 定时;ACK=0x71 */
#define USR_JB_CMD_DENGLE_CLR (0x72) /**< USB 清除全部 DengleACK=0x73 */
#define USR_JB_CMD_DENGLE_QRY (0x74) /**< USB 查询 Dengle 配置;RSP=0x75 */
-2081
View File
File diff suppressed because it is too large Load Diff
-30
View File
@@ -1,30 +0,0 @@
sdfile_vfs_ops
sbc_decoder
msbc_decoder
sbc_hwaccel
cvsd_decoder
pcm_decoder
mp3_decoder
Binary file not shown.
Binary file not shown.
-48
View File
@@ -1,48 +0,0 @@
@echo off
Setlocal enabledelayedexpansion
@echo ********************************************************************************
@echo SDK BR28
@echo ********************************************************************************
@echo %date%
cd /d %~dp0
set OBJDUMP=C:\JL\pi32\bin\llvm-objdump.exe
set OBJCOPY=C:\JL\pi32\bin\llvm-objcopy.exe
set ELFFILE=sdk.elf
set bankfiles=
set LZ4_PACKET=.\lz4_packet.exe
REM %OBJDUMP% -D -address-mask=0x1ffffff -print-dbg $1.elf > $1.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% aec.bin
%OBJCOPY% -O binary -j .overlay_aac %ELFFILE% aac.bin
%OBJCOPY% -O binary -j .overlay_aptx %ELFFILE% aptx.bin
%OBJCOPY% -O binary -j .common %ELFFILE% common.bin
for /L %%i in (0,1,20) do (
%OBJCOPY% -O binary -j .overlay_bank%%i %ELFFILE% bank%%i.bin
set bankfiles=!bankfiles! bank%%i.bin 0x0
)
%LZ4_PACKET% -dict text.bin -input common.bin 0 aec.bin 0 aac.bin 0 !bankfiles! -o bank.bin
%OBJDUMP% -section-headers -address-mask=0x1ffffff %ELFFILE%
REM %OBJDUMP% -t %ELFFILE% > symbol_tbl.txt
copy /b text.bin + data.bin + mov_slot.bin + data_code.bin + aec.bin + aac.bin + psr_data_code.bin app.bin
del !bankfiles! common.bin text.bin data.bin bank.bin
copy eq_cfg_hw_less.bin eq_cfg_hw.bin
call download/earphone/download_app_ota.bat
@@ -1 +0,0 @@
3DBA0ACD41A68B534365C721F7B23619914B4106E1024B5592A0A49D1DD417152E4DCF18
Binary file not shown.
@@ -1,48 +0,0 @@
@echo off
cd %~dp0
copy ..\..\script.ver .
copy ..\..\tone.cfg .
copy ..\..\p11_code.bin .
copy ..\..\br28loader.bin .
copy ..\..\ota.bin .
copy ..\..\anc_coeff.bin .
copy ..\..\anc_gains.bin .
..\..\isd_download.exe ..\..\isd_config.ini -tonorflash -dev br28 -boot 0x120000 -div8 -wait 300 -uboot ..\..\uboot.boot -app ..\..\app.bin -res ..\..\cfg_tool.bin tone.cfg p11_code.bin -uboot_compress
:: -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
..\..\ufw_maker.exe -fw_to_ufw jl_isd.fw
copy jl_isd.ufw update.ufw
del jl_isd.ufw
@REM 生成配置文件升级文件
::ufw_maker.exe -chip AC800X %ADD_KEY% -output config.ufw -res bt_cfg.cfg
::IF EXIST jl_696x.bin del jl_696x.bin
if exist script.ver del script.ver
if exist tone.cfg del tone.cfg
if exist p11_code.bin del p11_code.bin
if exist br28loader.bin del br28loader.bin
if exist anc_coeff.bin del anc_coeff.bin
if exist anc_gains.bin del anc_gains.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
@@ -1,48 +0,0 @@
@echo off
cd %~dp0
copy ..\..\script.ver .
copy ..\..\tone.cfg .
copy ..\..\p11_code.bin .
copy ..\..\br28loader.bin .
copy ..\..\ota.bin .
copy ..\..\anc_coeff.bin .
copy ..\..\anc_gains.bin .
..\..\isd_download.exe ..\..\isd_config.ini -tonorflash -dev br28 -boot 0x120000 -div8 -wait 300 -uboot ..\..\uboot.boot -app ..\..\app.bin -res ..\..\cfg_tool.bin tone.cfg p11_code.bin -uboot_compress -key RS-5B88.key
:: -format all -key RS-5B88.key
::-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
..\..\ufw_maker.exe -fw_to_ufw jl_isd.fw
copy jl_isd.ufw update.ufw
del jl_isd.ufw
@REM 生成配置文件升级文件
::ufw_maker.exe -chip AC800X %ADD_KEY% -output config.ufw -res bt_cfg.cfg
::IF EXIST jl_696x.bin del jl_696x.bin
if exist script.ver del script.ver
if exist tone.cfg del tone.cfg
if exist p11_code.bin del p11_code.bin
if exist br28loader.bin del br28loader.bin
if exist anc_coeff.bin del anc_coeff.bin
if exist anc_gains.bin del anc_gains.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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More