-
Notifications
You must be signed in to change notification settings - Fork 84
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
PolarFire SoC: Initial platform UART support #38
Conversation
|
||
static void uart_handle_irq(ps_chardevice_t* d UNUSED) | ||
{ | ||
|
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.
I'd recomment to add a comment that this is empty on purpose. Otherwise one might wonder if soemthing got lost form some failes merge
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.
Good call, added.
regs->tx_buffer = c; | ||
if (c == '\n' && (d->flags & SERIAL_AUTO_CR)) | ||
{ | ||
uart_putchar(d, '\r'); |
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.
This writes "\n\r" (LF+CR), but it should actually be "\r\n" (CR+LF ). That's a thing spreading through copy/paste since some time, see also https://github.com/seL4/util_libs/pull/30/commits).
I recommend to rewrite this as
static void busy_wait_fifo_empty_and_tx_char(uart_regs_t* regs, int c)
{
// wait until FIFO empty
while ((regs->line_status & LSR_TX_HOLD_REG_EMPTY_MASK) == 0)
{
// busy loop
}
regs->tx_buffer = c;
}
int uart_putchar(ps_chardevice_t* d, int c)
{
uart_regs_t* regs = uart_get_priv(d);
// turn LF into CR+LF if SERIAL_AUTO_CR is active
if ((c == '\n') && (d->flags & SERIAL_AUTO_CR))
{
busy_wait_fifo_empty_and_tx_char(d,'\r');
}
busy_wait_fifo_empty_and_tx_char(d, c);
return c;
}
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.
Nice catch, yeah I copied it from another driver.
d71006a
to
aa1199b
Compare
looks ok to me now |
@ssrg-bamboo |
Hello, I'm a bot! I'll bring this PR into Trustworthy Systems and run some tests |
Test results for commit aa1199bSummary
Detailed failure logs
Job: style
This is the most I can report on right now, sorry! |
Is this simply a failure on my part to run astyle? |
Apologize for leaving this PR unhandled for such a long time and thanks for this. |
aa1199b
to
8ded2c7
Compare
No worries! I just pushed the beautified files. |
@ssrg-bamboo |
Hello, I'm a bot! I'll bring this PR into Trustworthy Systems and run some tests |
All the tests we ran have passed! Nice job! |
Can you rebase this PR against master? |
Signed-off-by: Jesse Millwood <jesse.millwood@dornerworks.com>
8ded2c7
to
a6a56d6
Compare
@ssrg-bamboo |
Hello, I'm a bot! I'll bring this PR into Trustworthy Systems and run some tests |
All the tests we ran have passed! Nice job! |
Signed-off-by: Jesse Millwood jesse.millwood@dornerworks.com