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

HAL: Add a get_capabilities() function to GPIO API #12477

Merged
merged 4 commits into from
Feb 24, 2020

Conversation

fkjagodzinski
Copy link
Member

Summary of changes

Add the gpio_get_capabilities() function to the GPIO HAL API to skip the unsupported input pull modes when testing with the FPGA-CI-test-shield.

Updated tests:

  • tests-mbed_hal_fpga_ci_test_shield-gpio.

Impact of changes

Extend the GPIO HAL API with the gpio_get_capabilities() function. Unsupported input pull modes are skipped during the greentea tests.

Migration actions required

A default, weak implementation is provided. Every target has to override this weak implementation to provide the correct gpio_capabilities_t.

Documentation

None


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[x] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@ccli8, @wajahat-ublox, @mprse, @jamesbeyond


Filip Jagodzinski added 4 commits February 19, 2020 18:28
Add the gpio_get_capabilities() to GPIO HAL API.
Add a default, weak implementation, that every target can override.
Make use of the gpio_get_capabilities() function to skip unsupported
input pull modes when testing with the FPGA-CI-test-shield.
Remove the gpio_pinmap() for this target. GPIO tests are skipped based
on pin's capabilities.
TARGET_NANO100, TARGET_NUC472 & TARGET_M451 do not support input pull
mode configuration.
@ciarmcom
Copy link
Member

@fkjagodzinski, thank you for your changes.
@ccli8 @mprse @maclobdell @wajahat-ublox @Ronny-Liu @jamesbeyond @ARMmbed/mbed-os-hal @ARMmbed/mbed-os-test @ARMmbed/mbed-os-maintainers please review.

@fkjagodzinski
Copy link
Member Author

@ccli8, please note that this PR (09ecd2f) overrides your changes from 0e09260.

@ccli8
Copy link
Contributor

ccli8 commented Feb 21, 2020

@ccli8, please note that this PR (09ecd2f) overrides your changes from 0e09260.

@fkjagodzinski Thanks for your reminding. That's fine.

Copy link
Contributor

@mprse mprse left a comment

Choose a reason for hiding this comment

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

Everything looks good here. Just wondering if you can provide the test results as a part of this PR?

@mergify mergify bot added needs: CI and removed needs: review labels Feb 21, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Feb 21, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Feb 21, 2020

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 21, 2020

Everything looks good here. Just wondering if you can provide the test results as a part of this PR?

That would be great. This is otherwise ready. Let us know how was this tested

@fkjagodzinski
Copy link
Member Author

(...) Just wondering if you can provide the test results as a part of this PR?

| target       | platform_name | test suite                                  | test case             | passed | failed | result | elapsed_time (sec) |
|--------------|---------------|---------------------------------------------|-----------------------|--------|--------|--------|--------------------|
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-gpio     | basic input & output  | 1      | 0      | OK     | 1.72               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-gpio     | explicit init, input  | 1      | 0      | OK     | 1.82               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-gpio     | explicit init, output | 1      | 0      | OK     | 1.74               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-gpio     | input pull modes      | 1      | 0      | OK     | 1.84               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-gpio_irq | init/free             | 1      | 0      | OK     | 1.77               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-gpio_irq | rising & falling edge | 1      | 0      | OK     | 2.67               |
| target                | platform_name | test suite                                  | test case             | passed | failed | result | elapsed_time (sec) |
|-----------------------|---------------|---------------------------------------------|-----------------------|--------|--------|--------|--------------------|
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-gpio     | basic input & output  | 1      | 0      | OK     | 1.61               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-gpio     | explicit init, input  | 1      | 0      | OK     | 1.6                |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-gpio     | explicit init, output | 1      | 0      | OK     | 1.61               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-gpio     | input pull modes      | 1      | 0      | OK     | 1.63               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-gpio_irq | init/free             | 1      | 0      | OK     | 1.76               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-gpio_irq | rising & falling edge | 1      | 0      | OK     | 1.89               |

@fkjagodzinski
Copy link
Member Author

fkjagodzinski commented Feb 21, 2020

And in case of K64F, a more detailed log looks like this (note the skipped parts):

[1582301778.65][CONN][RXD] ***Testing GPIO on all form factor ports***
[1582301778.72][CONN][RXD]  D0 - IO pin tested on port: peripheral=(0) IO=(D0) ...succeeded
[1582301778.79][CONN][RXD]  D1 - IO pin tested on port: peripheral=(0) IO=(D1) ...succeeded
[1582301778.87][CONN][RXD]  D2 - IO pin tested on port: peripheral=(0) IO=(D2) ...succeeded
[1582301778.94][CONN][RXD]  D3 - IO pin tested on port: peripheral=(0) IO=(D3) ...succeeded
[1582301779.02][CONN][RXD]  D4 - IO pin tested on port: peripheral=(0) IO=(D4) ...succeeded
[1582301779.09][CONN][RXD]  D5 - IO pin tested on port: peripheral=(0) IO=(D5) ...succeeded
[1582301779.16][CONN][RXD]  D6 - IO pin tested on port: peripheral=(0) IO=(D6) ...succeeded
[1582301779.23][CONN][RXD]  D7 - IO pin tested on port: peripheral=(0) IO=(D7) ...succeeded
[1582301779.31][CONN][RXD]  D8 - IO pin tested on port: peripheral=(0) IO=(D8) ...succeeded
[1582301779.38][CONN][RXD]  D9 - IO pin tested on port: peripheral=(0) IO=(D9) ...succeeded
[1582301779.46][CONN][RXD] D10 - IO pin tested on port: peripheral=(0) IO=(D10) ...succeeded
[1582301779.53][CONN][RXD] D11 - IO pin tested on port: peripheral=(0) IO=(D11) ...succeeded
[1582301779.60][CONN][RXD] D12 - IO pin tested on port: peripheral=(0) IO=(D12) ...succeeded
[1582301779.68][CONN][RXD] D13 - IO pin tested on port: peripheral=(0) IO=(D13) ...succeeded
[1582301779.75][CONN][RXD] D14 - IO pin tested on port: peripheral=(0) IO=(D14) ...succeeded
[1582301779.83][CONN][RXD] D15 - IO pin tested on port: peripheral=(0) IO=(D15) ...succeeded
[1582301779.89][CONN][RXD]  A0 - IO pin tested on port: peripheral=(0) IO=(A0) ...succeeded
[1582301779.97][CONN][RXD]  A1 - IO pin tested on port: peripheral=(0) IO=(A1) ...succeeded
[1582301780.04][CONN][RXD]  A2 - IO pin tested on port: peripheral=(0) IO=(A2) ...succeeded
[1582301780.12][CONN][RXD]  A3 - IO pin tested on port: peripheral=(0) IO=(A3) ...succeeded
[1582301780.19][CONN][RXD]  A4 - IO pin tested on port: peripheral=(0) IO=(A4) ...succeeded
[1582301780.27][CONN][RXD]  A5 - IO pin tested on port: peripheral=(0) IO=(A5) ...succeeded
[1582301780.32][CONN][INF] found KV pair in stream: {{__testcase_finish;basic input & output;1;0}}, queued...
[1582301780.36][CONN][RXD] >>> 'basic input & output': 1 passed, 0 failed
[1582301780.36][CONN][RXD]
[1582301780.40][CONN][RXD] >>> Running case #2: 'input pull modes'...
[1582301780.45][CONN][INF] found KV pair in stream: {{__testcase_start;input pull modes}}, queued...
[1582301780.50][CONN][RXD] ***Testing GPIO on all form factor ports***
[1582301780.57][CONN][RXD]  D0 - IO pin tested on port: peripheral=(0) IO=(D0) ...succeeded
[1582301780.64][CONN][RXD]  D1 - IO pin tested on port: peripheral=(0) IO=(D1) ...succeeded
[1582301780.72][CONN][RXD]  D2 - IO pin tested on port: peripheral=(0) IO=(D2) ...succeeded
[1582301780.80][CONN][RXD]  D3 - IO pin tested on port: peripheral=(0) IO=(D3) ...succeeded
[1582301780.87][CONN][RXD]  D4 - IO pin tested on port: peripheral=(0) IO=(D4) ...succeeded
[1582301780.94][CONN][RXD]  D5 - IO pin tested on port: peripheral=(0) IO=(D5) ...succeeded
[1582301781.02][CONN][RXD]  D6 - IO pin tested on port: peripheral=(0) IO=(D6) ...succeeded
[1582301781.09][CONN][RXD]  D7 - IO pin tested on port: peripheral=(0) IO=(D7) ...succeeded
[1582301781.17][CONN][RXD]  D8 - IO pin tested on port: peripheral=(0) IO=(D8) ...succeeded
[1582301781.24][CONN][RXD]  D9 - IO pin tested on port: peripheral=(0) IO=(D9) ...succeeded
[1582301781.32][CONN][RXD] D10 - IO pin tested on port: peripheral=(0) IO=(D10) ...succeeded
[1582301781.40][CONN][RXD] D11 - IO pin tested on port: peripheral=(0) IO=(D11) ...succeeded
[1582301781.47][CONN][RXD] D12 - IO pin tested on port: peripheral=(0) IO=(D12) ...succeeded
[1582301781.55][CONN][RXD] D13 - IO pin tested on port: peripheral=(0) IO=(D13) ...succeeded
[1582301781.68][CONN][RXD] D14 - IO pin tested on port: peripheral=(0) IO=(D14) ...skipped PullUp,skipped PullDown,skipped PullNone,succeeded
[1582301781.80][CONN][RXD] D15 - IO pin tested on port: peripheral=(0) IO=(D15) ...skipped PullUp,skipped PullDown,skipped PullNone,succeeded
[1582301781.87][CONN][RXD]  A0 - IO pin tested on port: peripheral=(0) IO=(A0) ...succeeded
[1582301781.95][CONN][RXD]  A1 - IO pin tested on port: peripheral=(0) IO=(A1) ...succeeded
[1582301782.02][CONN][RXD]  A2 - IO pin tested on port: peripheral=(0) IO=(A2) ...succeeded
[1582301782.09][CONN][RXD]  A3 - IO pin tested on port: peripheral=(0) IO=(A3) ...succeeded
[1582301782.17][CONN][RXD]  A4 - IO pin tested on port: peripheral=(0) IO=(A4) ...succeeded
[1582301782.25][CONN][RXD]  A5 - IO pin tested on port: peripheral=(0) IO=(A5) ...succeeded
[1582301782.29][CONN][INF] found KV pair in stream: {{__testcase_finish;input pull modes;1;0}}, queued...
[1582301782.33][CONN][RXD] >>> 'input pull modes': 1 passed, 0 failed
[1582301782.33][CONN][RXD]
[1582301782.39][CONN][RXD] >>> Running case #3: 'explicit init, input'...
[1582301782.43][CONN][INF] found KV pair in stream: {{__testcase_start;explicit init, input}}, queued...
[1582301782.47][CONN][RXD] ***Testing GPIO on all form factor ports***
[1582301782.54][CONN][RXD]  D0 - IO pin tested on port: peripheral=(0) IO=(D0) ...succeeded
[1582301782.62][CONN][RXD]  D1 - IO pin tested on port: peripheral=(0) IO=(D1) ...succeeded
[1582301782.69][CONN][RXD]  D2 - IO pin tested on port: peripheral=(0) IO=(D2) ...succeeded
[1582301782.76][CONN][RXD]  D3 - IO pin tested on port: peripheral=(0) IO=(D3) ...succeeded
[1582301782.84][CONN][RXD]  D4 - IO pin tested on port: peripheral=(0) IO=(D4) ...succeeded
[1582301782.91][CONN][RXD]  D5 - IO pin tested on port: peripheral=(0) IO=(D5) ...succeeded
[1582301782.98][CONN][RXD]  D6 - IO pin tested on port: peripheral=(0) IO=(D6) ...succeeded
[1582301783.06][CONN][RXD]  D7 - IO pin tested on port: peripheral=(0) IO=(D7) ...succeeded
[1582301783.13][CONN][RXD]  D8 - IO pin tested on port: peripheral=(0) IO=(D8) ...succeeded
[1582301783.20][CONN][RXD]  D9 - IO pin tested on port: peripheral=(0) IO=(D9) ...succeeded
[1582301783.27][CONN][RXD] D10 - IO pin tested on port: peripheral=(0) IO=(D10) ...succeeded
[1582301783.34][CONN][RXD] D11 - IO pin tested on port: peripheral=(0) IO=(D11) ...succeeded
[1582301783.42][CONN][RXD] D12 - IO pin tested on port: peripheral=(0) IO=(D12) ...succeeded
[1582301783.49][CONN][RXD] D13 - IO pin tested on port: peripheral=(0) IO=(D13) ...succeeded
[1582301783.62][CONN][RXD] D14 - IO pin tested on port: peripheral=(0) IO=(D14) ...skipped PullUp,skipped PullDown,skipped PullUp,skipped PullDown,succeeded
[1582301783.76][CONN][RXD] D15 - IO pin tested on port: peripheral=(0) IO=(D15) ...skipped PullUp,skipped PullDown,skipped PullUp,skipped PullDown,succeeded
[1582301783.84][CONN][RXD]  A0 - IO pin tested on port: peripheral=(0) IO=(A0) ...succeeded
[1582301783.91][CONN][RXD]  A1 - IO pin tested on port: peripheral=(0) IO=(A1) ...succeeded
[1582301783.98][CONN][RXD]  A2 - IO pin tested on port: peripheral=(0) IO=(A2) ...succeeded
[1582301784.06][CONN][RXD]  A3 - IO pin tested on port: peripheral=(0) IO=(A3) ...succeeded
[1582301784.13][CONN][RXD]  A4 - IO pin tested on port: peripheral=(0) IO=(A4) ...succeeded
[1582301784.21][CONN][RXD]  A5 - IO pin tested on port: peripheral=(0) IO=(A5) ...succeeded
[1582301784.25][CONN][INF] found KV pair in stream: {{__testcase_finish;explicit init, input;1;0}}, queued...
[1582301784.30][CONN][RXD] >>> 'explicit init, input': 1 passed, 0 failed
[1582301784.30][CONN][RXD]
[1582301784.35][CONN][RXD] >>> Running case #4: 'explicit init, output'...
[1582301784.40][CONN][INF] found KV pair in stream: {{__testcase_start;explicit init, output}}, queued...
[1582301784.44][CONN][RXD] ***Testing GPIO on all form factor ports***
[1582301784.52][CONN][RXD]  D0 - IO pin tested on port: peripheral=(0) IO=(D0) ...succeeded
[1582301784.58][CONN][RXD]  D1 - IO pin tested on port: peripheral=(0) IO=(D1) ...succeeded
[1582301784.66][CONN][RXD]  D2 - IO pin tested on port: peripheral=(0) IO=(D2) ...succeeded
[1582301784.73][CONN][RXD]  D3 - IO pin tested on port: peripheral=(0) IO=(D3) ...succeeded
[1582301784.80][CONN][RXD]  D4 - IO pin tested on port: peripheral=(0) IO=(D4) ...succeeded
[1582301784.88][CONN][RXD]  D5 - IO pin tested on port: peripheral=(0) IO=(D5) ...succeeded
[1582301784.95][CONN][RXD]  D6 - IO pin tested on port: peripheral=(0) IO=(D6) ...succeeded
[1582301785.03][CONN][RXD]  D7 - IO pin tested on port: peripheral=(0) IO=(D7) ...succeeded
[1582301785.10][CONN][RXD]  D8 - IO pin tested on port: peripheral=(0) IO=(D8) ...succeeded
[1582301785.16][CONN][RXD]  D9 - IO pin tested on port: peripheral=(0) IO=(D9) ...succeeded
[1582301785.24][CONN][RXD] D10 - IO pin tested on port: peripheral=(0) IO=(D10) ...succeeded
[1582301785.32][CONN][RXD] D11 - IO pin tested on port: peripheral=(0) IO=(D11) ...succeeded
[1582301785.38][CONN][RXD] D12 - IO pin tested on port: peripheral=(0) IO=(D12) ...succeeded
[1582301785.46][CONN][RXD] D13 - IO pin tested on port: peripheral=(0) IO=(D13) ...succeeded
[1582301785.56][CONN][RXD] D14 - IO pin tested on port: peripheral=(0) IO=(D14) ...skipped gpio_init_inout,succeeded
[1582301785.66][CONN][RXD] D15 - IO pin tested on port: peripheral=(0) IO=(D15) ...skipped gpio_init_inout,succeeded
[1582301785.73][CONN][RXD]  A0 - IO pin tested on port: peripheral=(0) IO=(A0) ...succeeded
[1582301785.81][CONN][RXD]  A1 - IO pin tested on port: peripheral=(0) IO=(A1) ...succeeded
[1582301785.88][CONN][RXD]  A2 - IO pin tested on port: peripheral=(0) IO=(A2) ...succeeded
[1582301785.94][CONN][RXD]  A3 - IO pin tested on port: peripheral=(0) IO=(A3) ...succeeded
[1582301786.02][CONN][RXD]  A4 - IO pin tested on port: peripheral=(0) IO=(A4) ...succeeded
[1582301786.09][CONN][RXD]  A5 - IO pin tested on port: peripheral=(0) IO=(A5) ...succeeded
[1582301786.14][CONN][INF] found KV pair in stream: {{__testcase_finish;explicit init, output;1;0}}, queued...
[1582301786.19][CONN][RXD] >>> 'explicit init, output': 1 passed, 0 failed

@0xc0170 0xc0170 merged commit dc733d8 into ARMmbed:master Feb 24, 2020
@mergify mergify bot removed the ready for merge label Feb 24, 2020
@fkjagodzinski fkjagodzinski deleted the hal-gpio-get_capabilities branch February 24, 2020 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants