eaca5921c6a8a7c9d71b3bddeef5280ab9e66bed
[openwrt/svn-archive/archive.git] / target / linux / mcs814x / files-3.3 / arch / arm / mach-mcs814x / include / mach / entry-macro.S
1 #include <mach/mcs814x.h>
2 .macro disable_fiq
3 .endm
4
5 .macro arch_ret_to_user, tmp1, tmp2
6 .endm
7
8 .macro get_irqnr_preamble, base, tmp
9 ldr \base, =mcs814x_intc_base @ base virtual address of AIC peripheral
10 ldr \base, [\base]
11 .endm
12
13 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
14 mov \tmp, #MCS814X_IRQ_STS0 @ load tmp with STS0 register offset
15 ldr \irqstat, [\base, \tmp] @ load value at base + tmp
16 tst \irqstat, \irqstat @ test if no active IRQ's
17 beq 1002f @ if no active irqs return with status 0
18 mov \irqnr, #0 @ start from irq zero
19 mov \tmp, #1 @ the mask initially 1
20 1001:
21 tst \irqstat, \tmp @ and with mask
22 addeq \irqnr, \irqnr, #1 @ if zero then add one to nr
23 moveq \tmp, \tmp, lsl #1 @ shift mask one to left
24 beq 1001b @ if zero then loop again
25 mov \irqstat, \tmp @ save the return mask
26 mov \tmp, #MCS814X_IRQ_STS0 @ load tmp with ICR offset
27 str \irqstat, [\base, \tmp] @ clear irq with selected mask
28 1002:
29 .endm