Supports inter-nuclear communication

This commit is contained in:
anguoyoula 2024-01-15 15:39:47 +08:00
parent 255d7464f7
commit 0923c6239a
8 changed files with 45 additions and 19 deletions

View File

@ -201,3 +201,24 @@ saveenv
## 四、核间通信测试
> XiUOS 将收到的数据打印后返回到Linux
### 1、烧录A55端的Linux和M33端的XiUOS
<div align= "center"><img src = img/rpmsg_begin.png></div>
### 2、在M33端创建监听任务
```c
CreateRPMsgTask // 该命令会创建一个通信节点在探测到Linux的第一条信息时该通信节点被激活
```
<div align= "center"><img src = img/rpmsg_create.png></div>
### 3、在Linux端启动核间通信测试例程
```c
rpmsg_sample_client 0
```
<div align= "center"><img src = img/rpmsg_test_begin.png></div>
### 3、测试结果
<div align= "center"><img src = img/rpmsg_test_result.png></div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 KiB

View File

@ -297,7 +297,7 @@ void platform_release_rpmsg_vdev (void * platform, struct rpmsg_device * rpdev)
struct rpmsg_virtio_device * rpmsg_vdev; struct rpmsg_virtio_device * rpmsg_vdev;
struct remoteproc_priv * prproc = rproc->priv; struct remoteproc_priv * prproc = rproc->priv;
KMutexDelete(ipi.ipi_mutx_id[prproc->notify_id]); // KMutexDelete(ipi.ipi_mutx_id[prproc->notify_id]);
ipi.ipi_mutx_id[prproc->notify_id] = -1; ipi.ipi_mutx_id[prproc->notify_id] = -1;
KTaskDelete(ipi_tsk_id[prproc->notify_id]); KTaskDelete(ipi_tsk_id[prproc->notify_id]);
@ -363,11 +363,12 @@ static void* IpiTask (void * exinf)
while (1) while (1)
{ {
// extern long ShowTask(void); if (ipi.ipi_mutx_id[prproc->notify_id] != 1)
// ShowTask(); {
__WFI();
KMutexObtain(ipi.ipi_mutx_id[prproc->notify_id], WAITING_FOREVER); continue;
// KPrintf("IpiTask: after KSemaphoreObtain\n"); }
// KMutexObtain(ipi.ipi_mutx_id[prproc->notify_id], WAITING_FOREVER);
/* Ignore a incoming interrupt if the virtio layer of a target remoteproc is not yet initialized */ /* Ignore a incoming interrupt if the virtio layer of a target remoteproc is not yet initialized */
if (metal_list_is_empty(&rproc->vdevs)) if (metal_list_is_empty(&rproc->vdevs))
@ -381,8 +382,8 @@ static void* IpiTask (void * exinf)
KPrintf("remoteproc_get_notification() failed with %d", ret); KPrintf("remoteproc_get_notification() failed with %d", ret);
break; break;
} }
ipi.ipi_mutx_id[prproc->notify_id] = 0;
DelayKTask(10); // DelayKTask(10);
} }
} }
@ -391,14 +392,14 @@ static void start_ipi_task (void * platform)
struct remoteproc * rproc = platform; struct remoteproc * rproc = platform;
struct remoteproc_priv * prproc = rproc->priv; struct remoteproc_priv * prproc = rproc->priv;
int32 mutx_id = KMutexCreate(); // int32 mutx_id = KMutexCreate();
// if (mutx_id < 0)
if (mutx_id < 0) // {
{ // KPrintf("start_ipi_task: create sem fail!\n");
KPrintf("start_ipi_task: create sem fail!\n"); // return ;
return ; // }
} // ipi.ipi_mutx_id[prproc->notify_id] = mutx_id;
ipi.ipi_mutx_id[prproc->notify_id] = mutx_id; ipi.ipi_mutx_id[prproc->notify_id] = 0;
// KPrintf("start_ipi_task: prproc->notify_id = %d, ipi.ipi_mutx_id[prproc->notify_id] = %d \n",prproc->notify_id,ipi.ipi_mutx_id[prproc->notify_id]); // KPrintf("start_ipi_task: prproc->notify_id = %d, ipi.ipi_mutx_id[prproc->notify_id] = %d \n",prproc->notify_id,ipi.ipi_mutx_id[prproc->notify_id]);

View File

@ -67,7 +67,7 @@ struct ipi_info
int registered; int registered;
unsigned int mbx_chn[CFG_RPMSG_SVCNO]; unsigned int mbx_chn[CFG_RPMSG_SVCNO];
unsigned int chn_mask; /**< IPI channel mask */ unsigned int chn_mask; /**< IPI channel mask */
int32 ipi_mutx_id[CFG_RPMSG_SVCNO]; volatile int32 ipi_mutx_id[CFG_RPMSG_SVCNO];
}; };
struct shm_info struct shm_info

View File

@ -109,9 +109,13 @@ static int rzv2_mhu_callback (mhu_callback_args_t * p_args)
return METAL_IRQ_NOT_HANDLED; /* Invalid message arrived */ return METAL_IRQ_NOT_HANDLED; /* Invalid message arrived */
} }
if (ipi.ipi_mutx_id[val] >= 0) // if (ipi.ipi_mutx_id[val] >= 0)
// {
// KMutexAbandon(ipi.ipi_mutx_id[val]);
// }
if (ipi.ipi_mutx_id[val] != -1)
{ {
KMutexAbandon(ipi.ipi_mutx_id[val]); ipi.ipi_mutx_id[val] = 1;
} }
else else
{ {