This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: C API for timer and watchdog
- From: Jonathan Larmour <jlarmour at redhat dot com>
- To: Sam Sortais <sams at myself dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Fri, 07 Dec 2001 18:44:30 +0000
- Subject: Re: [ECOS] C API for timer and watchdog
- Organization: Red Hat UK Ltd.
- References: <20011207182641.9184.qmail@iname.com>
Sam Sortais wrote:
>
> Hi all,
>
> I am using eCos on PC and was hopping to use C API but found different issues:
>
> 1) I noticed a watchdog component in the code, (not found in PC latest doc, maybe under development ?) so I was wondering if it was supported by PC platform.
> Looking at the code it seems support is there and use an emulation mode with RTC.
> However the only interface seems to be in C++ and if I want to do call in C I will have to write a wrapper.
Sorry yes.
> On the same topic I did not found a wrapper for Timer API in C.
> Is the only way to use POSIX interface ?
Actually you can use the C library time() function.
> 2)Still about API, is there anyway (in C) to know what is the current state of a thread ?
There isn't a well defined way, but you can access the "state" member of a
cyg_thread structure. The values are:
RUNNING = 0, // Thread is runnable or running
SLEEPING = 1, // Thread is waiting for something to
happen
COUNTSLEEP = 2, // Sleep in counted manner
SUSPENDED = 4, // Suspend count is non-zero
CREATING = 8, // Thread is being created
EXITED = 16, // Thread has exited
> 3) After loading and starting an application with RedBoot, I was hopping to go back to RedBoot when the application terminate, so I can load a new one. Is it the way it is supposed to work ?
If you load using GDB this happens (when you quit GDB, which sends a "kill"
packet). If you load directly it doesn't.
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine