test: 🐛 增减打印测试

This commit is contained in:
yuanQie 2025-05-26 22:30:20 +08:00
parent 441127df95
commit 406059f4a8

View File

@ -186,38 +186,43 @@ void *handleUdpTransmission(void *arg)
printf("[while(1)]:/*************************************/\n");
while (1)
{
printf("[slot]:%u \n", slot_ind_flag);
// printf("[slot]:%u \n", slot_ind_flag);
if (1 == slot_ind_flag)
{
printf("[test 01]\n");
slot_ind_flag = 0;
/************************************************************************************** */
// wr 16016*64(byte) [8008] 2字节复制一次while循环会写入 1/20 的数据触发条件为slot_ind_flag
printf("[test 02]\n");
size_t buffer_start = data_index;// 当前数据读取的起始索引
size_t elements_remaining = 65535 - buffer_start;// 从buffer_start到数组末尾的剩余元素数
size_t elements_to_copy = (elements_remaining >= 8008) ? 8008 : elements_remaining; // 剩余
printf("[test 03]\n");
// 拷贝前半部分(可能跨数组末尾)
printf("[test 04]\n");
memcpy((char*)map_base_tx_case52 + wr_cunt * 16016, &txt_buffer[buffer_start], elements_to_copy * 2);
printf("[test 05]\n");
// 处理数组环绕
if (elements_to_copy < 8008) {
size_t elements_needed = 8008 - elements_to_copy;
memcpy((char*)map_base_tx_case52 + wr_cunt * 16016 + elements_to_copy * 2, &txt_buffer[0], elements_needed * 2);
}
printf("[test 02]\n");
printf("[test 06]\n");
// 更新数组索引和块索引
data_index = (data_index + 8008) % 65535;
wr_cunt = (wr_cunt + 1) % 20;
/************************************************************************************** */
// 更新生产者计数
printf("[test 07]\n");
uint8_t w_idx = __atomic_load_n(
(volatile uint8_t *)(map_base_rxf_case52 + 0),
__ATOMIC_ACQUIRE
);
printf("[test 03]\n");
// uint8_t w_idx = *((volatile uint8_t *)map_base_rxf_case52);
/************************************************************************************** */
// 尝试读取
uint8_t block_n = 0;
printf("[test 08]\n");
if (w_idx == r_idx){
printf("[while(1)]: w_idx = %hhu, r_idx = %hhu\n", w_idx, r_idx);
printf("[while(1)]: 空\n");