summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorJeenu Viswambharan <jeenu.viswambharan@arm.com>2016-08-09 15:26:55 +0100
committerJeenu Viswambharan <jeenu.viswambharan@arm.com>2016-09-06 18:21:29 +0100
commit620ee44566591a3ade345da5a3741867ae31b436 (patch)
tree6fdbf197851ca961cd798248650d92d8f26e479c /framework
parent9fbd13ee27da46a7159cc53d9366175e85458274 (diff)
Introduce a convenient sleep function
The sleep function constructs a PSCI state ID, and calls tftf_program_timer_and_suspend to have the calling CPU suspended for the specified duration. Change-Id: I6822e3a051cc147093724d4b92f17516a3641484
Diffstat (limited to 'framework')
-rw-r--r--framework/timer/timer_framework.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/framework/timer/timer_framework.c b/framework/timer/timer_framework.c
index ad22b42..4adff6f 100644
--- a/framework/timer/timer_framework.c
+++ b/framework/timer/timer_framework.c
@@ -271,6 +271,25 @@ int tftf_program_timer_and_suspend(unsigned long milli_secs,
return rc;
}
+int tftf_timer_sleep(unsigned long milli_secs)
+{
+ int ret, power_state;
+ uint32_t stateid;
+
+ ret = tftf_psci_make_composite_state_id(MPIDR_AFFLVL0,
+ PSTATE_TYPE_STANDBY, &stateid);
+ if (ret != PSCI_E_SUCCESS)
+ return -1;
+
+ power_state = tftf_make_psci_pstate(MPIDR_AFFLVL0, PSTATE_TYPE_STANDBY,
+ stateid);
+ ret = tftf_program_timer_and_suspend(milli_secs, power_state);
+ if (ret != 0)
+ return -1;
+
+ return 0;
+}
+
int tftf_cancel_timer(void)
{
unsigned int core_pos = platform_get_core_pos(read_mpidr_el1());