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

        NAME eventq

        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)

        EXTERN ??DiI_a
        EXTERN ??EnI_a

??DataTable0 EQU 0
??DataTable1 EQU 0
??DataTable2 EQU 0
??DataTable5 EQU 0
??DataTable6 EQU 0
??DataTable7 EQU 0
        MULTWEAK ??rA??DiI_a
        MULTWEAK ??rA??EnI_a
        PUBWEAK ?init?tab?DATA_Z
        MULTWEAK boardSetBusyLed??rA
        PUBLIC eventqDispatch
        FUNCTION eventqDispatch,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBWEAK eventqGet
        FUNCTION eventqGet,0203H
        LOCFRAME CSTACK, 4, STACK
        MULTWEAK eventqGet??rA
        PUBLIC eventqGetHandler
        FUNCTION eventqGetHandler,0203H
        PUBLIC eventqInit
        FUNCTION eventqInit,0203H
        PUBLIC eventqPut
        FUNCTION eventqPut,0203H
        LOCFRAME CSTACK, 4, STACK
        PUBLIC eventqRegisterHandler
        FUNCTION eventqRegisterHandler,0203H
        PUBLIC eventqUrgentPut
        FUNCTION eventqUrgentPut,0203H
        LOCFRAME CSTACK, 8, 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
        
boardSetBusyLed     SYMBOL "boardSetBusyLed"
boardSetBusyLed??rA SYMBOL "??rA", boardSetBusyLed
eventqGet           SYMBOL "eventqGet"
eventqGet??rA       SYMBOL "??rA", eventqGet

        EXTERN boardSetBusyLed
        FUNCTION boardSetBusyLed,0202H


        RSEG DATA_Z:DATA:SORT:NOROOT(2)
maxEvents:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
maxUrgentEvents:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
eventsDropped:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
urgentEventsDropped:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
bogusEvents:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
eventQueue:
        DS8 64

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
urgentEventQueue:
        DS8 16

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
eventFuncs:
        DS8 48

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
qHead:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
qTail:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
qSize:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
qUrgentHead:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
qUrgentTail:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
qUrgentSize:
        DS8 4

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function eventqGet
   CODE32      
eventqGet:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   MVN         R3,#+0x0
   MOV         R0,R3
   LDR         R12,??eventqGet_0  ;; qUrgentSize
   LDR         R1,[R12, #+0]
   CMP         R1,#+0x1
   BLT         ??eventqGet_1
   LDR         R2,??eventqGet_0+4  ;; qUrgentTail
   LDR         R3,[R2, #+0]
   LDR         R12,??eventqGet_0+8  ;; urgentEventQueue
   LDRB        R1,[R3, +R12]
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,R1
   LDR         R2,??eventqGet_0+4  ;; qUrgentTail
   LDR         R3,[R2, #+0]
   CMP         R3,#+0xF
   BNE         ??eventqGet_2
   MOV         R1,#+0x0
   LDR         R12,??eventqGet_0+4  ;; qUrgentTail
   STR         R1,[R12, #+0]
   B           ??eventqGet_3
??eventqGet_2:
   LDR         R1,??eventqGet_0+4  ;; qUrgentTail
   LDR         R1,[R1, #+0]
   LDR         R2,??eventqGet_0+4  ;; qUrgentTail
   LDR         R3,??eventqGet_0+4  ;; qUrgentTail
   LDR         R12,[R3, #+0]
   ADDS        R3,R12,#+0x1
   STR         R3,[R2, #+0]
??eventqGet_3:
   _BLF        ??DiI_a,??rA??DiI_a
   LDR         R1,??eventqGet_0   ;; qUrgentSize
   LDR         R2,??eventqGet_0   ;; qUrgentSize
   LDR         R12,[R2, #+0]
   SUBS        R3,R12,#+0x1
   STR         R3,[R1, #+0]
   _BLF        ??EnI_a,??rA??EnI_a
   B           ??eventqGet_4
??eventqGet_1:
   LDR         LR,??eventqGet_0+12  ;; qSize
   LDR         R1,[LR, #+0]
   CMP         R1,#+0x1
   BLT         ??eventqGet_5
   LDR         R2,??eventqGet_0+16  ;; qTail
   LDR         R12,[R2, #+0]
   LDR         R3,??eventqGet_0+20  ;; eventQueue
   LDRB        LR,[R12, +R3]
   ANDS        LR,LR,#+0xFF       ;; Zero extend
   MOV         R0,LR
   LDR         R1,??eventqGet_0+16  ;; qTail
   LDR         R2,[R1, #+0]
   CMP         R2,#+0x3F
   BNE         ??eventqGet_6
   MOV         R2,#+0x0
   LDR         R12,??eventqGet_0+16  ;; qTail
   STR         R2,[R12, #+0]
   B           ??eventqGet_7
??eventqGet_6:
   LDR         R3,??eventqGet_0+16  ;; qTail
   LDR         R2,[R3, #+0]
   LDR         LR,??eventqGet_0+16  ;; qTail
   LDR         R1,??eventqGet_0+16  ;; qTail
   LDR         R12,[R1, #+0]
   ADDS        R3,R12,#+0x1
   STR         R3,[LR, #+0]
??eventqGet_7:
   _BLF        ??DiI_a,??rA??DiI_a
   LDR         R2,??eventqGet_0+12  ;; qSize
   LDR         LR,??eventqGet_0+12  ;; qSize
   LDR         R1,[LR, #+0]
   SUBS        R12,R1,#+0x1
   STR         R12,[R2, #+0]
   _BLF        ??EnI_a,??rA??EnI_a
   B           ??eventqGet_4
??eventqGet_5:
   B           ??eventqGet_8
??eventqGet_4:
??eventqGet_8:
   LDMIA       SP!,{PC}           ;; return
   DATA        
??eventqGet_0:
   DC32        qUrgentSize
   DC32        qUrgentTail
   DC32        urgentEventQueue
   DC32        qSize
   DC32        qTail
   DC32        eventQueue
        CFI EndBlock cfiBlock0

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function eventqInit
   CODE32      
eventqInit:
   MOV         R0,#+0x0
   MOV         R1,R0
??eventqInit_0:
   CMP         R1,#+0xC
   BGE         ??eventqInit_1
   MOV         R2,#+0x4
   LDR         R3,??DataTable8    ;; eventFuncs
   MLAS        R12,R2,R1,R3
   MOV         R0,#+0x0
   STR         R0,[R12, #+0]
   ADDS        R1,R1,#+0x1
   B           ??eventqInit_0
??eventqInit_1:
   MOV         R2,#+0x0
   MOV         R1,R2
??eventqInit_2:
   CMP         R1,#+0x40
   BGE         ??eventqInit_3
   LDR         R3,??DataTable3    ;; eventQueue
   MOV         R12,#+0x0
   STRB        R12,[R1, +R3]
   ADDS        R1,R1,#+0x1
   B           ??eventqInit_2
??eventqInit_3:
   MOV         R0,#+0x0
   MOV         R1,R0
??eventqInit_4:
   CMP         R1,#+0x10
   BGE         ??eventqInit_5
   LDR         R2,??DataTable4    ;; urgentEventQueue
   MOV         R3,#+0x0
   STRB        R3,[R1, +R2]
   ADDS        R1,R1,#+0x1
   B           ??eventqInit_4
??eventqInit_5:
   MOV         R0,#+0x0
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock1

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function eventqPut
   CODE32      
eventqPut:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   LDR         R2,??eventqPut_0   ;; qSize
   LDR         R3,[R2, #+0]
   CMP         R3,#+0x40
   BNE         ??eventqPut_1
   LDR         R12,??eventqPut_0+4  ;; eventsDropped
   LDR         R1,??eventqPut_0+4  ;; eventsDropped
   LDR         R2,[R1, #+0]
   ADDS        R3,R2,#+0x1
   STR         R3,[R12, #+0]
   B           ??eventqPut_2
??eventqPut_1:
   _BLF        ??DiI_a,??rA??DiI_a
   LDR         R12,??eventqPut_0+8  ;; qHead
   LDR         R1,[R12, #+0]
   LDR         R2,??DataTable3    ;; eventQueue
   MOV         R3,R0
   STRB        R3,[R1, +R2]
   LDR         LR,??eventqPut_0+8  ;; qHead
   LDR         R12,[LR, #+0]
   CMP         R12,#+0x3F
   BNE         ??eventqPut_3
   MOV         R1,#+0x0
   LDR         R2,??eventqPut_0+8  ;; qHead
   STR         R1,[R2, #+0]
   B           ??eventqPut_4
??eventqPut_3:
   LDR         R1,??eventqPut_0+8  ;; qHead
   LDR         R1,[R1, #+0]
   LDR         R3,??eventqPut_0+8  ;; qHead
   LDR         LR,??eventqPut_0+8  ;; qHead
   LDR         R12,[LR, #+0]
   ADDS        R2,R12,#+0x1
   STR         R2,[R3, #+0]
??eventqPut_4:
   LDR         R1,??eventqPut_0   ;; qSize
   LDR         R3,??eventqPut_0   ;; qSize
   LDR         LR,[R3, #+0]
   ADDS        R12,LR,#+0x1
   STR         R12,[R1, #+0]
   _BLF        ??EnI_a,??rA??EnI_a
   LDR         R2,??eventqPut_0+12  ;; maxEvents
   LDR         R1,[R2, #+0]
   LDR         R3,??eventqPut_0   ;; qSize
   LDR         LR,[R3, #+0]
   CMP         R1,LR
   BCS         ??eventqPut_2
   LDR         R12,??eventqPut_0+12  ;; maxEvents
   LDR         R2,??eventqPut_0   ;; qSize
   LDR         R1,[R2, #+0]
   STR         R1,[R12, #+0]
??eventqPut_2:
   LDMIA       SP!,{PC}           ;; return
   DATA        
??eventqPut_0:
   DC32        qSize
   DC32        eventsDropped
   DC32        qHead
   DC32        maxEvents
        CFI EndBlock cfiBlock2

        RSEG CODE:CODE:NOROOT(2)
   DATA        
??DataTable3:
   DC32        eventQueue

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock3 Using cfiCommon0
        CFI Function eventqUrgentPut
   CODE32      
eventqUrgentPut:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   MOV         R4,R0
   LDR         R1,??eventqUrgentPut_0  ;; qUrgentSize
   LDR         R2,[R1, #+0]
   CMP         R2,#+0x10
   BNE         ??eventqUrgentPut_1
   MOV         R0,R4
   BL          eventqPut
   LDR         R3,??eventqUrgentPut_0+4  ;; urgentEventsDropped
   LDR         R12,??eventqUrgentPut_0+4  ;; urgentEventsDropped
   LDR         LR,[R12, #+0]
   ADDS        R0,LR,#+0x1
   STR         R0,[R3, #+0]
   B           ??eventqUrgentPut_2
??eventqUrgentPut_1:
   _BLF        ??DiI_a,??rA??DiI_a
   LDR         R1,??eventqUrgentPut_0+8  ;; qUrgentHead
   LDR         R2,[R1, #+0]
   LDR         R3,??DataTable4    ;; urgentEventQueue
   MOV         R12,R4
   STRB        R12,[R2, +R3]
   LDR         LR,??eventqUrgentPut_0+8  ;; qUrgentHead
   LDR         R0,[LR, #+0]
   CMP         R0,#+0xF
   BNE         ??eventqUrgentPut_3
   MOV         R0,#+0x0
   LDR         R1,??eventqUrgentPut_0+8  ;; qUrgentHead
   STR         R0,[R1, #+0]
   B           ??eventqUrgentPut_4
??eventqUrgentPut_3:
   LDR         R2,??eventqUrgentPut_0+8  ;; qUrgentHead
   LDR         R0,[R2, #+0]
   LDR         R3,??eventqUrgentPut_0+8  ;; qUrgentHead
   LDR         R12,??eventqUrgentPut_0+8  ;; qUrgentHead
   LDR         LR,[R12, #+0]
   ADDS        R1,LR,#+0x1
   STR         R1,[R3, #+0]
??eventqUrgentPut_4:
   LDR         R0,??eventqUrgentPut_0  ;; qUrgentSize
   LDR         R2,??eventqUrgentPut_0  ;; qUrgentSize
   LDR         R3,[R2, #+0]
   ADDS        R12,R3,#+0x1
   STR         R12,[R0, #+0]
   _BLF        ??EnI_a,??rA??EnI_a
   LDR         LR,??eventqUrgentPut_0+12  ;; maxUrgentEvents
   LDR         R1,[LR, #+0]
   LDR         R0,??eventqUrgentPut_0  ;; qUrgentSize
   LDR         R2,[R0, #+0]
   CMP         R1,R2
   BCS         ??eventqUrgentPut_2
   LDR         R3,??eventqUrgentPut_0+12  ;; maxUrgentEvents
   LDR         R12,??eventqUrgentPut_0  ;; qUrgentSize
   LDR         LR,[R12, #+0]
   STR         LR,[R3, #+0]
??eventqUrgentPut_2:
   LDMIA       SP!,{R4,PC}        ;; return
   DATA        
??eventqUrgentPut_0:
   DC32        qUrgentSize
   DC32        urgentEventsDropped
   DC32        qUrgentHead
   DC32        maxUrgentEvents
        CFI EndBlock cfiBlock3

        RSEG CODE:CODE:NOROOT(2)
   DATA        
??DataTable4:
   DC32        urgentEventQueue

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock4 Using cfiCommon0
        CFI Function eventqRegisterHandler
   CODE32      
eventqRegisterHandler:
   MOV         R2,R0
   CMP         R2,#+0x0
   BLT         ??eventqRegisterHandler_0
   CMP         R2,#+0xC
   BLT         ??eventqRegisterHandler_1
??eventqRegisterHandler_0:
   MVN         R0,#+0x0
   B           ??eventqRegisterHandler_2
??eventqRegisterHandler_1:
   MOV         R0,#+0x4
   LDR         R3,??DataTable8    ;; eventFuncs
   MLAS        R12,R0,R2,R3
   STR         R1,[R12, #+0]
   MOV         R0,#+0x0
??eventqRegisterHandler_2:
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock4

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock5 Using cfiCommon0
        CFI Function eventqGetHandler
   CODE32      
eventqGetHandler:
   MOV         R2,R0
   CMP         R2,#+0x0
   BLT         ??eventqGetHandler_0
   CMP         R2,#+0xC
   BLT         ??eventqGetHandler_1
??eventqGetHandler_0:
   MVN         R0,#+0x0
   B           ??eventqGetHandler_2
??eventqGetHandler_1:
   CMP         R1,#+0x0
   BNE         ??eventqGetHandler_3
   MVN         R0,#+0x0
   B           ??eventqGetHandler_2
??eventqGetHandler_3:
   MOV         R0,#+0x4
   LDR         R3,??DataTable8    ;; eventFuncs
   MLAS        R12,R0,R2,R3
   LDR         R0,[R12, #+0]
   STR         R0,[R1, #+0]
   MOV         R0,#+0x0
??eventqGetHandler_2:
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock5

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock6 Using cfiCommon0
        CFI Function eventqDispatch
   CODE32      
eventqDispatch:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   _BLF        eventqGet,eventqGet??rA
   MOV         R4,R0
??eventqDispatch_0:
   CMN         R4,#+0x1
   BEQ         ??eventqDispatch_1
   MOV         R0,#+0x1
   _BLF        boardSetBusyLed,boardSetBusyLed??rA
   CMP         R4,#+0x0
   BLT         ??eventqDispatch_2
   CMP         R4,#+0xC
   BGE         ??eventqDispatch_2
   MOV         R0,#+0x4
   LDR         R1,??DataTable8    ;; eventFuncs
   MLAS        R2,R0,R4,R1
   LDR         R3,[R2, #+0]
   CMP         R3,#+0x0
   BEQ         ??eventqDispatch_3
   MOV         R12,#+0x4
   LDR         LR,??DataTable8    ;; eventFuncs
   MLAS        R0,R12,R4,LR
   LDR         R1,[R0, #+0]
   MOV         LR,PC
   MOV         PC,R1
   B           ??eventqDispatch_3
??eventqDispatch_2:
   LDR         R2,??eventqDispatch_4  ;; bogusEvents
   LDR         R3,??eventqDispatch_4  ;; bogusEvents
   LDR         R12,[R3, #+0]
   ADDS        LR,R12,#+0x1
   STR         LR,[R2, #+0]
??eventqDispatch_3:
   _BLF        eventqGet,eventqGet??rA
   MOV         R4,R0
   B           ??eventqDispatch_0
??eventqDispatch_1:
   MOV         R0,#+0x0
   _BLF        boardSetBusyLed,boardSetBusyLed??rA
   LDMIA       SP!,{R4,PC}        ;; return
   DATA        
??eventqDispatch_4:
   DC32        bogusEvents
        CFI EndBlock cfiBlock6

        RSEG CODE:CODE:NOROOT(2)
   DATA        
??DataTable8:
   DC32        eventFuncs

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock7 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 cfiBlock7

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock8 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 cfiBlock8

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

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

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

        END
// 
// 1 196 bytes in segment CODE
//   172 bytes in segment DATA_Z
//    12 bytes in segment INITTAB
// 
// 840 bytes of CODE memory (+ 368 bytes shared)
// 172 bytes of DATA memory
//
//Errors: none
//Warnings: none
