]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/open-amp.git/commitdiff
rpmsg_init: caller to control whether to init env
authorWendy Liang <jliang@xilinx.com>
Tue, 28 Jun 2016 23:08:47 +0000 (16:08 -0700)
committerWendy Liang <jliang@xilinx.com>
Thu, 13 Oct 2016 05:01:43 +0000 (22:01 -0700)
Add parameter to rpmsg_init() to allow caller to specify
whether to initialize environment in the function.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
lib/include/openamp/rpmsg.h
lib/remoteproc/remoteproc.c
lib/rpmsg/rpmsg.c

index 1230f6b35b4be5a2daed7a7fe26b8072bdd366d5..8bf92981c81aeefd9d75031187f981f1e30b6e54 100644 (file)
@@ -330,6 +330,7 @@ static inline int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev,
  * @param channel_destroyed - callback function for channel deletion
  * @default_cb              - default callback for channel
  * @param role              - role of the other device, Master or Remote
+ * @param init_env          - 1 to initialize env, 0 not to
  * @return - status of function execution
  *
  */
@@ -337,7 +338,8 @@ static inline int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev,
 int rpmsg_init(int dev_id, struct remote_device **rdev,
               rpmsg_chnl_cb_t channel_created,
               rpmsg_chnl_cb_t channel_destroyed,
-              rpmsg_rx_cb_t default_cb, int role);
+              rpmsg_rx_cb_t default_cb, int role,
+              int init_env);
 
 /**
  * rpmsg_deinit
index 56fb333cfdb11206ebb113f8a38111e4b1d1a630..cf51ee51168d9038e1f9c43a55ab08cdf90245f3 100644 (file)
@@ -91,7 +91,7 @@ int remoteproc_resource_init(struct rsc_table_info *rsc_info,
                                    rpmsg_init(rproc->proc->cpu_id,
                                               &rproc->rdev, channel_created,
                                               channel_destroyed, default_cb,
-                                              RPMSG_MASTER);
+                                              RPMSG_MASTER, 0);
                        } else {
                                status = RPROC_ERR_NO_RSC_TABLE;
                        }
@@ -345,14 +345,14 @@ int remoteproc_boot(struct remote_proc *rproc)
                                               &rproc->rdev,
                                               rproc->channel_created,
                                               rproc->channel_destroyed,
-                                              rproc->default_cb, RPMSG_MASTER);
+                                              rproc->default_cb, RPMSG_MASTER, 0);
 #else
                                status =
                                    rpmsg_init(rproc->proc->cpu_id,
                                               &rproc->rdev,
                                               rproc->channel_created,
                                               rproc->channel_destroyed,
-                                              rproc->default_cb, RPMSG_REMOTE);
+                                              rproc->default_cb, RPMSG_REMOTE, 0);
 #endif
                        }
                } else {
index 9a3549643e8026425803ec7687ffe4e749469783..0497ff82f8738aa9d3ae01834f5b7d682bae1e70 100644 (file)
@@ -72,6 +72,7 @@
  * @param channel_destroyed - callback function for channel deletion
  * @param default_cb        - default callback for channel I/O
  * @param role              - role of the other device, Master or Remote
+ * @param init_env          - 1 to initialize env, 0 not to
  *
  * @return - status of function execution
  *
 int rpmsg_init(int dev_id, struct remote_device **rdev,
               rpmsg_chnl_cb_t channel_created,
               rpmsg_chnl_cb_t channel_destroyed,
-              rpmsg_rx_cb_t default_cb, int role)
+              rpmsg_rx_cb_t default_cb, int role,
+              int init_env)
 {
        int status;
 
-       /* Initialize IPC environment */
-       struct metal_init_params init_params = METAL_INIT_DEFAULTS;
-       status = metal_init(&init_params);
+       if (init_env) {
+               /* Initialize IPC environment */
+               struct metal_init_params init_params = METAL_INIT_DEFAULTS;
+               status = metal_init(&init_params);
+               if (status != RPMSG_SUCCESS)
+                       return status;
+       }
+
+       /* Initialize the remote device for given cpu id */
+       status = rpmsg_rdev_init(rdev, dev_id, role, channel_created,
+                                channel_destroyed, default_cb);
        if (status == RPMSG_SUCCESS) {
-               /* Initialize the remote device for given cpu id */
-               status = rpmsg_rdev_init(rdev, dev_id, role, channel_created,
-                                        channel_destroyed, default_cb);
-               if (status == RPMSG_SUCCESS) {
-                       /* Kick off IPC with the remote device */
-                       status = rpmsg_start_ipc(*rdev);
-               }
+               /* Kick off IPC with the remote device */
+               status = rpmsg_start_ipc(*rdev);
        }
 
        /* Deinit system in case of error */