drivers/rptun: Add 'RPTUN_CONFIG' interface.

Change-Id: I1c6177ffe0c49c385f0d784b1ff0dbb69b6432f8
Signed-off-by: zhongan <zhongan@xiaomi.com>
This commit is contained in:
zhongan 2020-05-21 12:24:56 +08:00 committed by Abdelatif Guettouche
parent b256b2055f
commit 2818b6b2c0
2 changed files with 31 additions and 0 deletions

View File

@ -112,6 +112,7 @@ static int rptun_mmap(FAR struct remoteproc *rproc,
FAR metal_phys_addr_t *pa, FAR metal_phys_addr_t *da,
FAR void **va, size_t size, unsigned int attribute,
FAR struct metal_io_region **io_);
static int rptun_config(struct remoteproc *rproc, void *data);
static int rptun_start(FAR struct remoteproc *rproc);
static int rptun_stop(FAR struct remoteproc *rproc);
static int rptun_notify(FAR struct remoteproc *rproc, uint32_t id);
@ -147,6 +148,7 @@ static struct remoteproc_ops g_rptun_ops =
.init = rptun_init,
.remove = rptun_remove,
.mmap = rptun_mmap,
.config = rptun_config,
.start = rptun_start,
.stop = rptun_stop,
.notify = rptun_notify,
@ -269,6 +271,18 @@ static int rptun_mmap(FAR struct remoteproc *rproc,
return 0;
}
static int rptun_config(struct remoteproc *rproc, void *data)
{
struct rptun_priv_s *priv = rproc->priv;
if (RPTUN_IS_MASTER(priv->dev))
{
return RPTUN_CONFIG(priv->dev, data);
}
return 0;
}
static int rptun_start(FAR struct remoteproc *rproc)
{
FAR struct rptun_priv_s *priv = rproc->priv;

View File

@ -156,6 +156,22 @@
#define RPTUN_IS_MASTER(d) ((d)->ops->is_master(d))
/****************************************************************************
* Name: RPTUN_CONFIG
*
* Description:
* CONFIG remote cpu
*
* Input Parameters:
* dev - Device-specific state data
* data - Device-specific private data
*
* Returned Value:
* OK unless an error occurs. Then a negated errno value is returned
*
****************************************************************************/
#define RPTUN_CONFIG(d, p) ((d)->ops->config(d, p))
/****************************************************************************
* Name: RPTUN_START
*
@ -276,6 +292,7 @@ struct rptun_ops_s
CODE bool (*is_autostart)(FAR struct rptun_dev_s *dev);
CODE bool (*is_master)(FAR struct rptun_dev_s *dev);
CODE int (*config)(struct rptun_dev_s *dev, void *data);
CODE int (*start)(FAR struct rptun_dev_s *dev);
CODE int (*stop)(FAR struct rptun_dev_s *dev);
CODE int (*notify)(FAR struct rptun_dev_s *dev, uint32_t vqid);