//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// IAR ARM ANSI C/C++ Compiler V4.11A/W32              20/Jul/2004  18:58:51 /
// Copyright 1999-2004 IAR Systems. All rights reserved.                     /
//                                                                           /
//    Cpu mode        =  arm                                                 /
//    Endian          =  little                                              /
//    Stack alignment =  4                                                   /
//    Source file     =  C:\medusa\zl_mii.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\zl_mii.c       /
//    List file       =  C:\medusa\Debug\List\zl_mii.s79                     /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME zl_mii

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

        RSEG CSTACK:DATA:NOROOT(2)

        PUBWEAK `?*?DATA_ID`
        PUBWEAK ?init?tab?DATA_I
        MULTWEAK _Stoul??rA
        PUBWEAK atoi
        FUNCTION atoi,010203H
        LOCFRAME CSTACK, 8, STACK
        MULTWEAK atoi??rA
        MULTWEAK cliRegisterCommand??rA
        MULTWEAK clicharGetOutputBuffer??rA
        MULTWEAK clicharSendOutputBuffer??rA
        FUNCTION miiHandler,0603H
        LOCFRAME CSTACK, 44, STACK
        FUNCTION phypwrHandler,0603H
        LOCFRAME CSTACK, 32, STACK
        MULTWEAK sprintf??rA
        MULTWEAK strtol??rA
        MULTWEAK zarlinkIndexedRead??rA
        MULTWEAK zarlinkIndexedWrite??rA
        PUBLIC zarlinkMiiDump
        FUNCTION zarlinkMiiDump,0203H
        LOCFRAME CSTACK, 28, STACK
        PUBLIC zarlinkMiiInit
        FUNCTION zarlinkMiiInit,0203H
        LOCFRAME CSTACK, 4, STACK
        PUBLIC zarlinkMiiPowerSave
        FUNCTION zarlinkMiiPowerSave,0203H
        LOCFRAME CSTACK, 16, STACK
        PUBLIC zarlinkMiiRead
        FUNCTION zarlinkMiiRead,0203H
        LOCFRAME CSTACK, 32, STACK
        PUBLIC zarlinkMiiWrite
        FUNCTION zarlinkMiiWrite,0203H
        LOCFRAME CSTACK, 28, 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
        
_Stoul              SYMBOL "_Stoul"
cliRegisterCommand  SYMBOL "cliRegisterCommand"
clicharGetOutputBuffer SYMBOL "clicharGetOutputBuffer"
clicharSendOutputBuffer SYMBOL "clicharSendOutputBuffer"
sprintf             SYMBOL "sprintf"
strtol              SYMBOL "strtol"
zarlinkIndexedRead  SYMBOL "zarlinkIndexedRead"
zarlinkIndexedWrite SYMBOL "zarlinkIndexedWrite"
_Stoul??rA          SYMBOL "??rA", _Stoul
atoi                SYMBOL "atoi"
atoi??rA            SYMBOL "??rA", atoi
cliRegisterCommand??rA SYMBOL "??rA", cliRegisterCommand
clicharGetOutputBuffer??rA SYMBOL "??rA", clicharGetOutputBuffer
clicharSendOutputBuffer??rA SYMBOL "??rA", clicharSendOutputBuffer
sprintf??rA         SYMBOL "??rA", sprintf
strtol??rA          SYMBOL "??rA", strtol
zarlinkIndexedRead??rA SYMBOL "??rA", zarlinkIndexedRead
zarlinkIndexedWrite??rA SYMBOL "??rA", zarlinkIndexedWrite

        EXTERN _Stoul
        FUNCTION _Stoul,010202H
        EXTERN cliRegisterCommand
        FUNCTION cliRegisterCommand,0202H
        EXTERN clicharGetOutputBuffer
        FUNCTION clicharGetOutputBuffer,0202H
        EXTERN clicharSendOutputBuffer
        FUNCTION clicharSendOutputBuffer,0202H
        EXTERN sprintf
        FUNCTION sprintf,010202H
        EXTERN strtol
        FUNCTION strtol,010202H
        EXTERN zarlinkIndexedRead
        FUNCTION zarlinkIndexedRead,0202H
        EXTERN zarlinkIndexedWrite
        FUNCTION zarlinkIndexedWrite,0202H


        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function atoi
   CODE32      
// __??Code32?? __intrinsic __code __arm __atpcs int atoi(char const *)
atoi:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   MOV         R4,R0
   MOV         R2,#+0xA
   MOV         R1,#+0x0
   MOV         R0,R4
   _BLF        _Stoul,_Stoul??rA
   LDMIA       SP!,{R4,PC}        ;; return
        CFI EndBlock cfiBlock0

        RSEG DATA_I:DATA:SORT:NOROOT(2)
miiRegs:
        DS8 96
	REQUIRE `?<Initializer for miiRegs>`

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function zarlinkMiiWrite
   CODE32      
zarlinkMiiWrite:
   STMDB       SP!,{R4-R9,LR}     ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R9 Frame(CFA, -8)
        CFI R8 Frame(CFA, -12)
        CFI R7 Frame(CFA, -16)
        CFI R6 Frame(CFA, -20)
        CFI R5 Frame(CFA, -24)
        CFI R4 Frame(CFA, -28)
        CFI CFA R13+28
   MOV         R4,R0
   MOV         R5,R1
   MOV         R6,R2
   MOV         R0,#+0x2
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedRead,zarlinkIndexedRead??rA
   MOV         R7,R0
   MOV         R0,R7
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   ORRS        R1,R0,#+0x40
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x2
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R1,#+0x0
   MOV         R8,R1
??zarlinkMiiWrite_0:
   CMP         R8,#+0x3E8
   BGE         ??zarlinkMiiWrite_1
   MOV         R0,#+0x6
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedRead,zarlinkIndexedRead??rA
   MOV         R9,R0
   MOV         R2,R9
   ANDS        R2,R2,#+0xFF       ;; Zero extend
   TST         R2,#+0x80
   BNE         ??zarlinkMiiWrite_1
   ADDS        R8,R8,#+0x1
   B           ??zarlinkMiiWrite_0
??zarlinkMiiWrite_1:
   MOV         R3,R9
   ANDS        R3,R3,#+0xFF       ;; Zero extend
   TST         R3,#+0x80
   BNE         ??zarlinkMiiWrite_2
   MVN         R0,#+0x0
   B           ??zarlinkMiiWrite_3
??zarlinkMiiWrite_2:
   MOV         R1,R6
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x3
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R6,R6, LSL #+16
   MOVS        R6,R6, LSR #+16
   MOV         R1,R6, LSR #+8
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x4
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R12,R5
   ANDS        R12,R12,#+0xFF     ;; Zero extend
   ANDS        LR,R12,#+0x1F
   ORRS        R1,LR,#+0x20
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x5
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R0,R4
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   ANDS        R1,R0,#+0x1F
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x6
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R1,R7
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x2
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R0,#+0x0
??zarlinkMiiWrite_3:
   LDMIA       SP!,{R4-R9,PC}     ;; return
        CFI EndBlock cfiBlock1

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function zarlinkMiiRead
   CODE32      
zarlinkMiiRead:
   STMDB       SP!,{R4-R10,LR}    ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R10 Frame(CFA, -8)
        CFI R9 Frame(CFA, -12)
        CFI R8 Frame(CFA, -16)
        CFI R7 Frame(CFA, -20)
        CFI R6 Frame(CFA, -24)
        CFI R5 Frame(CFA, -28)
        CFI R4 Frame(CFA, -32)
        CFI CFA R13+32
   MOV         R4,R0
   MOV         R5,R1
   MOV         R6,R2
   MOV         R0,#+0x2
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedRead,zarlinkIndexedRead??rA
   MOV         R9,R0
   MOV         R0,R9
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   ORRS        R1,R0,#+0x40
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x2
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R1,#+0x0
   MOV         R10,R1
??zarlinkMiiRead_0:
   CMP         R10,#+0x3E8
   BGE         ??zarlinkMiiRead_1
   MOV         R0,#+0x6
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedRead,zarlinkIndexedRead??rA
   MOV         R8,R0
   MOV         R2,R8
   ANDS        R2,R2,#+0xFF       ;; Zero extend
   TST         R2,#+0x80
   BNE         ??zarlinkMiiRead_1
   ADDS        R10,R10,#+0x1
   B           ??zarlinkMiiRead_0
??zarlinkMiiRead_1:
   MOV         R3,R8
   ANDS        R3,R3,#+0xFF       ;; Zero extend
   TST         R3,#+0x80
   BNE         ??zarlinkMiiRead_2
   MVN         R0,#+0x0
   B           ??zarlinkMiiRead_3
??zarlinkMiiRead_2:
   MOV         R12,R5
   ANDS        R12,R12,#+0xFF     ;; Zero extend
   ANDS        LR,R12,#+0x1F
   ORRS        R1,LR,#+0x40
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x5
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R0,R4
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   ANDS        R1,R0,#+0x1F
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x6
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   MOV         R1,#+0x0
   MOV         R10,R1
??zarlinkMiiRead_4:
   CMP         R10,#+0x3E8
   BGE         ??zarlinkMiiRead_5
   MOV         R0,#+0x6
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedRead,zarlinkIndexedRead??rA
   MOV         R8,R0
   MOV         R2,R8
   ANDS        R2,R2,#+0xFF       ;; Zero extend
   ANDS        R3,R2,#+0xC0
   CMP         R3,#+0xC0
   BEQ         ??zarlinkMiiRead_5
   ADDS        R10,R10,#+0x1
   B           ??zarlinkMiiRead_4
??zarlinkMiiRead_5:
   MOV         R12,R8
   ANDS        R12,R12,#+0xFF     ;; Zero extend
   ANDS        LR,R12,#+0xC0
   CMP         LR,#+0xC0
   BEQ         ??zarlinkMiiRead_6
   MVN         R0,#+0x1
   B           ??zarlinkMiiRead_3
??zarlinkMiiRead_6:
   MOV         R0,#+0x7
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedRead,zarlinkIndexedRead??rA
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   MOV         R7,R0
   MOV         R0,#+0x8
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedRead,zarlinkIndexedRead??rA
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   ORRS        R7,R7,R0, LSL #+8
   MOV         R1,R9
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x2
   ORR         R0,R0,#+0x600
   _BLF        zarlinkIndexedWrite,zarlinkIndexedWrite??rA
   STRH        R7,[R6, #+0]
   MOV         R0,#+0x0
??zarlinkMiiRead_3:
   LDMIA       SP!,{R4-R10,PC}    ;; return
        CFI EndBlock cfiBlock2

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock3 Using cfiCommon0
        CFI Function zarlinkMiiDump
   CODE32      
zarlinkMiiDump:
   STMDB       SP!,{R4-R7,LR}     ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R7 Frame(CFA, -8)
        CFI R6 Frame(CFA, -12)
        CFI R5 Frame(CFA, -16)
        CFI R4 Frame(CFA, -20)
        CFI CFA R13+20
   SUB         SP,SP,#+0x8
        CFI CFA R13+28
   MOV         R4,R0
   CMP         R4,#+0x8
   BLT         ??zarlinkMiiDump_0
   CMP         R4,#+0xE
   BLT         ??zarlinkMiiDump_1
??zarlinkMiiDump_0:
   MOV         R0,R7
   B           ??zarlinkMiiDump_2
??zarlinkMiiDump_1:
   MOV         R0,SP
   _BLF        clicharGetOutputBuffer,clicharGetOutputBuffer??rA
   MOV         R5,R0
   MOV         R2,R4
   LDR         R1,??zarlinkMiiDump_3  ;; `?<Constant "\\r\\ndumping all regs fo...">`
   MOV         R0,R5
   _BLF        sprintf,sprintf??rA
   LDR         R1,[SP, #+0]
   MOV         R0,R5
   _BLF        clicharSendOutputBuffer,clicharSendOutputBuffer??rA
   MOV         R1,#+0x0
   MOV         R7,R1
   MOV         R2,#+0x0
   MOV         R6,R2
??zarlinkMiiDump_4:
   CMP         R6,#+0xC
   BGE         ??zarlinkMiiDump_5
   CMP         R7,#+0x0
   BNE         ??zarlinkMiiDump_5
   ADD         R2,SP,#+0x4
   MOV         R3,#+0x8
   LDR         R12,??zarlinkMiiDump_3+4  ;; miiRegs
   MLAS        LR,R3,R6,R12
   LDR         R1,[LR, #+0]
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,R4
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   BL          zarlinkMiiRead
   MOV         R7,R0
   CMP         R7,#+0x0
   BNE         ??zarlinkMiiDump_6
   LDRH        R3,[SP, #+4]
   MOV         R3,R3, LSL #+16
   MOVS        R3,R3, LSR #+16
   MOV         R1,#+0x8
   LDR         R2,??zarlinkMiiDump_3+4  ;; miiRegs
   MLAS        R12,R1,R6,R2
   LDR         R2,[R12, #+4]
   LDR         R1,??zarlinkMiiDump_3+8  ;; `?<Constant "%s [%04x]\\r\\n">`
   MOV         R0,R5
   _BLF        sprintf,sprintf??rA
   LDR         R1,[SP, #+0]
   MOV         R0,R5
   _BLF        clicharSendOutputBuffer,clicharSendOutputBuffer??rA
??zarlinkMiiDump_6:
   ADDS        R6,R6,#+0x1
   B           ??zarlinkMiiDump_4
??zarlinkMiiDump_5:
   MOV         R0,R7
??zarlinkMiiDump_2:
   ADD         SP,SP,#+0x8        ;; stack cleaning
        CFI CFA R13+20
   LDMIA       SP!,{R4-R7,PC}     ;; return
   DATA        
??zarlinkMiiDump_3:
   DC32        `?<Constant "\\r\\ndumping all regs fo...">`
   DC32        miiRegs
   DC32        `?<Constant "%s [%04x]\\r\\n">`
        CFI EndBlock cfiBlock3

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock4 Using cfiCommon0
        CFI Function zarlinkMiiPowerSave
   CODE32      
zarlinkMiiPowerSave:
   STMDB       SP!,{R4,R5,LR}     ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R5 Frame(CFA, -8)
        CFI R4 Frame(CFA, -12)
        CFI CFA R13+12
   SUB         SP,SP,#+0x4
        CFI CFA R13+16
   MOV         R4,R0
   MVN         R0,#+0x0
   MOV         R5,R0
   CMP         R4,#+0x8
   BLT         ??zarlinkMiiPowerSave_0
   CMP         R4,#+0xE
   BLT         ??zarlinkMiiPowerSave_1
??zarlinkMiiPowerSave_0:
   MOV         R0,R5
   B           ??zarlinkMiiPowerSave_2
??zarlinkMiiPowerSave_1:
   MOV         R2,SP
   MOV         R1,#+0x1
   MOV         R0,R4
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   BL          zarlinkMiiRead
   MOV         R5,R0
   CMP         R5,#+0x0
   BNE         ??zarlinkMiiPowerSave_3
   LDRH        R2,[SP, #+0]
   MOV         R2,R2, LSL #+16
   MOVS        R2,R2, LSR #+16
   TST         R2,#+0x4
   BNE         ??zarlinkMiiPowerSave_4
   MOV         R2,#+0x800
   MOV         R1,#+0x0
   MOV         R0,R4
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   BL          zarlinkMiiWrite
   MOV         R5,R0
   CMP         R5,#+0x0
   BNE         ??zarlinkMiiPowerSave_3
   MOV         R3,#+0x1
   MOV         R5,R3
   B           ??zarlinkMiiPowerSave_3
??zarlinkMiiPowerSave_4:
   MOV         R12,#+0x0
   MOV         R5,R12
??zarlinkMiiPowerSave_3:
   MOV         R0,R5
??zarlinkMiiPowerSave_2:
   ADD         SP,SP,#+0x4        ;; stack cleaning
        CFI CFA R13+12
   LDMIA       SP!,{R4,R5,PC}     ;; return
        CFI EndBlock cfiBlock4

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock5 Using cfiCommon0
        CFI Function phypwrHandler
   CODE32      
phypwrHandler:
   STMDB       SP!,{R4-R8,LR}     ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R8 Frame(CFA, -8)
        CFI R7 Frame(CFA, -12)
        CFI R6 Frame(CFA, -16)
        CFI R5 Frame(CFA, -20)
        CFI R4 Frame(CFA, -24)
        CFI CFA R13+24
   SUB         SP,SP,#+0x8
        CFI CFA R13+32
   MOV         R4,R0
   MOV         R5,R1
   MOV         R6,R2
   MVN         R0,#+0x0
   MOV         R7,R0
   ADD         R0,SP,#+0x4
   _BLF        clicharGetOutputBuffer,clicharGetOutputBuffer??rA
   MOV         R8,R0
   MOV         R0,R7
   ADD         SP,SP,#+0x8        ;; stack cleaning
        CFI CFA R13+24
   LDMIA       SP!,{R4-R8,PC}     ;; return
        CFI EndBlock cfiBlock5

        RSEG DATA_I:DATA:SORT:NOROOT(2)
defaultPhy:
        DS8 4
	REQUIRE `?<Initializer for defaultPhy>`

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock6 Using cfiCommon0
        CFI Function miiHandler
   CODE32      
miiHandler:
   STMDB       SP!,{R4-R10,LR}    ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R10 Frame(CFA, -8)
        CFI R9 Frame(CFA, -12)
        CFI R8 Frame(CFA, -16)
        CFI R7 Frame(CFA, -20)
        CFI R6 Frame(CFA, -24)
        CFI R5 Frame(CFA, -28)
        CFI R4 Frame(CFA, -32)
        CFI CFA R13+32
   SUB         SP,SP,#+0x8
        CFI CFA R13+40
   MOV         R7,R0
   MOV         R8,R1
   MOV         R9,R2
   MVN         R0,#+0x0
   MOV         R10,R0
   ADD         R0,SP,#+0x4
   _BLF        clicharGetOutputBuffer,clicharGetOutputBuffer??rA
   MOV         R6,R0
   LDR         R1,[R8, #+4]
   LDRB        R2,[R1, #+0]
   ANDS        R2,R2,#+0xFF       ;; Zero extend
   SUB         R2,R2,#+0x41
   CMP         R2,#+0x36
   BHI         ??miiHandler_0
   ADR         R3,`?<Jumptable for miiHandler>_0`
   LDRB        R3,[R3, R2]
   ADD         PC,PC,R3, LSL #+2
   DATA        
`?<Jumptable for miiHandler>_0`:
   DC8         +0x57,+0x9A,+0x9A,+0x49
   DC8         +0x9A,+0x9A,+0x9A,+0x9A
   DC8         +0x9A,+0x9A,+0x9A,+0x9A
   DC8         +0x9A,+0x9A,+0x9A,+0xD
   DC8         +0x9A,+0x1B,+0x9A,+0x9A
   DC8         +0x9A,+0x9A,+0x68,+0x9A
   DC8         +0x9A,+0x9A,+0x9A,+0x9A
   DC8         +0x9A,+0x9A,+0x9A,+0x9A
   DC8         +0x57,+0x9A,+0x9A,+0x49
   DC8         +0x9A,+0x9A,+0x9A,+0x9A
   DC8         +0x9A,+0x9A,+0x9A,+0x9A
   DC8         +0x9A,+0x9A,+0x9A,+0xD
   DC8         +0x9A,+0x1B,+0x9A,+0x9A
   DC8         +0x9A,+0x9A,+0x68,+0x0
   CODE32      
??miiHandler_1:
   CMP         R7,#+0x3
   BNE         ??miiHandler_0
   LDR         R0,[R8, #+8]
   _BLF        atoi,atoi??rA
   LDR         R12,??miiHandler_2  ;; defaultPhy
   STR         R0,[R12, #+0]
   LDR         LR,??miiHandler_2  ;; defaultPhy
   LDR         R2,[LR, #+0]
   LDR         R1,??miiHandler_2+4  ;; `?<Constant "mii default phy set t...">`
   MOV         R0,R6
   _BLF        sprintf,sprintf??rA
   MOV         R0,#+0x0
   MOV         R10,R0
   B           ??miiHandler_0
??miiHandler_3:
   LDR         R1,??miiHandler_2  ;; defaultPhy
   LDR         R2,[R1, #+0]
   CMN         R2,#+0x1
   BNE         ??miiHandler_4
   LDR         R1,??miiHandler_2+8  ;; `?<Constant "mii default phy not s...">`
   MOV         R0,R6
   _BLF        sprintf,sprintf??rA
   B           ??miiHandler_0
??miiHandler_4:
   MOV         R2,#+0x10
   MOV         R1,#+0x0
   LDR         R0,[R8, #+8]
   _BLF        strtol,strtol??rA
   MOV         R5,R0
   MOV         R2,SP
   MOV         R1,R5
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   LDR         R3,??miiHandler_2  ;; defaultPhy
   LDR         R0,[R3, #+0]
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   BL          zarlinkMiiRead
   MOV         R10,R0
   CMP         R10,#+0x0
   BNE         ??miiHandler_5
   LDRH        LR,[SP, #+0]
   MOV         LR,LR, LSL #+16
   MOVS        LR,LR, LSR #+16
   STMDB       SP!,{LR}           ;; Push
        CFI CFA R13+44
   MOV         R3,R5
   ANDS        R3,R3,#+0xFF       ;; Zero extend
   LDR         R0,??miiHandler_2  ;; defaultPhy
   LDR         R2,[R0, #+0]
   LDR         R1,??miiHandler_2+12  ;; `?<Constant "mii read phy[%02x] re...">`
   MOV         R0,R6
   _BLF        sprintf,sprintf??rA
   ADD         SP,SP,#+0x4        ;; stack cleaning
        CFI CFA R13+40
   B           ??miiHandler_0
??miiHandler_5:
   STMDB       SP!,{R10}          ;; Push
        CFI CFA R13+44
   MOV         R3,R5
   ANDS        R3,R3,#+0xFF       ;; Zero extend
   LDR         R1,??miiHandler_2  ;; defaultPhy
   LDR         R2,[R1, #+0]
   LDR         R1,??miiHandler_2+16  ;; `?<Constant "mii read phy[%02x] re...">_1`
   MOV         R0,R6
   _BLF        sprintf,sprintf??rA
   ADD         SP,SP,#+0x4        ;; stack cleaning
        CFI CFA R13+40
   B           ??miiHandler_0
??miiHandler_6:
   LDR         R2,??miiHandler_2  ;; defaultPhy
   LDR         R3,[R2, #+0]
   CMN         R3,#+0x1
   BNE         ??miiHandler_7
   LDR         R1,??miiHandler_2+8  ;; `?<Constant "mii default phy not s...">`
   MOV         R0,R6
   _BLF        sprintf,sprintf??rA
   B           ??miiHandler_0
??miiHandler_7:
   LDR         R12,??miiHandler_2  ;; defaultPhy
   LDR         R0,[R12, #+0]
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   BL          zarlinkMiiDump
   MOV         R10,R0
   B           ??miiHandler_0
??miiHandler_8:
   MOV         LR,#+0x0
   MOV         R10,LR
   MOV         R0,#+0x8
   MOV         R4,R0
??miiHandler_9:
   CMP         R4,#+0xE
   BGE         ??miiHandler_10
   CMP         R10,#+0x0
   BNE         ??miiHandler_10
   MOV         R0,R4
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   BL          zarlinkMiiDump
   MOV         R10,R0
   ADDS        R4,R4,#+0x1
   B           ??miiHandler_9
??miiHandler_10:
   MOV         R1,#+0x0
   STRB        R1,[R6, #+0]
   B           ??miiHandler_0
??miiHandler_11:
   LDR         R2,??miiHandler_2  ;; defaultPhy
   LDR         R3,[R2, #+0]
   CMN         R3,#+0x1
   BNE         ??miiHandler_12
   LDR         R1,??miiHandler_2+8  ;; `?<Constant "mii default phy not s...">`
   MOV         R0,R6
   _BLF        sprintf,sprintf??rA
   B           ??miiHandler_0
??miiHandler_12:
   MOV         R2,#+0x10
   MOV         R1,#+0x0
   LDR         R0,[R8, #+8]
   _BLF        strtol,strtol??rA
   MOV         R5,R0
   MOV         R2,#+0x10
   MOV         R1,#+0x0
   LDR         R0,[R8, #+12]
   _BLF        strtol,strtol??rA
   STRH        R0,[SP, #+0]
   LDRH        R2,[SP, #+0]
   MOV         R1,R5
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   LDR         R0,??miiHandler_2  ;; defaultPhy
   LDR         R0,[R0, #+0]
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   BL          zarlinkMiiWrite
   MOV         R10,R0
   CMP         R10,#+0x0
   BNE         ??miiHandler_13
   LDRH        R2,[SP, #+0]
   MOV         R2,R2, LSL #+16
   MOVS        R2,R2, LSR #+16
   STMDB       SP!,{R2}           ;; Push
        CFI CFA R13+44
   MOV         R3,R5
   ANDS        R3,R3,#+0xFF       ;; Zero extend
   LDR         R12,??miiHandler_2  ;; defaultPhy
   LDR         R2,[R12, #+0]
   LDR         R1,??miiHandler_2+20  ;; `?<Constant "mii write phy[%02x] r...">`
   MOV         R0,R6
   _BLF        sprintf,sprintf??rA
   ADD         SP,SP,#+0x4        ;; stack cleaning
        CFI CFA R13+40
   B           ??miiHandler_0
??miiHandler_13:
   STMDB       SP!,{R10}          ;; Push
        CFI CFA R13+44
   MOV         R3,R5
   ANDS        R3,R3,#+0xFF       ;; Zero extend
   LDR         LR,??miiHandler_2  ;; defaultPhy
   LDR         R2,[LR, #+0]
   LDR         R1,??miiHandler_2+24  ;; `?<Constant "mii write phy[%02x] r...">_1`
   MOV         R0,R6
   _BLF        sprintf,sprintf??rA
   ADD         SP,SP,#+0x4        ;; stack cleaning
        CFI CFA R13+40
??miiHandler_0:
   LDR         R1,[SP, #+4]
   MOV         R0,R6
   _BLF        clicharSendOutputBuffer,clicharSendOutputBuffer??rA
   MOV         R0,R10
   ADD         SP,SP,#+0x8        ;; stack cleaning
        CFI CFA R13+32
   LDMIA       SP!,{R4-R10,PC}    ;; return
   DATA        
??miiHandler_2:
   DC32        defaultPhy
   DC32        `?<Constant "mii default phy set t...">`
   DC32        `?<Constant "mii default phy not s...">`
   DC32        `?<Constant "mii read phy[%02x] re...">`
   DC32        `?<Constant "mii read phy[%02x] re...">_1`
   DC32        `?<Constant "mii write phy[%02x] r...">`
   DC32        `?<Constant "mii write phy[%02x] r...">_1`
        CFI EndBlock cfiBlock6

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock7 Using cfiCommon0
        CFI Function zarlinkMiiInit
   CODE32      
zarlinkMiiInit:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   LDR         R2,??zarlinkMiiInit_0  ;; `?<Constant "mii [(p)hy <defaultPh...">`
   LDR         R1,??zarlinkMiiInit_0+4  ;; miiHandler
   LDR         R0,??zarlinkMiiInit_0+8  ;; `?<Constant "mii">`
   _BLF        cliRegisterCommand,cliRegisterCommand??rA
   LDR         R2,??zarlinkMiiInit_0+12  ;; `?<Constant "phypwr [phy] - enable...">`
   LDR         R1,??zarlinkMiiInit_0+16  ;; phypwrHandler
   LDR         R0,??zarlinkMiiInit_0+20  ;; `?<Constant "phypwr">`
   _BLF        cliRegisterCommand,cliRegisterCommand??rA
   MOV         R0,#+0x0
   LDMIA       SP!,{PC}           ;; return
   DATA        
??zarlinkMiiInit_0:
   DC32        `?<Constant "mii [(p)hy <defaultPh...">`
   DC32        miiHandler
   DC32        `?<Constant "mii">`
   DC32        `?<Constant "phypwr [phy] - enable...">`
   DC32        phypwrHandler
   DC32        `?<Constant "phypwr">`
        CFI EndBlock cfiBlock7

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

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

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

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

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

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

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

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

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

        RSEG DATA_ID:CONST:SORT:NOROOT(2)
`?<Initializer for miiRegs>`:
        DC32 0, `?<Constant "Basic Control   ">`, 1
        DC32 `?<Constant "Basic Status    ">`, 2
        DC32 `?<Constant "PHY Id 1        ">`, 3
        DC32 `?<Constant "PHY Id 2        ">`, 4
        DC32 `?<Constant "Autoneg Advert  ">`, 5
        DC32 `?<Constant "Autoneg Partner ">`, 6
        DC32 `?<Constant "Autoneg Expans  ">`, 7
        DC32 `?<Constant "Autoneg Next Pg ">`, 8
        DC32 `?<Constant "Lnk Prt Next Pg ">`, 21
        DC32 `?<Constant "RXER Counter    ">`, 27
        DC32 `?<Constant "IRQ Ctrl/Status ">`, 31
        DC32 `?<Constant "100BaseTX PHY   ">`

        RSEG DATA_ID:CONST:SORT:NOROOT(2)
`?<Initializer for defaultPhy>`:
        DC32 4294967295

        RSEG DATA_ID:CONST:SORT:NOROOT(2)
`?*?DATA_ID`:

        RSEG INITTAB:CODE:ROOT(2)
   DATA
?init?tab?DATA_I:
   DCD      sfe(DATA_I) - sfb(DATA_I), sfb(DATA_I), sfb(DATA_ID)

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

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

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

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

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

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

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

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

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "Lnk Prt Next Pg ">`:
        DC8 "Lnk Prt Next Pg "
        DC8 0, 0, 0

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

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "IRQ Ctrl/Status ">`:
        DC8 "IRQ Ctrl/Status "
        DC8 0, 0, 0

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

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "\\r\\ndumping all regs fo...">`:
        DC8 "\015\012dumping all regs for phy [%d]\015\012"
        DC8 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "%s [%04x]\\r\\n">`:
        DC8 "%s [%04x]\015\012"

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "mii default phy set t...">`:
        DC8 "mii default phy set to [%02x]\015\012"

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "mii default phy not s...">`:
        DC8 6DH, 69H, 69H, 20H, 64H, 65H, 66H, 61H
        DC8 75H, 6CH, 74H, 20H, 70H, 68H, 79H, 20H
        DC8 6EH, 6FH, 74H, 20H, 73H, 65H, 74H, 2CH
        DC8 20H, 70H, 6CH, 65H, 61H, 73H, 65H, 20H
        DC8 75H, 73H, 65H, 20H, 6DH, 69H, 69H, 20H
        DC8 5BH, 70H, 68H, 79H, 20H, 3CH, 64H, 65H
        DC8 66H, 61H, 75H, 6CH, 74H, 50H, 68H, 79H
        DC8 3EH, 5DH, 0DH, 0AH, 0
        DC8 0, 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "mii read phy[%02x] re...">`:
        DC8 "mii read phy[%02x] reg[%02x] = %04x  OK\015\012"
        DC8 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "mii read phy[%02x] re...">_1`:
        DC8 "mii read phy[%02x] reg[%02x]  ERROR %d\015\012"
        DC8 0, 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "mii write phy[%02x] r...">`:
        DC8 "mii write phy[%02x] reg[%02x] <-- %04x  OK\015\012"
        DC8 0, 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "mii write phy[%02x] r...">_1`:
        DC8 "mii write phy[%02x] reg[%02x]  ERROR %d\015\012"
        DC8 0, 0

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

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "mii [(p)hy <defaultPh...">`:
        DC8 6DH, 69H, 69H, 20H, 5BH, 28H, 70H, 29H
        DC8 68H, 79H, 20H, 3CH, 64H, 65H, 66H, 61H
        DC8 75H, 6CH, 74H, 50H, 68H, 79H, 3EH, 5DH
        DC8 20H, 5BH, 28H, 72H, 29H, 65H, 61H, 64H
        DC8 20H, 3CH, 61H, 64H, 64H, 72H, 65H, 73H
        DC8 73H, 3EH, 5DH, 20H, 5BH, 28H, 77H, 29H
        DC8 72H, 69H, 74H, 65H, 20H, 3CH, 61H, 64H
        DC8 64H, 72H, 65H, 73H, 73H, 3EH, 20H, 3CH
        DC8 64H, 61H, 74H, 61H, 3EH, 5DH, 20H, 5BH
        DC8 28H, 61H, 29H, 6CH, 6CH, 72H, 65H, 67H
        DC8 73H, 5DH, 20H, 5BH, 28H, 64H, 29H, 75H
        DC8 6DH, 70H, 72H, 65H, 67H, 73H, 5DH, 0

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

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "phypwr [phy] - enable...">`:
        DC8 70H, 68H, 79H, 70H, 77H, 72H, 20H, 5BH
        DC8 70H, 68H, 79H, 5DH, 20H, 2DH, 20H, 65H
        DC8 6EH, 61H, 62H, 6CH, 65H, 20H, 70H, 6FH
        DC8 77H, 65H, 72H, 20H, 73H, 61H, 76H, 65H
        DC8 20H, 6DH, 6FH, 64H, 65H, 20H, 69H, 66H
        DC8 20H, 6EH, 6FH, 20H, 6CH, 69H, 6EH, 6BH
        DC8 20H, 64H, 65H, 74H, 65H, 63H, 74H, 65H
        DC8 64H, 20H, 6FH, 6EH, 20H, 61H, 20H, 70H
        DC8 68H, 79H, 0
        DC8 0

        END
// 
// 2 040 bytes in segment CODE
//   740 bytes in segment DATA_C
//   100 bytes in segment DATA_I
//   100 bytes in segment DATA_ID
//    12 bytes in segment INITTAB
// 
// 1 904 bytes of CODE  memory (+ 148 bytes shared)
//   840 bytes of CONST memory
//   100 bytes of DATA  memory
//
//Errors: none
//Warnings: 6
