test: 🐛 增减打印测试
This commit is contained in:
parent
441127df95
commit
406059f4a8
@ -186,38 +186,43 @@ void *handleUdpTransmission(void *arg)
|
|||||||
printf("[while(1)]:/*************************************/\n");
|
printf("[while(1)]:/*************************************/\n");
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
printf("[slot]:%u \n", slot_ind_flag);
|
// printf("[slot]:%u \n", slot_ind_flag);
|
||||||
if (1 == slot_ind_flag)
|
if (1 == slot_ind_flag)
|
||||||
{
|
{
|
||||||
printf("[test 01]\n");
|
printf("[test 01]\n");
|
||||||
slot_ind_flag = 0;
|
slot_ind_flag = 0;
|
||||||
/************************************************************************************** */
|
/************************************************************************************** */
|
||||||
// wr 16016*64(byte) [8008] 2字节复制,一次while循环会写入 1/20 的数据,触发条件为slot_ind_flag
|
// wr 16016*64(byte) [8008] 2字节复制,一次while循环会写入 1/20 的数据,触发条件为slot_ind_flag
|
||||||
|
printf("[test 02]\n");
|
||||||
size_t buffer_start = data_index;// 当前数据读取的起始索引
|
size_t buffer_start = data_index;// 当前数据读取的起始索引
|
||||||
size_t elements_remaining = 65535 - buffer_start;// 从buffer_start到数组末尾的剩余元素数
|
size_t elements_remaining = 65535 - buffer_start;// 从buffer_start到数组末尾的剩余元素数
|
||||||
size_t elements_to_copy = (elements_remaining >= 8008) ? 8008 : elements_remaining; // 剩余
|
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);
|
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) {
|
if (elements_to_copy < 8008) {
|
||||||
size_t elements_needed = 8008 - elements_to_copy;
|
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);
|
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;
|
data_index = (data_index + 8008) % 65535;
|
||||||
wr_cunt = (wr_cunt + 1) % 20;
|
wr_cunt = (wr_cunt + 1) % 20;
|
||||||
/************************************************************************************** */
|
/************************************************************************************** */
|
||||||
// 更新生产者计数
|
// 更新生产者计数
|
||||||
|
printf("[test 07]\n");
|
||||||
uint8_t w_idx = __atomic_load_n(
|
uint8_t 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
|
||||||
);
|
);
|
||||||
printf("[test 03]\n");
|
|
||||||
// uint8_t w_idx = *((volatile uint8_t *)map_base_rxf_case52);
|
// uint8_t w_idx = *((volatile uint8_t *)map_base_rxf_case52);
|
||||||
/************************************************************************************** */
|
/************************************************************************************** */
|
||||||
// 尝试读取
|
// 尝试读取
|
||||||
uint8_t block_n = 0;
|
uint8_t block_n = 0;
|
||||||
|
printf("[test 08]\n");
|
||||||
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)]: 空\n");
|
printf("[while(1)]: 空\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user