SOL_API void sol_shutdown(void) { if (_init_count == 0) { SOL_CRI("sol_init() was not called"); return; } _init_count--; if (_init_count > 0) return; SOL_DBG("shutdown"); sol_ipm_shutdown(); sol_update_shutdown(); sol_comms_shutdown(); sol_flow_shutdown(); sol_crypto_shutdown(); sol_blob_shutdown(); sol_pin_mux_shutdown(); sol_platform_shutdown(); mainloop_impl->shutdown(); sol_modules_clear_cache(); sol_log_shutdown(); }
SOL_API void sol_shutdown(void) { if (_init_count == 0) { SOL_CRI("sol_init() was not called"); return; } _init_count--; if (_init_count > 0) return; SOL_DBG("shutdown"); #ifdef NETWORK sol_comms_shutdown(); #endif #ifdef FLOW_SUPPORT sol_flow_shutdown(); #endif sol_blob_shutdown(); sol_pin_mux_shutdown(); sol_platform_shutdown(); sol_mainloop_impl_shutdown(); sol_log_shutdown(); }
SOL_API int sol_init(void) { int r; _init_count++; if (_init_count > 1) return 0; r = sol_log_init(); if (r < 0) goto log_error; sol_log_domain_init_level(SOL_LOG_DOMAIN); r = mainloop_impl->init(); if (r < 0) goto impl_error; r = sol_platform_init(); if (r < 0) goto platform_error; r = sol_pin_mux_init(); if (r < 0) goto pin_mux_error; r = sol_blob_init(); if (r < 0) goto blob_error; r = sol_crypto_init(); if (r < 0) goto crypto_error; r = sol_flow_init(); if (r < 0) goto flow_error; r = sol_comms_init(); if (r < 0) goto comms_error; r = sol_update_init(); if (r < 0) goto update_error; r = sol_ipm_init(); if (r < 0) goto ipm_error; SOL_DBG("Soletta %s on %s-%s initialized", sol_platform_get_sw_version(), BASE_OS, sol_platform_get_os_version()); return 0; ipm_error: sol_update_shutdown(); update_error: sol_comms_shutdown(); comms_error: sol_flow_shutdown(); flow_error: sol_crypto_shutdown(); crypto_error: sol_blob_shutdown(); blob_error: sol_pin_mux_shutdown(); pin_mux_error: sol_platform_shutdown(); platform_error: mainloop_impl->shutdown(); impl_error: sol_log_shutdown(); log_error: _init_count = 0; return r; }
SOL_API int sol_init(void) { int r; _init_count++; if (_init_count > 1) return 0; r = sol_log_init(); if (r < 0) goto log_error; sol_log_domain_init_level(SOL_LOG_DOMAIN); r = sol_mainloop_impl_init(); if (r < 0) goto impl_error; r = sol_platform_init(); if (r < 0) goto platform_error; r = sol_pin_mux_init(); if (r < 0) goto pin_mux_error; r = sol_blob_init(); if (r < 0) goto blob_error; #ifdef FLOW_SUPPORT r = sol_flow_init(); if (r < 0) goto flow_error; #endif #ifdef NETWORK r = sol_comms_init(); if (r < 0) goto comms_error; #endif SOL_DBG("initialized"); return 0; #ifdef NETWORK comms_error: #endif #ifdef FLOW_SUPPORT sol_flow_shutdown(); flow_error: #endif sol_blob_shutdown(); blob_error: sol_pin_mux_shutdown(); pin_mux_error: sol_platform_shutdown(); platform_error: sol_mainloop_impl_shutdown(); impl_error: sol_log_shutdown(); log_error: _init_count = 0; return r; }