Compare commits
3 Commits
c47bed0760
...
mueller/ua
Author | SHA1 | Date | |
---|---|---|---|
40e7b2dc31 | |||
b9d0ff8fb7 | |||
227535c461 |
@@ -1,2 +1,3 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE SourceHandler.cpp DestHandler.cpp
|
target_sources(
|
||||||
FaultHandlerBase.cpp UserBase.cpp CfdpHandler.cpp)
|
${LIB_FSFW_NAME} PRIVATE SourceHandler.cpp DestHandler.cpp
|
||||||
|
FaultHandlerBase.cpp UserBase.cpp CfdpHandler.cpp)
|
||||||
|
@@ -17,7 +17,7 @@ CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerC
|
|||||||
cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList,
|
cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList,
|
||||||
cfdpCfg.lostSegmentsList),
|
cfdpCfg.lostSegmentsList),
|
||||||
FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore,
|
FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore,
|
||||||
fsfwParams.tmStore)) {
|
fsfwParams.tmStore)) {
|
||||||
destHandler.setMsgQueue(msgQueue);
|
destHandler.setMsgQueue(msgQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,7 +12,11 @@
|
|||||||
struct FsfwHandlerParams {
|
struct FsfwHandlerParams {
|
||||||
FsfwHandlerParams(object_id_t objectId, HasFileSystemIF& vfs, AcceptsTelemetryIF& packetDest,
|
FsfwHandlerParams(object_id_t objectId, HasFileSystemIF& vfs, AcceptsTelemetryIF& packetDest,
|
||||||
StorageManagerIF& tcStore, StorageManagerIF& tmStore, MessageQueueIF& msgQueue)
|
StorageManagerIF& tcStore, StorageManagerIF& tmStore, MessageQueueIF& msgQueue)
|
||||||
: objectId(objectId), vfs(vfs), packetDest(packetDest), tcStore(tcStore), tmStore(tmStore),
|
: objectId(objectId),
|
||||||
|
vfs(vfs),
|
||||||
|
packetDest(packetDest),
|
||||||
|
tcStore(tcStore),
|
||||||
|
tmStore(tmStore),
|
||||||
msgQueue(msgQueue) {}
|
msgQueue(msgQueue) {}
|
||||||
object_id_t objectId{};
|
object_id_t objectId{};
|
||||||
HasFileSystemIF& vfs;
|
HasFileSystemIF& vfs;
|
||||||
|
@@ -526,16 +526,16 @@ ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandI
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
info->active = true;
|
info->active = true;
|
||||||
if (info->countdown != nullptr) {
|
if (info->countdown != nullptr) {
|
||||||
info->delayCycles = info->maxDelayCycles;
|
|
||||||
} else {
|
|
||||||
info->countdown->resetTimer();
|
info->countdown->resetTimer();
|
||||||
|
} else {
|
||||||
|
info->delayCycles = info->maxDelayCycles;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info->active = false;
|
info->active = false;
|
||||||
if (info->countdown != nullptr) {
|
if (info->countdown != nullptr) {
|
||||||
info->delayCycles = 0;
|
|
||||||
} else {
|
|
||||||
info->countdown->timeOut();
|
info->countdown->timeOut();
|
||||||
|
} else {
|
||||||
|
info->delayCycles = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/osal/common/TcpIpBase.h"
|
#include "fsfw/osal/common/TcpIpBase.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
|
#include "fsfw/serviceinterface.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
#include "fsfw/osal/windows/winTaskHelpers.h"
|
#include "fsfw/osal/windows/winTaskHelpers.h"
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) {
|
TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) {
|
||||||
return (static_cast<uint16_t>(prioClass) << 16) | static_cast<uint16_t>(prioNumber);
|
return (static_cast<uint16_t>(prioClass) << 16) | static_cast<uint16_t>(prioNumber);
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef PLATFORM_WIN
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
class SpacePacketParser {
|
class SpacePacketParser {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct FoundPacketInfo {
|
struct FoundPacketInfo {
|
||||||
size_t startIdx = 0;
|
size_t startIdx = 0;
|
||||||
size_t sizeFound = 0;
|
size_t sizeFound = 0;
|
||||||
@@ -51,9 +50,7 @@ class SpacePacketParser {
|
|||||||
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
|
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
|
||||||
FoundPacketInfo& packetInfo);
|
FoundPacketInfo& packetInfo);
|
||||||
|
|
||||||
size_t getAmountRead() {
|
size_t getAmountRead() { return amountRead; }
|
||||||
return amountRead;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
nextStartIdx = 0;
|
nextStartIdx = 0;
|
||||||
|
@@ -1 +1 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PUBLIC UartComIF.cpp UartCookie.cpp)
|
target_sources(${LIB_FSFW_NAME} PUBLIC UartComIF.cpp UartCookie.cpp helper.cpp)
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#include "UartComIF.h"
|
#include "UartComIF.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
@@ -93,7 +92,7 @@ int UartComIF::configureUartPort(UartCookie* uartCookie) {
|
|||||||
setStopBitOptions(&options, uartCookie);
|
setStopBitOptions(&options, uartCookie);
|
||||||
setDatasizeOptions(&options, uartCookie);
|
setDatasizeOptions(&options, uartCookie);
|
||||||
setFixedOptions(&options);
|
setFixedOptions(&options);
|
||||||
setUartMode(&options, *uartCookie);
|
uart::setMode(options, uartCookie->getUartMode());
|
||||||
if (uartCookie->getInputShouldBeFlushed()) {
|
if (uartCookie->getInputShouldBeFlushed()) {
|
||||||
tcflush(fd, TCIFLUSH);
|
tcflush(fd, TCIFLUSH);
|
||||||
}
|
}
|
||||||
@@ -102,7 +101,7 @@ int UartComIF::configureUartPort(UartCookie* uartCookie) {
|
|||||||
options.c_cc[VTIME] = 0;
|
options.c_cc[VTIME] = 0;
|
||||||
options.c_cc[VMIN] = 0;
|
options.c_cc[VMIN] = 0;
|
||||||
|
|
||||||
configureBaudrate(&options, uartCookie);
|
uart::setBaudrate(options, uartCookie->getBaudrate());
|
||||||
|
|
||||||
/* Save option settings */
|
/* Save option settings */
|
||||||
if (tcsetattr(fd, TCSANOW, &options) != 0) {
|
if (tcsetattr(fd, TCSANOW, &options) != 0) {
|
||||||
@@ -191,138 +190,6 @@ void UartComIF::setFixedOptions(struct termios* options) {
|
|||||||
options->c_oflag &= ~ONLCR;
|
options->c_oflag &= ~ONLCR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCookie) {
|
|
||||||
switch (uartCookie->getBaudrate()) {
|
|
||||||
case UartBaudRate::RATE_50:
|
|
||||||
cfsetispeed(options, B50);
|
|
||||||
cfsetospeed(options, B50);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_75:
|
|
||||||
cfsetispeed(options, B75);
|
|
||||||
cfsetospeed(options, B75);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_110:
|
|
||||||
cfsetispeed(options, B110);
|
|
||||||
cfsetospeed(options, B110);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_134:
|
|
||||||
cfsetispeed(options, B134);
|
|
||||||
cfsetospeed(options, B134);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_150:
|
|
||||||
cfsetispeed(options, B150);
|
|
||||||
cfsetospeed(options, B150);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_200:
|
|
||||||
cfsetispeed(options, B200);
|
|
||||||
cfsetospeed(options, B200);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_300:
|
|
||||||
cfsetispeed(options, B300);
|
|
||||||
cfsetospeed(options, B300);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_600:
|
|
||||||
cfsetispeed(options, B600);
|
|
||||||
cfsetospeed(options, B600);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_1200:
|
|
||||||
cfsetispeed(options, B1200);
|
|
||||||
cfsetospeed(options, B1200);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_1800:
|
|
||||||
cfsetispeed(options, B1800);
|
|
||||||
cfsetospeed(options, B1800);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_2400:
|
|
||||||
cfsetispeed(options, B2400);
|
|
||||||
cfsetospeed(options, B2400);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_4800:
|
|
||||||
cfsetispeed(options, B4800);
|
|
||||||
cfsetospeed(options, B4800);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_9600:
|
|
||||||
cfsetispeed(options, B9600);
|
|
||||||
cfsetospeed(options, B9600);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_19200:
|
|
||||||
cfsetispeed(options, B19200);
|
|
||||||
cfsetospeed(options, B19200);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_38400:
|
|
||||||
cfsetispeed(options, B38400);
|
|
||||||
cfsetospeed(options, B38400);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_57600:
|
|
||||||
cfsetispeed(options, B57600);
|
|
||||||
cfsetospeed(options, B57600);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_115200:
|
|
||||||
cfsetispeed(options, B115200);
|
|
||||||
cfsetospeed(options, B115200);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_230400:
|
|
||||||
cfsetispeed(options, B230400);
|
|
||||||
cfsetospeed(options, B230400);
|
|
||||||
break;
|
|
||||||
#ifndef __APPLE__
|
|
||||||
case UartBaudRate::RATE_460800:
|
|
||||||
cfsetispeed(options, B460800);
|
|
||||||
cfsetospeed(options, B460800);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_500000:
|
|
||||||
cfsetispeed(options, B500000);
|
|
||||||
cfsetospeed(options, B500000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_576000:
|
|
||||||
cfsetispeed(options, B576000);
|
|
||||||
cfsetospeed(options, B576000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_921600:
|
|
||||||
cfsetispeed(options, B921600);
|
|
||||||
cfsetospeed(options, B921600);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_1000000:
|
|
||||||
cfsetispeed(options, B1000000);
|
|
||||||
cfsetospeed(options, B1000000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_1152000:
|
|
||||||
cfsetispeed(options, B1152000);
|
|
||||||
cfsetospeed(options, B1152000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_1500000:
|
|
||||||
cfsetispeed(options, B1500000);
|
|
||||||
cfsetospeed(options, B1500000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_2000000:
|
|
||||||
cfsetispeed(options, B2000000);
|
|
||||||
cfsetospeed(options, B2000000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_2500000:
|
|
||||||
cfsetispeed(options, B2500000);
|
|
||||||
cfsetospeed(options, B2500000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_3000000:
|
|
||||||
cfsetispeed(options, B3000000);
|
|
||||||
cfsetospeed(options, B3000000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_3500000:
|
|
||||||
cfsetispeed(options, B3500000);
|
|
||||||
cfsetospeed(options, B3500000);
|
|
||||||
break;
|
|
||||||
case UartBaudRate::RATE_4000000:
|
|
||||||
cfsetispeed(options, B4000000);
|
|
||||||
cfsetospeed(options, B4000000);
|
|
||||||
break;
|
|
||||||
#endif // ! __APPLE__
|
|
||||||
default:
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t UartComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) {
|
ReturnValue_t UartComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) {
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
@@ -592,12 +459,4 @@ ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF* cookie) {
|
|||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UartComIF::setUartMode(struct termios* options, UartCookie& uartCookie) {
|
|
||||||
UartModes uartMode = uartCookie.getUartMode();
|
|
||||||
if (uartMode == UartModes::NON_CANONICAL) {
|
|
||||||
/* Disable canonical mode */
|
|
||||||
options->c_lflag &= ~ICANON;
|
|
||||||
} else if (uartMode == UartModes::CANONICAL) {
|
|
||||||
options->c_lflag |= ICANON;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -1,13 +1,15 @@
|
|||||||
#ifndef BSP_Q7S_COMIF_UARTCOMIF_H_
|
#ifndef BSP_Q7S_COMIF_UARTCOMIF_H_
|
||||||
#define BSP_Q7S_COMIF_UARTCOMIF_H_
|
#define BSP_Q7S_COMIF_UARTCOMIF_H_
|
||||||
|
|
||||||
|
#include "UartCookie.h"
|
||||||
|
#include "helper.h"
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "UartCookie.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the communication interface to access serial ports on linux based operating
|
* @brief This is the communication interface to access serial ports on linux based operating
|
||||||
@@ -101,14 +103,6 @@ class UartComIF : public DeviceCommunicationIF, public SystemObject {
|
|||||||
*/
|
*/
|
||||||
void setDatasizeOptions(struct termios* options, UartCookie* uartCookie);
|
void setDatasizeOptions(struct termios* options, UartCookie* uartCookie);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This functions adds the baudrate specified in the uartCookie to the termios options
|
|
||||||
* struct.
|
|
||||||
*/
|
|
||||||
void configureBaudrate(struct termios* options, UartCookie* uartCookie);
|
|
||||||
|
|
||||||
void setUartMode(struct termios* options, UartCookie& uartCookie);
|
|
||||||
|
|
||||||
ReturnValue_t handleCanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter,
|
ReturnValue_t handleCanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter,
|
||||||
size_t requestLen);
|
size_t requestLen);
|
||||||
ReturnValue_t handleNoncanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter,
|
ReturnValue_t handleNoncanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter,
|
||||||
|
@@ -1,51 +1,14 @@
|
|||||||
#ifndef SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
|
#ifndef SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
|
||||||
#define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
|
#define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
|
||||||
|
|
||||||
|
#include "helper.h"
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
enum class Parity { NONE, EVEN, ODD };
|
|
||||||
|
|
||||||
enum class StopBits { ONE_STOP_BIT, TWO_STOP_BITS };
|
|
||||||
|
|
||||||
enum class UartModes { CANONICAL, NON_CANONICAL };
|
|
||||||
|
|
||||||
enum class BitsPerWord { BITS_5, BITS_6, BITS_7, BITS_8 };
|
|
||||||
|
|
||||||
enum class UartBaudRate {
|
|
||||||
RATE_50,
|
|
||||||
RATE_75,
|
|
||||||
RATE_110,
|
|
||||||
RATE_134,
|
|
||||||
RATE_150,
|
|
||||||
RATE_200,
|
|
||||||
RATE_300,
|
|
||||||
RATE_600,
|
|
||||||
RATE_1200,
|
|
||||||
RATE_1800,
|
|
||||||
RATE_2400,
|
|
||||||
RATE_4800,
|
|
||||||
RATE_9600,
|
|
||||||
RATE_19200,
|
|
||||||
RATE_38400,
|
|
||||||
RATE_57600,
|
|
||||||
RATE_115200,
|
|
||||||
RATE_230400,
|
|
||||||
RATE_460800,
|
|
||||||
RATE_500000,
|
|
||||||
RATE_576000,
|
|
||||||
RATE_921600,
|
|
||||||
RATE_1000000,
|
|
||||||
RATE_1152000,
|
|
||||||
RATE_1500000,
|
|
||||||
RATE_2000000,
|
|
||||||
RATE_2500000,
|
|
||||||
RATE_3000000,
|
|
||||||
RATE_3500000,
|
|
||||||
RATE_4000000
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cookie for the UartComIF. There are many options available to configure the UART driver.
|
* @brief Cookie for the UartComIF. There are many options available to configure the UART driver.
|
||||||
|
150
src/fsfw_hal/linux/uart/helper.cpp
Normal file
150
src/fsfw_hal/linux/uart/helper.cpp
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
#include "helper.h"
|
||||||
|
#include "fsfw/serviceinterface.h"
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
void uart::setMode(struct termios& options, UartModes mode) {
|
||||||
|
if (mode == UartModes::NON_CANONICAL) {
|
||||||
|
/* Disable canonical mode */
|
||||||
|
options.c_lflag &= ~ICANON;
|
||||||
|
} else if (mode == UartModes::CANONICAL) {
|
||||||
|
options.c_lflag |= ICANON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart::setBaudrate(struct termios& options, UartBaudRate baud) {
|
||||||
|
switch (baud) {
|
||||||
|
case UartBaudRate::RATE_50:
|
||||||
|
cfsetispeed(&options, B50);
|
||||||
|
cfsetospeed(&options, B50);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_75:
|
||||||
|
cfsetispeed(&options, B75);
|
||||||
|
cfsetospeed(&options, B75);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_110:
|
||||||
|
cfsetispeed(&options, B110);
|
||||||
|
cfsetospeed(&options, B110);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_134:
|
||||||
|
cfsetispeed(&options, B134);
|
||||||
|
cfsetospeed(&options, B134);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_150:
|
||||||
|
cfsetispeed(&options, B150);
|
||||||
|
cfsetospeed(&options, B150);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_200:
|
||||||
|
cfsetispeed(&options, B200);
|
||||||
|
cfsetospeed(&options, B200);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_300:
|
||||||
|
cfsetispeed(&options, B300);
|
||||||
|
cfsetospeed(&options, B300);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_600:
|
||||||
|
cfsetispeed(&options, B600);
|
||||||
|
cfsetospeed(&options, B600);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_1200:
|
||||||
|
cfsetispeed(&options, B1200);
|
||||||
|
cfsetospeed(&options, B1200);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_1800:
|
||||||
|
cfsetispeed(&options, B1800);
|
||||||
|
cfsetospeed(&options, B1800);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_2400:
|
||||||
|
cfsetispeed(&options, B2400);
|
||||||
|
cfsetospeed(&options, B2400);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_4800:
|
||||||
|
cfsetispeed(&options, B4800);
|
||||||
|
cfsetospeed(&options, B4800);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_9600:
|
||||||
|
cfsetispeed(&options, B9600);
|
||||||
|
cfsetospeed(&options, B9600);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_19200:
|
||||||
|
cfsetispeed(&options, B19200);
|
||||||
|
cfsetospeed(&options, B19200);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_38400:
|
||||||
|
cfsetispeed(&options, B38400);
|
||||||
|
cfsetospeed(&options, B38400);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_57600:
|
||||||
|
cfsetispeed(&options, B57600);
|
||||||
|
cfsetospeed(&options, B57600);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_115200:
|
||||||
|
cfsetispeed(&options, B115200);
|
||||||
|
cfsetospeed(&options, B115200);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_230400:
|
||||||
|
cfsetispeed(&options, B230400);
|
||||||
|
cfsetospeed(&options, B230400);
|
||||||
|
break;
|
||||||
|
#ifndef __APPLE__
|
||||||
|
case UartBaudRate::RATE_460800:
|
||||||
|
cfsetispeed(&options, B460800);
|
||||||
|
cfsetospeed(&options, B460800);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_500000:
|
||||||
|
cfsetispeed(&options, B500000);
|
||||||
|
cfsetospeed(&options, B500000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_576000:
|
||||||
|
cfsetispeed(&options, B576000);
|
||||||
|
cfsetospeed(&options, B576000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_921600:
|
||||||
|
cfsetispeed(&options, B921600);
|
||||||
|
cfsetospeed(&options, B921600);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_1000000:
|
||||||
|
cfsetispeed(&options, B1000000);
|
||||||
|
cfsetospeed(&options, B1000000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_1152000:
|
||||||
|
cfsetispeed(&options, B1152000);
|
||||||
|
cfsetospeed(&options, B1152000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_1500000:
|
||||||
|
cfsetispeed(&options, B1500000);
|
||||||
|
cfsetospeed(&options, B1500000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_2000000:
|
||||||
|
cfsetispeed(&options, B2000000);
|
||||||
|
cfsetospeed(&options, B2000000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_2500000:
|
||||||
|
cfsetispeed(&options, B2500000);
|
||||||
|
cfsetospeed(&options, B2500000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_3000000:
|
||||||
|
cfsetispeed(&options, B3000000);
|
||||||
|
cfsetospeed(&options, B3000000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_3500000:
|
||||||
|
cfsetispeed(&options, B3500000);
|
||||||
|
cfsetospeed(&options, B3500000);
|
||||||
|
break;
|
||||||
|
case UartBaudRate::RATE_4000000:
|
||||||
|
cfsetispeed(&options, B4000000);
|
||||||
|
cfsetospeed(&options, B4000000);
|
||||||
|
break;
|
||||||
|
#endif // ! __APPLE__
|
||||||
|
default:
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int uart::readCountersAndErrors(int serialPort, serial_icounter_struct& icounter) {
|
||||||
|
return ioctl(serialPort, TIOCGICOUNT, &icounter);
|
||||||
|
}
|
||||||
|
|
62
src/fsfw_hal/linux/uart/helper.h
Normal file
62
src/fsfw_hal/linux/uart/helper.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#ifndef FSFW_HAL_LINUX_UART_HELPER_H_
|
||||||
|
#define FSFW_HAL_LINUX_UART_HELPER_H_
|
||||||
|
|
||||||
|
#include <termios.h>
|
||||||
|
#include <linux/serial.h>
|
||||||
|
|
||||||
|
enum class Parity { NONE, EVEN, ODD };
|
||||||
|
|
||||||
|
enum class StopBits { ONE_STOP_BIT, TWO_STOP_BITS };
|
||||||
|
|
||||||
|
enum class UartModes { CANONICAL, NON_CANONICAL };
|
||||||
|
|
||||||
|
enum class BitsPerWord { BITS_5, BITS_6, BITS_7, BITS_8 };
|
||||||
|
|
||||||
|
enum class UartBaudRate {
|
||||||
|
RATE_50,
|
||||||
|
RATE_75,
|
||||||
|
RATE_110,
|
||||||
|
RATE_134,
|
||||||
|
RATE_150,
|
||||||
|
RATE_200,
|
||||||
|
RATE_300,
|
||||||
|
RATE_600,
|
||||||
|
RATE_1200,
|
||||||
|
RATE_1800,
|
||||||
|
RATE_2400,
|
||||||
|
RATE_4800,
|
||||||
|
RATE_9600,
|
||||||
|
RATE_19200,
|
||||||
|
RATE_38400,
|
||||||
|
RATE_57600,
|
||||||
|
RATE_115200,
|
||||||
|
RATE_230400,
|
||||||
|
RATE_460800,
|
||||||
|
RATE_500000,
|
||||||
|
RATE_576000,
|
||||||
|
RATE_921600,
|
||||||
|
RATE_1000000,
|
||||||
|
RATE_1152000,
|
||||||
|
RATE_1500000,
|
||||||
|
RATE_2000000,
|
||||||
|
RATE_2500000,
|
||||||
|
RATE_3000000,
|
||||||
|
RATE_3500000,
|
||||||
|
RATE_4000000
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace uart {
|
||||||
|
|
||||||
|
void setMode(struct termios& options, UartModes mode);
|
||||||
|
/**
|
||||||
|
* @brief This functions adds the baudrate specified in the uartCookie to the termios options
|
||||||
|
* struct.
|
||||||
|
*/
|
||||||
|
void setBaudrate(struct termios& options, UartBaudRate baud);
|
||||||
|
|
||||||
|
int readCountersAndErrors(int serialPort, serial_icounter_struct& icounter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FSFW_HAL_LINUX_UART_HELPER_H_ */
|
@@ -17,7 +17,7 @@ class FaultHandlerMock : public FaultHandlerBase {
|
|||||||
|
|
||||||
void noticeOfSuspensionCb(TransactionId& id, ConditionCode code) override;
|
void noticeOfSuspensionCb(TransactionId& id, ConditionCode code) override;
|
||||||
void noticeOfCancellationCb(TransactionId& id, ConditionCode code) override;
|
void noticeOfCancellationCb(TransactionId& id, ConditionCode code) override;
|
||||||
void abandonCb(TransactionId& id,ConditionCode code) override;
|
void abandonCb(TransactionId& id, ConditionCode code) override;
|
||||||
void ignoreCb(TransactionId& id, ConditionCode code) override;
|
void ignoreCb(TransactionId& id, ConditionCode code) override;
|
||||||
|
|
||||||
FaultInfo& getFhInfo(FaultHandlerCode fhCode);
|
FaultInfo& getFhInfo(FaultHandlerCode fhCode);
|
||||||
|
Reference in New Issue
Block a user