-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
arch/arm/src/samv7/sam_qencoder.c: add support for GETINDEX ioctl call #12081
arch/arm/src/samv7/sam_qencoder.c: add support for GETINDEX ioctl call #12081
Conversation
uint32_t new_pos; | ||
new_pos = sam_tc_getcounter(priv->tch); |
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.
uint32_t new_pos; | |
new_pos = sam_tc_getcounter(priv->tch); | |
uint16_t new_pos = sam_tc_getcounter(priv->tch); |
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.
Gain the use of uint32_t is based on the above described overhead with 16-bit operations on ARM and x86.
****************************************************************************/ | ||
|
||
static inline int32_t sam_qe_pos_16to32b(struct qe_lowerhalf_s *lower, | ||
uint32_t current_pos) |
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.
uint32_t current_pos) | |
uint16_t current_pos) |
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.
Gain, I expect no gain there
****************************************************************************/ | ||
|
||
static inline int32_t sam_qe_indx_pos_16to32b(struct qe_lowerhalf_s *lower, | ||
uint32_t current_indx_pos) |
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.
uint32_t current_indx_pos) | |
uint16_t current_indx_pos) |
I'm sorry for my inactivity, however I'm considering everything and I'll look into it further at the end of this week. Thanks for feedback. |
Don't worry! The most important is getting it working correctly! |
49cf972
to
005fd52
Compare
The SAMV7's qencoder driver now supports the GETINDEX ioctl call which does not reset the internal Timer/Counter and returns the current position, position of the last index and the number of captured indexes to a struct qe_index_s pointer. Because the SAMV7's timers are 16bit, the extension to 32 bits must be done. Select CONFIG_SAMV7_QENCODER_ENABLE_GETINDEX in the Kconfig to enable this functionality. This driver does not obey the instructions given in the ATSAMV7 2023 datasheet because the recommended trigger resets the internal counter which is not desired. Instead, a capture into capture A and capture B registers is used. This way if an event happens (the rising edge of the index signal), the current counter's value is captured. Signed-off-by: Stepan Pressl <pressste@fel.cvut.cz>
005fd52
to
5114bb3
Compare
The SAMV7's qencoder driver now supports the GETINDEX ioctl call which does not reset the internal Timer/Counter and returns the current position, position of the last index and the number of captured indexes to a struct qe_index_s pointer. Because the SAMV7's timers are 16bit, the extension to 32 bits must be done.
Select CONFIG_SAMV7_QENCODER_ENABLE_GETINDEX in the Kconfig to enable this functionality.
This driver does not obey the instructions given in the ATSAMV7 2023 datasheet because the recommended trigger resets the internal counter which is not desired. Instead, a capture into capture A and capture B registers is used. This way if an event happens (the rising edge of the index signal), the current counter's value is captured.