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

Improve handling of drivers that use mutexes #1011

Merged
merged 1 commit into from
Nov 22, 2018

Conversation

josesimoes
Copy link
Member

Description

  • BusRelease are now called after the event code block and not on the event handler.
  • The drivers HAL init are called at nanoHAL_Initialize() to prevent drivers being locked on a nanoCLR restart.

Motivation and Context

  • Attempt to fix device locking when drivers that use mutexes are involved. There is the potential to lock the device on nanoCLR restart.

How Has This Been Tested?

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Signed-off-by: José Simões [email protected]

@josesimoes josesimoes added Type: enhancement Series: STM32xx Everything related specifically with STM32 targets labels Nov 22, 2018
@nfbot
Copy link
Member

nfbot commented Nov 22, 2018

Hi @josesimoes,

I'm nanoFramework bot.
Thank you for your contribution!

A human will be reviewing it shortly. 😉

- BusRelease are now called after the event code block and not on the event handler.
- The bus release are called at nanoHAL_Uninitialize() to prevent drivers being locked on a nanoCLR restart.

Signed-off-by: José Simões <[email protected]>
@josesimoes josesimoes merged commit d9e3316 into nanoframework:develop Nov 22, 2018
@josesimoes josesimoes changed the title Improve handling of drivers that have mutexes Improve handling of drivers that use mutexes Nov 22, 2018
@josesimoes josesimoes deleted the improve-driver-mutexes branch November 22, 2018 19:27
@gligorov
Copy link
Sponsor Contributor

I see a small typo/bug on the line 95, targets/CMSIS-OS/ChibiOS/nanoCLR/targetHAL.cpp

#if STM32_I2C_USE_I2C2

i2cReleaseBus(&I2CD1);

Should be, i2cReleaseBus(&I2CD2);

@josesimoes
Copy link
Member Author

@gligorov 😯 wow! Thanks for the code review and catching that. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Series: STM32xx Everything related specifically with STM32 targets Type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants