osal taken over
This commit is contained in:
parent
e052a9694f
commit
c174c9ecb8
34
osal/CMakeLists.txt
Normal file
34
osal/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Check the OS_FSFW variable
|
||||||
|
if(${OS_FSFW} STREQUAL "freertos")
|
||||||
|
add_subdirectory(FreeRTOS)
|
||||||
|
elseif(${OS_FSFW} STREQUAL "rtems")
|
||||||
|
add_subdirectory(rtems)
|
||||||
|
elseif(${OS_FSFW} STREQUAL "linux")
|
||||||
|
add_subdirectory(linux)
|
||||||
|
elseif(${OS_FSFW} STREQUAL "host")
|
||||||
|
add_subdirectory(host)
|
||||||
|
if (WIN32)
|
||||||
|
add_subdirectory(windows)
|
||||||
|
elseif(UNIX)
|
||||||
|
target_sources(${LIB_FSFW_NAME}
|
||||||
|
PUBLIC
|
||||||
|
linux/TcUnixUdpPollingTask.cpp
|
||||||
|
linux/TmTcUnixUdpBridge.cpp
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
message(WARNING "The OS_FSFW variable was not set. Assuming host OS..")
|
||||||
|
# Not set. Assumuing this is a host build, try to determine host OS
|
||||||
|
if (WIN32)
|
||||||
|
add_subdirectory(host)
|
||||||
|
add_subdirectory(windows)
|
||||||
|
elseif (UNIX)
|
||||||
|
add_subdirectory(linux)
|
||||||
|
else ()
|
||||||
|
# MacOS or other OSes have not been tested yet / are not supported.
|
||||||
|
message(FATAL_ERROR "The host OS could not be determined! Aborting.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
30
osal/FreeRTOS/CMakeLists.txt
Normal file
30
osal/FreeRTOS/CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME}
|
||||||
|
PRIVATE
|
||||||
|
Clock.cpp
|
||||||
|
FixedTimeslotTask.cpp
|
||||||
|
BinarySemaphore.cpp
|
||||||
|
BinSemaphUsingTask.cpp
|
||||||
|
CountingSemaphore.cpp
|
||||||
|
CountingSemaphUsingTask.cpp
|
||||||
|
MessageQueue.cpp
|
||||||
|
Mutex.cpp
|
||||||
|
MutexFactory.cpp
|
||||||
|
PeriodicTask.cpp
|
||||||
|
QueueFactory.cpp
|
||||||
|
SemaphoreFactory.cpp
|
||||||
|
TaskFactory.cpp
|
||||||
|
Timekeeper.cpp
|
||||||
|
TaskManagement.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# FreeRTOS is required to link the FSFW now. It is recommended to compile
|
||||||
|
# FreeRTOS as a static library and set LIB_OS_NAME to the target name of the
|
||||||
|
# library.
|
||||||
|
if(NOT LIB_OS_NAME)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"FreeRTOS needs to be linked as a target and "
|
||||||
|
"LIB_OS_NAME needs to be set to the target"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${LIB_FSWFW_NAME} ${LIB_OS_NAME})
|
21
osal/host/CMakeLists.txt
Normal file
21
osal/host/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME}
|
||||||
|
PRIVATE
|
||||||
|
Clock.cpp
|
||||||
|
FixedTimeslotTask.cpp
|
||||||
|
MessageQueue.cpp
|
||||||
|
Mutex.cpp
|
||||||
|
MutexFactory.cpp
|
||||||
|
PeriodicTask.cpp
|
||||||
|
QueueFactory.cpp
|
||||||
|
QueueMapManager.cpp
|
||||||
|
SemaphoreFactory.cpp
|
||||||
|
TaskFactory.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
target_link_libraries(${LIB_FSFW_NAME}
|
||||||
|
PRIVATE
|
||||||
|
rt
|
||||||
|
pthread
|
||||||
|
)
|
||||||
|
endif()
|
11
osal/windows/CMakeLists.txt
Normal file
11
osal/windows/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME}
|
||||||
|
PRIVATE
|
||||||
|
TcWinUdpPollingTask.cpp
|
||||||
|
TmTcWinUdpBridge.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${LIB_FSFW_NAME}
|
||||||
|
PRIVATE
|
||||||
|
wsock32
|
||||||
|
ws2_32
|
||||||
|
)
|
@ -6,6 +6,7 @@ TmTcWinUdpBridge::TmTcWinUdpBridge(object_id_t objectId,
|
|||||||
uint16_t serverPort, uint16_t clientPort):
|
uint16_t serverPort, uint16_t clientPort):
|
||||||
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
|
communicationLinkUp = false;
|
||||||
|
|
||||||
// Initiates Winsock DLL.
|
// Initiates Winsock DLL.
|
||||||
WSAData wsaData;
|
WSAData wsaData;
|
||||||
@ -90,7 +91,6 @@ ReturnValue_t TmTcWinUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
|||||||
// sif::debug << "TmTcUnixUdpBridge::sendTm: " << bytesSent << " bytes were"
|
// sif::debug << "TmTcUnixUdpBridge::sendTm: " << bytesSent << " bytes were"
|
||||||
// " sent." << std::endl;
|
// " sent." << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TmTcWinUdpBridge::checkAndSetClientAddress(sockaddr_in newAddress) {
|
void TmTcWinUdpBridge::checkAndSetClientAddress(sockaddr_in newAddress) {
|
||||||
@ -101,6 +101,7 @@ void TmTcWinUdpBridge::checkAndSetClientAddress(sockaddr_in newAddress) {
|
|||||||
// &newAddress.sin_addr.s_addr, ipAddress, 15) << std::endl;
|
// &newAddress.sin_addr.s_addr, ipAddress, 15) << std::endl;
|
||||||
// sif::debug << "IP Address Old: " << inet_ntop(AF_INET,
|
// sif::debug << "IP Address Old: " << inet_ntop(AF_INET,
|
||||||
// &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl;
|
// &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl;
|
||||||
|
registerCommConnect();
|
||||||
|
|
||||||
// Set new IP address if it has changed.
|
// Set new IP address if it has changed.
|
||||||
if(clientAddress.sin_addr.s_addr != newAddress.sin_addr.s_addr) {
|
if(clientAddress.sin_addr.s_addr != newAddress.sin_addr.s_addr) {
|
||||||
@ -114,7 +115,7 @@ void TmTcWinUdpBridge::handleSocketError() {
|
|||||||
switch(errCode) {
|
switch(errCode) {
|
||||||
case(WSANOTINITIALISED): {
|
case(WSANOTINITIALISED): {
|
||||||
sif::info << "TmTcWinUdpBridge::handleSocketError: WSANOTINITIALISED: "
|
sif::info << "TmTcWinUdpBridge::handleSocketError: WSANOTINITIALISED: "
|
||||||
<< "WSAStartup(...) call " << "necessary" << std::endl;
|
<< "WSAStartup(...) call necessary" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -159,11 +160,11 @@ void TmTcWinUdpBridge::handleSendError() {
|
|||||||
switch(errCode) {
|
switch(errCode) {
|
||||||
case(WSANOTINITIALISED): {
|
case(WSANOTINITIALISED): {
|
||||||
sif::info << "TmTcWinUdpBridge::handleSendError: WSANOTINITIALISED: "
|
sif::info << "TmTcWinUdpBridge::handleSendError: WSANOTINITIALISED: "
|
||||||
<< "WSAStartup(...) call " << "necessary" << std::endl;
|
<< "WSAStartup(...) call necessary" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(WSAEADDRNOTAVAIL): {
|
case(WSAEADDRNOTAVAIL): {
|
||||||
sif::info << "TmTcWinUdpBridge::handleReadError: WSAEADDRNOTAVAIL: "
|
sif::info << "TmTcWinUdpBridge::handleSendError: WSAEADDRNOTAVAIL: "
|
||||||
<< "Check target address. " << std::endl;
|
<< "Check target address. " << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user