File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929#include <sys/boardctl.h>
3030#include <sys/time.h>
3131
32+ #include <cxd56_rtc.h>
33+
3234#include "sched/sched.h"
3335
3436#include "boards/board.h"
4547safe_mode_t port_init (void ) {
4648 boardctl (BOARDIOC_INIT , 0 );
4749
48- board_init ();
50+ // Wait until RTC is available
51+ while (g_rtc_enabled == false);
4952
5053 if (board_requests_safe_mode ()) {
5154 return USER_SAFE_MODE ;
@@ -121,14 +124,10 @@ void board_timerhook(void)
121124}
122125
123126uint64_t port_get_raw_ticks (uint8_t * subticks ) {
124- struct timeval tv ;
125- gettimeofday (& tv , NULL );
126- long computed_subticks = tv .tv_usec * 1024 * 32 / 1000000 ;
127- if (subticks != NULL ) {
128- * subticks = computed_subticks % 32 ;
129- }
127+ uint64_t count = cxd56_rtc_count ();
128+ * subticks = count % 32 ;
130129
131- return tv . tv_sec * 1024 + computed_subticks / 32 ;
130+ return count / 32 ;
132131}
133132
134133// Enable 1/1024 second tick.
You can’t perform that action at this time.
0 commit comments