driver/rtc: add config RTC_RPMSG_SERVER_NAME to

specified the name of remote proc(rpmsg server)

Change-Id: I0086bb43727a2bbb5e68f88907b5e4608182ef9c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2021-04-24 14:18:21 +08:00 committed by Alan Carvalho de Assis
parent 018cf26605
commit f082893b9a
5 changed files with 15 additions and 10 deletions

View File

@ -240,7 +240,7 @@ int up_rptun_init(void)
#endif #endif
#if CONFIG_SIM_RPTUN_MASTER == 0 #if CONFIG_SIM_RPTUN_MASTER == 0
up_rtc_set_lowerhalf(rpmsg_rtc_initialize("server", 0)); up_rtc_set_lowerhalf(rpmsg_rtc_initialize(0));
#endif #endif
#ifdef CONFIG_FS_HOSTFS_RPMSG #ifdef CONFIG_FS_HOSTFS_RPMSG

View File

@ -50,6 +50,7 @@ CONFIG_RTC_ARCH=y
CONFIG_RTC_DRIVER=y CONFIG_RTC_DRIVER=y
CONFIG_RTC_EXTERNAL=y CONFIG_RTC_EXTERNAL=y
CONFIG_RTC_RPMSG=y CONFIG_RTC_RPMSG=y
CONFIG_RTC_RPMSG_SERVER_NAME="server"
CONFIG_SCHED_CHILD_STATUS=y CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y CONFIG_SCHED_HPWORK=y

View File

@ -297,6 +297,13 @@ config RTC_RPMSG
depends on OPENAMP depends on OPENAMP
select ARCH_HAVE_RTC_SUBSECONDS select ARCH_HAVE_RTC_SUBSECONDS
config RTC_RPMSG_SERVER_NAME
string "The name of RTC Rpmsg Server"
depends on RTC_RPMSG
---help---
The proc name of rtc server. Client requests time from
specified name of remote proc.
endif # RTC endif # RTC
menuconfig WATCHDOG menuconfig WATCHDOG

View File

@ -107,7 +107,6 @@ struct rpmsg_rtc_lowerhalf_s
*/ */
struct rpmsg_endpoint ept; struct rpmsg_endpoint ept;
FAR const char *cpuname;
struct work_s syncwork; struct work_s syncwork;
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM
@ -229,7 +228,8 @@ static void rpmsg_rtc_device_created(FAR struct rpmsg_device *rdev,
{ {
FAR struct rpmsg_rtc_lowerhalf_s *lower = priv; FAR struct rpmsg_rtc_lowerhalf_s *lower = priv;
if (strcmp(lower->cpuname, rpmsg_get_cpuname(rdev)) == 0) if (strcmp(CONFIG_RTC_RPMSG_SERVER_NAME,
rpmsg_get_cpuname(rdev)) == 0)
{ {
lower->ept.priv = lower; lower->ept.priv = lower;
@ -244,7 +244,8 @@ static void rpmsg_rtc_device_destroy(FAR struct rpmsg_device *rdev,
{ {
FAR struct rpmsg_rtc_lowerhalf_s *lower = priv; FAR struct rpmsg_rtc_lowerhalf_s *lower = priv;
if (strcmp(lower->cpuname, rpmsg_get_cpuname(rdev)) == 0) if (strcmp(CONFIG_RTC_RPMSG_SERVER_NAME,
rpmsg_get_cpuname(rdev)) == 0)
{ {
rpmsg_destroy_ept(&lower->ept); rpmsg_destroy_ept(&lower->ept);
} }
@ -681,7 +682,6 @@ static void rpmsg_rtc_server_ns_bind(FAR struct rpmsg_device *rdev,
* Take remote core RTC as external RTC hardware through rpmsg. * Take remote core RTC as external RTC hardware through rpmsg.
* *
* Input Parameters: * Input Parameters:
* cpuname - current cpu name
* minor - device minor number * minor - device minor number
* *
* Returned Value: * Returned Value:
@ -690,8 +690,7 @@ static void rpmsg_rtc_server_ns_bind(FAR struct rpmsg_device *rdev,
* *
****************************************************************************/ ****************************************************************************/
FAR struct rtc_lowerhalf_s *rpmsg_rtc_initialize(FAR const char *cpuname, FAR struct rtc_lowerhalf_s *rpmsg_rtc_initialize(int minor)
int minor)
{ {
FAR struct rpmsg_rtc_lowerhalf_s *lower; FAR struct rpmsg_rtc_lowerhalf_s *lower;
@ -699,7 +698,6 @@ FAR struct rtc_lowerhalf_s *rpmsg_rtc_initialize(FAR const char *cpuname,
if (lower) if (lower)
{ {
lower->ops = &g_rpmsg_rtc_ops; lower->ops = &g_rpmsg_rtc_ops;
lower->cpuname = cpuname;
rpmsg_register_callback(lower, rpmsg_register_callback(lower,
rpmsg_rtc_device_created, rpmsg_rtc_device_created,

View File

@ -42,8 +42,7 @@ extern "C"
#ifdef CONFIG_RTC_RPMSG #ifdef CONFIG_RTC_RPMSG
FAR struct rtc_lowerhalf_s *rpmsg_rtc_initialize(FAR const char *cpu_name, FAR struct rtc_lowerhalf_s *rpmsg_rtc_initialize(int minor);
int minor);
FAR struct rtc_lowerhalf_s *rpmsg_rtc_server_initialize( FAR struct rtc_lowerhalf_s *rpmsg_rtc_server_initialize(
FAR struct rtc_lowerhalf_s *lower); FAR struct rtc_lowerhalf_s *lower);