1 /* 2 * Copyright (c) 2023 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Note this run in the runner context, and therefore 7 * this file should therefore only be built once for all CPUs. 8 */ 9 10 #include "bs_tracing.h" 11 #include "bs_dump_files.h" 12 #include "bs_pc_backchannel.h" 13 #include "nsi_tasks.h" 14 #include "nsi_main.h" 15 #include "nsi_hw_scheduler.h" 16 #include "NRF_HWLowL.h" 17 #include "bsim_args_runner.h" 18 main_clean_up_trace_wrap(void)19static uint8_t main_clean_up_trace_wrap(void) 20 { 21 return nsi_exit_inner(0); 22 } 23 trace_registration(void)24static void trace_registration(void) 25 { 26 bs_trace_register_cleanup_function(main_clean_up_trace_wrap); 27 bs_trace_register_time_function(nsi_hws_get_time); 28 } 29 30 NSI_TASK(trace_registration, PRE_BOOT_1, 31 0 /*we want to run this as early as possible */); 32 open_dumps(void)33static void open_dumps(void) 34 { 35 bs_dump_files_open(bsim_args_get_simid(), 36 bsim_args_get_global_device_nbr()); 37 } 38 39 NSI_TASK(open_dumps, PRE_BOOT_2, 500); 40 exit_hooks(void)41static void exit_hooks(void) 42 { 43 hwll_terminate_simulation(); 44 bs_dump_files_close_all(); 45 bs_clean_back_channels(); 46 } 47 48 NSI_TASK(exit_hooks, ON_EXIT_PRE, 500); 49