Skip to content

Conversation

@marcuschangarm
Copy link
Contributor

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

Marcus Chang added 2 commits March 27, 2018 16:30
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.
Copy link
Contributor

@cmonr cmonr left a 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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/* Take ownership and configure UART if necessary. */
nordic_nrf5_serial_configure(obj);

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for comments

@cmonr cmonr requested a review from pan- March 28, 2018 03:52
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 28, 2018

/morph build

1 similar comment
@marcuschangarm
Copy link
Contributor Author

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 28, 2018

Build : SUCCESS

Build number : 1620
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6491/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 28, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 29, 2018

@cmonr cmonr merged commit 120f920 into ARMmbed:feature-nrf528xx Mar 29, 2018
@marcuschangarm marcuschangarm deleted the fix-nrf52-serial branch April 5, 2018 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants