aboutsummaryrefslogtreecommitdiff
path: root/platform/freertos/init.cc
diff options
context:
space:
mode:
Diffstat (limited to 'platform/freertos/init.cc')
-rw-r--r--platform/freertos/init.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/platform/freertos/init.cc b/platform/freertos/init.cc
index c993b406..524d3131 100644
--- a/platform/freertos/init.cc
+++ b/platform/freertos/init.cc
@@ -95,15 +95,7 @@ BaseType_t init() {
DramVoteClientSingleton::init();
-#ifdef CHRE_USE_BUFFERED_LOGGING
- chre::LogBufferManagerSingleton::init(gPrimaryLogBufferData,
- gSecondaryLogBufferData,
- sizeof(gPrimaryLogBufferData));
-
- rc = xTaskCreate(chreFlushLogsToHostThreadEntry, getChreFlushTaskName(),
- kChreTaskStackDepthWords, nullptr /* args */,
- kChreTaskPriority, &gChreFlushTaskHandle);
-#endif
+ rc = initLogger();
if (rc == pdPASS) {
rc = xTaskCreate(chreThreadEntry, getChreTaskName(),
@@ -118,6 +110,22 @@ BaseType_t init() {
return rc;
}
+BaseType_t initLogger() {
+ BaseType_t rc = pdPASS;
+#ifdef CHRE_USE_BUFFERED_LOGGING
+ if (!chre::LogBufferManagerSingleton::isInitialized()) {
+ chre::LogBufferManagerSingleton::init(gPrimaryLogBufferData,
+ gSecondaryLogBufferData,
+ sizeof(gPrimaryLogBufferData));
+
+ rc = xTaskCreate(chreFlushLogsToHostThreadEntry, getChreFlushTaskName(),
+ kChreTaskStackDepthWords, nullptr /* args */,
+ kChreTaskPriority, &gChreFlushTaskHandle);
+ }
+#endif
+ return rc;
+}
+
void deinit() {
// On a deinit call, we just stop the CHRE event loop. This causes the 'run'
// method in the task function exit, and move on to handle task cleanup