123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- /*
- * Copyright (c) 2019 Actions Semiconductor Co., Ltd
- *
- * SPDX-License-Identifier: Apache-2.0
- */
- /**
- * @file system manager
- */
- #include <os_common_api.h>
- #include <msg_manager.h>
- #include <app_manager.h>
- #include <srv_manager.h>
- #ifdef CONFIG_FS_MANAGER
- #include <fs_manager.h>
- #endif
- #ifdef CONFIG_SDFS_MANAGER
- #include <sdfs_manager.h>
- #endif
- #ifdef CONFIG_UI_MANAGER
- #include <ui_manager.h>
- #endif
- #include <hotplug_manager.h>
- #include <esd_manager.h>
- #ifdef CONFIG_AUDIO
- #include <audio_system.h>
- #endif
- #ifdef CONFIG_SENSOR_MANAGER
- #include <sensor_manager.h>
- #endif
- #ifdef CONFIG_GPS_MANAGER
- #include <gps_manager.h>
- #endif
- #include <sys_monitor.h>
- #include <power_manager.h>
- #include <property_manager.h>
- #ifdef CONFIG_PLAYTTS
- #include <tts_manager.h>
- #endif
- #ifdef CONFIG_MEDIA_SERVICE
- #include <media_service.h>
- #endif
- #include <sys_wakelock.h>
- #ifdef CONFIG_FM
- #include <fm_manager.h>
- #endif
- void system_ready(void)
- {
- struct sys_monitor_t *sys_monitor = sys_monitor_get_instance();
- if (sys_monitor)
- sys_monitor->system_ready = 1;
-
- #ifdef CONFIG_SYS_WAKELOCK
- sys_wake_unlock(FULL_WAKE_LOCK);
- #endif
- }
- bool system_is_ready(void)
- {
- struct sys_monitor_t *sys_monitor = sys_monitor_get_instance();
- if (sys_monitor)
- return (sys_monitor->system_ready == 1);
- return false;
- }
- int system_restore_factory_config(void)
- {
- #ifdef CONFIG_PROPERTY
- property_flush(NULL);
- #endif
- return 0;
- }
- void system_init(void)
- {
- #ifdef CONFIG_FS_MANAGER
- fs_manager_init();
- #endif
- #ifdef CONFIG_FILE_SYSTEM_LITTLEFS
- littlefs_manager_init();
- #endif
- #ifdef CONFIG_SDFS_MANAGER
- sdfs_manager_init();
- #endif
- msg_manager_init();
- srv_manager_init();
- app_manager_init();
- #ifdef CONFIG_MEDIA_SERVICE
- media_service_init();
- #endif
- sys_monitor_init();
- #ifdef CONFIG_ESD_MANAGER
- esd_manager_init();
- #endif
- #ifdef CONFIG_MEDIA
- aduio_system_init();
- #endif
- #ifdef CONFIG_PLAYTTS
- tts_manager_init();
- #endif
- #ifdef CONFIG_POWER_MANAGER
- power_manager_init();
- #endif
- #ifdef CONFIG_UI_MANAGER
- ui_manager_init();
- #endif
- #ifdef CONFIG_HOTPLUG_MANAGER
- hotplug_manager_init();
- #endif
- #ifdef CONFIG_FM
- fm_manager_init();
- #endif
- #ifdef CONFIG_SENSOR_MANAGER
- sensor_manager_init();
- #endif
- #ifdef CONFIG_GPS_MANAGER
- gps_manager_init();
- #endif
- sys_monitor_start();
- }
- void system_deinit(void)
- {
- sys_monitor_stop();
- #ifdef CONFIG_UI_MANAGER
- ui_manager_exit();
- #endif
- #ifdef CONFIG_PLAYTTS
- tts_manager_deinit();
- #endif
- #ifdef CONFIG_ESD_MANAGER
- esd_manager_deinit();
- #endif
- #ifdef CONFIG_FM
- fm_manager_deinit();
- #endif
- }
|