SAMA5 Timer/counter repair: Missing sem_post() caused a hang

This commit is contained in:
Gregory Nutt 2014-08-09 18:34:52 -06:00
parent c44f9ec764
commit 6324df44e8
4 changed files with 25 additions and 11 deletions

View File

@ -67,11 +67,15 @@
****************************************************************************/
#ifdef CONFIG_SAMA5_TC_DEBUG
# define tcdbg dbg
# define tcvdbg vdbg
# define tcdbg dbg
# define tcvdbg vdbg
# define tclldbg lldbg
# define tcllvdbg llvdbg
#else
# define tcdbg(x...)
# define tcvdbg(x...)
# define tclldbg(x...)
# define tcllvdbg(x...)
#endif
/****************************************************************************
@ -316,8 +320,6 @@ int sam_freerun_counter(struct sam_freerun_s *freerun, struct timespec *ts)
int sam_freerun_uninitialize(struct sam_freerun_s *freerun)
{
irqstate_t flags;
/* Now we can disable the timer interrupt and disable the timer. */
sam_tc_attach(freerun->handle, NULL, NULL, 0);
@ -326,7 +328,6 @@ int sam_freerun_uninitialize(struct sam_freerun_s *freerun)
/* Free the timer */
sam_tc_free(freerun->handle);
irqrestore(flags);
return OK;
}

View File

@ -67,11 +67,15 @@
****************************************************************************/
#ifdef CONFIG_SAMA5_TC_DEBUG
# define tcdbg dbg
# define tcvdbg vdbg
# define tcdbg dbg
# define tcvdbg vdbg
# define tclldbg lldbg
# define tcllvdbg llvdbg
#else
# define tcdbg(x...)
# define tcvdbg(x...)
# define tclldbg(x...)
# define tcllvdbg(x...)
#endif
/****************************************************************************

View File

@ -90,9 +90,13 @@
#ifdef CONFIG_SAMA5_TC_DEBUG
# define tcdbg dbg
# define tcvdbg vdbg
# define tclldbg llbg
# define tcllvdbg llvdbg
#else
# define tcdbg(x...)
# define tcvdbg(x...)
# define tclldbg(x...)
# define tcllvdbg(x...)
#endif
/****************************************************************************
@ -1138,6 +1142,7 @@ TC_HANDLE sam_tc_allocate(int channel, int mode)
sam_chan_putreg(chan, SAM_TC_CMR_OFFSET, mode);
sam_regdump(chan, "Allocated");
sam_givesem(chan->tc);
}
/* Return an opaque reference to the channel */

View File

@ -149,11 +149,15 @@
#endif
#ifdef CONFIG_SAMA5_TC_DEBUG
# define tcdbg dbg
# define tcvdbg vdbg
# define tcdbg dbg
# define tcvdbg vdbg
# define tclldbg lldbg
# define tcllvdbg llvdbg
#else
# define tcdbg(x...)
# define tcvdbg(x...)
# define tclldbg(x...)
# define tcllvdbg(x...)
#endif
/****************************************************************************
@ -243,7 +247,7 @@ void up_timer_initialize(void)
CONFIG_USEC_PER_TICK);
if (ret < 0)
{
tcdbg("ERROR: sam_oneshot_initialize failed\n");
tclldbg("ERROR: sam_oneshot_initialize failed\n");
PANIC();
}
@ -254,7 +258,7 @@ void up_timer_initialize(void)
CONFIG_USEC_PER_TICK);
if (ret < 0)
{
tcdbg("ERROR: sam_freerun_initialize failed\n");
tclldbg("ERROR: sam_freerun_initialize failed\n");
PANIC();
}
}