Files
OpenCellular/core/host/main.c
Aseda Aboagye a21650f05f emulator: Fix handling of early IRQs.
Since the interrupt generator is now spawned right after the hooks task
and the generator can generate interrupts whenever it wants, it's
possible for an interrupt to fire before task switching is enabled.
When this happens, the main thread needs to be suspended so that the IRQ
can be serviced.

BRANCH=None
BUG=None
TEST="make clobber && make -j buildall tests" several times."

Change-Id: I5fb4f17666e3db9c670c4352bb36b84e4606dfa0
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/285634
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
2015-07-17 00:05:46 +00:00

70 lines
1.4 KiB
C

/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Entry point of unit test executable */
#include "console.h"
#include "flash.h"
#include "hooks.h"
#include "host_task.h"
#include "keyboard_scan.h"
#include "stack_trace.h"
#include "system.h"
#include "task.h"
#include "test_util.h"
#include "timer.h"
#include "uart.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
const char *__prog_name;
const char *__get_prog_name(void)
{
return __prog_name;
}
int main(int argc, char **argv)
{
__prog_name = argv[0];
/*
* In order to properly service IRQs before task switching is enabled,
* we must set up our signal handler for the main thread.
*/
task_register_interrupt();
task_register_tracedump();
register_test_end_hook();
flash_pre_init();
system_pre_init();
system_common_pre_init();
test_init();
timer_init();
#ifdef HAS_TASK_KEYSCAN
keyboard_scan_init();
#endif
uart_init();
if (system_jumped_to_this_image()) {
CPRINTS("Emulator initialized after sysjump");
} else {
CPUTS("\n\n--- Emulator initialized after reboot ---\n");
CPUTS("[Reset cause: ");
system_print_reset_flags();
CPUTS("]\n");
}
task_start();
return 0;
}