-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add cycle counter driver and test app #386
base: master
Are you sure you want to change the base?
Conversation
libtock/cycle_counter.h
Outdated
bool cycle_counter_exists(void); | ||
int cycle_counter_start(void); | ||
int cycle_counter_stop(void); | ||
int cycle_counter_reset(void); | ||
int cycle_counter_read(int *count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably best to document these in the header file.
It's also worth saying that stop does not reset the counter and it needs to manually be reset
Can I ask you follow the new guide? https://github.com/tock/libtock-c/blob/43525b8fedff3531685dbb20b08916addcca0997/doc/guide.md Maybe not the syscalls folder but the naming convention? |
21d0830
to
f8e7bb0
Compare
Also adds a helper function for SuccessU64 syscall return values
f8e7bb0
to
8fd8e7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little ergonomic patch, but o/w looks good pending the kernel impl
} else if (rc == RETURNCODE_ERESERVE) { | ||
printf("Cycle counter claimed by another app\n"); | ||
} else if (rc != 0) { | ||
printf("Cycle counter: other error: %d\n", rc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf("Cycle counter: other error: %d\n", rc); | |
printf("Cycle counter: other error: %d (%s)\n", rc, tock_strerr(rc)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new libtock format
I will come back to this once the new libtock format is merged |
@hudson-ayers is this still on your queue? |
Yeah it is, just have had limited time for Tock stuff and have focused more on kernel stuff. I will get back to this eventually |
This PR adds a driver for the cycle counter capsule, for which kernel support is being added in tock/tock#3934. It also adds a basic test application which prints the number of cycles required to toggle an LED, after checking that the ability to start and stop the driver has not already been claimed by another app.
Tested by adding the capsule to the nrf52840dk and running this app. It takes about 4000 cycles to toggle an LED from userspace.