windowsCE异常和中断服务程序初探


nbsp;     ; parameter to oeminterrupthandler
     msr     cpsr_c, #svc_mode:or:0x80       ; switch to supervisor mode w/irqs disabled
        stmfd   sp!,                        ; save lr onto the svc stack       
        stmfd   sp!,                        ; save irq lr (in r0) onto the svc stack (param)
        ;
        ; now we call the oem"s interrupt handler code. it is up to them to
        ; enable interrupts if they so desire. we can"t do it for them since
        ; there"s only on interrupt and they haven"t yet defined their nesting.
        ;

        call    oeminterrupthandler
        ldmfd   sp!,                        ; dummy pop (parameter)
        ldmfd   sp!,                        ; restore svc lr from the svc stack
        msr     cpsr_c, #irq_mode:or:0x80       ; switch back to irq mode w/irqs disabled
    ; restore the saved program status register from the stack.
        ;
        ldmfd   sp!,                        ; restore irq spsr from the irq stack
        msr     spsr, r1                        ; (r1) = saved status reg
        ldr     lr, =kdata                      ; (lr) = ptr to kdatastruct
       
       
        cmp     r0, #sysintr_resched      ;->时间片已到,进行调度
        beq     %f10           
        ;sysintr_devices equ 8         ;是否设备中断,中断号是否有效
    ;sysintr_max_devices equ 32   
        sub     r0, r0, #sysintr_devices
        cmp     r0, #sysintr_max_devices
                            ;由此可以看出windowsce的系统中断号最大支持32种从9-40.
                            ;其中第16号(24)被定义为sysintr_firmware
        ; if not a device request (and not sysintr_resched)
       
        ldrhsb  r0, [lr, #bresched]             ; (r0) = reschedule flag
        bhs     %f20                            ; not a device request
       
        ;pendevents  equ 0x340             ; offset 0x10*sizeof(dword) of ainfo
                            ;device 中断
        ldr     r2, [lr, #pendevents]          

COPYRIGHT(C) 2011 厦门永宏亚得机电科技有限公司版权所有(闽ICP备05025945号) ALL RIGHTS RESERVED?

电话: 0592-5190891 传真: 0592-5190720 E-Mail: E-mail:yade8895@163.com
地址: 厦门市海沧区兴港六里17号2607室 邮编:361009 联系人:翟先生