-
Notifications
You must be signed in to change notification settings - Fork 3k
[feature-nrf528xx] NRF52 serial bug fix and serial_free implementation #6491
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
[feature-nrf528xx] NRF52 serial bug fix and serial_free implementation #6491
Conversation
serial_putc didn't work when called with interrupts disabled.
Instance counter keeps track of how many objects have been initialized and freed. On the first object the instance is enabled and on the last object the instance is disabled.
cmonr
left a comment
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.
LGTM aside for a few questions.
| nordic_nrf5_uart_state[instance].usage_counter++; | ||
|
|
||
| /* Enable instance on first usage. */ | ||
| if (nordic_nrf5_uart_state[instance].usage_counter == 1) { |
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.
Why does each peripheral instance have a usage counter? Shouldn't the usage counter be a part of the bank of peripherals?
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.
You enable/disable each instance separately.
| { | ||
| MBED_ASSERT(obj); | ||
|
|
||
| #if DEVICE_SERIAL_ASYNCH |
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 need for this feels very strange.
Is this to say that obj can take multiple serial_t types?
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.
Yes, all obj across the HAL is like that: https://github.com/ARMmbed/mbed-os/blob/master/hal/serial_api.h#L85-L101
| /* Take ownership and configure UART if necessary. */ | ||
| nordic_nrf5_serial_configure(obj); | ||
|
|
||
| /** |
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.
+1 for comments
|
/morph build |
1 similar comment
|
/morph build |
Build : SUCCESSBuild number : 1620 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1249 |
Test : SUCCESSBuild number : 1402 |
Description
Fixed a bug preventing serial_putc from working when interrupts were disabled.
Added resource counting and implemented missing serial_free function.
Pull request type
[x] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change