sys_manager.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file system manager
  8. */
  9. #include <os_common_api.h>
  10. #include <msg_manager.h>
  11. #include <app_manager.h>
  12. #include <srv_manager.h>
  13. #ifdef CONFIG_FS_MANAGER
  14. #include <fs_manager.h>
  15. #endif
  16. #ifdef CONFIG_SDFS_MANAGER
  17. #include <sdfs_manager.h>
  18. #endif
  19. #ifdef CONFIG_UI_MANAGER
  20. #include <ui_manager.h>
  21. #endif
  22. #include <hotplug_manager.h>
  23. #include <esd_manager.h>
  24. #ifdef CONFIG_AUDIO
  25. #include <audio_system.h>
  26. #endif
  27. #ifdef CONFIG_SENSOR_MANAGER
  28. #include <sensor_manager.h>
  29. #endif
  30. #ifdef CONFIG_GPS_MANAGER
  31. #include <gps_manager.h>
  32. #endif
  33. #include <sys_monitor.h>
  34. #include <power_manager.h>
  35. #include <property_manager.h>
  36. #ifdef CONFIG_PLAYTTS
  37. #include <tts_manager.h>
  38. #endif
  39. #ifdef CONFIG_MEDIA_SERVICE
  40. #include <media_service.h>
  41. #endif
  42. #include <sys_wakelock.h>
  43. #ifdef CONFIG_FM
  44. #include <fm_manager.h>
  45. #endif
  46. void system_ready(void)
  47. {
  48. struct sys_monitor_t *sys_monitor = sys_monitor_get_instance();
  49. if (sys_monitor)
  50. sys_monitor->system_ready = 1;
  51. #ifdef CONFIG_SYS_WAKELOCK
  52. sys_wake_unlock(FULL_WAKE_LOCK);
  53. #endif
  54. }
  55. bool system_is_ready(void)
  56. {
  57. struct sys_monitor_t *sys_monitor = sys_monitor_get_instance();
  58. if (sys_monitor)
  59. return (sys_monitor->system_ready == 1);
  60. return false;
  61. }
  62. int system_restore_factory_config(void)
  63. {
  64. #ifdef CONFIG_PROPERTY
  65. property_flush(NULL);
  66. #endif
  67. return 0;
  68. }
  69. void system_init(void)
  70. {
  71. #ifdef CONFIG_FS_MANAGER
  72. fs_manager_init();
  73. #endif
  74. #ifdef CONFIG_FILE_SYSTEM_LITTLEFS
  75. littlefs_manager_init();
  76. #endif
  77. #ifdef CONFIG_SDFS_MANAGER
  78. sdfs_manager_init();
  79. #endif
  80. msg_manager_init();
  81. srv_manager_init();
  82. app_manager_init();
  83. #ifdef CONFIG_MEDIA_SERVICE
  84. media_service_init();
  85. #endif
  86. sys_monitor_init();
  87. #ifdef CONFIG_ESD_MANAGER
  88. esd_manager_init();
  89. #endif
  90. #ifdef CONFIG_MEDIA
  91. aduio_system_init();
  92. #endif
  93. #ifdef CONFIG_PLAYTTS
  94. tts_manager_init();
  95. #endif
  96. #ifdef CONFIG_POWER_MANAGER
  97. power_manager_init();
  98. #endif
  99. #ifdef CONFIG_UI_MANAGER
  100. ui_manager_init();
  101. #endif
  102. #ifdef CONFIG_HOTPLUG_MANAGER
  103. hotplug_manager_init();
  104. #endif
  105. #ifdef CONFIG_FM
  106. fm_manager_init();
  107. #endif
  108. #ifdef CONFIG_SENSOR_MANAGER
  109. sensor_manager_init();
  110. #endif
  111. #ifdef CONFIG_GPS_MANAGER
  112. gps_manager_init();
  113. #endif
  114. sys_monitor_start();
  115. }
  116. void system_deinit(void)
  117. {
  118. sys_monitor_stop();
  119. #ifdef CONFIG_UI_MANAGER
  120. ui_manager_exit();
  121. #endif
  122. #ifdef CONFIG_PLAYTTS
  123. tts_manager_deinit();
  124. #endif
  125. #ifdef CONFIG_ESD_MANAGER
  126. esd_manager_deinit();
  127. #endif
  128. #ifdef CONFIG_FM
  129. fm_manager_deinit();
  130. #endif
  131. }