Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for additional baud rates #2217

Merged
merged 3 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Drv/LinuxUartDriver/LinuxUartDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,38 @@
case BAUD_921K:
relayRate = B921600;
break;
case BAUD_1000K:
relayRate = B1000000;
break;
case BAUD_1152K:
relayRate = B1152000;
break;
case BAUD_1500K:
relayRate = B1500000;
break;
case BAUD_2000K:
relayRate = B2000000;
break;
#ifdef B2500000
Dismissed Show dismissed Hide dismissed
case BAUD_2500K:
SMorettini marked this conversation as resolved.
Show resolved Hide resolved
relayRate = B2500000;
break;
#endif
#ifdef B3000000
Dismissed Show dismissed Hide dismissed
case BAUD_3000K:
relayRate = B3000000;
break;
#endif
#ifdef B3500000
Dismissed Show dismissed Hide dismissed
case BAUD_3500K:
relayRate = B3500000;
break;
#endif
#ifdef B4000000
Dismissed Show dismissed Hide dismissed
case BAUD_4000K:
relayRate = B4000000;
break;
#endif
#endif
default:
FW_ASSERT(0, baud);
Expand Down
31 changes: 30 additions & 1 deletion Drv/LinuxUartDriver/LinuxUartDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <Os/Mutex.hpp>
#include <Os/Task.hpp>

#include <termios.h>

namespace Drv {

class LinuxUartDriver : public LinuxUartDriverComponentBase {
Expand All @@ -36,7 +38,34 @@ class LinuxUartDriver : public LinuxUartDriverComponentBase {
);

//! Configure UART parameters
enum UartBaudRate { BAUD_9600=9600, BAUD_19200=19200, BAUD_38400=38400, BAUD_57600=57600, BAUD_115K=115200, BAUD_230K=230400, BAUD_460K=460800, BAUD_921K=921600};
enum UartBaudRate {
BAUD_9600=9600,
BAUD_19200=19200,
BAUD_38400=38400,
BAUD_57600=57600,
BAUD_115K=115200,
BAUD_230K=230400,
#ifdef TGT_OS_TYPE_LINUX
BAUD_460K=460800,
BAUD_921K=921600,
BAUD_1000K=1000000000,
BAUD_1152K=1152000000,
BAUD_1500K=1500000000,
BAUD_2000K=2000000000,
#ifdef B2500000
BAUD_2500K=2500000000,
#endif
#ifdef B3000000
BAUD_3000K=3000000000,
#endif
#ifdef B3500000
BAUD_3500K=3500000000,
#endif
#ifdef B4000000
BAUD_4000K=4000000000
#endif
#endif
};

enum UartFlowControl { NO_FLOW, HW_FLOW };

Expand Down
Loading