Use libmetal sleep and timestamp APIs
authorWendy Liang <jliang@xilinx.com>
Sat, 15 Oct 2016 00:29:34 +0000 (17:29 -0700)
committerWendy Liang <jliang@xilinx.com>
Sat, 15 Oct 2016 04:40:00 +0000 (21:40 -0700)
Replace the OpenAMP sleep and timestamp APIs with
those provided from libmetal.

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

index b522aa2ac31d18635dd0454582f2949dd14c908b..301c7e27de7d88a7054caf20788b45f0e4d43524 100644 (file)
@@ -50,6 +50,7 @@
 #include <metal/device.h>
 #include <metal/shmem.h>
 #include <metal/utilities.h>
+#include <metal/time.h>
 
 #define DEFAULT_VRING_MEM_SIZE 0x10000
 
@@ -360,7 +361,7 @@ int hil_boot_cpu(struct hil_proc *proc, unsigned int start_addr)
                proc->ops->boot_cpu(proc, start_addr);
        }
 #if defined (OPENAMP_BENCHMARK_ENABLE)
-       boot_time_stamp = env_get_timestamp();
+       boot_time_stamp = metal_get_timestamp();
 #endif
 
        return 0;
@@ -380,7 +381,7 @@ void hil_shutdown_cpu(struct hil_proc *proc)
                proc->ops->shutdown_cpu(proc);
        }
 #if defined (OPENAMP_BENCHMARK_ENABLE)
-       shutdown_time_stamp = env_get_timestamp();
+       shutdown_time_stamp = metal_get_timestamp();
 #endif
 }
 
index a399d89b6f9ede818513b82dbf4e78c9261ac180..c86e92a688756e7f1832ed15eacd9ad8f010eec4 100644 (file)
 #define openamp_dbg(...)
 #endif
 
-/**
- * env_sleep_msec
- *
- * Suspends the calling thread for given time in msecs.
- *
- * @param num_msec -  delay in msecs
- */
-void env_sleep_msec(int num_msec);
-
-/**
- * env_get_timestamp
- *
- * Returns a 64 bit time stamp.
- *
- *
- */
-unsigned long long env_get_timestamp(void);
-
 #endif                         /* _ENV_H_ */
index 50fb8c6b6bf33455aa1b361c6df420260bbef6d4..406532214b1f20766fe469e368a8fc352f4c2eb2 100644 (file)
@@ -36,6 +36,7 @@
 #include "openamp/hil.h"
 #include "metal/sys.h"
 #include "metal/alloc.h"
+#include "metal/sleep.h"
 
 /**
  * remoteproc_resource_init
@@ -291,7 +292,7 @@ int remoteproc_boot(struct remote_proc *rproc)
                        if (status == RPROC_SUCCESS) {
                                /* Wait for remote side to come up. This delay is arbitrary and may
                                 * need adjustment for different configuration of remote systems */
-                               env_sleep_msec(RPROC_BOOT_DELAY);
+                               metal_sleep_usec(RPROC_BOOT_DELAY);
 
                                /* Initialize RPMSG "messaging" component */
 
index c48d12ac89b84acd24411e2554904ae1ae682957..32943d65f63e897b2897e035b4b79b01f497b928 100644 (file)
@@ -58,6 +58,7 @@
 #include "openamp/rpmsg.h"
 #include "metal/sys.h"
 #include "metal/cache.h"
+#include "metal/sleep.h"
 
 /**
  * rpmsg_init
@@ -177,7 +178,7 @@ int rpmsg_send_offchannel_raw(struct rpmsg_channel *rp_chnl, uint32_t src,
                 * Wait parameter is true - pool the buffer for
                 * 15 secs as defined by the APIs.
                 */
-               env_sleep_msec(RPMSG_TICKS_PER_INTERVAL);
+               metal_sleep_usec(RPMSG_TICKS_PER_INTERVAL);
                metal_mutex_acquire(&rdev->lock);
                buffer = rpmsg_get_tx_buffer(rdev, &buff_len, &idx);
                metal_mutex_release(&rdev->lock);
@@ -333,7 +334,7 @@ void *rpmsg_get_tx_payload_buffer(struct rpmsg_channel *rpdev, uint32_t *size,
                         * Wait parameter is true - pool the buffer for
                         * 15 secs as defined by the APIs.
                         */
-                       env_sleep_msec(RPMSG_TICKS_PER_INTERVAL);
+                       metal_sleep_usec(RPMSG_TICKS_PER_INTERVAL);
                        metal_mutex_acquire(&rdev->lock);
                        hdr = (struct rpmsg_hdr *) rpmsg_get_tx_buffer(rdev, &buff_len, &idx);
                        metal_mutex_release(&rdev->lock);