[Cbe-oss-dev] [PATCH 13/17]MARS/modules/task: Add get ticks
Yuji Mano
yuji.mano at am.sony.com
Wed Dec 3 13:59:16 EST 2008
This adds the get ticks function to the Task API.
Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
modules/task/include/host/mars/task.h | 5 +++++
modules/task/include/mpu/mars/task.h | 11 +++++++++++
modules/task/src/host/lib/task.c | 5 +++++
modules/task/src/mpu/lib/task.c | 5 +++++
modules/task/src/mpu/module/task_module.c | 6 ++++++
modules/task/src/mpu/module/task_module.h | 1 +
6 files changed, 33 insertions(+)
--- a/modules/task/include/host/mars/task.h
+++ b/modules/task/include/host/mars/task.h
@@ -168,6 +168,11 @@ int mars_task_wait(struct mars_task_id *
*/
int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code);
+/**
+ * \ingroup group_mars_task
+ */
+uint32_t mars_task_get_ticks(void);
+
#if defined(__cplusplus)
}
#endif
--- a/modules/task/include/mpu/mars/task.h
+++ b/modules/task/include/mpu/mars/task.h
@@ -229,6 +229,17 @@ int mars_task_try_wait(struct mars_task_
/**
* \ingroup group_mars_task
+ * \brief <b>[host/MPU]</b> Gets tick counter value.
+ *
+ * \note Counter's frequency depends on runtime environment.
+ *
+ * \return
+ * uint32_t - 32-bit tick counter value
+ */
+uint32_t mars_task_get_ticks(void);
+
+/**
+ * \ingroup group_mars_task
* \brief <b>[MPU]</b> Gets id of kernel that the task is being executed on.
*
* \return
--- a/modules/task/src/host/lib/task.c
+++ b/modules/task/src/host/lib/task.c
@@ -370,3 +370,8 @@ int mars_task_try_wait(struct mars_task_
return MARS_SUCCESS;
}
+
+uint32_t mars_task_get_ticks(void)
+{
+ return mars_get_ticks();
+}
--- a/modules/task/src/mpu/lib/task.c
+++ b/modules/task/src/mpu/lib/task.c
@@ -157,6 +157,11 @@ int mars_task_try_wait(struct mars_task_
return MARS_SUCCESS;
}
+uint32_t mars_task_get_ticks(void)
+{
+ return (*mars_task_module_syscalls->get_ticks)();
+}
+
uint32_t mars_task_get_kernel_id(void)
{
return (*mars_task_module_syscalls->get_kernel_id)();
--- a/modules/task/src/mpu/module/task_module.c
+++ b/modules/task/src/mpu/module/task_module.c
@@ -51,6 +51,11 @@ static struct mars_task_context_save_uni
typedef void (*mars_task_entry)(struct mars_task_args *args,
struct mars_task_module_syscalls *task_module_syscalls);
+static uint32_t get_ticks(void)
+{
+ return mars_module_get_ticks();
+}
+
static uint32_t get_kernel_id(void)
{
return mars_module_get_kernel_id();
@@ -391,6 +396,7 @@ static int task_signal_try_wait(void)
static struct mars_task_module_syscalls task_module_syscalls =
{
+ get_ticks,
get_kernel_id,
get_task,
get_task_by_id,
--- a/modules/task/src/mpu/module/task_module.h
+++ b/modules/task/src/mpu/module/task_module.h
@@ -54,6 +54,7 @@
/* mars task module syscalls */
struct mars_task_module_syscalls {
+ uint32_t (*get_ticks)(void);
uint32_t (*get_kernel_id)(void);
struct mars_task_context * (*get_task)(void);
struct mars_task_context * (*get_task_by_id)
More information about the cbe-oss-dev
mailing list