fixed msg_transfer issues

This commit is contained in:
xianfeng.du 2023-08-02 09:09:41 +08:00
parent f3dc68a2f2
commit b16159b07a
2 changed files with 10 additions and 2 deletions

View File

@ -149,7 +149,11 @@ int32_t msg_transfer_alloc_msg(int32_t handle_id, uint16_t cu_flag, uint32_t buf
*(uint32_t *)buf = ch->bufAddr + ch->offset;
UCP_PRINT_LOG("msg_transfer_alloc_msg,buf:0x%08x,availableSize:0x%08x,offset:0x%08x", *(uint32_t *)buf, ch->availableSize, ch->offset);
#else
uint32_t availableLength = ch->bufSize - MSG_MBUF_HEAD_SIZE;
int32_t availableLength = ch->bufSize - MSG_MBUF_HEAD_SIZE;
if(0 >= availableLength) {
return UNINITIALIZED_QUEUE;
}
*availableSize = availableLength;
if (bufSize > availableLength) {
UCP_PRINT_ERROR("msg_transfer_alloc_msg,OUT_OF_BLOCK_MEMORY");
@ -157,6 +161,9 @@ int32_t msg_transfer_alloc_msg(int32_t handle_id, uint16_t cu_flag, uint32_t buf
}
msg_buf = msg_queue_ul_alloc_buf(inst_id,que_id,&buf_id);
if(NULL == msg_buf){
return UNINITIALIZED_QUEUE;
}
*(uint32_t *)buf = (uint32_t)msg_buf;
*offset = buf_id;//redefine offset to buf_id
#endif
@ -201,7 +208,7 @@ int32_t msg_transfer_send_msg(int32_t handle_id, uint16_t cu_flag, uint8_t* msg_
MsgMemBufAttr_t *mbuf = (MsgMemBufAttr_t *)get_mbuf_ptr(ch->bufBase, ch->bufSize, idx);
do_write(&mbuf->msgSize, msg_len);
__ucps2_synch(0);
uint32_t value = (inst_id << 24) + (que_id << 16) + idx;
int32_t ret = ecs_hw_que_send(ECS_RFM_SPU0_HW_QUEUE, value);
#endif

View File

@ -52,6 +52,7 @@ ALWAYS_INLINE uint8_t* msg_queue_ul_alloc_buf(uint8_t inst_id, uint8_t que_id, u
if (NULL == mbuf)
{
UCP_PRINT_ERROR("msg_queue_ul_alloc_buf: mbuf ERROR!");
return NULL;
}
uint8_t *buf = (uint8_t *)&mbuf[1];
*buf_id = idx;