summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6ea722b)
raw | patch | inline | side by side (parent: 6ea722b)
author | Stephen Molfetta <sjmolfetta@ti.com> | |
Tue, 16 Feb 2016 16:31:46 +0000 (10:31 -0600) | ||
committer | Sam Nelson <sam.nelson@ti.com> | |
Fri, 19 Feb 2016 22:31:10 +0000 (17:31 -0500) |
Watchdog implementation configures timers to operate in posted-write
mode, requiring SW to poll on TWPS register prior to subsequent write
access.
Therefore, references to the Watchdog timer instance must be declared
as volatile. Otherwise, the initial value read of the TWPS will be
used as the polling value indefinitely, causing a potential lockup
if the application is completely idle.
Signed-off-by: Stephen Molfetta <sjmolfetta@ti.com>
mode, requiring SW to poll on TWPS register prior to subsequent write
access.
Therefore, references to the Watchdog timer instance must be declared
as volatile. Otherwise, the initial value read of the TWPS will be
used as the polling value indefinitely, causing a potential lockup
if the application is completely idle.
Signed-off-by: Stephen Molfetta <sjmolfetta@ti.com>
packages/ti/deh/Watchdog.c | patch | blob | history |
index b06e8c2f4637c7a8b28fd1ad9abd2602b061dd71..10bfedb7d7b552e1fa43c66fc4d574db6777ea2f 100644 (file)
/*
* ======== initTimer ========
*/
/*
* ======== initTimer ========
*/
-static Void initTimer(Watchdog_TimerRegs *timer, Bool boot)
+static Void initTimer(volatile Watchdog_TimerRegs *timer, Bool boot)
{
Timer_Handle tHandle;
Types_FreqHz tFreq;
{
Timer_Handle tHandle;
Types_FreqHz tFreq;
*/
Void Watchdog_init( Void (*timerFxn)(Void) )
{
*/
Void Watchdog_init( Void (*timerFxn)(Void) )
{
- Hwi_Params hwiParams;
- UInt key;
- Timer_Handle tHandle;
- Types_FreqHz tFreq;
- Watchdog_TimerRegs *timer;
- Int i;
- static Bool first = TRUE;
+ Hwi_Params hwiParams;
+ UInt key;
+ Timer_Handle tHandle;
+ Types_FreqHz tFreq;
+ volatile Watchdog_TimerRegs *timer;
+ Int i;
+ static Bool first = TRUE;
tHandle = Timer_Object_get(NULL, 0);
Timer_getFreq(tHandle, &tFreq); /* get timer frequency */
tHandle = Timer_Object_get(NULL, 0);
Timer_getFreq(tHandle, &tFreq); /* get timer frequency */
}
#endif
for (i = 0; i < Watchdog_module->wdtCores; i++) { /* loop for SMP cores */
}
#endif
for (i = 0; i < Watchdog_module->wdtCores; i++) { /* loop for SMP cores */
- timer = (Watchdog_TimerRegs *) Watchdog_module->device[i].baseAddr;
+ timer = (volatile Watchdog_TimerRegs *) Watchdog_module->device[i].baseAddr;
/* Check if timer is enabled by host-side */
if ((REG32(Watchdog_module->device[i].clkCtrl) &
/* Check if timer is enabled by host-side */
if ((REG32(Watchdog_module->device[i].clkCtrl) &
*/
Void Watchdog_stop(Int core)
{
*/
Void Watchdog_stop(Int core)
{
- Watchdog_TimerRegs *timer = Watchdog_module->device[core].baseAddr;
+ volatile Watchdog_TimerRegs *timer = Watchdog_module->device[core].baseAddr;
if ((Watchdog_module->status[core] == Watchdog_Mode_ENABLED) && timer) {
while (timer->twps & WATCHDOG_TIMER_TWPS_W_PEND_TCLR);
if ((Watchdog_module->status[core] == Watchdog_Mode_ENABLED) && timer) {
while (timer->twps & WATCHDOG_TIMER_TWPS_W_PEND_TCLR);
*/
Void Watchdog_start(Int core)
{
*/
Void Watchdog_start(Int core)
{
- Watchdog_TimerRegs *timer = Watchdog_module->device[core].baseAddr;
+ volatile Watchdog_TimerRegs *timer = Watchdog_module->device[core].baseAddr;
if ((Watchdog_module->status[core] == Watchdog_Mode_ENABLED) && timer) {
while (timer->twps & WATCHDOG_TIMER_TWPS_W_PEND_TCLR);
if ((Watchdog_module->status[core] == Watchdog_Mode_ENABLED) && timer) {
while (timer->twps & WATCHDOG_TIMER_TWPS_W_PEND_TCLR);
*/
Void Watchdog_kick(Int core)
{
*/
Void Watchdog_kick(Int core)
{
- Watchdog_TimerRegs *timer = Watchdog_module->device[core].baseAddr;
+ volatile Watchdog_TimerRegs *timer = Watchdog_module->device[core].baseAddr;
if ((Watchdog_module->status[core] == Watchdog_Mode_ENABLED) && timer) {
while (timer->twps & WATCHDOG_TIMER_TWPS_W_PEND_TGRR);
if ((Watchdog_module->status[core] == Watchdog_Mode_ENABLED) && timer) {
while (timer->twps & WATCHDOG_TIMER_TWPS_W_PEND_TGRR);
*/
Void Watchdog_restore(Int event, Ptr data)
{
*/
Void Watchdog_restore(Int event, Ptr data)
{
- Int i;
- Watchdog_TimerRegs *timer;
+ Int i;
+ volatile Watchdog_TimerRegs *timer;
for (i = 0; i < Watchdog_module->wdtCores; i++) { /* loop for SMP cores */
for (i = 0; i < Watchdog_module->wdtCores; i++) { /* loop for SMP cores */
- timer = (Watchdog_TimerRegs *) Watchdog_module->device[i].baseAddr;
+ timer = (volatile Watchdog_TimerRegs *) Watchdog_module->device[i].baseAddr;
if (Watchdog_module->status[i] == Watchdog_Mode_ENABLED) {
/* Configure the timer */
if (Watchdog_module->status[i] == Watchdog_Mode_ENABLED) {
/* Configure the timer */