//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// IAR ARM ANSI C/C++ Compiler V4.11A/W32              20/Jul/2004  18:58:48 /
// Copyright 1999-2004 IAR Systems. All rights reserved.                     /
//                                                                           /
//    Cpu mode        =  arm                                                 /
//    Endian          =  little                                              /
//    Stack alignment =  4                                                   /
//    Source file     =  C:\medusa\watchdog.c                                /
//    Command line    =  -I "C:\Program Files\IAR Systems\Embedded           /
//                       Workbench 4.0\ARM\INC\" -lc C:\medusa\Debug\List\   /
//                       -la C:\medusa\Debug\List\ -o C:\medusa\Debug\Obj\   /
//                       -s2 --no_cse --no_unroll --no_inline                /
//                       --no_code_motion --no_tbaa --no_clustering          /
//                       --no_scheduling --debug --cpu_mode arm --endian     /
//                       little --cpu ARM7TDMI-S --stack_align 4 -e --fpu    /
//                       None "-D_DLIB_CONFIG_FILE=C:\Program Files\IAR      /
//                       Systems\Embedded Workbench                          /
//                       4.0\ARM\LIB\dl4tpannl8n.h" C:\medusa\watchdog.c     /
//    List file       =  C:\medusa\Debug\List\watchdog.s79                   /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME watchdog

        RTMODEL "ARMv4M", "USED"
        RTMODEL "StackAlign4", "USED"
        RTMODEL "__cpu_mode", "__pcs__arm"
        RTMODEL "__data_model", "absolute"
        RTMODEL "__endian", "little"
        RTMODEL "__rt_version", "6"

        RSEG CSTACK:DATA:NOROOT(2)
        RSEG IRQSTACK:DATA:NOROOT(2)

        EXTERN ??DiI_a
        EXTERN ??EnI_a

        MULTWEAK ??rA??DiI_a
        MULTWEAK ??rA??EnI_a
        MULTWEAK cliRegisterCommand??rA
        MULTWEAK eventqPut??rA
        MULTWEAK eventqRegisterHandler??rA
        FUNCTION handleEvent,0603H
        LOCFRAME CSTACK, 4, STACK
        FUNCTION resetHandler,0603H
        LOCFRAME CSTACK, 16, STACK
        PUBLIC watchdogInit
        FUNCTION watchdogInit,0203H
        LOCFRAME CSTACK, 4, STACK
        FUNCTION watchdogIsr,0203H
        PUBLIC watchdogKick
        FUNCTION watchdogKick,0203H
        LOCFRAME CSTACK, 4, STACK
        FUNCTION watchdogReset,0203H
        LOCFRAME CSTACK, 4, STACK
        
        CFI Names cfiNames0
        CFI StackFrame CFA R13 HUGEDATA
        CFI Resource R0:32, R1:32, R2:32, R3:32, R4:32, R5:32, R6:32, R7:32
        CFI Resource R8:32, R9:32, R10:32, R11:32, R12:32, CPSR:32, R13:32
        CFI Resource R14:32, SPSR:32
        CFI VirtualResource ?RET:32
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 4
        CFI DataAlign 4
        CFI ReturnAddress ?RET CODE
        CFI CFA R13+0
        CFI R0 Undefined
        CFI R1 Undefined
        CFI R2 Undefined
        CFI R3 Undefined
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 Undefined
        CFI CPSR SameValue
        CFI R14 Undefined
        CFI SPSR SameValue
        CFI ?RET R14
        CFI EndCommon cfiCommon0
        
        
        CFI Names cfiNames1
        CFI StackFrame CFA_R13_usr R13_usr HUGEDATA
        CFI StackFrame CFA_R13_irq R13_irq HUGEDATA
        CFI Resource R0:32, R1:32, R2:32, R3:32, R4:32, R5:32, R6:32, R7:32
        CFI Resource R8:32, R9:32, R10:32, R11:32, R12:32, CPSR:32, R13_usr:32
        CFI Resource R14_usr:32, R13_irq:32, R14_irq:32, SPSR_irq:32
        CFI VirtualResource ?RET:32
        CFI EndNames cfiNames1
        
        CFI Common cfiCommon1 Using cfiNames1
        CFI CodeAlign 4
        CFI DataAlign 4
        CFI ReturnAddress ?RET CODE
        CFI CFA_R13_usr R13_usr+0
        CFI CFA_R13_irq R13_irq+0
        CFI R0 SameValue
        CFI R1 SameValue
        CFI R2 SameValue
        CFI R3 SameValue
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 SameValue
        CFI CPSR SPSR_irq
        CFI R14_usr SameValue
        CFI R14_irq Undefined
        CFI SPSR_irq Undefined
        CFI ?RET add(R14_irq, literal(-4))
        CFI EndCommon cfiCommon1
        
cliRegisterCommand  SYMBOL "cliRegisterCommand"
eventqPut           SYMBOL "eventqPut"
eventqRegisterHandler SYMBOL "eventqRegisterHandler"
cliRegisterCommand??rA SYMBOL "??rA", cliRegisterCommand
eventqPut??rA       SYMBOL "??rA", eventqPut
eventqRegisterHandler??rA SYMBOL "??rA", eventqRegisterHandler

        EXTERN cliRegisterCommand
        FUNCTION cliRegisterCommand,0202H
        EXTERN eventqPut
        FUNCTION eventqPut,0202H
        EXTERN eventqRegisterHandler
        FUNCTION eventqRegisterHandler,0202H


        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function watchdogReset
   CODE32      
watchdogReset:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   _BLF        ??DiI_a,??rA??DiI_a
   MOV         R0,#+0xE0000008
   MOV         R1,#+0xAA
   STR         R1,[R0, #+0]
   MOV         R2,#+0xE0000008
   MOV         R3,#+0x55
   STR         R3,[R2, #+0]
   _BLF        ??EnI_a,??rA??EnI_a
   LDMIA       SP!,{PC}           ;; return
        CFI EndBlock cfiBlock0

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function watchdogKick
   CODE32      
watchdogKick:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   MOV         R0,#+0xB
   _BLF        eventqPut,eventqPut??rA
   LDMIA       SP!,{PC}           ;; return
        CFI EndBlock cfiBlock1

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock2 Using cfiCommon1
        CFI Function watchdogIsr
   CODE32      
watchdogIsr:
   SUB         LR,LR,#+0x4
        CFI ?RET R14_irq
   STMDB       SP!,{LR}
        CFI ?RET Frame(CFA_R13_irq, -4)
        CFI CFA_R13_irq R13_irq+4
   MRS         LR,SPSR
        CFI SPSR_irq R14_irq
   STMDB       SP!,{R12,LR}
        CFI R14_irq Frame(CFA_R13_irq, -8)
        CFI R12 Frame(CFA_R13_irq, -12)
        CFI CFA_R13_irq R13_irq+12
   MRS         LR,CPSR
   ORR         LR,LR,#+0x1F
   MSR         CPSR,LR
   MRS         R12,CPSR
   ORR         R12,R12,#+0x92
   BIC         R12,R12,#+0xD
   MSR         CPSR,R12
   LDMIA       SP!,{R12,LR}
        CFI R12 SameValue
        CFI CFA_R13_irq R13_irq+4
   MSR         SPSR,LR
        CFI R14_irq SPSR_irq
   LDMIA       SP!,{PC}^          ;; return
        CFI EndBlock cfiBlock2

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock3 Using cfiCommon0
        CFI Function resetHandler
   CODE32      
resetHandler:
   STMDB       SP!,{R4-R6,LR}     ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R6 Frame(CFA, -8)
        CFI R5 Frame(CFA, -12)
        CFI R4 Frame(CFA, -16)
        CFI CFA R13+16
   MOV         R4,R0
   MOV         R5,R1
   MOV         R6,R2
   BL          watchdogReset
??resetHandler_0:
   B           ??resetHandler_0
        CFI EndBlock cfiBlock3

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock4 Using cfiCommon0
        CFI Function handleEvent
   CODE32      
handleEvent:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   BL          watchdogReset
   LDMIA       SP!,{PC}           ;; return
        CFI EndBlock cfiBlock4

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock5 Using cfiCommon0
        CFI Function watchdogInit
   CODE32      
watchdogInit:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   LDR         R2,??watchdogInit_0  ;; `?<Constant "reset - resets the pr...">`
   LDR         R1,??watchdogInit_0+4  ;; resetHandler
   LDR         R0,??watchdogInit_0+8  ;; `?<Constant "reset">`
   _BLF        cliRegisterCommand,cliRegisterCommand??rA
   LDR         R1,??watchdogInit_0+12  ;; handleEvent
   MOV         R0,#+0xB
   _BLF        eventqRegisterHandler,eventqRegisterHandler??rA
   MOV         R0,#+0xE0000004
   MOV         R1,#+0x80000000
   STR         R1,[R0, #+0]
   MOV         R2,#+0xE0000000
   MOV         R3,#+0x3
   STR         R3,[R2, #+0]
   BL          watchdogReset
   MOV         R0,#+0x0
   LDMIA       SP!,{PC}           ;; return
   DATA        
??watchdogInit_0:
   DC32        `?<Constant "reset - resets the pr...">`
   DC32        resetHandler
   DC32        `?<Constant "reset">`
   DC32        handleEvent
        CFI EndBlock cfiBlock5

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock6 Using cfiCommon0
        CFI NoFunction
   CODE32      
??rA??DiI_a:
   LDR         R12,??Subroutine0_0  ;; ??DiI_a
   MOV         PC,R12
   DATA        
??Subroutine0_0:
   DC32        ??DiI_a
        CFI EndBlock cfiBlock6

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock7 Using cfiCommon0
        CFI NoFunction
   CODE32      
??rA??EnI_a:
   LDR         R12,??Subroutine1_0  ;; ??EnI_a
   MOV         PC,R12
   DATA        
??Subroutine1_0:
   DC32        ??EnI_a
        CFI EndBlock cfiBlock7

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock8 Using cfiCommon0
        CFI NoFunction
   CODE32      
eventqPut??rA:
   LDR         R12,??Subroutine2_0  ;; eventqPut
   MOV         PC,R12
   DATA        
??Subroutine2_0:
   DC32        eventqPut
        CFI EndBlock cfiBlock8

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock9 Using cfiCommon0
        CFI NoFunction
   CODE32      
cliRegisterCommand??rA:
   LDR         R12,??Subroutine3_0  ;; cliRegisterCommand
   MOV         PC,R12
   DATA        
??Subroutine3_0:
   DC32        cliRegisterCommand
        CFI EndBlock cfiBlock9

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock10 Using cfiCommon0
        CFI NoFunction
   CODE32      
eventqRegisterHandler??rA:
   LDR         R12,??Subroutine4_0  ;; eventqRegisterHandler
   MOV         PC,R12
   DATA        
??Subroutine4_0:
   DC32        eventqRegisterHandler
        CFI EndBlock cfiBlock10

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "reset">`:
        DC8 "reset"
        DC8 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "reset - resets the pr...">`:
        DC8 "reset - resets the processor via watchdog"
        DC8 0, 0

        END
// 
// 292 bytes in segment CODE
//  52 bytes in segment DATA_C
// 
// 232 bytes of CODE  memory (+ 60 bytes shared)
//  52 bytes of CONST memory
//
//Errors: none
//Warnings: 2
