Search
Project
General
Profile
Sign in
Register
Home
Projects
Redmine shortcuts
Search
:
MityDSP-L138 (ARM9 Based Platforms)
All Projects
Mity CPU Platforms
»
MityDSP-L138 (ARM9 Based Platforms)
Overview
Activity
Wiki
Forums
Download (782 Bytes)
Using Watchdog
» watchdog.h
Jonathan Cormier
, 10/14/2014 03:43 PM
#include
<semaphore.h>
namespace
MityDSP
{
/**
* The tcWatchdog class provides a simple abstraction for the linux
* watchdog device management. Typical use pattern:
*
* @code {
*
* tcWatchdog* pW = new tcWatchdog();
* int handle = pW->RegisterCheckpoint();
* pW->StartWatchDog(10);
*
* while (!done)
* {
* /// do stuff
* pW->Checkin(handle);
* }
*
* delete pW;
*
* @code }
*/
class
tcWatchdog
{
public:
tcWatchdog
(
const
char
*
apDevice
=
"/dev/watchdog"
);
virtual
~
tcWatchdog
(
void
);
int
StartWatchDog
(
int
TimeoutSecs
);
int
RegisterCheckpoint
(
void
);
int
UnRegisterCheckpoint
(
int
handle
);
int
Checkin
(
int
Checkpoint
);
protected:
volatile
int
mnMask
;
volatile
int
mnSet
;
sem_t
mhSem
;
char
*
mpFileName
;
int
mnFd
;
};
}
« Previous
1
…
4
5
6
7
Next »
(6-6/7)
Go to top
Loading...