This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Getting the trigger value of an Alarm -> is it possible?
- To: ecos-discuss at sourceware dot cygnus dot com
- Subject: [ECOS] Re: Getting the trigger value of an Alarm -> is it possible?
- From: Elias Biris <ebiris at cadence dot com>
- Date: Fri, 01 Jun 2001 13:13:48 +0100
How about using the existing C struct for an alarm: cyg_alarm ? (not the
C++ class Cyg_Alarm)
Is that struct used only for memory allocation purposes? Do its internal
members (like trigger) get synchronized when the class Cyg_Alarm synchronizes ?
The doc about this data struct mandates that :
"cyg_thread, cyg_interrupt, cyg_counter, cyg_clock, cyg_alarm, cyg_mbox,
cyg_mempool_var, and cyg_mempool_fix These types are of the appropriate
size to contain the memory used by the respective kernel objects. These
types are only used in the corresponding create call where the programmer
allocates the memory for the object and passes the address to the kernel.
After creation the provided handle is used to reference the object."
Kind regards,
------------------------8<---------snip----------------
You wrote :
Elias Biris wrote:
>
> hello,
>
> I am new to the usage of eCos and admittedly I am still trying to learn the
> ropes with RTOSes and embedded sw.
>
> I got a question related to alarms and counters as they get handled in
> eCos. I'd like to have the ability to get the a count of how many ticks are
> remaining at any point in time till the expiration of a timer. Since the
> internals of Cyg_Alarm class are protected, and there is no api to get to
> them I thought someone may have an idea or similar experience. I could do
> something like the following :
>
> From the outset I am keeping the period of a timer. By getting the time of
> the last expiration I could get to find the number of ticks till the next
> expiration.
>
> However, this is not very accurate. Any ideas ?
This may be one of the times when you find it's really useful to have the
source and customize whatever you want... Jifl
------------------------8<---------snip----------------
Elias Biris, Software Engineer, R&D Livingston
Cadence Design Systems, EMAIL:: ebiris@cadence.com
SOC Design Centre, 1 The Alba Campus TEL:: +44 (0)1506 59 5036
Livingston EH54 7HH, Scotland, UK FAX:: +44 (0)1506 59 5959