From 244b2c5ca8b14627e4a17755e5922221e121c771 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Wed, 09 Oct 2024 06:15:07 +0000
Subject: [PATCH] change system file
---
kernel/drivers/rpmsg/rockchip_rpmsg_test.c | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/kernel/drivers/rpmsg/rockchip_rpmsg_test.c b/kernel/drivers/rpmsg/rockchip_rpmsg_test.c
index 08677d6..7f607bd 100644
--- a/kernel/drivers/rpmsg/rockchip_rpmsg_test.c
+++ b/kernel/drivers/rpmsg/rockchip_rpmsg_test.c
@@ -6,17 +6,22 @@
* Author: Hongming Zou <hongming.zou@rock-chips.com>
*/
+#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/rpmsg.h>
#include <linux/rpmsg/rockchip_rpmsg.h>
+#include <linux/time.h>
#include <linux/virtio.h>
#define LINUX_TEST_MSG_1 "Announce master ept id!"
#define LINUX_TEST_MSG_2 "Rockchip rpmsg linux test pingpong!"
-#define MSG_LIMIT 100
+#define MSG_LIMIT 10000
-struct instance_data {
+/* different processor cores may need to adjust the value of this definition */
+#define LINUX_RPMSG_COMPENSATION (1) //ms
+
+struct rpmsg_info_t {
int rx_count;
};
@@ -25,18 +30,19 @@
{
int ret;
uint32_t remote_ept_id;
- struct instance_data *idata = dev_get_drvdata(&rp->dev);
+ struct rpmsg_info_t *info = dev_get_drvdata(&rp->dev);
remote_ept_id = src;
dev_info(&rp->dev, "rx msg %s rx_count %d(remote_ept_id: 0x%x)\n",
- (char *)payload, ++idata->rx_count, remote_ept_id);
+ (char *)payload, ++info->rx_count, remote_ept_id);
/* test should not live forever */
- if (idata->rx_count >= MSG_LIMIT) {
+ if (info->rx_count >= MSG_LIMIT) {
dev_info(&rp->dev, "Rockchip rpmsg test exit!\n");
return 0;
}
+ mdelay(LINUX_RPMSG_COMPENSATION);
/* send a new message now */
ret = rpmsg_sendto(rp->ept, LINUX_TEST_MSG_2, strlen(LINUX_TEST_MSG_2), remote_ept_id);
if (ret)
@@ -48,17 +54,17 @@
{
int ret;
uint32_t master_ept_id, remote_ept_id;
- struct instance_data *idata;
+ struct rpmsg_info_t *info;
master_ept_id = rp->src;
remote_ept_id = rp->dst;
dev_info(&rp->dev, "new channel: 0x%x -> 0x%x!\n", master_ept_id, remote_ept_id);
- idata = devm_kzalloc(&rp->dev, sizeof(*idata), GFP_KERNEL);
- if (!idata)
+ info = devm_kzalloc(&rp->dev, sizeof(*info), GFP_KERNEL);
+ if (!info)
return -ENOMEM;
- dev_set_drvdata(&rp->dev, idata);
+ dev_set_drvdata(&rp->dev, info);
/*
* send a message to our remote processor, and tell remote
@@ -69,7 +75,7 @@
dev_err(&rp->dev, "rpmsg_send failed: %d\n", ret);
return ret;
}
-
+ mdelay(LINUX_RPMSG_COMPENSATION);
ret = rpmsg_sendto(rp->ept, LINUX_TEST_MSG_2, strlen(LINUX_TEST_MSG_2), remote_ept_id);
if (ret) {
dev_err(&rp->dev, "rpmsg_send failed: %d\n", ret);
@@ -86,6 +92,7 @@
static struct rpmsg_device_id rockchip_rpmsg_test_id_table[] = {
{ .name = "rpmsg-ap3-ch0" },
+ { .name = "rpmsg-mcu0-test" },
{ /* sentinel */ },
};
--
Gitblit v1.6.2