📄 callout_interrupt_atlasii.s
字号:
CALLOUT_END(interrupt_unmask_atlasii_cam_i2c)/* * ----------------------------------------------------------------------- * Identify interrupt source. * * Returns interrupt number in r4 * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_id_atlasii_usp4_7, 0, interrupt_patch) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 /* * Read pending IRQ interrupts */ ldr r1, [ip, #0x38] //INT_PEND_EXT mov r1, r1, lsr #8 ldr r2, [ip, #0x2C] //INT_RISC_MASK_EXT mov r2, r2, lsr #8 and r1, r1, r2 cmp r1, #0 beq 1f /* glitch */ mov r4, #4 mov r2, #1 /* * Scan for first set bit start from bit 16 */0: subs r4, r4, #1 blt 1f tst r1, r2, lsl r4 beq 0b /* * Mask the interrupt */ ldr r1, [ip, #0x2C] //INT_RISC_MASK_EXT add r4, r4, #8 bic r1, r1, r2, lsl r4 str r1, [ip, #0x2C] //INT_RISC_MASK_EXT subs r4, r4, #8 b 2f1: mov r4, #-12:CALLOUT_END(interrupt_id_atlasii_usp4_7)/* * ----------------------------------------------------------------------- * Acknowledge specified interrupt * * On entry: * r4 contains the interrupt number * r7 contains the interrupt mask count * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_eoi_atlasii_usp4_7, 0, interrupt_patch) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 /* * Only unmask interrupt if mask count is zero */ teq r7, #0 bne 0f mov r2, #1 add r4, r4, #8 ldr r1, [ip, #0x2C] //INT_RISC_MASK_EXT orr r1, r1, r2, lsl r4 str r1, [ip, #0x2C] //INT_RISC_MASK_EXT0:CALLOUT_END(interrupt_eoi_atlasii_usp4_7)/* * ----------------------------------------------------------------------- * Mask specified interrupt * * On entry: * r0 - syspage_ptr * r1 - interrupt number * * Returns: * r0 - error status * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_mask_atlasii_usp4_7, 0, interrupt_patch) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 mov r2, #1 /* * Mask the interrupt */ add r1, r1, #8 ldr r0, [ip, #0x2C] //INT_RISC_MASK_EXT mov r2, r2, lsl r1 bic r0, r0, r2 str r0, [ip, #0x2C] //INT_RISC_MASK_EXT mov r0, #0 mov pc, lrCALLOUT_END(interrupt_mask_atlasii_usp4_7)/* * ----------------------------------------------------------------------- * Unmask specified interrupt * * On entry: * r0 - syspage_ptr * r1 - interrupt number * * Returns: * r0 - error status * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_unmask_atlasii_usp4_7, 0, interrupt_patch) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 mov r2, #1 /* * Unmask the interrupt */ add r1, r1, #8 ldr r0, [ip, #0x2C] //INT_RISC_MASK_EXT orr r0, r0, r2, lsl r1 str r0, [ip, #0x2C] //INT_RISC_MASK_EXT mov r0, #0 mov pc, lrCALLOUT_END(interrupt_unmask_atlasii_usp4_7)/* * ----------------------------------------------------------------------- * Routine to patch dma callout code * * On entry: * r0 - physical address of syspage * r1 - virtual address of syspage * r2 - offset from start of syspage to start of the callout routine * r3 - offset from start of syspage to read/write data used by callout * ----------------------------------------------------------------------- */interrupt_patch_dma: stmdb sp!,{r4,lr} add r4, r0, r2 // address of callout routine /* * Map interrupt controller registers */ mov r0, #0x120 // size of interrupt registers ldr r1, Lintr2_base bl callout_io_map /* * Patch the callout routine */ CALLOUT_PATCH r4, r0, r1, r2, ip ldmia sp!,{r4,pc}Lintr2_base: .word _DMA_MODULE_BASE /* * ----------------------------------------------------------------------- * Identify interrupt source. * * Returns interrupt number in r4 * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_id_atlasii_dma, 0, interrupt_patch_dma) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 mov r4, #-1 /* * Read pending IRQ interrupts */ ldr r1, [ip, #0x114] //DMA_CHN_INT ldr r2, [ip, #0x118] //DMA_INT_EN and r1, r1, r2 cmp r1, #0 beq 1f /* glitch */ mov r4, #12 mov r2, #1 /* * Scan for first set bit */0: subs r4, r4, #1 blt 1f tst r1, r2, lsl r4 beq 0b /* * Clear the interrupt source */ ldr r1, [ip, #0x114] //DMA_CHN_INT orr r1, r1, r2, lsl r4 str r1, [ip, #0x114] //DMA_CHN_INT /* * Mask the interrupt */ ldr r1, [ip, #0x118] //DMA_INT_EN bic r1, r1, r2, lsl r4 str r1, [ip, #0x118] //DMA_INT_EN1:CALLOUT_END(interrupt_id_atlasii_dma)/* * ----------------------------------------------------------------------- * Acknowledge specified interrupt * * On entry: * r4 contains the interrupt number * r7 contains the interrupt mask count * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_eoi_atlasii_dma, 0, interrupt_patch_dma) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 /* * Only unmask interrupt if mask count is zero */ teq r7, #0 bne 0f mov r2, #1 mov r2, r2, lsl r4 ldr r1, [ip, #0x118] //DMA_INT_EN orr r1, r1, r2 str r1, [ip, #0x118] //DMA_INT_EN0:CALLOUT_END(interrupt_eoi_atlasii_dma)/* * ----------------------------------------------------------------------- * Mask specified interrupt * * On entry: * r0 - syspage_ptr * r1 - interrupt number * * Returns: * r0 - error status * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_mask_atlasii_dma, 0, interrupt_patch_dma) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 mov r2, #1 /* * Mask the interrupt */ ldr r0, [ip, #0x118] //DMA_INT_EN mov r2, r2, lsl r1 bic r0, r0, r2 str r0, [ip, #0x118] //DMA_INT_EN mov r0, #0 mov pc, lrCALLOUT_END(interrupt_mask_atlasii_dma)/* * ----------------------------------------------------------------------- * Unmask specified interrupt * * On entry: * r0 - syspage_ptr * r1 - interrupt number * * Returns: * r0 - error status * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_unmask_atlasii_dma, 0, interrupt_patch_dma) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 mov r2, #1 /* * Unmask the interrupt */ ldr r0, [ip, #0x118] //DMA_INT_EN orr r0, r0, r2, lsl r1 str r0, [ip, #0x118] //DMA_INT_EN mov r0, #0 mov pc, lrCALLOUT_END(interrupt_unmask_atlasii_dma)/* * ----------------------------------------------------------------------- * Routine to patch GPIO group0 callout code * * On entry: * r0 - physical address of syspage * r1 - virtual address of syspage * r2 - offset from start of syspage to start of the callout routine * r3 - offset from start of syspage to read/write data used by callout * ----------------------------------------------------------------------- */interrupt_patch_gpio0: stmdb sp!,{r4,lr} add r4, r0, r2 // address of callout routine /* * Map interrupt controller registers */ mov r0, #0x90 // size of interrupt registers ldr r1, Lintr3_base bl callout_io_map /* * Patch the callout routine */ CALLOUT_PATCH r4, r0, r1, r2, ip ldmia sp!,{r4,pc}Lintr3_base: .word _GPIO_MODULE_BASE /* * ----------------------------------------------------------------------- * Identify interrupt source. * * Returns interrupt number in r4 * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_id_atlasii_gpio0, 0, interrupt_patch_gpio0) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 /* * Read pending IRQ interrupts */ ldr r1, [ip, #0x8c] //GPIO group0 Int sts mov r4, #32 mov r2, #1 /* * Scan for first set bit */0: subs r4, r4, #1 blt 1f //no bit set tst r1, r2, lsl r4 beq 0b /* test see if this bit is enabled */ mov r3, r4, lsl #2 ldr r1, [ip, r3] //GPIOx ctrl reg tst r1, r2, lsl #3 //Int_enable bit beq 1f /* glitch */ /* * Clear the interrupt source */ orr r1, r1, r2, lsl #4 //int sts bit clear #str r1, [ip, r3] //GPIOx ctrl reg /* * Mask the interrupt */# ldr r1, [ip, r3] //GPIOx ctrl reg bic r1, r1, r2, lsl #3 //Int_enable bit str r1, [ip, r3] //GPIOx ctrl reg b 2f1: mov r4, #-12:CALLOUT_END(interrupt_id_atlasii_gpio0)/* * ----------------------------------------------------------------------- * Acknowledge specified interrupt * * On entry: * r4 contains the interrupt number * r7 contains the interrupt mask count * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_eoi_atlasii_gpio0, 0, interrupt_patch_gpio0) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 /* * Only unmask interrupt if mask count is zero */ teq r7, #0 bne 0f mov r2, #1 mov r3, r4, lsl #2 ldr r1, [ip, r3] //GPIOx ctrl reg orr r1, r1, r2, lsl #3 //Int_enable bit str r1, [ip, r3] //GPIOx ctrl reg0:CALLOUT_END(interrupt_eoi_atlasii_gpio0)/* * ----------------------------------------------------------------------- * Mask specified interrupt * * On entry: * r0 - syspage_ptr * r1 - interrupt number * * Returns: * r0 - error status * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_mask_atlasii_gpio0, 0, interrupt_patch_gpio0) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 mov r2, #1 /* * Mask the interrupt */ mov r3, r1, lsl #2 ldr r1, [ip, r3] //GPIOx ctrl reg bic r1, r1, r2, lsl #3 //Int_enable bit str r1, [ip, r3] //GPIOx ctrl reg mov r0, #0 mov pc, lrCALLOUT_END(interrupt_mask_atlasii_gpio0)/* * ----------------------------------------------------------------------- * Unmask specified interrupt * * On entry: * r0 - syspage_ptr * r1 - interrupt number * * Returns: * r0 - error status * ----------------------------------------------------------------------- */CALLOUT_START(interrupt_unmask_atlasii_gpio0, 0, interrupt_patch_gpio0) /* * Get the interrupt controller base address (patched) */ mov ip, #0x000000ff orr ip, ip, #0x0000ff00 orr ip, ip, #0x00ff0000 orr ip, ip, #0xff000000 mov r2, #1 /* * Unmask the interrupt */ mov r3, r1, lsl #2 ldr r1, [ip, r3] //GPIOx ctrl reg orr r1, r1, r2, lsl #3 //Int_enable bit str r1, [ip, r3] //GPIOx ctrl reg mov r0, #0 mov pc, lrCALLOUT_END(interrupt_unmask_atlasii_gpio0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -