LINUX用户态代码如何访问DSP对应消息

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LINUX用户态代码如何访问DSP对应消息

1,010 次查看
luoqiaofa
Contributor II
DSP代码如下:
请问LINXU用用户态代码如何编写 程序才能访问 DS中ipcRxCallback 代码,多谢
0 项奖励
5 回复数

894 次查看
luoqiaofa
Contributor II

请问如下配置是否正确?

#define MSG_REQ_MAX_BUF_SIZE 1024 /* bytes per TTI */
#define MSG_REQ_DEPTH (1) /* as told in DSD L2L1integration */

if (fsl_ipc_open_prod_ch(cid, fipc_priv.ipc) != 0)
{
return -1;
}

printf("fipc_open_MSG_channel: channel=%d\n", cid);

r.size = MSG_REQ_MAX_BUF_SIZE * (MSG_REQ_DEPTH + 1);
ret = fsl_usmmgr_alloc(&r, fipc_priv.usmmgr);
if (ret) {
goto on_msg_open_error;
}

/* L1 expects DDR address to be 256 bytes aligned */
if (r.phys_addr % 256)
{
r.phys_addr += 256 - (r.phys_addr % 256);
}

ret = fsl_ipc_configure_channel(cid, MSG_REQ_DEPTH, IPC_MSG_CH, r.phys_addr, MSG_REQ_MAX_BUF_SIZE, NULL, fipc_priv.ipc);
if (ret) {
goto on_msg_open_error;
}

0 项奖励

894 次查看
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the attached example code, please refer to "channel67_thread" function in the attached file from package ipc-ust.

0 项奖励

894 次查看
luoqiaofa
Contributor II

示例代码中并没有 IPC_MSG_CH 这种代码的消息收发示例

这与DSP中的消息类型定义 OS_HET_IPC_MESSAGE_CH 是一致的吧?

所以我想问的是,如何配置并使用此类消息?

LINUX 用户态代码是不是相应使用如下接口

int fsl_ipc_configure_channel(uint32_t channel_id, uint32_t depth,
ipc_ch_type_t channel_type,
unsigned long msg_ring_paddr, uint32_t msg_size,
ipc_cbfunc_t cbfunc, fsl_ipc_t ipc)

fsl_ipc_configure_channel(VS_REQUEST_CH_ID, 1, IPC_MSG_CH, msg_ring_paddr, 256, NULL, fipc_priv.ipc) 

请问参数是否是这填写?  msg_ring_paddr 是指的是物理地址? 使用 ipc_v2p 转换后得到的地址么?

 
pastedImage_1.png

pastedImage_2.png

0 项奖励

894 次查看
yipingwang
NXP TechSupport
NXP TechSupport

1. Linux
The IPC layer never allocates any memory, the application invoking IPC should pre-allocate memory and attach to the
channel.
For example:
• - For MSG_CH, the consumer application when calling fsl_ipc_configure_channel, should set the msg_ring memory
equal to the msg_size*depth and aligned to the msg_size
• - For TXREQ_CH, the producer application should call fsl_ipc_configure_txreq to provide buffers where linearization
should be done by DMA.


2. SmartDSP OS
The IPC layer will allocate OS internal structures for optimizing the access to the IPC control area. Buffers, used by
message channels, are to be pre-allocated by the application and the memory manager (os_mem_part_t*) handle will
be passed during opening the channel.

int fsl_ipc_configure_channel(uint32_t channel_id,
uint32_t depth,
ipc_ch_type_t channel_type,
unsigned long msg_ring_paddr,
uint32_t msg_size,
ipc_cbfunc_t cbfunc,
fsl_ipc_t ipc);

channel_id - [IN][M]unique id of the channel
*
* depth - [IN][M]user configurable number of entries in the ring.
* depth <= max depth
*
* channel_type - [IN][M]either of IPC_PTR_CH/IPC_MSG_CH
*
* msg_ring_paddr - [IN]Physical address of the message ring. Required
* only for IPC_MSG_CH
*
* msg_size - [IN]max size of each message.
* For PTR_CH, msg_ring_vaddr, msg_ring_paddr, msg_size
* are all NULL. Required only for IPC_MSG_CH
*

* cbfunc - [IN]The callback function called on receiving interrupt
* from the producer. If cbfunc is NULL, channel does not
* support notifications.
*

0 项奖励

894 次查看
yipingwang
NXP TechSupport
NXP TechSupport

IPC module is provided as user space library (libipc.so) and loadable kernel modules. Apart from providing APIs for L2-L1 communication, a hugepage based user space shared memory manager is also provided as a user space library
(libmem.so). In order to use IPC services, user space application needs to be linked with these libraries.

For details, please refer to "9.3.2.1 IPC User Guide" in QorIQ Linux SDK 2.0 document.

0 项奖励