SAMV7: Add support for CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP
This commit is contained in:
parent
3ce3dbc6ed
commit
192772b7ee
@ -190,6 +190,7 @@ config ARCH_CHIP_SAMV7
|
|||||||
select ARCH_CORTEXM7
|
select ARCH_CORTEXM7
|
||||||
select ARCH_HAVE_MPU
|
select ARCH_HAVE_MPU
|
||||||
select ARCH_HAVE_RAMFUNCS
|
select ARCH_HAVE_RAMFUNCS
|
||||||
|
select ARCH_HAVE_TICKLESS
|
||||||
select ARMV7M_HAVE_STACKCHECK
|
select ARMV7M_HAVE_STACKCHECK
|
||||||
---help---
|
---help---
|
||||||
Atmel SAMV7 (ARM Cortex-M7) architectures
|
Atmel SAMV7 (ARM Cortex-M7) architectures
|
||||||
|
@ -243,6 +243,9 @@ static void sam_oneshot_handler(void *arg)
|
|||||||
|
|
||||||
void up_timer_initialize(void)
|
void up_timer_initialize(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP
|
||||||
|
uint64_t max_delay;
|
||||||
|
#endif
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Initialize the one-shot timer */
|
/* Initialize the one-shot timer */
|
||||||
@ -256,6 +259,29 @@ void up_timer_initialize(void)
|
|||||||
PANIC();
|
PANIC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP
|
||||||
|
/* Get the maximum delay of the one-shot timer in microseconds */
|
||||||
|
|
||||||
|
ret = sam_oneshot_max_delay(&g_tickless.oneshot, &max_delay);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
tclldbg("ERROR: sam_oneshot_max_delay failed\n");
|
||||||
|
PANIC();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert this to configured clock ticks for use by the OS timer logic */
|
||||||
|
|
||||||
|
max_delay /= CONFIG_USEC_PER_TICK;
|
||||||
|
if (max_delay > (uint64_t)UINT32_MAX)
|
||||||
|
{
|
||||||
|
g_oneshot_maxticks = UINT32_MAX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_oneshot_maxticks = (uint32_t)max_delay;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialize the free-running timer */
|
/* Initialize the free-running timer */
|
||||||
|
|
||||||
ret = sam_freerun_initialize(&g_tickless.freerun,
|
ret = sam_freerun_initialize(&g_tickless.freerun,
|
||||||
|
@ -467,7 +467,7 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot, struct timespec *ts)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if 0 /* Not used */
|
#ifdef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP
|
||||||
int sam_oneshot_max_delay(struct sam_oneshot_s *oneshot, uint64_t *usec)
|
int sam_oneshot_max_delay(struct sam_oneshot_s *oneshot, uint64_t *usec)
|
||||||
{
|
{
|
||||||
DEBUGASSERT(oneshot && usec);
|
DEBUGASSERT(oneshot && usec);
|
||||||
|
@ -141,7 +141,7 @@ int sam_oneshot_initialize(struct sam_oneshot_s *oneshot, int chan,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if 0 /* Not used */
|
#ifdef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP
|
||||||
int sam_oneshot_max_delay(struct sam_oneshot_s *oneshot, uint64_t *usec);
|
int sam_oneshot_max_delay(struct sam_oneshot_s *oneshot, uint64_t *usec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user