On 27/10/11 23:17, Tom Schouten wrote: > On 10/12/2011 09:41 AM, Will Wagner wrote: >> On 12/10/2011 14:25, Tom Schouten wrote: >> >> <snip> >> >>> >>> From my limited knowledge it seems however that it is not possible to >>> "fake" an interrupt, i.e. >>> >>> #define CYGNUM_HAL_INTERRUPT_VIRTUAL0 33 >>> #define CYGNUM_HAL_INTERRUPT_VIRTUAL1 34 >>> >>> such that these 33 and 34 vectors can be used in >>> cyg_drv_interrupt_create() of some eCos driver. >> >> If I understand what you are asking for this is pretty straight >> forward, in fact for the at91 there is already code doing this for the >> SYS interrupt and so extending it to PIOa and PIOB is pretty easy. If >> you look in packages\hal\arm\at91\var\current\src\at91_misc.c you can >> see how this is done for the SYS interrupt. > Following this was indeed straight forward for a single pin. > > Though this seems to break down for multiple pins, as reading the > interrupt status register > HAL_READ_UINT32(AT91_PIOA + AT91_PIO_ISR, isr); > might return multiple flags, and I don't see a way to then map this to > triggering multiple vectors. > > Once the ISR is read, all the flags are reset so it's not possible to > only ack one and let it re-trigger in hardware. > > Any idea how to work around that?
Extending hal_IRQ_handler() is not the way to go. Instead you should use a trampoline ISR attached to the PIO vector. This then reads the PIO ISR register and calls the virtual interrupts for all the active pins. If you look in hal_arbiter.h you will find hal_call_isr() which does all the eCos-related hard work, and an explanation of how to write your trampoline and how to set it up. -- Nick Garnett eCos Kernel Architect eCosCentric Limited http://www.eCosCentric.com The eCos experts Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571 Registered in England and Wales: Reg No: 4422071 -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss