sync c1 change

This commit is contained in:
Steven Dan
2026-05-23 20:11:15 +08:00
parent c82257934a
commit 26e64a3421
2 changed files with 12 additions and 5 deletions

View File

@@ -737,8 +737,15 @@ void XUA_Buffer_Ep(
if(usb_speed != XUD_SPEED_HS)
feedbackMul = 8ULL; /* TODO Use 4 instead of 8 to avoid windows LSB issues? */
/* Number of MCLK ticks in this SOF period (E.g = 125 * 24.576 = 3072) */
int count = (int) ((short)(u_tmp - lastClock));
/* Number of MCLK ticks in this SOF period (E.g = 125 * 24.576 = 3072)
* 改动原因:原 (short) 截断只能处理 MCLK 计数 < 32768 的情况。
* UAC1 使用 FS USBSOF 周期 1ms1024x MCLK49.152MHz)时
* 每个 SOF 产生 49152 ticks > 32767(short) 溢出为 -16384负数
* 导致 feedback 计算错误,录音 IN endpoint 缓冲区管理失败,录音卡住。
* 改为 (unsigned short) 后49152 = 0xC000truncate 后仍为 49152
* 同时保留对 16-bit 端口计时器回绕wraparound的正确处理。
* UAC2 HS SOF125µs下最大 6144 ticks < 32768两者等价无副作用。 */
int count = (int) ((unsigned short)(u_tmp - lastClock));
unsigned long long full_result = count * feedbackMul * sampleFreq;
@@ -1235,7 +1242,7 @@ void XUA_Buffer_Ep(
{
if (btn_start_time == 0)
{
UserReadHIDButtons(&g_hidData[1]);
// UserReadHIDButtons(&g_hidData[1]);
btn_start_time = now;
XUD_SetReady_In(ep_hid, g_hidData, HID_BUTTON_REPORT_BYTES);
}

View File

@@ -8,8 +8,8 @@
#define CLKBLK_SPDIF_TX XS1_CLKBLK_1
#define CLKBLK_SPDIF_RX XS1_CLKBLK_1
#define CLKBLK_MCLK XS1_CLKBLK_2
#define CLKBLK_FLASHLIB XS1_CLKBLK_3 /* Clock block for use by flash lib */
#define CLKBLK_FLASHLIB XS1_CLKBLK_1 /* Clock block for use by flash lib */
#define CLKBLK_ADAT_RX XS1_CLKBLK_REF /* Use REF for ADAT_RX on x200/AI series */
#define CLKBLK_I2S_BIT XS1_CLKBLK_1
#define CLKBLK_I2S_BIT XS1_CLKBLK_3
#endif /* _UAC_HWRESOURCES_H_ */