feat: 🐛 测试:修改变量声明位置

This commit is contained in:
yuanQie 2025-05-27 18:41:45 +08:00
parent d09adfc9cd
commit 5feefd8bd6

View File

@ -187,6 +187,10 @@ void *handleUdpTransmission(void *arg)
} }
printf("[tx]:初始10块写入完成当前地址块=%zu数据索引=%zu\n", wr_cunt, data_index); printf("[tx]:初始10块写入完成当前地址块=%zu数据索引=%zu\n", wr_cunt, data_index);
printf("[while(1)]:/*************************************/\n"); printf("[while(1)]:/*************************************/\n");
size_t current_pos = 0;
uint16_t value_mem = 0;
uint8_t block_n = 0;
uint8_t cut_i = 0;
while (1) while (1)
{ {
if (1 == slot_ind_flag) if (1 == slot_ind_flag)
@ -195,24 +199,24 @@ void *handleUdpTransmission(void *arg)
slot_ind_flag = 0; slot_ind_flag = 0;
/************************************************************************************** */ /************************************************************************************** */
// wr 16016*20(byte),一次while循环会写入 1/20 的数据触发条件为slot_ind_flag // wr 16016*20(byte),一次while循环会写入 1/20 的数据触发条件为slot_ind_flag
const size_t current_pos = wr_cunt * 16016; current_pos = wr_cunt * 16016;
for (int i = 0; i < 8008; ++i) { for (int i = 0; i < 8008; ++i) {
const uint16_t value = txt_buffer[(data_index + i) % 65535]; value_mem = txt_buffer[(data_index + i) % 65535];
memcpy((char*)map_base_tx_case52 + current_pos + i*2, &value, 2); memcpy((char*)map_base_tx_case52 + current_pos + i*2, &value_mem, 2);
} }
data_index = (data_index + 8008) % 65535; data_index = (data_index + 8008) % 65535;
wr_cunt = (wr_cunt + 1) % 20; wr_cunt = (wr_cunt + 1) % 20;
/************************************************************************************** */ /************************************************************************************** */
// 更新生产者计数 // 更新生产者计数
uint8_t w_idx = __atomic_load_n( w_idx = __atomic_load_n(
(volatile uint8_t *)(map_base_rxf_case52 + 0), (volatile uint8_t *)(map_base_rxf_case52 + 0),
__ATOMIC_ACQUIRE __ATOMIC_ACQUIRE
); );
// uint8_t w_idx = *((volatile uint8_t *)map_base_rxf_case52); // w_idx = *((volatile uint8_t *)map_base_rxf_case52);
/************************************************************************************** */ /************************************************************************************** */
// 尝试读取 // 尝试读取
uint8_t block_n = 0; block_n = 0;
if (w_idx == r_idx){ if (w_idx == r_idx){
printf("[while(1)]: w_idx = %hhu, r_idx = %hhu\n", w_idx, r_idx); printf("[while(1)]: w_idx = %hhu, r_idx = %hhu\n", w_idx, r_idx);
printf("[while(1)]: pass\n"); printf("[while(1)]: pass\n");
@ -221,7 +225,7 @@ void *handleUdpTransmission(void *arg)
printf("[while(1)]: w_idx = %hhu, r_idx = %hhu\n", w_idx, r_idx); printf("[while(1)]: w_idx = %hhu, r_idx = %hhu\n", w_idx, r_idx);
printf("[while(1)]: r_idx < w_idx\n"); printf("[while(1)]: r_idx < w_idx\n");
block_n = w_idx - r_idx; block_n = w_idx - r_idx;
for (uint8_t cut_i = 0; cut_i < block_n; cut_i++) for (cut_i = 0; cut_i < block_n; cut_i++)
{ {
memcpy(udp_data_buffer, memcpy(udp_data_buffer,
(char*)map_base_rx_case52 + r_idx * 16016, (char*)map_base_rx_case52 + r_idx * 16016,
@ -252,7 +256,7 @@ void *handleUdpTransmission(void *arg)
printf("[while(1)]: w_idx < r_idx\n"); printf("[while(1)]: w_idx < r_idx\n");
printf("[while(1)]: w_idx = %hhu, r_idx = %hhu\n", w_idx, r_idx); printf("[while(1)]: w_idx = %hhu, r_idx = %hhu\n", w_idx, r_idx);
// 取完末尾 // 取完末尾
for (uint8_t cut_i = 0; cut_i < (8-r_idx); cut_i++) for (cut_i = 0; cut_i < (8-r_idx); cut_i++)
{ {
memcpy(udp_data_buffer, memcpy(udp_data_buffer,
(char*)map_base_rx_case52 + r_idx * 16016, (char*)map_base_rx_case52 + r_idx * 16016,
@ -279,7 +283,7 @@ void *handleUdpTransmission(void *arg)
} }
r_idx = r_idx % 8; r_idx = r_idx % 8;
// 取从头开始 // 取从头开始
for (uint8_t cut_i = 0; cut_i < w_idx; cut_i++) for (cut_i = 0; cut_i < w_idx; cut_i++)
{ {
memcpy(udp_data_buffer, memcpy(udp_data_buffer,
(char*)map_base_rx_case52 + cut_i * 16016, (char*)map_base_rx_case52 + cut_i * 16016,