On Mon, 10 May 1999, Chris Rutter wrote:
>
>but I remember very little about [Strong]ARM timing. With the assistance
>of David Seal and Wilco D., I've hugely optimised the find_first_zero_bit()
>and find_next_zero_bit() routines (see a current comp.sys.arm thread).
>
Don't know what you're using, but here's the code that I use in my embedded
work to find the first IRQ bit in my StrongARM IRQ handler. I did a bit of work
on this one and I don't think you can make it much better. Note that in this
case, the `sl' register points to a vector of trap handlers, followed by a
a vector of `this' pointers.
ldr r0,=ARM_ICIP /* Fetch interrupt pending register */
text ip,#IRQTable
ldr r0,[r0]
movs r1,r0,lsr #16 /* High order half-word set? */
movne r0,r1 /* Interrupts 16..31 if YES */
movne r1,#16
tst r0,#(0xff<<8) /* High-order 8 ints set? */
ldreqb ip,[ip,r0] /* If not */
ldrneb ip,[ip,r0,lsr #8] /* If yes */
addne r1,r1,#8
add ip,ip,r1 /* Add base IRQ (0,8,16,24) */
add r1,sl,#4*MAXTRAPS
ldr r0,[r1,ip,lsl #2] /* Fetch `this' variable */
mov lr,pc
ldr pc,[sl,ip,lsl #2] /* Invoke IRQ handler */
ldr pc,SysIret /* Return from interrupt */
/*
* Convert an 8-bit bit field into the highest numbered bit
* that's set.
*/
IRQTable:
.byte V_NoIRQ, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
.byte 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
.byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
.byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
.byte 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
.byte 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
.byte 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
.byte 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
--
Jon Olson, Modular Mining Systems
3289 E. Hemisphere Loop
Tucson, AZ 85706
INTERNET: [EMAIL PROTECTED]
PHONE: (520)746-9127
FAX: (520)889-5790
unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]