Skip to content

Conversation

@fvincenzo
Copy link
Member

@fvincenzo fvincenzo commented Sep 17, 2018

The CMSDK Timers (Single/Dual) can be used as a timer or as a counter. The unified interface proposed in #8340 unifies counter.h and rtc.h to provide a common interface.

This patchset makes the CMSDK Timers drivers compliant with the new proposed interface.

Changes:
v5:

  • Addressed review comments.

v4:

  • Implemented the new set_wrap/set_alarm API
  • Fixed a bug
  • Rebase on the latest topic-counters branch
  • General code cleanup

v3:

  • Removed status check in set_wrap_alarm
  • Rebase on latest master

v2:

  • Updated device tree for mps2_an385. The timers and counters are now working correctly even of this platform.

@nashif
Copy link
Member

nashif commented Sep 17, 2018

good to see you back @fvincenzo :)

@fvincenzo
Copy link
Member Author

good to see you back @fvincenzo :)
Thanks 😄

@codecov-io
Copy link

codecov-io commented Oct 1, 2018

Codecov Report

Merging #10025 into topic-counters will increase coverage by 3.18%.
The diff coverage is n/a.

Impacted file tree graph

@@                Coverage Diff                 @@
##           topic-counters   #10025      +/-   ##
==================================================
+ Coverage           50.35%   53.53%   +3.18%     
==================================================
  Files                 320      239      -81     
  Lines               53658    27052   -26606     
  Branches            13377     6521    -6856     
==================================================
- Hits                27017    14482   -12535     
+ Misses              21574     9900   -11674     
+ Partials             5067     2670    -2397
Impacted Files Coverage Δ
include/bluetooth/buf.h 0% <0%> (-100%) ⬇️
include/drivers/bluetooth/hci_driver.h 0% <0%> (-100%) ⬇️
include/bluetooth/hci.h 0% <0%> (-77.78%) ⬇️
include/misc/byteorder.h 56.81% <0%> (-40.91%) ⬇️
subsys/bluetooth/host/hci_core.c 2.67% <0%> (-38.78%) ⬇️
subsys/bluetooth/host/uuid.c 0% <0%> (-34.15%) ⬇️
include/bluetooth/bluetooth.h 0% <0%> (-31.58%) ⬇️
subsys/bluetooth/common/log.c 0% <0%> (-21.43%) ⬇️
subsys/net/ip/ipv6_mld.c 48.85% <0%> (-11.56%) ⬇️
lib/os/fdtable.c 31.46% <0%> (-11.24%) ⬇️
... and 125 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0aebb61...b448f19. Read the comment docs.

@galak galak changed the base branch from master to topic-counters October 30, 2018 16:10
@nordic-krch
Copy link
Contributor

please fix conflicts

@nordic-krch
Copy link
Contributor

please rebase on topic-counters

@galak
Copy link
Contributor

galak commented Nov 14, 2018

please rebase on topic-counters

rebased.

@fvincenzo
Copy link
Member Author

please rebase on topic-counters

rebased.

@galak Thanks 👍

@fvincenzo fvincenzo force-pushed the master branch 2 times, most recently from e8d4de9 to bcedfc4 Compare November 16, 2018 15:25
@fvincenzo
Copy link
Member Author

fvincenzo commented Nov 16, 2018

please rebase on topic-counters

@nordic-krch I did the changes your required in the last iterations of these patches, could you please acknowledge you change requests and close them? Unless you have more comments 😄

@MaureenHelm MaureenHelm added area: Counter area: API Changes to public APIs labels Nov 28, 2018
@MaureenHelm
Copy link
Member

@fvincenzo It looks like some non-counter related stuff slipped into this PR since you submitted it from fvincenzo:master. Will you please move the counter patches to their own branch and resubmit the PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

please align to latest changes set_wrap -> set_top_value, get_wrap->get_top_value

Copy link
Member

Choose a reason for hiding this comment

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

The fact that CI is still passing suggests that we're not building this driver in CI. @fvincenzo will you please add counter to the supported list in the appropriate <board>.yaml file? Like this:

supported:
- ieee802154
- adc
- counter

Copy link
Contributor

Choose a reason for hiding this comment

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

if counter_config_info is correctly set you don't need to provide this function as it will be never called if counter_config_info indicates that there is not channels. See counter_set_channel_alarm in counter.h

Copy link
Contributor

Choose a reason for hiding this comment

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

name has changed.

@nordic-krch
Copy link
Contributor

@fvincenzo i added couple of minor comments. Please rebase on latest topic-counters and update the code. I think that build is green because this driver is never compiled. You could try to add a board to test so that it's verified.

@fvincenzo
Copy link
Member Author

@fvincenzo i added couple of minor comments. Please rebase on latest topic-counters and update the code. I think that build is green because this driver is never compiled. You could try to add a board to test so that it's verified.

@nordic-krch thanks for adding the comments. It is quite strange though, the code has been tested on beetle locally for all the drivers I submitted in this pull request and works correctly. I do not like to push untested code for review. Said that I think that the situation is getting confusing (at least on my side 😄): my tree is currently rebased on origin/topic-counters as per your request and it is how I tested my code. Am I doing anything wrong?

@nordic-krch
Copy link
Contributor

@fvincenzo that is indeed strange. counter api struct has no .set_wrap field anymore (it's renamed to set_top_value):

counter_api_set_top_value set_top_value;

And in your code you are setting it in the driver. So would expect that compilation will fail 😄

@fvincenzo
Copy link
Member Author

fvincenzo commented Jan 24, 2019

@fvincenzo that is indeed strange. counter api struct has no .set_wrap field anymore (it's renamed to set_top_value):
zephyr/include/counter.h

Line 111 in 26b5136

counter_api_set_top_value set_top_value;
And in your code you are setting it in the driver. So would expect that compilation will fail

@nordic-krch Well then we have to work out why this is happening 😄. So are we sure that the topic branch is origin/topic-counters?

This is what the datastructure looks like (top commit f81e4d78702ec32ae811d2c86e5c91ba0f525cad) :

struct counter_driver_api {
	counter_api_start start;
	counter_api_stop stop;
	counter_api_read read;
	counter_api_set_alarm set_alarm;
	counter_api_disable_alarm disable_alarm;
	counter_api_set_wrap set_wrap;
	counter_api_get_pending_int get_pending_int;
	counter_api_get_wrap get_wrap;
	counter_api_get_max_relative_alarm get_max_relative_alarm;
	counter_api_get_user_data get_user_data;
};

@nordic-krch
Copy link
Contributor

@fvincenzo you are missing 6 commits in origin/topic-counters: https://github.com/zephyrproject-rtos/zephyr/commits/topic-counters

@fvincenzo
Copy link
Member Author

@fvincenzo i added couple of minor comments. Please rebase on latest topic-counters and update the code. I think that build is green because this driver is never compiled. You could try to add a board to test so that it's verified.

@nordic-krch This commits were put on the tree after I updated my pull request (this explains)... Anyway, since the interface changed several times from last September (and I have been rebasing few times to accomodate it), how about you freeze it and than we start the porting of the drivers, otherwise it will always be a race behind you... 😄

@nordic-krch
Copy link
Contributor

@fvincenzo sorry for that, unfortunately for driver maintainers there are still active discussions so api will change again but we want to get to master with current api and do the second round once there is a conclusion.

@fvincenzo
Copy link
Member Author

@fvincenzo sorry for that, unfortunately for driver maintainers there are still active discussions so api will change again but we want to get to master with current api and do the second round once there is a conclusion.

@nordic-krch That is fine by me. Changing an API is a complex process... and it is better to get it right. From the process stand point, I believe that the drivers porting should start only when the API reaches a versioned (i.e. 1.0) state. So that a driver can be declared compliant with a certain version. When are you going to release the first version?

@nordic-krch
Copy link
Contributor

could you rebase your PR so we can merge it? I see that it contains additional 21 commits that shouldn't be there.

@galak
Copy link
Contributor

galak commented Jan 29, 2019

could you rebase your PR so we can merge it? I see that it contains additional 21 commits that shouldn't be there.

rebased

@nordic-krch
Copy link
Contributor

how about you freeze it and than we start the porting of the drivers, otherwise it will always be a race behind you... 😄

@fvincenzo It's freezed for now until we go to master. please apply comments so we can merge it.

@galak galak added this to the v1.14.0 milestone Jan 29, 2019
@galak
Copy link
Contributor

galak commented Jan 31, 2019

@MaureenHelm, @nordic-krch can you guys re-review.

galak added 5 commits February 5, 2019 09:29
Add a label property so we can use that in drivers rather than getting
from Kconfig.

Signed-off-by: Kumar Gala <[email protected]>
The CMSDK Timer can be used as a timer or as a counter.
The unified interface proposed in zephyrproject-rtos#8340 unifies counter.h and rtc.h to
provide a common interface.

This patch modifies the timer implementation of the single timer to
make it compliant with the new proposed interface.

Signed-off-by: Vincenzo Frascino <[email protected]>
Signed-off-by: Kumar Gala <[email protected]>
The CMSDK Dual Timer can be used as a timer or as a counter.
The unified interface proposed in zephyrproject-rtos#8340 unifies counter.h and rtc.h to
provide a common interface.

This patch modifies the timer implementation of the dual timer to
make it compliant with the new proposed interface.

Signed-off-by: Vincenzo Frascino <[email protected]>
Signed-off-by: Kumar Gala <[email protected]>
Enable testing of counter (COUNTER_{D}TMR_CMSDK) on mps2_an385 and
enable timers on v2m_beetle (TIMER_{D}TMR_CMSDK).

Signed-off-by: Kumar Gala <[email protected]>
Convert cmsdk driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <[email protected]>
@galak
Copy link
Contributor

galak commented Feb 5, 2019

@nordic-krch @MaureenHelm can you guys re-review.

Copy link
Contributor

@nordic-krch nordic-krch left a comment

Choose a reason for hiding this comment

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

approve with 2 minor comments (seems like description is not updated after taking it from template).

label:
type: string
category: required
description: Human readable string describing the device (used by Zephyr for API name)
Copy link
Contributor

Choose a reason for hiding this comment

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

should that be here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Meaning?

label:
type: string
category: required
description: Human readable string describing the device (used by Zephyr for API name)
Copy link
Contributor

Choose a reason for hiding this comment

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

should that be here?

@MaureenHelm MaureenHelm merged commit b0d2c86 into zephyrproject-rtos:topic-counters Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: API Changes to public APIs area: Counter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants