This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: timer -> interrupt
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Sicheri Marco <m dot sicheri at ctsgroup dot it>
- Cc: "eCos Discus.List" <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 22 Oct 2004 17:18:29 +0200
- Subject: Re: [ECOS] timer -> interrupt
- References: <002401c4b848$db27a0e0$110110ac@Msicheri>
On Fri, Oct 22, 2004 at 05:07:32PM +0200, Sicheri Marco wrote:
> I All,
> I need to create a timer that cause an interrupt.
> Oh yes, the cyg_alarm_xxx work fine! But the resolution (tick) isn't
> sufficient... :o(
> My timer must count and each 100us (time between 100us and 800us) cause a
> interrupt, so that my interrupt routine can work.
> How can i do it?
> Normaly I programming the CPU registers with time and interupt vector. But
> in eCos: How do i do?
Reading the manual is normally a good start.
http://ecos.sourceware.org/docs-latest/
You need to add an interrupt handling function using the
cyg_interrupt_*() functions. Then program one of the spare hardware
timer to generate interrupts at the rate you need. You have a few
choices how you handle the interrupt after that.
You could instantiate a new counter object. Your DSR routine then
calls the counters tick function. You can then use this new counter
object with the normal cyg_alarm_*() functions to give high accuracy
alarms.
You your DSR function could do all you need.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss