1/*# 2 *# Copyright 2018, Data61 3 *# Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 *# ABN 41 687 119 230. 5 *# 6 *# This software may be distributed and modified according to the terms of 7 *# the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 *# See "LICENSE_BSD2.txt" for details. 9 *# 10 *# @TAG(DATA61_BSD) 11 #*/ 12 13#include <camkes.h> 14#include <camkes/init.h> 15 16int component_control_main() { 17 int error; 18 19 if (pre_init) { 20 pre_init(); 21 } 22 23 /* we call pre_init_interface_sync in all circumstances, even if we do not support 24 * init, as the implementation already has an internal guard for init support and 25 * so the function will just do nothing without init support. Always calling it 26 * provides a bit more flexibility in the future, and is consistent with the 27 * post_init version which *does* do something even if we do not support init 28 */ 29 error = pre_init_interface_sync(); 30 if (error) { 31 return error; 32 } 33 34 if (post_init) { 35 post_init(); 36 } 37 38 error = post_init_interface_sync(); 39 if (error) { 40 return error; 41 } 42 43 /*- if me.type.control -*/ 44 return run(); 45 /*- else -*/ 46 return 0; 47 /*- endif -*/ 48} 49 50