-
Notifications
You must be signed in to change notification settings - Fork 31
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
Adds 9bit reception support to the TI uart drivers. #713
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8f0dfc7
Adds 9bit reception capability to the CC32xxUart.
balazsracz 0b3174b
Merge branch 'master' into bracz-tiuart-ninebit
balazsracz dbca917
Adds 9bit to the tiva UART as well.
balazsracz 0496cf4
Merge branch 'master' into bracz-tiuart-ninebit
balazsracz e4c9d95
Fix comments.
balazsracz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ TivaUart::TivaUart(const char *name, unsigned long base, uint32_t interrupt, | |
, hwFIFO_(hw_fifo) | ||
, uartMode_(mode) | ||
, txPending_(false) | ||
, nineBit_(false) | ||
{ | ||
static_assert( | ||
UART_CONFIG_PAR_NONE == 0, "driverlib changed against our assumptions"); | ||
|
@@ -218,14 +219,35 @@ void TivaUart::interrupt_handler() | |
while (MAP_UARTCharsAvail(base_)) | ||
{ | ||
long data = MAP_UARTCharGetNonBlocking(base_); | ||
if (data >= 0 && data <= 0xff) | ||
if (nineBit_) | ||
{ | ||
unsigned char c = data; | ||
if (rxBuf->put(&c, 1) == 0) | ||
if (rxBuf->space() < 2) | ||
{ | ||
overrunCount++; | ||
++overrunCount; | ||
} | ||
else | ||
{ | ||
// parity error bit is moved to the ninth bit, then two bytes | ||
// are written to the buffer. | ||
long bit9 = (data & 0x200) >> 1; | ||
data &= 0xff; | ||
data |= bit9; | ||
rxBuf->put((uint8_t *)&data, 2); | ||
rxBuf->signal_condition_from_isr(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
} | ||
} | ||
else if (data >= 0 && data <= 0xff) | ||
{ | ||
if (rxBuf->space() < 1) | ||
{ | ||
++overrunCount; | ||
} | ||
else | ||
{ | ||
unsigned char c = data; | ||
rxBuf->put(&c, 1); | ||
rxBuf->signal_condition_from_isr(); | ||
} | ||
rxBuf->signal_condition_from_isr(); | ||
} | ||
} | ||
/* transmit a character if we have pending tx data */ | ||
|
@@ -302,6 +324,13 @@ int TivaUart::ioctl(File *file, unsigned long int key, unsigned long data) | |
uartMode_ |= UART_CONFIG_PAR_ONE; | ||
MAP_UARTParityModeSet(base_, UART_CONFIG_PAR_ONE); | ||
break; | ||
case TCNINEBITRX: | ||
nineBit_ = data != 0; | ||
if (!nineBit_) | ||
{ | ||
break; | ||
} | ||
// fall through | ||
case TCPARZERO: | ||
uartMode_ &= ~UART_CONFIG_PAR_MASK; | ||
uartMode_ |= UART_CONFIG_PAR_ZERO; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if/else [overrun] logic for signal_condition_from_isr() is not the same for both 9 and 8 bit data paths. I think technically either is actually fine, but we should be consistent. Pick one and modify the other to match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed