Skip to content

[HAL] Modified SPI to use shared mutex #2297

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

Merged
merged 1 commit into from
Jul 29, 2016
Merged

[HAL] Modified SPI to use shared mutex #2297

merged 1 commit into from
Jul 29, 2016

Conversation

neilt6
Copy link
Contributor

@neilt6 neilt6 commented Jul 28, 2016

Modified the SPI class to use a shared mutex for all instances in response to #2276. This is consistent with I2C and others.

Modified the SPI class to use a shared mutex for all instances. This is
consistent with I2C and others.
@sg-
Copy link
Contributor

sg- commented Jul 28, 2016

@c1728p9

@c1728p9
Copy link
Contributor

c1728p9 commented Jul 28, 2016

Thanks for the PR @neilt6. This looks good to me.

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 29, 2016

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM,ARM,IAR
TARGETS=K64F,NRF51_DK,NRF51_MICROBIT,NUCLEO_F411RE

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 29, 2016

/morph test

@anpilog
Copy link
Contributor

anpilog commented Jul 29, 2016

Hi,

What about MCU with more than 1 SPI controller?
Does it mean that all of them share one mutex in RTOS build?

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 29, 2016

What about MCU with more than 1 SPI controller?
Does it mean that all of them share one mutex in RTOS build?

yes, same as there's only one owner (private member variable).
We shall have a look at it and provide better locking mechanism (per peripheral instance).

@mbed-bot
Copy link

[Build 739]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@anpilog
Copy link
Contributor

anpilog commented Jul 29, 2016

Then it probably should be:

class SPI {
public:
    virtual bool lock(uint32_t millisec=osWaitForever) {
        return _mutex->lock(millisec) == osOK;
    }
}

Otherwise any attempt to use SPI methods would lead to wait.

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 29, 2016

@anpilog Can you create an issue for this? this might not be just a case for SPI. Shall we discuss this aside from this PR?

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 560

All builds and test passed!

@anpilog
Copy link
Contributor

anpilog commented Jul 29, 2016

Ok.
#2310

@0xc0170 0xc0170 removed the needs: CI label Jul 29, 2016
@0xc0170
Copy link
Contributor

0xc0170 commented Jul 29, 2016

CI results are good !

@0xc0170 0xc0170 merged commit ac34f29 into ARMmbed:master Jul 29, 2016
@neilt6 neilt6 deleted the spi-mutex-fix branch July 29, 2016 15: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.

6 participants