Skip to content

Commit cf8e35f

Browse files
lrgirdwolgirdwood
authored andcommitted
zephyr: init: create a zephyr entry point in SOF.
Zephyr already uses main() and has already performed a lot of init prior to entering SOF. Make sure no HW init is repeated. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent fd50697 commit cf8e35f

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/init/init.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ int master_core_init(int argc, char *argv[], struct sof *sof)
7171
sof->argc = argc;
7272
sof->argv = argv;
7373

74+
#ifndef __ZEPHYR__
7475
/* init architecture */
7576
trace_point(TRACE_BOOT_ARCH);
7677
err = arch_init();
@@ -83,6 +84,7 @@ int master_core_init(int argc, char *argv[], struct sof *sof)
8384
init_heap(sof);
8485

8586
interrupt_init(sof);
87+
#endif /* __ZEPHYR__ */
8688

8789
#if CONFIG_TRACE
8890
trace_point(TRACE_BOOT_SYS_TRACES);
@@ -112,7 +114,11 @@ int master_core_init(int argc, char *argv[], struct sof *sof)
112114
return err;
113115
}
114116

117+
#ifdef __ZEPHYR__
118+
int sof_main(int argc, char *argv[])
119+
#else
115120
int main(int argc, char *argv[])
121+
#endif
116122
{
117123
int err;
118124

@@ -123,7 +129,9 @@ int main(int argc, char *argv[])
123129
else
124130
err = slave_core_init(&sof);
125131

132+
#ifndef __ZEPHYR__
126133
/* should never get here */
127134
panic(SOF_IPC_PANIC_TASK);
135+
#endif
128136
return err;
129137
}

src/platform/intel/cavs/platform.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,11 @@ int platform_init(struct sof *sof)
391391
platform_memory_windows_init(MEM_WND_INIT_CLEAR);
392392
#endif
393393

394+
#ifndef __ZEPHYR__
394395
/* init timers, clocks and schedulers */
395396
trace_point(TRACE_BOOT_PLATFORM_TIMER);
396397
platform_timer_start(sof->platform_timer);
398+
#endif
397399

398400
trace_point(TRACE_BOOT_PLATFORM_CLOCK);
399401
platform_clock_init(sof);
@@ -511,6 +513,7 @@ int platform_init(struct sof *sof)
511513
if (ret < 0)
512514
return ret;
513515

516+
#ifndef __ZEPHYR__
514517
#if CONFIG_DW_SPI
515518
/* initialize the SPI slave */
516519
trace_point(TRACE_BOOT_PLATFORM_SPI);
@@ -535,10 +538,11 @@ int platform_init(struct sof *sof)
535538

536539
/* show heap status */
537540
heap_trace_all(1);
538-
541+
#endif /* __ZEPHYR__ */
539542
return 0;
540543
}
541544

545+
#ifndef __ZEPHYR__
542546
void platform_wait_for_interrupt(int level)
543547
{
544548
#if CONFIG_CAVS_USE_LPRO_IN_WAITI
@@ -553,3 +557,4 @@ void platform_wait_for_interrupt(int level)
553557
arch_wait_for_interrupt(level);
554558
#endif
555559
}
560+
#endif

0 commit comments

Comments
 (0)