/* 边界测试: icc数据包从1到fifo大小的发送测试 */ s32 icc_send_test_007(void) { u32 i = 0; u32 j = 0; u32 fifo_size = g_icc_ctrl.channels[ICC_CHN_RFILE]->fifo_recv->size; u32 turn_back_cnt = 3; u32 channel_idx = ICC_CHN_RFILE; u32 sub_chn_idx = ICC_TEST_DEFAULT_ASYN_SUBCHN_NUM; u32 channel_id = (channel_idx << 16 | sub_chn_idx); fifo_size -= sizeof(struct icc_channel_packet); for(i = 1; i <= fifo_size; i++) { for(j = 0; j < fifo_size * turn_back_cnt / i + 1; j++) { if(ICC_OK != icc_send_test(ICC_SEND_CPU, channel_id, g_icc_test.channels[channel_idx].sub_channels[sub_chn_idx].wr_buf, i,0, ICC_TAKE_SEM_TIMEOUT_JIFFIES)) { icc_print_info("[FAIL] single channel, asynchronous send\n"); return ICC_TEST_FAIL; } } } icc_print_info("[PASS] single channel, asynchronous send\n"); return ICC_TEST_PASS; }
/* ccore与mcore消息异步互发*/ s32 icc_mcore_send_test_002(void) { /* 异步发送, 默认要用测试专用的子通道, 即16 */ #if defined(__VXWORKS__) || defined(__CMSIS_RTOS) u32 channel_idx = ICC_CHN_MCORE_CCORE; u32 sub_chn_idx = ICC_TEST_DEFAULT_ASYN_SUBCHN_NUM / 2; u32 channel_id = (channel_idx << 16 | sub_chn_idx); u8 *wr_buff = g_icc_test.channels[channel_idx].sub_channels[sub_chn_idx].wr_buf; /*lint !e416 !e831*/ #endif /* ccore发给mcore */ #if defined(__VXWORKS__) if(ICC_OK != icc_send_test(ICC_CPU_MCU, channel_id, wr_buff , 10, sub_chn_idx, ICC_TAKE_SEM_TIMEOUT_JIFFIES)) { icc_print_info("[FAIL] single channel, asynchronous send to cm3\n"); return ICC_TEST_FAIL; } /* mcore发给ccore */ #elif defined(__CMSIS_RTOS) if(ICC_OK != icc_send_test(ICC_CPU_MODEM, channel_id, wr_buff , 10, sub_chn_idx, ICC_TAKE_SEM_TIMEOUT_MS)) { icc_print_info("[FAIL] single channel, asynchronous send to ccore\n"); return ICC_TEST_FAIL; } #endif icc_print_info("[PASS] single channel, asynchronous send\n"); return ICC_TEST_PASS; }
/* msg_type: 0, recv; 1, send */ void icc_channel_info_show(u32 msg_type, u32 real_channel_id) { struct icc_uni_channel_info *channel = NULL; channel = msg_type? &(g_icc_dbg.channel_stat[real_channel_id]->send): &(g_icc_dbg.channel_stat[real_channel_id]->recv); icc_print_info("******************channel[0x%x]****************\n", real_channel_id); icc_print_info("msg_len : 0x%x\n", channel->total.sum_len); icc_print_info("msg_num : 0x%x\n", channel->total.sum_num); icc_print_info("msg_num_prev: 0x%x\n", channel->total.sum_num_prev); icc_print_info("func_size : 0x%x\n", channel->func_size); channel->total.sum_num_prev = channel->total.sum_num; }
void icc_sub_channel_info_show(u32 msg_type, u32 real_channel_id, u32 func_id) { struct icc_uni_channel_info *channel = NULL; channel = msg_type? &(g_icc_dbg.channel_stat[real_channel_id]->send): &(g_icc_dbg.channel_stat[real_channel_id]->recv); func_id %= channel->func_size; icc_print_info("***********sub channel[0x%x]***********\n", func_id); icc_print_info("msg_len : 0x%x\n", channel->sub_chn[func_id].sum_len); icc_print_info("msg_num : 0x%x\n", channel->sub_chn[func_id].sum_num); icc_print_info("sum_num_prev: 0x%x\n", channel->sub_chn[func_id].sum_num_prev); channel->sub_chn[func_id].sum_num_prev = channel->sub_chn[func_id].sum_num; }
s32 icc_send_test_009(void) { u32 channel_id = (ICC_CHN_CSHELL << 16 | 2); u8 send_data = 0x0; if (ICC_SEND_SYNC_RET == bsp_icc_send_sync(ICC_SEND_CPU, channel_id, &send_data, 0, MAX_SCHEDULE_TIMEOUT))/*lint !e40 !e516*/ { icc_print_info("[PASS] single channel, synchronous send!\n"); return ICC_TEST_PASS; } icc_print_info("[FAIL] single channel, synchronous send!\n"); return ICC_TEST_FAIL; }
void icc_channel_packet_dump(struct icc_channel_packet *packet) { if ((0 == g_icc_dbg.msg_print_sw) && (0 == g_icc_ctrl.wake_up_flag)) { return; } if (1 == g_icc_ctrl.wake_up_flag) { g_icc_ctrl.wake_up_flag = 0; icc_print_info("[C SR]icc recv msg dump\n"); } if(!packet) { icc_print_error("packet pointer is NULL!\n"); return; } icc_print_info("***********************************************************************\n"); icc_print_info("icc_channel_packet.channel_id: 0x%x\n", packet->channel_id); icc_print_info("icc_channel_packet.len: 0x%x\n", packet->len); icc_print_info("icc_channel_packet.src_cpu_id: 0x%x\n", packet->src_cpu_id); icc_print_info("icc_channel_packet.timestamp: 0x%x\n", packet->timestamp); icc_print_info("icc_channel_packet.task_id: 0x%x\n", packet->task_id); icc_print_info("***********************************************************************\n"); }
s32 icc_send_test_002(void) { /* 同步发送, 默认要用测试专用的子通道, 即33 */ u32 channel_id = (ICC_CHN_RFILE << 16 | ICC_TEST_DEFAULT_SYNC_SUBCHN_NUM); u32 send_data=0x10305070; if (ICC_SEND_SYNC_RET == bsp_icc_send_sync(ICC_SEND_CPU, channel_id, (u8*)&send_data, sizeof(send_data), MAX_SCHEDULE_TIMEOUT))/*lint !e40 !e516*/ { icc_print_info("[PASS] single channel, synchronous send!\n"); return ICC_TEST_PASS; } icc_print_info("[FAIL] single channel, synchronous send!\n"); return ICC_TEST_FAIL; }
static void channel_fifo_dump(u32 real_channel_id, u32 fifo_type, const char* fifo_name) { void *base_addr = 0; struct icc_channel* channel = g_icc_ctrl.channels[real_channel_id%g_icc_ctrl.channel_size]; struct icc_channel_fifo* fifo = NULL; if(!channel) { icc_print_error("channel pointer is NULL!\n"); return; } fifo = (0 == fifo_type)? channel->fifo_recv: channel->fifo_send; if(!fifo) { icc_print_error("fifo pointer is NULL!\n"); return; } base_addr = (void*)fifo + sizeof(struct icc_channel_fifo); icc_print_info("***************************%s**********************************\n", fifo_name); icc_print_info("icc_channel_fifo address: %p\n", fifo); icc_print_info("icc_channel_fifo.base_addr: %p\n", base_addr); icc_print_info("icc_channel_fifo.magic: 0x%x\n", fifo->magic); icc_print_info("icc_channel_fifo.size: 0x%x\n", fifo->size); icc_print_info("icc_channel_fifo.write: 0x%x\n", fifo->write); icc_print_info("icc_channel_fifo.read: 0x%x\n", fifo->read); icc_print_info("icc_channel_fifo.data: 0x%x\n\n", *((s32*)(fifo->data))); }
/* icc异步发送基本测试, 发非空数据,不在icc任务而在自己的任务中调用 */ s32 icc_send_test_010(void) { /* 异步发送, 默认要用测试专用的子通道, 即32 */ u32 channel_idx = ICC_CHN_CSHELL; u32 sub_chn_idx = 2; u32 channel_id = (channel_idx << 16 | sub_chn_idx); if(ICC_OK != icc_send_test(ICC_SEND_CPU, channel_id, g_icc_test.channels[channel_idx].sub_channels[sub_chn_idx].wr_buf, ICC_NEW_DATA_LEN, ICC_NEW_START_DATA, ICC_TAKE_SEM_TIMEOUT_JIFFIES)) { icc_print_info("[FAIL] single channel, asynchronous send\n"); return ICC_TEST_FAIL; } icc_print_info("[PASS] single channel, asynchronous send\n"); return ICC_TEST_PASS; }
/* icc异步发送基本测试 */ s32 icc_send_test_001(void) { /* 异步发送, 默认要用测试专用的子通道, 即32 */ u32 channel_idx = ICC_CHN_RFILE; u32 sub_chn_idx = ICC_TEST_DEFAULT_ASYN_SUBCHN_NUM; u32 channel_id = (channel_idx << 16 | sub_chn_idx); if(ICC_OK != icc_send_test(ICC_SEND_CPU, channel_id, g_icc_test.channels[channel_idx].sub_channels[sub_chn_idx].wr_buf, 60, sub_chn_idx, ICC_TAKE_SEM_TIMEOUT_JIFFIES)) { icc_print_info("[FAIL] single channel, asynchronous send\n"); return ICC_TEST_FAIL; } icc_print_info("[PASS] single channel, asynchronous send\n"); return ICC_TEST_PASS; }
void icc_sub_channel_info_show_all(u32 msg_type, u32 real_channel_id) { struct icc_uni_channel_info *channel = NULL; u32 i = 0; channel = msg_type? &(g_icc_dbg.channel_stat[real_channel_id]->send): &(g_icc_dbg.channel_stat[real_channel_id]->recv); for(i = 0; i < channel->func_size; i++) { if(channel->sub_chn[i].sum_num_prev != channel->sub_chn[i].sum_num) { icc_print_info("***********sub channel[0x%x]***********\n", i); icc_print_info("msg_len : 0x%x\n", channel->sub_chn[i].sum_len); icc_print_info("msg_num : 0x%x\n", channel->sub_chn[i].sum_num); icc_print_info("sum_num_prev: 0x%x\n", channel->sub_chn[i].sum_num_prev); } channel->sub_chn[i].sum_num_prev = channel->sub_chn[i].sum_num; } }
void icc_init_info_dump(u32 real_channel_id) { struct icc_init_info* info = &(g_icc_init_info[real_channel_id%g_icc_ctrl.channel_size]); if(!info) /*lint !e774 */ { icc_print_error("init_info pointer is NULL!\n"); return; } icc_print_info("***********************************************************************\n"); icc_print_info("icc_init_fifo.real_channel_id: 0x%x\n", info->real_channel_id); icc_print_info("icc_init_fifo.mode: 0x%x\n", info->mode); icc_print_info("icc_init_fifo.send_addr: 0x%p\n", info->send_addr); icc_print_info("icc_init_fifo.fifo_size: 0x%x\n", info->fifo_size); icc_print_info("icc_init_fifo.recv_addr: 0x%p\n", info->recv_addr); icc_print_info("icc_init_fifo.func_size: 0x%x\n", info->func_size); icc_print_info("icc_init_fifo.ipc_send_irq_id: 0x%x\n", info->ipc_send_irq_id); icc_print_info("icc_init_fifo.ipc_recv_irq_id: 0x%x\n", info->ipc_recv_irq_id); icc_print_info("***********************************************************************\n"); }
void icc_struct_dump(void) { icc_print_info("***************************icc结构体信息***************************\n"); icc_print_info("icc初始化信息 : icc_init_info_dump channel_id\n"); icc_print_info("icc_control结构体 : icc_control_dump\n"); icc_print_info("icc_channel结构体 : icc_channel_dump channel_id\n"); icc_print_info("icc_channel_fifo结构体 : icc_channel_fifo_dump channel_id\n"); icc_print_info("icc_channel_vector结构体 : icc_channel_vector_dump channel_id func_id\n"); icc_print_info("结构体显示函数参数说明 : channel_id, 主通道号; fucn_id,子通道号\n"); }
static s32 icc_test_multi_send_func(void *obj) { u32 channel_id = (u32)obj; u32 i = 0; u8 *buf = g_icc_test.channels[GET_CHN_ID(channel_id)].sub_channels[GET_FUNC_ID(channel_id)].wr_buf; for(i = 0; i < ICC_TEST_SEND_CNT; i++) { icc_task_delay(200); icc_print_debug("try to send channel%d's data, buf: 0x%x", channel_id, buf); if(ICC_OK != icc_send_test(ICC_SEND_CPU, channel_id, buf, 30, GET_FUNC_ID(channel_id), ICC_TAKE_SEM_TIMEOUT_JIFFIES)) { icc_print_info("[FAIL] asynchronous send\n"); return ICC_TEST_FAIL; } } icc_print_info("[PASS] asynchronous send\n"); return ICC_TEST_PASS; }
void icc_control_dump(void) { u32 i = 0; icc_print_info("***********************************************************************\n"); icc_print_info("icc_control.cpuid: 0x%x\n", g_icc_ctrl.cpu_id); icc_print_info("icc_control.state: 0x%x\n", g_icc_ctrl.state); icc_print_info("icc_control.shared_task_id: 0x%p\n", g_icc_ctrl.shared_task_id); icc_print_info("icc_control.shared_recv_ipc_irq_id: 0x%x\n", g_icc_ctrl.shared_recv_ipc_irq_id); for(i = 0; i < ICC_CHN_ID_MAX; i++) { if(i < 10) { icc_print_info("icc_control.channels[%d]: 0x%p\n", i, g_icc_ctrl.channels[i]); } else { icc_print_info("icc_control.channels[%d]: 0x%p\n", i, g_icc_ctrl.channels[i]); } } icc_print_info("icc_control.channel_size: 0x%x\n", g_icc_ctrl.channel_size); icc_print_info("***********************************************************************\n"); }
void icc_channel_vector_dump(u32 channel_id, u32 func_id) { struct icc_channel_vector* vector = NULL; channel_id %= g_icc_ctrl.channel_size; func_id %= g_icc_ctrl.channels[channel_id]->func_size; vector = &(g_icc_ctrl.channels[channel_id]->rector[func_id]); if(!vector) { icc_print_error("vector pointer is NULL!\n"); return; } icc_print_info("***********************************************************************\n"); icc_print_info("icc_channel_vector base addr: %p\n", vector); icc_print_info("icc_channel_vector.read_cb: %p\n", vector->read_cb); icc_print_info("icc_channel_vector.read_context: %p\n", vector->read_context); icc_print_info("icc_channel_vector.write_cb: %p\n", vector->write_cb); icc_print_info("icc_channel_vector.write_context: %p\n", vector->write_context); icc_print_info("icc_channel_vector.return_data: 0x%x\n", vector->return_data); icc_print_info("***********************************************************************\n"); }
void icc_msg_dump(struct icc_msg_fifo *queue, u32 start, u32 end) { u32 i = 0; for(i = start; i < end; i++) { icc_print_info("[C SR]*******the latest [%d] msg*******\n", i-start); icc_print_info("channel_id : 0x%x\n", queue->msg[i].channel_id); icc_print_info("send_task_id: 0x%x\n", queue->msg[i].send_task_id); icc_print_info("recv_task_id: 0x%x\n", queue->msg[i].recv_task_id); icc_print_info("length : 0x%x\n", queue->msg[i].len); icc_print_info("pos_in_fifo : 0x%x\n", queue->msg[i].pos); } }
static s32 icc_test_multi_send_sync_func(void *obj) { u32 channel_id = (u32)obj; u32 channel_idx = GET_CHN_ID(channel_id); u32 sub_chn_idx = GET_FUNC_ID(channel_id); u32 i = 0; u32 send_data = 0x10305070; #ifdef ICC_HAS_SYNC_SEND_FEATURE for(i = 0; i < ICC_TEST_SEND_CNT; i++) { if (ICC_SEND_SYNC_RET != bsp_icc_send_sync(ICC_SEND_CPU,channel_id,(u8*)&send_data,sizeof(send_data),MAX_SCHEDULE_TIMEOUT)) /*lint !e40 !e516*/ { icc_print_error("[FAIL] synchronous send!\n"); return ICC_TEST_PASS; } g_icc_test.channels[channel_idx].sub_channels[sub_chn_idx].success_cnt++; } #endif icc_print_info("[PASS] synchronous send\n"); return ICC_TEST_PASS; }
void icc_channel_dump(u32 real_channel_id) { struct icc_channel* channel = g_icc_ctrl.channels[real_channel_id%g_icc_ctrl.channel_size]; u32 i = 0; if(!channel) { icc_print_error("channel pointer is NULL!\n"); return; } icc_print_info("***********************************************************************\n"); icc_print_info("icc_channel address: %p\n", channel); icc_print_info("icc_channel.id: 0x%x\n", channel->id); icc_print_info("icc_channel.state: 0x%x\n", channel->state); icc_print_info("icc_channel.mode: 0x%x\n", channel->mode.val); icc_print_info("icc_channel.task_id: 0x%p\n", channel->private_task_id); icc_print_info("icc_channel.ipc_send_irq_id: 0x%x\n", channel->ipc_send_irq_id); icc_print_info("icc_channel.ipc_recv_irq_id: 0x%x\n", channel->ipc_recv_irq_id); icc_print_info("icc_channel.fifo_recv: %p\n", channel->fifo_recv); icc_print_info("icc_channel.fifo_send: %p\n", channel->fifo_send); for(i = 0; i < channel->func_size; i++) { if(i < 10) { icc_print_info("icc_channel.channel->rector[%d]: 0x%p\n", i, &channel->rector[i]); } else { icc_print_info("icc_channel.channel->rector[%d]: 0x%p\n", i, &channel->rector[i]); } } icc_print_info("icc_channel.func_size: 0x%x\n", channel->func_size); icc_print_info("icc_channel.seq_num_recv 0x%x\n", channel->seq_num_recv); icc_print_info("icc_channel.seq_num_send: 0x%x\n", channel->seq_num_send); icc_print_info("***********************************************************************\n"); }
void icc_help(void) { icc_print_info("***************************************icc调试帮助信息***************************************\n"); icc_print_info("结构体信息dump : icc_struct_dump\n"); icc_print_info("调试打印开关 : icc_dbg_print_sw 0|1\n"); icc_print_info("错误码说明 : icc_errno_show\n"); icc_print_info("收到ipc中断统计 : icc_recv_ipc_int_show\n"); icc_print_info("最近n条收发消息显示 : icc_msg_record_show msg_type msg_num\n"); icc_print_info("单个通道统计信息 : icc_channel_info_show msg_type channel_id\n"); icc_print_info("所有子通道统计信息 : icc_sub_channel_info_show_all msg_type channel_id\n"); icc_print_info("单个子通道统计信息 : icc_sub_channel_info_show msg_type channel_id func_id\n"); icc_print_info("收发消息显示函数参数说明: msg_type, 消息类型(0: 接收; 1: 发送); msg_num, 显示消息个数(<=10)\n"); icc_print_info("通道统计信息函数参数说明: msg_type, 同上; channel_id, 主通道号; fucn_id, 子通道号\n"); }
void icc_print_level_set(u32 level) { (void)bsp_mod_level_set(BSP_MODU_ICC, level); icc_print_info("bsp_mod_level_set(BSP_MODU_ICC=%d, level=%d)\n", BSP_MODU_ICC, level); }
void icc_errno_show(void) { icc_print_info("******************icc错误码信息******************\n"); icc_print_info("0x%x: channel init error\n",ICC_CHN_INIT_FAIL); icc_print_info("0x%x: malloc channel memory fail\n",ICC_MALLOC_CHANNEL_FAIL); icc_print_info("0x%x: malloc rector memory fail\n",ICC_MALLOC_VECTOR_FAIL); icc_print_info("0x%x: create task fail\n",ICC_CREATE_TASK_FAIL); icc_print_info("0x%x: debug init error\n",ICC_DEBUG_INIT_FAIL); icc_print_info("0x%x: create semaphore fail\n",ICC_CREATE_SEM_FAIL); icc_print_info("0x%x: register ipc int fail\n",ICC_REGISTER_INT_FAIL); icc_print_info("0x%x: interface parameter error\n",ICC_INVALID_PARA); icc_print_info("0x%x: fifo is full\n",ICC_INVALID_NO_FIFO_SPACE); icc_print_info("0x%x: sem take timeout\n",ICC_WAIT_SEM_TIMEOUT); icc_print_info("0x%x: send len != expected\n",ICC_SEND_ERR); icc_print_info("0x%x: recv len != expected\n",ICC_RECV_ERR); icc_print_info("0x%x: register read callback fail\n",ICC_REGISTER_CB_FAIL); icc_print_info("0x%x: register dpm fail\n",ICC_REGISTER_DPM_FAIL); icc_print_info("0x%x: malloc memory fail\n",ICC_MALLOC_MEM_FAIL); icc_print_info("0x%x: null pointer\n",ICC_NULL_PTR); }
void icc_recv_ipc_int_show(void) { icc_print_info("*******icc收到的ipc中断统计*******\n"); icc_print_info("ipc_int_cnt: %d\n", g_icc_dbg.ipc_int_cnt); }
void icc_channel_fifo_dump(u32 real_channel_id) { channel_fifo_dump(real_channel_id, 0, "recv fifo"); channel_fifo_dump(real_channel_id, 1, "send fifo"); icc_print_info("**********************************************************************\n"); }
int icc_channel_packet_dump(struct icc_channel_packet *packet) { struct icc_channel *channel = NULL; const char *name = NULL; struct icc_channel_vector *vector = NULL; read_cb_func read_cb = NULL; void *read_context = NULL; int ret = ICC_OK; if (GET_CHN_ID(packet->channel_id) >= ICC_CHN_ID_MAX) { ret = ICC_ERR; name = "unknown"; goto packet_dump; /*lint !e801 */ } channel = g_icc_ctrl.channels[GET_CHN_ID(packet->channel_id)]; if (NULL == channel) { ret = ICC_ERR; name = "unknown"; goto packet_dump; /*lint !e801 */ } name = channel->name; if (GET_FUNC_ID(packet->channel_id) >= channel->func_size) { ret = ICC_ERR; goto packet_dump; /*lint !e801 */ } vector = &channel->rector[GET_FUNC_ID(packet->channel_id)]; read_cb = vector->read_cb; read_context = vector->read_context; if ((0 == g_icc_dbg.msg_print_sw) && (0 == g_icc_ctrl.wake_up_flag) && (0 == g_icc_ctrl.sleep_flag)) { return ret; } if (1 == g_icc_ctrl.wake_up_flag) { g_icc_ctrl.wake_up_flag = 0; icc_print_info("[C SR]icc recv msg dump\n"); } if (1 == g_icc_ctrl.sleep_flag) { g_icc_ctrl.sleep_flag = 0; } packet_dump: icc_pm_om_log(packet, read_cb, read_context); icc_print_info("*******************icc[%s]*******************\n", name); icc_print_info("channel_id : 0x%x\n", packet->channel_id); icc_print_info("len : 0x%x\n", packet->len); icc_print_info("src_cpu_id : 0x%x\n", packet->src_cpu_id); icc_print_info("timestamp : 0x%x\n", packet->timestamp); icc_print_info("task_id : 0x%x\n", packet->task_id); icc_print_info("read_cb : 0x%p\n", read_cb); icc_print_info("read_context: 0x%p\n", read_context); icc_print_info("**********************************************\n"); return ret; }