From 1f9109b924e50ee32fce78947140c44667a3c960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Smoczy=C5=84ski?= Date: Sun, 19 Sep 2021 15:45:30 +0200 Subject: [PATCH] [BH-819] Fix illegal dependencies in bsp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Break circular dependencies in the BSP module. Fix some missing dependencies which surfaced after fixing BSP. Signed-off-by: Marcin SmoczyƄski --- module-audio/board/rt1051/CMakeLists.txt | 1 + module-bluetooth/Bluetooth/BluetoothWorker.cpp | 6 ++---- module-bluetooth/Bluetooth/BluetoothWorker.hpp | 14 +------------- module-bluetooth/CMakeLists.txt | 5 +---- module-bsp/CMakeLists.txt | 3 +-- module-bsp/board/linux/CMakeLists.txt | 2 ++ module-bsp/board/linux/bluetooth/Bluetooth.cpp | 1 - .../board/linux/watchdog/software_watchdog.cpp | 4 ++-- .../board/rt1051/bluetooth/BlueKitchen.cpp | 1 - .../board/rt1051/bluetooth/BluetoothCommon.cpp | 1 - module-bsp/bsp/bluetooth/Bluetooth.hpp | 17 +++++++++++++++++ module-bsp/bsp/vibrator/vibrator.hpp | 1 - .../battery_charger/AbstractBatteryCharger.hpp | 1 - module-db/CMakeLists.txt | 1 + module-gui/CMakeLists.txt | 2 ++ module-services/service-appmgr/CMakeLists.txt | 1 + .../service-desktop/endpoints/CMakeLists.txt | 2 ++ module-services/service-evtmgr/CMakeLists.txt | 7 ++++++- module-services/service-time/CMakeLists.txt | 1 + module-sys/Service/include/Service/Service.hpp | 1 - module-sys/SystemManager/CMakeLists.txt | 6 +++--- module-utils/log/board/rt1051/CMakeLists.txt | 1 + 22 files changed, 44 insertions(+), 35 deletions(-) diff --git a/module-audio/board/rt1051/CMakeLists.txt b/module-audio/board/rt1051/CMakeLists.txt index a9850302c232bd19a8ecca3ede66d2591f849ff6..3954e3744f10c8302032e3c48f273b40eb003323 100644 --- a/module-audio/board/rt1051/CMakeLists.txt +++ b/module-audio/board/rt1051/CMakeLists.txt @@ -14,4 +14,5 @@ target_include_directories(${AUDIO_BOARD_LIBRARY} INTERFACE ${CMAKE_CURRENT_SOUR target_link_libraries(${AUDIO_BOARD_LIBRARY} module-bsp module-os + module-bluetooth ) diff --git a/module-bluetooth/Bluetooth/BluetoothWorker.cpp b/module-bluetooth/Bluetooth/BluetoothWorker.cpp index 6523874357b9ae608862578f9973c990a7c7faf9..e4ddb2892c5a6da86edc030ee233808ee4e27071 100644 --- a/module-bluetooth/Bluetooth/BluetoothWorker.cpp +++ b/module-bluetooth/Bluetooth/BluetoothWorker.cpp @@ -24,8 +24,6 @@ #define logHciBytes(...) #endif -using namespace bsp; - namespace queues { constexpr inline auto io = "qBtIO"; @@ -107,7 +105,7 @@ void BluetoothWorker::registerQueues() { static_cast(service)->workerQueue = Worker::getQueueHandleByName(queues::cmd); runLoop->setTriggerQueue(Worker::getQueueHandleByName(queues::btstack)); - BlueKitchen::getInstance()->qHandle = queues[queueIO_handle]->GetQueueHandle(); + bsp::BlueKitchen::getInstance()->qHandle = queues[queueIO_handle]->GetQueueHandle(); } void BluetoothWorker::onLinkKeyAdded(const std::string &deviceAddress) @@ -211,7 +209,7 @@ auto BluetoothWorker::handleMessage(uint32_t queueID) -> bool LOG_ERROR("Queue receive failure!"); return false; } - auto bt = BlueKitchen::getInstance(); + auto bt = bsp::BlueKitchen::getInstance(); switch (notification) { case bluetooth::Message::EvtSending: logHciComs("[evt] sending"); diff --git a/module-bluetooth/Bluetooth/BluetoothWorker.hpp b/module-bluetooth/Bluetooth/BluetoothWorker.hpp index f0e581a1658f05328d6323518c24bdc4052a243e..c74170a16d91e2d25a3462cc44f8122d8b595dcf 100644 --- a/module-bluetooth/Bluetooth/BluetoothWorker.hpp +++ b/module-bluetooth/Bluetooth/BluetoothWorker.hpp @@ -29,19 +29,7 @@ struct HCI; namespace bluetooth { - enum Message : std::uint8_t - { - /// asynchronous messages to use on event from irq - EvtSending, /// Bt stack ordered a write transaction and it is pending - EvtSent, /// trigger Bt stack wrote, enable writting in HCI in BluetoothWorker task - EvtSendingError, /// bsp error on send - EvtReceiving, /// Bt stack requested a receive transaction and it is pending - EvtReceived, /// trigger Bt stack received, start processing HCI in BluetoothWorker task - EvtRecUnwanted, /// not requested recieve - probably receive came to fast from sent... - EvtReceivingError, /// bsp error on receive - EvtUartError, /// generic uart error - EvtErrorRec, /// there was error o queue receive - }; + using namespace bsp::bluetooth; inline const char *MessageCstr(Message what) { diff --git a/module-bluetooth/CMakeLists.txt b/module-bluetooth/CMakeLists.txt index 11bc00138998a12c49e2d82d07a5cde026f26d61..e489022f27296bcfea96c9e549a70b12acb5c532 100644 --- a/module-bluetooth/CMakeLists.txt +++ b/module-bluetooth/CMakeLists.txt @@ -28,11 +28,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Bluetooth/interface/profiles/PhoneInterface.cpp ) -message("Build with BlueKitchen") include(lib/btstack.cmake) - -message(${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) -message("Sources: " ${SOURCES}) add_library(${PROJECT_NAME} STATIC ${SOURCES} ${BOARD_DIR_SOURCES}) @@ -56,6 +52,7 @@ target_include_directories( PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${TARGET_LIBRARIES_INCLUDES} + ${BT_STACK_ROOT} ${BT_STACK_ROOT}/src ${BT_STACK_ROOT}/src/classic ) diff --git a/module-bsp/CMakeLists.txt b/module-bsp/CMakeLists.txt index b85ae4be807fdc0b5a3095bff1fe2e80b37f12d6..c3238553b342b74e238b3c3f0c08d8ae8aae3afc 100644 --- a/module-bsp/CMakeLists.txt +++ b/module-bsp/CMakeLists.txt @@ -70,9 +70,8 @@ target_link_libraries(${PROJECT_NAME} hal eventstore module-os - service-bluetooth magic_enum - ${TARGET_LIBRARIES} + utility PRIVATE purefs-paths time-constants diff --git a/module-bsp/board/linux/CMakeLists.txt b/module-bsp/board/linux/CMakeLists.txt index 5d56fc767067aecbba687caac457f868bbaffee8..6b92d79afa62d0f33f572304a95ccfdc518886ad 100644 --- a/module-bsp/board/linux/CMakeLists.txt +++ b/module-bsp/board/linux/CMakeLists.txt @@ -47,6 +47,8 @@ target_include_directories( > ) +target_link_libraries(module-bsp PRIVATE sys-common) + set_source_files_properties(board.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-function) target_compile_options(module-bsp PUBLIC "-Wno-unused-result") diff --git a/module-bsp/board/linux/bluetooth/Bluetooth.cpp b/module-bsp/board/linux/bluetooth/Bluetooth.cpp index 1f9cdd39800d446c02fcf43da0bbe7b9688b6c26..1a23bca3850feed921150850d4890a7443060609 100644 --- a/module-bsp/board/linux/bluetooth/Bluetooth.cpp +++ b/module-bsp/board/linux/bluetooth/Bluetooth.cpp @@ -2,7 +2,6 @@ // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "bsp/bluetooth/Bluetooth.hpp" -#include "BluetoothWorker.hpp" #include /// stubs diff --git a/module-bsp/board/linux/watchdog/software_watchdog.cpp b/module-bsp/board/linux/watchdog/software_watchdog.cpp index 00a8f57a43e5c8dc4ed2bc35264ed925db1ec773..79bc08f2d9a6c841cfcf759423c06399c5a3d8df 100644 --- a/module-bsp/board/linux/watchdog/software_watchdog.cpp +++ b/module-bsp/board/linux/watchdog/software_watchdog.cpp @@ -2,8 +2,8 @@ // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "software_watchdog.hpp" -#include -#include +#include +#include #include #include #include diff --git a/module-bsp/board/rt1051/bluetooth/BlueKitchen.cpp b/module-bsp/board/rt1051/bluetooth/BlueKitchen.cpp index ac66386a10f364ea9f19607f8d277718b7da4bbf..ba8c2ee43a3bafa2cf396e7c9875fb60da14f4af 100644 --- a/module-bsp/board/rt1051/bluetooth/BlueKitchen.cpp +++ b/module-bsp/board/rt1051/bluetooth/BlueKitchen.cpp @@ -2,7 +2,6 @@ // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "bsp/bluetooth/Bluetooth.hpp" -#include "BluetoothWorker.hpp" #include #include "FreeRTOS.h" #include "fsl_lpuart.h" diff --git a/module-bsp/board/rt1051/bluetooth/BluetoothCommon.cpp b/module-bsp/board/rt1051/bluetooth/BluetoothCommon.cpp index 254db2b91c1c1968c00ea74e5c3ef1a0815a3f31..8503b37600bfca9eb7863d6b37a5d4fef4f67f5a 100644 --- a/module-bsp/board/rt1051/bluetooth/BluetoothCommon.cpp +++ b/module-bsp/board/rt1051/bluetooth/BluetoothCommon.cpp @@ -1,7 +1,6 @@ // Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md -#include "BluetoothWorker.hpp" #include "bsp/bluetooth/Bluetooth.hpp" #include #include "FreeRTOS.h" diff --git a/module-bsp/bsp/bluetooth/Bluetooth.hpp b/module-bsp/bsp/bluetooth/Bluetooth.hpp index bd96f6b114573f1c8ccb63c158df34956bd9c2ed..09bf8d0d52a81ce57ab900ca62dca48ff241c0a8 100644 --- a/module-bsp/bsp/bluetooth/Bluetooth.hpp +++ b/module-bsp/bsp/bluetooth/Bluetooth.hpp @@ -17,6 +17,23 @@ namespace bsp { + namespace bluetooth + { + enum Message : std::uint8_t + { + /// asynchronous messages to use on event from irq + EvtSending, /// Bt stack ordered a write transaction and it is pending + EvtSent, /// trigger Bt stack wrote, enable writting in HCI in BluetoothWorker task + EvtSendingError, /// bsp error on send + EvtReceiving, /// Bt stack requested a receive transaction and it is pending + EvtReceived, /// trigger Bt stack received, start processing HCI in BluetoothWorker task + EvtRecUnwanted, /// not requested recieve - probably receive came to fast from sent... + EvtReceivingError, /// bsp error on receive + EvtUartError, /// generic uart error + EvtErrorRec, /// there was error o queue receive + }; + } + class BTdev { public: enum Error { diff --git a/module-bsp/bsp/vibrator/vibrator.hpp b/module-bsp/bsp/vibrator/vibrator.hpp index bd3c643b2fdfd842ec11ef2a54984f95663a6078..a117563dc330cddf4c744ca410cccd2eed149da1 100644 --- a/module-bsp/bsp/vibrator/vibrator.hpp +++ b/module-bsp/bsp/vibrator/vibrator.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include diff --git a/module-bsp/hal/include/hal/battery_charger/AbstractBatteryCharger.hpp b/module-bsp/hal/include/hal/battery_charger/AbstractBatteryCharger.hpp index 7a6b30cadd8eac08479a0d1152d3b226453f10a1..4a4e2d252a502c09ea4c578a5a682f91f2c3a683 100644 --- a/module-bsp/hal/include/hal/battery_charger/AbstractBatteryCharger.hpp +++ b/module-bsp/hal/include/hal/battery_charger/AbstractBatteryCharger.hpp @@ -5,7 +5,6 @@ #include #include -#include #include diff --git a/module-db/CMakeLists.txt b/module-db/CMakeLists.txt index d3590561e0d1c60f3247f622a680c6ce39f60086..a17375b948a3ef62d5c958545b5282bdc2c6c899 100644 --- a/module-db/CMakeLists.txt +++ b/module-db/CMakeLists.txt @@ -167,6 +167,7 @@ target_link_libraries(${PROJECT_NAME} module-utils module-vfs utf8 + desktop-endpoints PRIVATE application-calendar Microsoft.GSL::GSL diff --git a/module-gui/CMakeLists.txt b/module-gui/CMakeLists.txt index a0acd822e57d7ab173e965f52b1cb40d005dbbc9..e425058bc89e032921cdab892c7aa85b936b186d 100644 --- a/module-gui/CMakeLists.txt +++ b/module-gui/CMakeLists.txt @@ -19,8 +19,10 @@ target_link_libraries(${PROJECT_NAME} eventstore utils-math module-utils + sys-phonemodes sys-service sys-watchdog + service-bluetooth utf8 PRIVATE i18n diff --git a/module-services/service-appmgr/CMakeLists.txt b/module-services/service-appmgr/CMakeLists.txt index fbd3fb5a4dcbd891395ef4bb91b88c2ba5acc72a..314e7efe786f850a6154121109f5e635a9a769d0 100644 --- a/module-services/service-appmgr/CMakeLists.txt +++ b/module-services/service-appmgr/CMakeLists.txt @@ -76,6 +76,7 @@ target_link_libraries(service-appmgr json::json module-audio service-cellular + service-desktop service-db service-gui PUBLIC diff --git a/module-services/service-desktop/endpoints/CMakeLists.txt b/module-services/service-desktop/endpoints/CMakeLists.txt index ad6b8d8d26342b5db1e220227c4a6a31b53e8962..51b7de4c04f06e1beb4fc6773e98bf065e94e83f 100644 --- a/module-services/service-desktop/endpoints/CMakeLists.txt +++ b/module-services/service-desktop/endpoints/CMakeLists.txt @@ -29,6 +29,8 @@ target_link_libraries( desktop-endpoint-base PUBLIC endpoint-message-sender + hash-library::hash-library + module-db sys-service ) diff --git a/module-services/service-evtmgr/CMakeLists.txt b/module-services/service-evtmgr/CMakeLists.txt index 21164a12b9c238f5e4178fa4edbe2e5ffd5933d3..304d51865990281f430dc8b96b730b05fe2cbf95 100644 --- a/module-services/service-evtmgr/CMakeLists.txt +++ b/module-services/service-evtmgr/CMakeLists.txt @@ -24,7 +24,6 @@ target_include_directories(${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}" ${CMAKE_CURRENT_LIST_DIR}/service-evtmgr/include ) - target_link_libraries(${PROJECT_NAME} PRIVATE @@ -36,9 +35,15 @@ target_link_libraries(${PROJECT_NAME} service-audio service-cellular service-desktop + service-bluetooth sml::sml Microsoft.GSL::GSL eventstore + PUBLIC + service-db + sys-service + sys-manager + messagetype ) if (${ENABLE_TESTS}) diff --git a/module-services/service-time/CMakeLists.txt b/module-services/service-time/CMakeLists.txt index fef7513b3338832e3cbe0be0fd63400b123f87b3..a4917eb54d3c304da3531a46b1400aeddeeff55a 100644 --- a/module-services/service-time/CMakeLists.txt +++ b/module-services/service-time/CMakeLists.txt @@ -33,6 +33,7 @@ target_link_libraries(${PROJECT_NAME} utils-time service-db service-time-api + service-evtmgr module-sys module-apps ) diff --git a/module-sys/Service/include/Service/Service.hpp b/module-sys/Service/include/Service/Service.hpp index c67d987eae1e536d78b5b6979ad2de390c6a976b..740f67dbbc032ddc316caa6adb2dea0c801643a3 100644 --- a/module-sys/Service/include/Service/Service.hpp +++ b/module-sys/Service/include/Service/Service.hpp @@ -5,7 +5,6 @@ #include "ServiceForward.hpp" #include "BusProxy.hpp" -#include "Common.hpp" // for ReturnCodes, ServicePriority, BusChannels #include "Mailbox.hpp" // for Mailbox #include "Message.hpp" // for MessagePointer #include "ServiceManifest.hpp" diff --git a/module-sys/SystemManager/CMakeLists.txt b/module-sys/SystemManager/CMakeLists.txt index 2e29dbc154378786adc7047a6658c11e04814c93..99f417662574082e45fcc90025e492502a332502 100644 --- a/module-sys/SystemManager/CMakeLists.txt +++ b/module-sys/SystemManager/CMakeLists.txt @@ -29,14 +29,14 @@ target_include_directories(sys-manager ) target_link_libraries(sys-manager - PRIVATE + PUBLIC apps-common service-evtmgr - - PUBLIC eventstore sys-service sys-common + PRIVATE + service-desktop ) if (${ENABLE_TESTS}) diff --git a/module-utils/log/board/rt1051/CMakeLists.txt b/module-utils/log/board/rt1051/CMakeLists.txt index 1b6d6a296e2cdc3a59bf39cdee82f83cb2e06d92..4989715a24f0b8c8b93c078d19324728ab5c2d74 100644 --- a/module-utils/log/board/rt1051/CMakeLists.txt +++ b/module-utils/log/board/rt1051/CMakeLists.txt @@ -8,6 +8,7 @@ target_link_libraries(log PRIVATE module-bsp segger::rtt + utils-time ) if (${LOG_REDIRECT} STREQUAL "RTT_JLINK")