You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I follow the steps in https://openrisc.io/newlib/building.html to build my own or1k toolchains.
Now I am trying to use timerrelated functions in $OR1K_ELF/or1k-elf/include/or1k-support.h.
I first start with the example at line 446 in or1k-support.h
void tick_handler(void) {
// Make schedule decision
// and set new thread
or1k_timer_reset();
// End of exception, new thread will run
}
int main() {
// Configure operating system and start threads..
// Configure timer
or1k_timer_init(50);
or1k_timer_set_handler(&tick_handler);
or1k_timer_set_mode(SPR_TTMR_SR);
or1k_timer_enable();
// Schedule first thread and die..
}
But the example failed to pass compile because the define SPR_TTMR_SR is missed.
I try to get the answer from the define of or1k_timer_set_mode.
/*!
Set timer mode
The timer has different modes (see architecture manual). The default is to
automatically restart counting (SPR_TTMR_RT), others are single run
(SPR_TTMR_SR) and continuous run (SPR_TTMR_CR).
\param mode a valid mode (use definitions from spr-defs.h as it is important
that those are also at the correct position in the bit field!)
*/
void or1k_timer_set_mode(uint32_t mode);
But I still not clear about the value of mode for simple run and continues run.
Please kindly help.
Thanks.
The text was updated successfully, but these errors were encountered:
/* Restart counting when TTMR[TP]==TTCR /
#define OR1K_SPR_TICK_TTMR_MODE_RESTART 1
/ Stop counting when TTMR[TP]==TTCR /
#define OR1K_SPR_TICK_TTMR_MODE_STOP 2
/ Continue counting when TTMR[TP]==TTCR */
#define OR1K_SPR_TICK_TTMR_MODE_CONTINUE 3
My understanding is:
or1k_timer_set_mode(OR1K_SPR_TICK_TTMR_MODE_CONTINUE) is or1k_timer_set_mode(SPR_TTMR_CR) in the doc.
or1k_timer_set_mode(OR1K_SPR_TICK_TTMR_MODE_STOP) is
or1k_timer_set_mode(SPR_TTMR_SR) in the doc.
hi, Dear expert:
I follow the steps in https://openrisc.io/newlib/building.html to build my own or1k toolchains.
Now I am trying to use timerrelated functions in $OR1K_ELF/or1k-elf/include/or1k-support.h.
I first start with the example at line 446 in or1k-support.h
void tick_handler(void) {
// Make schedule decision
// and set new thread
or1k_timer_reset();
// End of exception, new thread will run
}
int main() {
// Configure operating system and start threads..
// Configure timer
or1k_timer_init(50);
or1k_timer_set_handler(&tick_handler);
or1k_timer_set_mode(SPR_TTMR_SR);
or1k_timer_enable();
// Schedule first thread and die..
}
But the example failed to pass compile because the define SPR_TTMR_SR is missed.
I try to get the answer from the define of or1k_timer_set_mode.
/*!
*/
void or1k_timer_set_mode(uint32_t mode);
But I still not clear about the value of mode for simple run and continues run.
Please kindly help.
Thanks.
The text was updated successfully, but these errors were encountered: