{"action":"created","issue":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2926","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2926/labels{/name}","comments_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2926/comments","events_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2926/events","html_url":"https://github.com/RIOT-OS/RIOT/pull/2926","id":73622386,"number":2926,"title":"sys: add new timer subsystem","user":{"login":"kaspar030","id":4679640,"avatar_url":"https://avatars.githubusercontent.com/u/4679640?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspar030","html_url":"https://github.com/kaspar030","followers_url":"https://api.github.com/users/kaspar030/followers","following_url":"https://api.github.com/users/kaspar030/following{/other_user}","gists_url":"https://api.github.com/users/kaspar030/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspar030/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspar030/subscriptions","organizations_url":"https://api.github.com/users/kaspar030/orgs","repos_url":"https://api.github.com/users/kaspar030/repos","events_url":"https://api.github.com/users/kaspar030/events{/privacy}","received_events_url":"https://api.github.com/users/kaspar030/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/core","name":"core","color":"0052cc"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/enhancement","name":"enhancement","color":"f17070"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/major","name":"major","color":"ff0000"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/NEEDS%20SQUASHING","name":"NEEDS SQUASHING","color":"009800"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/new%20feature","name":"new feature","color":"e11d21"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/Ready%20for%20CI%20build","name":"Ready for CI build","color":"bfdadc"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/Request%20for%20Comments","name":"Request for Comments","color":"23F823"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/TimerTaskForce","name":"TimerTaskForce","color":"f0c0ff"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/WIP","name":"WIP","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"gebart","id":317506,"avatar_url":"https://avatars.githubusercontent.com/u/317506?v=3","gravatar_id":"","url":"https://api.github.com/users/gebart","html_url":"https://github.com/gebart","followers_url":"https://api.github.com/users/gebart/followers","following_url":"https://api.github.com/users/gebart/following{/other_user}","gists_url":"https://api.github.com/users/gebart/gists{/gist_id}","starred_url":"https://api.github.com/users/gebart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gebart/subscriptions","organizations_url":"https://api.github.com/users/gebart/orgs","repos_url":"https://api.github.com/users/gebart/repos","events_url":"https://api.github.com/users/gebart/events{/privacy}","received_events_url":"https://api.github.com/users/gebart/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones/12","html_url":"https://github.com/RIOT-OS/RIOT/milestones/Release%202015.08","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones/12/labels","id":1088995,"number":12,"title":"Release 2015.08","description":"This release aims mainly to include the brand new network stack.","creator":{"login":"OlegHahm","id":1590423,"avatar_url":"https://avatars.githubusercontent.com/u/1590423?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegHahm","html_url":"https://github.com/OlegHahm","followers_url":"https://api.github.com/users/OlegHahm/followers","following_url":"https://api.github.com/users/OlegHahm/following{/other_user}","gists_url":"https://api.github.com/users/OlegHahm/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegHahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegHahm/subscriptions","organizations_url":"https://api.github.com/users/OlegHahm/orgs","repos_url":"https://api.github.com/users/OlegHahm/repos","events_url":"https://api.github.com/users/OlegHahm/events{/privacy}","received_events_url":"https://api.github.com/users/OlegHahm/received_events","type":"User","site_admin":false},"open_issues":68,"closed_issues":279,"state":"open","created_at":"2015-04-29T10:11:27Z","updated_at":"2015-08-14T12:35:12Z","due_on":"2015-08-30T22:00:00Z","closed_at":null},"comments":64,"created_at":"2015-05-06T13:34:51Z","updated_at":"2015-08-14T14:38:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/2926","html_url":"https://github.com/RIOT-OS/RIOT/pull/2926","diff_url":"https://github.com/RIOT-OS/RIOT/pull/2926.diff","patch_url":"https://github.com/RIOT-OS/RIOT/pull/2926.patch"},"body":"This is my work-in-progress new timer implementation.\r\n\r\nPlease take a look...\r\n\r\n~~The working title is \"wtimer\", but as that is hard to pronounce in english, I'm very open to suggestions.~~\r\n\r\nIt's now called xtimer, leaving room for two more tries! ;)\r\n\r\nIn order to actually try the code, I've adapted vtimer_msg to this API, the test is in test/wtimer_msg.\r\n\r\n~~(PR depends on #2870 so it can be tested on native).~~\r\n\r\nTo do:\r\n- [ ] support for base timer with a speed != 1MHz\r\n- [ ] ~~use slow low power timer or RTC if available~~ (let's get this in first)\r\n- [x] removal of timers\r\n- [x] some of the convenience functions are only available in 32bit versions\r\n- [x] some functions are missing\r\n\r\nOptional:\r\n- [ ] per-platform tuning values\r\n- [x] setting timers from whithin callbacks needs special care (half fixed)\r\n"},"comment":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/comments/131128299","html_url":"https://github.com/RIOT-OS/RIOT/pull/2926#issuecomment-131128299","issue_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2926","id":131128299,"user":{"login":"kaspar030","id":4679640,"avatar_url":"https://avatars.githubusercontent.com/u/4679640?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspar030","html_url":"https://github.com/kaspar030","followers_url":"https://api.github.com/users/kaspar030/followers","following_url":"https://api.github.com/users/kaspar030/following{/other_user}","gists_url":"https://api.github.com/users/kaspar030/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspar030/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspar030/subscriptions","organizations_url":"https://api.github.com/users/kaspar030/orgs","repos_url":"https://api.github.com/users/kaspar030/repos","events_url":"https://api.github.com/users/kaspar030/events{/privacy}","received_events_url":"https://api.github.com/users/kaspar030/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T14:38:50Z","updated_at":"2015-08-14T14:38:50Z","body":"> Better rounding, but requires that the intermediate variable has 15 extra bits of storage, so probably requires an intermediate cast to uint64_t\r\n\r\nWe could limit slower timers to less bits, e.g., 2^17 when they need dividing by 15. That would get more timers than necessary queued in the long_timers list, but need minimal changes.\r\n\r\n> and then rely on the same kind of spinlock-inside-ISR which avoids executing the callback early.\r\n\r\nI'd like to keep in-ISR spin locking to an absolute minimum. And in this case, we don't have an underlying time base to specify when we have spun enough, so it will be very hard to get this half-way accurate across platforms.\r\n\r\n> Also, do you have any plans to implement support for >1 MHz timers, such as the bus frequency timer on Kinetis (depends on core clocking, ~48 MHz on mulle standard configuration)?\r\n\r\nWell, it is easy to support them if they're using a factor of 2^n, but it wouldn't gain much precision using the current design. I'd say, if more than 1us precision is needed, using a shared multiplexing timer is a bad choice, and devs should directly use periph/timer.\r\n"}}