aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/gtimer/src/mod_gtimer.c14
-rw-r--r--module/timer/src/mod_timer.c4
2 files changed, 9 insertions, 9 deletions
diff --git a/module/gtimer/src/mod_gtimer.c b/module/gtimer/src/mod_gtimer.c
index a1fd882d..dc195d23 100644
--- a/module/gtimer/src/mod_gtimer.c
+++ b/module/gtimer/src/mod_gtimer.c
@@ -138,6 +138,8 @@ static int get_timer(fwk_id_t dev_id, uint64_t *timestamp)
{
struct dev_ctx *ctx;
int status;
+ uint32_t counter_low;
+ uint32_t counter_high;
status = fwk_module_check_call(dev_id);
if (status != FWK_SUCCESS)
@@ -145,16 +147,12 @@ static int get_timer(fwk_id_t dev_id, uint64_t *timestamp)
ctx = ctx_table + fwk_id_get_element_idx(dev_id);
- struct {
- uint32_t low;
- uint32_t high;
- } value;
-
/* Read 64-bit timer value */
- value.low = ctx->hw_timer->P_CVALL;
- value.high = ctx->hw_timer->P_CVALH;
+ counter_low = ctx->hw_timer->P_CVALL;
+ counter_high = ctx->hw_timer->P_CVALH;
+
+ *timestamp = ((uint64_t)counter_high << 32) | counter_low;
- *timestamp = *(uint64_t *)&value;
return FWK_SUCCESS;
}
diff --git a/module/timer/src/mod_timer.c b/module/timer/src/mod_timer.c
index d3b7b115..8fc61399 100644
--- a/module/timer/src/mod_timer.c
+++ b/module/timer/src/mod_timer.c
@@ -10,6 +10,7 @@
#include <stdbool.h>
#include <stdint.h>
+#include <string.h>
#include <fwk_assert.h>
#include <fwk_element.h>
#include <fwk_errno.h>
@@ -493,7 +494,8 @@ static void timer_isr(uintptr_t ctx_ptr)
.target_id = alarm->listener,
.id = alarm->event_id,
};
- *(uintptr_t *)event.params = alarm->param; /* Word-size parameter */
+
+ memcpy(event.params, &alarm->param, sizeof(alarm->param));
status = fwk_thread_put_event(&event);
if (status != FWK_SUCCESS)