Subversion Repositories svnkaklik

Rev

Rev 410 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download

GAS LISTING /tmp/cc0XjEMJ.s                     page 1


   1                            .file   "FrameMgr.c"
   2                    __SREG__ = 0x3f
   3                    __SP_H__ = 0x3e
   4                    __SP_L__ = 0x3d
   5                    __tmp_reg__ = 0
   6                    __zero_reg__ = 1
   7                            .global __do_copy_data
   8                            .global __do_clear_bss
   9                            .stabs  "/home/kaklik/projects/programy/C/avr/AVRcam/",100,0,2,.Ltext0
  10                            .stabs  "FrameMgr.c",100,0,2,.Ltext0
  11                            .text
  12                    .Ltext0:
  13                            .stabs  "gcc2_compiled.",60,0,0,0
  14                            .stabs  "int:t(0,1)=r(0,1);-32768;32767;",128,0,0,0
  15                            .stabs  "char:t(0,2)=@s8;r(0,2);0;255;",128,0,0,0
  16                            .stabs  "long int:t(0,3)=@s32;r(0,3);020000000000;017777777777;",128,0,0,0
  17                            .stabs  "unsigned int:t(0,4)=r(0,4);0;0177777;",128,0,0,0
  18                            .stabs  "long unsigned int:t(0,5)=@s32;r(0,5);0;037777777777;",128,0,0,0
  19                            .stabs  "long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;",128,0,0,
  20                            .stabs  "long long unsigned int:t(0,7)=@s64;r(0,7);0;01777777777777777777777;",128,0,0,0
  21                            .stabs  "short int:t(0,8)=r(0,8);-32768;32767;",128,0,0,0
  22                            .stabs  "short unsigned int:t(0,9)=r(0,9);0;0177777;",128,0,0,0
  23                            .stabs  "signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,0
  24                            .stabs  "unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,0
  25                            .stabs  "float:t(0,12)=r(0,1);4;0;",128,0,0,0
  26                            .stabs  "double:t(0,13)=r(0,1);4;0;",128,0,0,0
  27                            .stabs  "long double:t(0,14)=r(0,1);4;0;",128,0,0,0
  28                            .stabs  "void:t(0,15)=(0,15)",128,0,0,0
  29                            .stabs  "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/stdlib.h",130,0,0,0
  30                            .stabs  "/usr/lib/gcc/avr/4.2.1/include/stddef.h",130,0,0,0
  31                            .stabs  "size_t:t(2,1)=(0,4)",128,0,214,0
  32                            .stabs  "wchar_t:t(2,2)=(0,1)",128,0,326,0
  33                            .stabn  162,0,0,0
  34                            .stabs  "div_t:t(1,1)=(1,2)=s4quot:(0,1),0,16;rem:(0,1),16,16;;",128,0,69,0
  35                            .stabs  "ldiv_t:t(1,3)=(1,4)=s8quot:(0,3),0,32;rem:(0,3),32,32;;",128,0,75,0
  36                            .stabs  "__compar_fn_t:t(1,5)=(1,6)=*(1,7)=f(0,1)",128,0,78,0
  37                            .stabn  162,0,0,0
  38                            .stabs  "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/avr/io.h",130,0,0,0
  39                            .stabs  "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/avr/sfr_defs.h",130,0,0,0
  40                            .stabs  "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/inttypes.h",130,0,0,0
  41                            .stabs  "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/stdint.h",130,0,0,0
  42                            .stabs  "int8_t:t(6,1)=(0,10)",128,0,116,0
  43                            .stabs  "uint8_t:t(6,2)=(0,11)",128,0,117,0
  44                            .stabs  "int16_t:t(6,3)=(0,1)",128,0,118,0
  45                            .stabs  "uint16_t:t(6,4)=(0,4)",128,0,119,0
  46                            .stabs  "int32_t:t(6,5)=(0,3)",128,0,120,0
  47                            .stabs  "uint32_t:t(6,6)=(0,5)",128,0,121,0
  48                            .stabs  "int64_t:t(6,7)=(0,6)",128,0,122,0
  49                            .stabs  "uint64_t:t(6,8)=(0,7)",128,0,123,0
  50                            .stabs  "intptr_t:t(6,9)=(6,3)",128,0,135,0
  51                            .stabs  "uintptr_t:t(6,10)=(6,4)",128,0,140,0
  52                            .stabs  "int_least8_t:t(6,11)=(6,1)",128,0,152,0
  53                            .stabs  "uint_least8_t:t(6,12)=(6,2)",128,0,157,0
  54                            .stabs  "int_least16_t:t(6,13)=(6,3)",128,0,162,0
  55                            .stabs  "uint_least16_t:t(6,14)=(6,4)",128,0,167,0
  56                            .stabs  "int_least32_t:t(6,15)=(6,5)",128,0,172,0
  57                            .stabs  "uint_least32_t:t(6,16)=(6,6)",128,0,177,0
GAS LISTING /tmp/cc0XjEMJ.s                    page 2


  58                            .stabs  "int_least64_t:t(6,17)=(6,7)",128,0,182,0
  59                            .stabs  "uint_least64_t:t(6,18)=(6,8)",128,0,187,0
  60                            .stabs  "int_fast8_t:t(6,19)=(6,1)",128,0,200,0
  61                            .stabs  "uint_fast8_t:t(6,20)=(6,2)",128,0,205,0
  62                            .stabs  "int_fast16_t:t(6,21)=(6,3)",128,0,210,0
  63                            .stabs  "uint_fast16_t:t(6,22)=(6,4)",128,0,215,0
  64                            .stabs  "int_fast32_t:t(6,23)=(6,5)",128,0,220,0
  65                            .stabs  "uint_fast32_t:t(6,24)=(6,6)",128,0,225,0
  66                            .stabs  "int_fast64_t:t(6,25)=(6,7)",128,0,230,0
  67                            .stabs  "uint_fast64_t:t(6,26)=(6,8)",128,0,235,0
  68                            .stabs  "intmax_t:t(6,27)=(6,7)",128,0,249,0
  69                            .stabs  "uintmax_t:t(6,28)=(6,8)",128,0,254,0
  70                            .stabn  162,0,0,0
  71                            .stabs  "int_farptr_t:t(5,1)=(6,5)",128,0,76,0
  72                            .stabs  "uint_farptr_t:t(5,2)=(6,6)",128,0,80,0
  73                            .stabn  162,0,0,0
  74                            .stabn  162,0,0,0
  75                            .stabn  162,0,0,0
  76                            .stabs  "I2CInterface.h",130,0,0,0
  77                            .stabs  "CommonDefs.h",130,0,0,0
  78                            .stabs  "bool_t:t(8,1)=(0,11)",128,0,56,0
  79                            .stabn  162,0,0,0
  80                            .stabs  "i2cCmd_t:t(7,1)=(7,2)=s2configReg:(0,11),0,8;data:(0,11),8,8;;",128,0,53,0
  81                            .stabn  162,0,0,0
  82                            .stabs  " :T(0,16)=@s8;eST_FrameMgr_idle:0,ST_FrameMgr_TrackingFrame:1,ST_FrameMgr_DumpingFrame:2,;
  83                            .stabs  "FrameMgr_State_t:t(0,17)=(0,11)",128,0,72,0
  84                            .stabs  " :T(0,18)=@s8;enotTracked:0,color1:1,color2:2,color3:3,color4:4,color5:5,color6:6,color7:7
  85                            .stabs  "trackedColor_t:t(0,19)=(0,11)",128,0,127,0
  86                            .stabs  "trackedObject_t:t(0,20)=(0,21)=s8color:(0,19),0,8;lastLineXStart:(0,11),8,8;lastLineXFinis
  87                            .stabs  "FrameMgr_processFrame:F(0,15)",36,0,517,FrameMgr_processFrame
  88                    .global FrameMgr_processFrame
  89                            .type   FrameMgr_processFrame, @function
  90                    FrameMgr_processFrame:
  91                            .stabd  46,0,0
   1:FrameMgr.c    **** /*
   2:FrameMgr.c    ****     Copyright (C) 2004    John Orlando
   3:FrameMgr.c    ****     
   4:FrameMgr.c    ****    AVRcam: a small real-time image processing engine.
   5:FrameMgr.c    **** 
   6:FrameMgr.c    ****     This program is free software; you can redistribute it and/or
   7:FrameMgr.c    ****     modify it under the terms of the GNU General Public
   8:FrameMgr.c    ****     License as published by the Free Software Foundation; either
   9:FrameMgr.c    ****     version 2 of the License, or (at your option) any later version.
  10:FrameMgr.c    **** 
  11:FrameMgr.c    ****     This program is distributed in the hope that it will be useful,
  12:FrameMgr.c    ****     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13:FrameMgr.c    ****     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14:FrameMgr.c    ****     General Public License for more details.
  15:FrameMgr.c    **** 
  16:FrameMgr.c    ****     You should have received a copy of the GNU General Public
  17:FrameMgr.c    ****     License along with this program; if not, write to the Free Software
  18:FrameMgr.c    ****     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19:FrameMgr.c    **** 
  20:FrameMgr.c    ****    For more information on the AVRcam, please contact:
  21:FrameMgr.c    **** 
  22:FrameMgr.c    ****    john@jrobot.net
  23:FrameMgr.c    **** 
GAS LISTING /tmp/cc0XjEMJ.s                    page 3


  24:FrameMgr.c    ****    or go to www.jrobot.net for more details regarding the system.
  25:FrameMgr.c    **** */
  26:FrameMgr.c    **** /*********************************************************
  27:FrameMgr.c    ****         Module Name: FrameMgr.c
  28:FrameMgr.c    ****         Module Date: 04/10/2004
  29:FrameMgr.c    ****         Module Auth: John Orlando
  30:FrameMgr.c    ****         
  31:FrameMgr.c    ****         Description: This modules is responsible for performing
  32:FrameMgr.c    ****         both medium and high level processing on image data.
  33:FrameMgr.c    ****         This is performed at both the line level as well as
  34:FrameMgr.c    ****         the frame level.  It controls the main flow of the
  35:FrameMgr.c    ****         system, adhering to all the critical timing 
  36:FrameMgr.c    ****         requirements (such as when serial data can be transferred,
  37:FrameMgr.c    ****         etc).
  38:FrameMgr.c    ****     
  39:FrameMgr.c    ****     Revision History:
  40:FrameMgr.c    ****     Date        Rel Ver.    Notes
  41:FrameMgr.c    ****     4/10/2004      0.1     Module created
  42:FrameMgr.c    ****     6/30/2004      1.0     Initial release for Circuit Cellar
  43:FrameMgr.c    ****                            contest.
  44:FrameMgr.c    ****     11/15/2004     1.2     Updated processLine() function so 
  45:FrameMgr.c    ****                            it will remove objects less than
  46:FrameMgr.c    ****                            a specified length/width (reduces
  47:FrameMgr.c    ****                            shot noise)
  48:FrameMgr.c    **** *********************************************************/
  49:FrameMgr.c    **** 
  50:FrameMgr.c    **** /*      Includes */
  51:FrameMgr.c    **** #include <stdlib.h>
  52:FrameMgr.c    **** #include <string.h>
  53:FrameMgr.c    **** #include <avr/io.h>
  54:FrameMgr.c    **** #include "Executive.h"
  55:FrameMgr.c    **** #include "UIMgr.h"
  56:FrameMgr.c    **** #include "FrameMgr.h"
  57:FrameMgr.c    **** #include "CamInterface.h"
  58:FrameMgr.c    **** #include "UartInterface.h"
  59:FrameMgr.c    **** #include "Utility.h"
  60:FrameMgr.c    **** #include "I2CInterface.h"
  61:FrameMgr.c    **** #include "CamConfig.h"
  62:FrameMgr.c    **** #include "CommonDefs.h"
  63:FrameMgr.c    **** 
  64:FrameMgr.c    **** /*      Local Structures and Typedefs */
  65:FrameMgr.c    **** enum
  66:FrameMgr.c    **** {
  67:FrameMgr.c    ****         ST_FrameMgr_idle,
  68:FrameMgr.c    ****         ST_FrameMgr_TrackingFrame,
  69:FrameMgr.c    ****         ST_FrameMgr_DumpingFrame
  70:FrameMgr.c    **** };
  71:FrameMgr.c    **** 
  72:FrameMgr.c    **** typedef unsigned char FrameMgr_State_t;
  73:FrameMgr.c    **** 
  74:FrameMgr.c    **** /*  Definitions */
  75:FrameMgr.c    **** /* The most objects that can be tracked at any one time is 8.  
  76:FrameMgr.c    **** This number is determined by the number of bytes that can be
  77:FrameMgr.c    **** sent out during a frame (one byte per line, 144 lines per frame) 
  78:FrameMgr.c    **** with the number of bytes in a tracked object (7) + some wiggle
  79:FrameMgr.c    **** room :-) ... I guess this could be increased to around 20 if
  80:FrameMgr.c    **** we had enough room and cycles to process objects between lines */
GAS LISTING /tmp/cc0XjEMJ.s                    page 4


  81:FrameMgr.c    **** #define MAX_TRACKED_OBJECTS     8
  82:FrameMgr.c    **** 
  83:FrameMgr.c    **** /* This defines the number of bytes that make up a trackedObject_t
  84:FrameMgr.c    **** structure... */
  85:FrameMgr.c    **** #define SIZE_OF_TRACKED_OBJECT 8
  86:FrameMgr.c    **** 
  87:FrameMgr.c    **** /* This define is used to turn off the timer overflow interrupt
  88:FrameMgr.c    **** that is generated when the PCLK overflows TIMER1 */
  89:FrameMgr.c    **** #define DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK 0xFB
  90:FrameMgr.c    **** 
  91:FrameMgr.c    **** /* This define is used to determine if a run length is too small
  92:FrameMgr.c    **** to be concerned with.  This helps to reduce the number of false
  93:FrameMgr.c    **** positives. */
  94:FrameMgr.c    **** #define MIN_OBJECT_TRACKING_WIDTH 3
  95:FrameMgr.c    **** 
  96:FrameMgr.c    **** /* This define is used to determine if an object has enough
  97:FrameMgr.c    **** height to be considered worth tracking...it is used to reduce
  98:FrameMgr.c    **** shot noise */
  99:FrameMgr.c    **** #define MIN_OBJECT_TRACKING_HEIGHT 3
 100:FrameMgr.c    **** 
 101:FrameMgr.c    **** /* This define is used to indicate how often the filter routine
 102:FrameMgr.c    **** that removes objects less than MIN_OBJECT_TRACKING_HEIGHT should
 103:FrameMgr.c    **** be executed.  It is measured in a number of lines (7 nominally). */
 104:FrameMgr.c    **** #define RUN_OBJECT_FILTER_MASK 0x07
 105:FrameMgr.c    **** 
 106:FrameMgr.c    **** /* This enum describes the possible colors that can
 107:FrameMgr.c    **** be tracked by the system.  This can't be represented as
 108:FrameMgr.c    **** simple color names (red, brown, etc) due to the fact that
 109:FrameMgr.c    **** the user sets which colors will be associated with which
 110:FrameMgr.c    **** bits.  Remember...after the AND operation of the indexed
 111:FrameMgr.c    **** color map values executes, either a single bit indicating
 112:FrameMgr.c    **** the color should be set, or no bits indicating that the
 113:FrameMgr.c    **** color isn't represented in the color map (notTracked). */
 114:FrameMgr.c    **** enum
 115:FrameMgr.c    **** {
 116:FrameMgr.c    ****         notTracked,
 117:FrameMgr.c    ****         color1,         /* bit 1 color */
 118:FrameMgr.c    ****         color2,         /* bit 2 color */
 119:FrameMgr.c    ****         color3,         /* bit 3 color */
 120:FrameMgr.c    ****         color4,         /* bit 4 color */
 121:FrameMgr.c    ****         color5,         /* bit 5 color */
 122:FrameMgr.c    ****         color6,         /* bit 6 color */
 123:FrameMgr.c    ****         color7,         /* bit 7 color */
 124:FrameMgr.c    ****         color8          /* bit 8 color */
 125:FrameMgr.c    **** };
 126:FrameMgr.c    **** 
 127:FrameMgr.c    **** typedef unsigned char trackedColor_t;
 128:FrameMgr.c    **** 
 129:FrameMgr.c    **** /* This structure defines the info that needs to be
 130:FrameMgr.c    **** maintained for each trackedObject in the trackingTable */
 131:FrameMgr.c    **** typedef struct
 132:FrameMgr.c    **** {
 133:FrameMgr.c    ****         trackedColor_t  color;
 134:FrameMgr.c    ****         unsigned char lastLineXStart;
 135:FrameMgr.c    ****         unsigned char lastLineXFinish;
 136:FrameMgr.c    ****         unsigned char x_upperLeft;
 137:FrameMgr.c    ****         unsigned char y_upperLeft;
GAS LISTING /tmp/cc0XjEMJ.s                    page 5


 138:FrameMgr.c    ****         unsigned char x_lowerRight;
 139:FrameMgr.c    ****         unsigned char y_lowerRight;
 140:FrameMgr.c    ****         unsigned char objectValid;  /* used to be a fill byte...now it is
 141:FrameMgr.c    ****                                      used to determine if the object is valid
 142:FrameMgr.c    ****                                      or not...it gets invalidated if it is
 143:FrameMgr.c    ****                                      determined that it is too small, or
 144:FrameMgr.c    ****                                      that the object is within another object */
 145:FrameMgr.c    **** } trackedObject_t;
 146:FrameMgr.c    **** 
 147:FrameMgr.c    **** /* These defines are used to index into each individual element in the
 148:FrameMgr.c    **** trackedObject_t structure.  This seems to be MUCH more efficient than
 149:FrameMgr.c    **** accessing the elements in GCC. */
 150:FrameMgr.c    **** #define COLOR_OFFSET                0
 151:FrameMgr.c    **** #define LAST_LINE_X_START_OFFSET    1
 152:FrameMgr.c    **** #define LAST_LINE_X_FINISH_OFFSET   2
 153:FrameMgr.c    **** #define X_UPPER_LEFT_OFFSET         3
 154:FrameMgr.c    **** #define Y_UPPER_LEFT_OFFSET         4
 155:FrameMgr.c    **** #define X_LOWER_RIGHT_OFFSET        5
 156:FrameMgr.c    **** #define Y_LOWER_RIGHT_OFFSET        6
 157:FrameMgr.c    **** #define VALID_OBJECT_OFFSET         7
 158:FrameMgr.c    **** 
 159:FrameMgr.c    **** /*  Local Variables */
 160:FrameMgr.c    **** /* The trackedObjectTable is used to hold up to eight tracked objects
 161:FrameMgr.c    **** while they are being acquired. */
 162:FrameMgr.c    **** static trackedObject_t trackedObjectTable[MAX_TRACKED_OBJECTS];
 163:FrameMgr.c    **** static trackedObject_t *pCurrentTrackedObjectTable = trackedObjectTable;
 164:FrameMgr.c    **** static unsigned char lineCount = 0;
 165:FrameMgr.c    **** static FrameMgr_State_t currentState = ST_FrameMgr_idle;
 166:FrameMgr.c    **** static unsigned char numCurrTrackedObjects = 0;
 167:FrameMgr.c    **** static unsigned char numPrevTrackedObjects = 0;
 168:FrameMgr.c    **** static unsigned char trackedLineCount = 0;
 169:FrameMgr.c    **** 
 170:FrameMgr.c    **** /*  Local Functions  */
 171:FrameMgr.c    **** static void FrameMgr_findConnectedness(void);
 172:FrameMgr.c    **** 
 173:FrameMgr.c    **** /*  Extern Functions */
 174:FrameMgr.c    **** /* These functions are located in assembly files, and thus
 175:FrameMgr.c    **** must be externed here so they can be referenced in the source below. */
 176:FrameMgr.c    **** extern void CamIntAsm_waitForNewTrackingFrame(unsigned char *pBuffer, unsigned char *pMemLookup);
 177:FrameMgr.c    **** extern void CamIntAsm_waitForNewDumpFrame(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);
 178:FrameMgr.c    **** extern void CamIntAsm_acquireTrackingLine(unsigned char *pBuffer, unsigned char *pMemLookup);
 179:FrameMgr.c    **** extern void CamIntAsm_acquireDumpLine(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);
 180:FrameMgr.c    **** 
 181:FrameMgr.c    **** /***********************************************************
 182:FrameMgr.c    ****         Function Name: FrameMgr_init
 183:FrameMgr.c    ****         Function Description: This function is responsible
 184:FrameMgr.c    ****         for initializing the FrameMgr.  This includes 
 185:FrameMgr.c    ****         setting up the various buffers and data needed to 
 186:FrameMgr.c    ****         process each frame of image data.
 187:FrameMgr.c    ****         Inputs:  none
 188:FrameMgr.c    ****         Outputs: none
 189:FrameMgr.c    **** ***********************************************************/    
 190:FrameMgr.c    **** void FrameMgr_init(void)
 191:FrameMgr.c    **** {
 192:FrameMgr.c    ****         memset(trackedObjectTable,0x00,sizeof(trackedObjectTable));
 193:FrameMgr.c    **** }
 194:FrameMgr.c    **** 
GAS LISTING /tmp/cc0XjEMJ.s                    page 6


 195:FrameMgr.c    **** 
 196:FrameMgr.c    **** /***********************************************************
 197:FrameMgr.c    ****         Function Name: FrameMgr_dispatchEvent
 198:FrameMgr.c    ****         Function Description: This function is responsible for
 199:FrameMgr.c    ****         taking an incoming event and performing the needed
 200:FrameMgr.c    ****         actions with it as pertains to the FrameMgr.
 201:FrameMgr.c    ****         Inputs:  event - the generated event
 202:FrameMgr.c    ****         Outputs: none
 203:FrameMgr.c    **** ***********************************************************/    
 204:FrameMgr.c    **** void FrameMgr_dispatchEvent(unsigned char event)
 205:FrameMgr.c    **** {       
 206:FrameMgr.c    ****         switch(event)
 207:FrameMgr.c    ****         {
 208:FrameMgr.c    ****                 case EV_DUMP_FRAME:
 209:FrameMgr.c    ****             /* try re-initializing the camera before we start dumping */
 210:FrameMgr.c    ****             
 211:FrameMgr.c    ****                         CamConfig_setCamReg(0x11,0x01);  /* reduce the frame rate for dumping*/
 212:FrameMgr.c    ****                         CamConfig_sendFifoCmds();
 213:FrameMgr.c    ****                         Utility_delay(1000);            /* allow the new frame rate to settle */
 214:FrameMgr.c    ****                         lineCount = 0;
 215:FrameMgr.c    ****                         currentState = ST_FrameMgr_DumpingFrame;
 216:FrameMgr.c    ****                         //CamIntAsm_waitForNewDumpFrame(currentLineBuffer,previousLineBuffer);
 217:FrameMgr.c    ****             FrameMgr_acquireLine();
 218:FrameMgr.c    ****                         break;
 219:FrameMgr.c    ****                 
 220:FrameMgr.c    ****                 case EV_ENABLE_TRACKING:
 221:FrameMgr.c    ****                         currentState = ST_FrameMgr_TrackingFrame;                                       
 222:FrameMgr.c    ****                         FrameMgr_acquireFrame();
 223:FrameMgr.c    ****                         break;
 224:FrameMgr.c    ****                         
 225:FrameMgr.c    ****                 case EV_ACQUIRE_FRAME_COMPLETE:
 226:FrameMgr.c    ****                         FrameMgr_processFrame();
 227:FrameMgr.c    ****                         break;
 228:FrameMgr.c    ****                 
 229:FrameMgr.c    ****                 case EV_PROCESS_FRAME_COMPLETE:
 230:FrameMgr.c    ****                         FrameMgr_acquireFrame();
 231:FrameMgr.c    ****                         break;
 232:FrameMgr.c    **** 
 233:FrameMgr.c    ****                 case EV_SERIAL_DATA_RECEIVED:
 234:FrameMgr.c    ****                         if (currentState != ST_FrameMgr_idle)
 235:FrameMgr.c    ****                         {
 236:FrameMgr.c    ****                                 /* we need to go back to processing line data, since
 237:FrameMgr.c    ****                                 serial data reception interrupted us....just trash the
 238:FrameMgr.c    ****                                 frame and act like the frame has been processed, which
 239:FrameMgr.c    ****                                 will kick off the system to wait for the next line */
 240:FrameMgr.c    ****                                 PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);
 241:FrameMgr.c    ****                         }
 242:FrameMgr.c    ****                         break;
 243:FrameMgr.c    ****                         
 244:FrameMgr.c    ****                 case EV_DISABLE_TRACKING:
 245:FrameMgr.c    ****                         /* tracking needs to be turned off */
 246:FrameMgr.c    ****                         currentState = ST_FrameMgr_idle;
 247:FrameMgr.c    ****                         break;
 248:FrameMgr.c    ****         }
 249:FrameMgr.c    **** }
 250:FrameMgr.c    **** 
 251:FrameMgr.c    **** /***********************************************************
GAS LISTING /tmp/cc0XjEMJ.s                    page 7


 252:FrameMgr.c    ****         Function Name: FrameMgr_acquireFrame
 253:FrameMgr.c    ****         Function Description: This function is responsible for
 254:FrameMgr.c    ****         beginning of the acquisition of a new frame of data
 255:FrameMgr.c    ****         from the camera interface. The acquisition of this line 
 256:FrameMgr.c    ****         depends on the current state of the FrameMgr.
 257:FrameMgr.c    ****         Inputs:  none
 258:FrameMgr.c    ****         Outputs: none
 259:FrameMgr.c    **** ***********************************************************/    
 260:FrameMgr.c    **** void FrameMgr_acquireFrame(void)
 261:FrameMgr.c    **** {
 262:FrameMgr.c    ****         if (currentState == ST_FrameMgr_TrackingFrame)
 263:FrameMgr.c    ****         {
 264:FrameMgr.c    ****                 trackedLineCount = 0;
 265:FrameMgr.c    ****                 numPrevTrackedObjects = numCurrTrackedObjects;
 266:FrameMgr.c    ****                 numCurrTrackedObjects = 0;
 267:FrameMgr.c    ****                 
 268:FrameMgr.c    ****                 /* clear out the tracking table, and wait for the new frame
 269:FrameMgr.c    ****                 to start */
 270:FrameMgr.c    ****                 memset(trackedObjectTable,0x00,sizeof(trackedObjectTable));
 271:FrameMgr.c    ****                 //CamIntAsm_waitForNewTrackingFrame(currentLineBuffer,colorMap);
 272:FrameMgr.c    ****         WAIT_FOR_VSYNC_HIGH();
 273:FrameMgr.c    ****         CamIntAsm_acquireTrackingLine(currentLineBuffer,colorMap);
 274:FrameMgr.c    ****         }
 275:FrameMgr.c    **** }
 276:FrameMgr.c    **** 
 277:FrameMgr.c    **** /***********************************************************
 278:FrameMgr.c    ****         Function Name: FrameMgr_acquireLine
 279:FrameMgr.c    ****         Function Description: This function is responsible for
 280:FrameMgr.c    ****         acquiring a line of data from the camera interface.
 281:FrameMgr.c    ****         The acquisition of this line depends on the current
 282:FrameMgr.c    ****         state of the FrameMgr.
 283:FrameMgr.c    ****         Inputs:  none
 284:FrameMgr.c    ****         Outputs: none
 285:FrameMgr.c    **** ***********************************************************/    
 286:FrameMgr.c    **** void FrameMgr_acquireLine(void)
 287:FrameMgr.c    **** {
 288:FrameMgr.c    ****         unsigned char tmpLineCount;
 289:FrameMgr.c    ****         
 290:FrameMgr.c    ****         /* clearing out the buffers takes too long...we should
 291:FrameMgr.c    ****         just overwrite the data here without a problem when
 292:FrameMgr.c    ****         we start acquiring...at no point do we check for 
 293:FrameMgr.c    ****         a 0x00 value in the current or previous lineBuffers,
 294:FrameMgr.c    ****         so it was a bit excessive :-)  */
 295:FrameMgr.c    ****         
 296:FrameMgr.c    ****         /* check which state we are in and proceed as needed */
 297:FrameMgr.c    ****         if (currentState == ST_FrameMgr_DumpingFrame)
 298:FrameMgr.c    ****         {
 299:FrameMgr.c    ****                 tmpLineCount = lineCount*2;
 300:FrameMgr.c    ****         
 301:FrameMgr.c    ****         /* clearing out the line data in dump mode is ok, and actually
 302:FrameMgr.c    ****         is needed, since it is possible for the first dump line in
 303:FrameMgr.c    ****         a frame to come back with the last line captured of the
 304:FrameMgr.c    ****         last capture session...*/
 305:FrameMgr.c    ****         memset(currentLineBuffer,0x00,LENGTH_OF_LINE_BUFFER);
 306:FrameMgr.c    ****         memset(previousLineBuffer,0x00,LENGTH_OF_LINE_BUFFER);
 307:FrameMgr.c    ****                 /* wait for another VSYNC so we know which frame to use 
 308:FrameMgr.c    ****                 to start looking for a line to receive */
GAS LISTING /tmp/cc0XjEMJ.s                    page 8


 309:FrameMgr.c    ****                 WAIT_FOR_VSYNC_HIGH();  
 310:FrameMgr.c    ****                 WAIT_FOR_VSYNC_LOW();
 311:FrameMgr.c    ****                 
 312:FrameMgr.c    ****                 /* look at lineCount to determine how many HREFs we should
 313:FrameMgr.c    ****                 wait before we start sampling */
 314:FrameMgr.c    ****                 while(tmpLineCount != 0)
 315:FrameMgr.c    ****                 {
 316:FrameMgr.c    ****                         WAIT_FOR_HREF_HIGH(); 
 317:FrameMgr.c    ****                         tmpLineCount--;
 318:FrameMgr.c    ****                         WAIT_FOR_HREF_LOW(); 
 319:FrameMgr.c    ****                 }
 320:FrameMgr.c    ****                 
 321:FrameMgr.c    ****                 /*  we should now be ready to sample our line...*/
 322:FrameMgr.c    ****                 CamIntAsm_acquireDumpLine(currentLineBuffer,previousLineBuffer);
 323:FrameMgr.c    ****         }               
 324:FrameMgr.c    ****         else if (currentState == ST_FrameMgr_TrackingFrame)
 325:FrameMgr.c    ****         {
 326:FrameMgr.c    ****                 WAIT_FOR_HREF_LOW();
 327:FrameMgr.c    ****                 CamIntAsm_acquireTrackingLine(currentLineBuffer,colorMap);
 328:FrameMgr.c    ****         }
 329:FrameMgr.c    **** }
 330:FrameMgr.c    **** 
 331:FrameMgr.c    **** /***********************************************************
 332:FrameMgr.c    ****         Function Name: FrameMgr_processLine
 333:FrameMgr.c    ****         Function Description: This function is responsible for
 334:FrameMgr.c    ****         parsing the received image line and performing either
 335:FrameMgr.c    ****         connected region mapping (if in the Tracking state) or
 336:FrameMgr.c    ****         sending out the raw sampled data (if in the Dumping
 337:FrameMgr.c    ****         state).
 338:FrameMgr.c    ****         Inputs:  none
 339:FrameMgr.c    ****         Outputs: none
 340:FrameMgr.c    **** ***********************************************************/    
 341:FrameMgr.c    **** void FrameMgr_processLine(void)
 342:FrameMgr.c    **** {
 343:FrameMgr.c    ****         unsigned char i;
 344:FrameMgr.c    ****         volatile unsigned char dataToSend;
 345:FrameMgr.c    ****         unsigned char *pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;
 346:FrameMgr.c    **** #ifdef DEBUG_TRACKED_LINE    
 347:FrameMgr.c    ****         unsigned char *pSendData;
 348:FrameMgr.c    ****     unsigned char asciiBuffer[5];
 349:FrameMgr.c    ****     unsigned char pixelCount = 0;
 350:FrameMgr.c    **** #endif    
 351:FrameMgr.c    ****         
 352:FrameMgr.c    ****         if (currentState == ST_FrameMgr_DumpingFrame)
 353:FrameMgr.c    ****         {
 354:FrameMgr.c    ****                 /* we want to sit in a tight loop and send the acquired data
 355:FrameMgr.c    ****                 sitting in current and previous line buffers out the serial
 356:FrameMgr.c    ****                 port...it is sent out the serial port immediately instead
 357:FrameMgr.c    ****                 of going into the UIMgr tx fifo because we can't do anything
 358:FrameMgr.c    ****                 until its sent out anyway...may as well just get it out now     */
 359:FrameMgr.c    ****                 
 360:FrameMgr.c    ****                 /* currentLineBuffer is getting "g" previousLineBuffer is getting "b-r" */
 361:FrameMgr.c    ****                 UartInt_txByte(0x0B);                   /* send the header byte */
 362:FrameMgr.c    ****                 UartInt_txByte(lineCount);              /* send the line count */
 363:FrameMgr.c    ****                 for (i=0; i<NUM_PIXELS_IN_A_DUMP_LINE; i+=2)
 364:FrameMgr.c    ****                 {
 365:FrameMgr.c    ****                         /* when a dump line is sampled, the upper byte can potentially
GAS LISTING /tmp/cc0XjEMJ.s                    page 9


 366:FrameMgr.c    ****                         have garbage in it...we don't have time to mask it off as we're
 367:FrameMgr.c    ****                         sampling, so it is done here before we send it out...we also
 368:FrameMgr.c    ****                         combine the samples together so we really are sending up a
 369:FrameMgr.c    ****                         sample for line N as well as line N+1 */
 370:FrameMgr.c    ****                         dataToSend = currentLineBuffer[i];
 371:FrameMgr.c    ****                         dataToSend &= 0x0F;
 372:FrameMgr.c    ****                         dataToSend <<= 4;
 373:FrameMgr.c    ****                         dataToSend |= (previousLineBuffer[i] & 0x0F);
 374:FrameMgr.c    ****                         
 375:FrameMgr.c    ****                         /* dataToSend should be packed now */
 376:FrameMgr.c    ****                         UartInt_txByte(dataToSend);
 377:FrameMgr.c    ****                         
 378:FrameMgr.c    ****                         /* flip the colors around since we are doing all G on Y and BR on UV */
 379:FrameMgr.c    ****                         dataToSend = previousLineBuffer[i+1];
 380:FrameMgr.c    ****                         dataToSend &= 0x0F;
 381:FrameMgr.c    ****                         dataToSend <<= 4;
 382:FrameMgr.c    ****                         dataToSend |= (currentLineBuffer[i+1] & 0x0F);
 383:FrameMgr.c    ****                         
 384:FrameMgr.c    ****                         /* dataToSend should be packed now */
 385:FrameMgr.c    ****                         UartInt_txByte(dataToSend);
 386:FrameMgr.c    ****                 }
 387:FrameMgr.c    ****                 UartInt_txByte(0x0F);  /* send line end */
 388:FrameMgr.c    ****                 /* once all the data is sent, increment out line count by 2 since
 389:FrameMgr.c    ****                 we really get 2 lines worth of pixels on each pass */
 390:FrameMgr.c    ****                 /* Update...increment only by 1, but only send 72 double-lines */
 391:FrameMgr.c    ****                 lineCount++;
 392:FrameMgr.c    ****                 
 393:FrameMgr.c    ****                 /* check to see if we have retrieved all of the needed lines */
 394:FrameMgr.c    ****                 if (lineCount >= 72)  /* half 144, since we send two lines at a time */
 395:FrameMgr.c    ****                 {
 396:FrameMgr.c    ****                         /* we're done, so send the dump complete?...nope, just change
 397:FrameMgr.c    ****                         states and we should be fine */
 398:FrameMgr.c    ****                         lineCount = 0;
 399:FrameMgr.c    ****                         currentState = ST_FrameMgr_idle;
 400:FrameMgr.c    ****                         
 401:FrameMgr.c    ****                         /* disable the PCLK counting overflow interrupt */
 402:FrameMgr.c    ****                         TIMSK &= DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK;
 403:FrameMgr.c    ****                         
 404:FrameMgr.c    ****                         CamConfig_setCamReg(0x11,0x00);  /* reset the frame rate to normal*/
 405:FrameMgr.c    ****                         CamConfig_sendFifoCmds();
 406:FrameMgr.c    ****                 }
 407:FrameMgr.c    ****                 else
 408:FrameMgr.c    ****                 {
 409:FrameMgr.c    ****                         /* we have more lines to acquire in this frame, so keep on truckin...*/
 410:FrameMgr.c    ****                         PUBLISH_FAST_EVENT(FEV_PROCESS_LINE_COMPLETE);
 411:FrameMgr.c    ****                 }
 412:FrameMgr.c    ****         }
 413:FrameMgr.c    ****         else if (currentState == ST_FrameMgr_TrackingFrame)
 414:FrameMgr.c    ****         {
 415:FrameMgr.c    **** #ifdef DEBUG_TRACKED_LINE       
 416:FrameMgr.c    ****                 /* send the received line over serial...this should only send
 417:FrameMgr.c    ****                 until a pixelCount == 176 */
 418:FrameMgr.c    ****                 pSendData = currentLineBuffer;
 419:FrameMgr.c    ****                 itoa(trackedLineCount,asciiBuffer,10);
 420:FrameMgr.c    ****                 UIMgr_txBuffer(asciiBuffer,3);
 421:FrameMgr.c    ****                 UIMgr_txBuffer(" ",1);
 422:FrameMgr.c    ****                 while(pixelCount < ACTUAL_NUM_PIXELS_IN_A_LINE)  
GAS LISTING /tmp/cc0XjEMJ.s                    page 10


 423:FrameMgr.c    ****                 {
 424:FrameMgr.c    ****                         memset(asciiBuffer,0x00,5);
 425:FrameMgr.c    ****                         itoa(*pSendData++,asciiBuffer,10);      /* color is first byte */
 426:FrameMgr.c    ****                         UIMgr_txBuffer(asciiBuffer,3); /* 3 ascii bytes for data */
 427:FrameMgr.c    ****                         UIMgr_txBuffer(" ",1);
 428:FrameMgr.c    **** 
 429:FrameMgr.c    ****                         pixelCount += *pSendData;       /* run-length is second byte */
 430:FrameMgr.c    ****                         memset(asciiBuffer,0x00,5);
 431:FrameMgr.c    ****                         itoa(*pSendData++,asciiBuffer,10);
 432:FrameMgr.c    ****                         UIMgr_txBuffer(asciiBuffer,3);
 433:FrameMgr.c    ****                         UIMgr_txBuffer(" ",1);
 434:FrameMgr.c    ****                 }
 435:FrameMgr.c    ****                 UIMgr_txBuffer("\n\r",2);
 436:FrameMgr.c    **** 
 437:FrameMgr.c    ****                 trackedLineCount++;
 438:FrameMgr.c    ****                 if (trackedLineCount == 144)
 439:FrameMgr.c    ****                 {
 440:FrameMgr.c    ****                         UIMgr_txBuffer("  FC  \n\r",8);
 441:FrameMgr.c    ****                         trackedLineCount = 0;
 442:FrameMgr.c    ****                         PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);
 443:FrameMgr.c    ****                 }
 444:FrameMgr.c    ****                 else
 445:FrameMgr.c    ****                 {
 446:FrameMgr.c    ****                         PUBLISH_EVENT(EV_PROCESS_LINE_COMPLETE);
 447:FrameMgr.c    ****                 }       
 448:FrameMgr.c    **** #else
 449:FrameMgr.c    ****         /* determine if any of the RLE blocks overlap */
 450:FrameMgr.c    ****                 FrameMgr_findConnectedness();
 451:FrameMgr.c    ****         
 452:FrameMgr.c    ****         /* we also want to remove any objects that are less than
 453:FrameMgr.c    ****         a minimum height...we already removed portions of the 
 454:FrameMgr.c    ****         run-length that are less than MIN_PIXEL_WIDTH in the
 455:FrameMgr.c    ****         findConnectedness() routine...doing it here instead of 
 456:FrameMgr.c    ****         a function to speed things up...this may end up slowing down the
 457:FrameMgr.c    ****         frame rate slightly, and can be removed if this isn't needed */
 458:FrameMgr.c    ****   
 459:FrameMgr.c    ****         /* run this routine once every 8 lines */       
 460:FrameMgr.c    ****         if ( (trackedLineCount & RUN_OBJECT_FILTER_MASK) == RUN_OBJECT_FILTER_MASK)
 461:FrameMgr.c    ****         {
 462:FrameMgr.c    ****             for (i=0; i<MAX_TRACKED_OBJECTS; i++)
 463:FrameMgr.c    ****             {
 464:FrameMgr.c    ****                 if ( *(pTrackedObjectData + VALID_OBJECT_OFFSET) == TRUE)
 465:FrameMgr.c    ****                 {
 466:FrameMgr.c    ****                     /* check to see if the object is already in
 467:FrameMgr.c    ****                     our past...i.e., its last */
 468:FrameMgr.c    ****                     if ( (*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) - 
 469:FrameMgr.c    ****                           *(pTrackedObjectData + Y_UPPER_LEFT_OFFSET)) < MIN_OBJECT_TRACKING_HEIGHT
 470:FrameMgr.c    ****                     {
 471:FrameMgr.c    ****                         /* the object is less than the minimum height...see if it is adjacent
 472:FrameMgr.c    ****                         to the current line we just processed...if so, leave it here...otherwise,
 473:FrameMgr.c    ****                         it needs to be invalidated since its too small */
 474:FrameMgr.c    ****                         if ( trackedLineCount - *(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) > 2)
 475:FrameMgr.c    ****                         {
 476:FrameMgr.c    ****                             /* invalidate the object */
 477:FrameMgr.c    ****                             *(pTrackedObjectData + VALID_OBJECT_OFFSET) = FALSE;
 478:FrameMgr.c    ****                             numCurrTrackedObjects--;
 479:FrameMgr.c    ****                         }
GAS LISTING /tmp/cc0XjEMJ.s                    page 11


 480:FrameMgr.c    ****                     }
 481:FrameMgr.c    ****                 }
 482:FrameMgr.c    ****                 pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
 483:FrameMgr.c    ****             }
 484:FrameMgr.c    ****         }     
 485:FrameMgr.c    ****  
 486:FrameMgr.c    ****                 trackedLineCount++;
 487:FrameMgr.c    ****                 if (trackedLineCount == ACTUAL_NUM_LINES_IN_A_FRAME)
 488:FrameMgr.c    ****                 {
 489:FrameMgr.c    ****                         /* an entire frame of tracking data has been acquired, so
 490:FrameMgr.c    ****                         publish an event letting the system know this fact */
 491:FrameMgr.c    ****                         PUBLISH_EVENT(EV_ACQUIRE_FRAME_COMPLETE);
 492:FrameMgr.c    ****                         /* disable the PCLK counting overflow interrupt */
 493:FrameMgr.c    ****                         TIMSK &= DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK;
 494:FrameMgr.c    ****                         trackedLineCount = 0;
 495:FrameMgr.c    ****                 }
 496:FrameMgr.c    ****                 else
 497:FrameMgr.c    ****                 {
 498:FrameMgr.c    ****                         PUBLISH_FAST_EVENT(FEV_PROCESS_LINE_COMPLETE);
 499:FrameMgr.c    ****                 }
 500:FrameMgr.c    **** #endif          
 501:FrameMgr.c    ****         }
 502:FrameMgr.c    ****         else
 503:FrameMgr.c    ****         {
 504:FrameMgr.c    ****                 /* ...and here? */
 505:FrameMgr.c    ****         }
 506:FrameMgr.c    **** }
 507:FrameMgr.c    **** 
 508:FrameMgr.c    **** /***********************************************************
 509:FrameMgr.c    ****         Function Name: FrameMgr_processFrame
 510:FrameMgr.c    ****         Function Description: This function is responsible for
 511:FrameMgr.c    ****         parsing the completed frame and performing all actions
 512:FrameMgr.c    ****         needed at this level.
 513:FrameMgr.c    ****         Inputs:  none
 514:FrameMgr.c    ****         Outputs: none
 515:FrameMgr.c    **** ***********************************************************/    
 516:FrameMgr.c    **** void FrameMgr_processFrame(void)
 517:FrameMgr.c    **** {
  92                            .stabn  68,0,517,.LM0-.LFBB1
  93                    .LM0:
  94                    .LFBB1:
  95                    /* prologue: frame size=0 */
  96 0000 DF92                  push r13
  97 0002 EF92                  push r14
  98 0004 FF92                  push r15
  99 0006 0F93                  push r16
 100 0008 1F93                  push r17
 101 000a CF93                  push r28
 102 000c DF93                  push r29
 103                    /* prologue end (size=7) */
 518:FrameMgr.c    ****         unsigned char i,k,color;
 519:FrameMgr.c    **** #if DEBUG_FRAME_DATA    
 520:FrameMgr.c    ****         unsigned char asciiBuffer[5];
 521:FrameMgr.c    ****     unsigned char j;
 522:FrameMgr.c    **** #endif    
 523:FrameMgr.c    ****         unsigned char *pTableData = (unsigned char *)pCurrentTrackedObjectTable;
 104                            .stabn  68,0,523,.LM1-.LFBB1
GAS LISTING /tmp/cc0XjEMJ.s                    page 12


 105                    .LM1:
 106 000e 2091 0000             lds r18,pCurrentTrackedObjectTable
 107 0012 3091 0000             lds r19,(pCurrentTrackedObjectTable)+1
 524:FrameMgr.c    ****         unsigned char tmpUpperLeftX,tmpUpperLeftY,tmpLowerRightX,tmpLowerRightY;
 525:FrameMgr.c    ****         
 526:FrameMgr.c    **** #if DEBUG_FRAME_DATA    
 527:FrameMgr.c    ****         /* we want to send all of the currently tracked table out
 528:FrameMgr.c    ****         the serial port for debugging */
 529:FrameMgr.c    ****         for (i=0; i<numCurrTrackedObjects; i++)
 530:FrameMgr.c    ****         {
 531:FrameMgr.c    ****                 UIMgr_txBuffer("----------\r\n",12);
 532:FrameMgr.c    ****                 for (j=0; j<SIZE_OF_TRACKED_OBJECT; j++)
 533:FrameMgr.c    ****                 {
 534:FrameMgr.c    ****                         memset(asciiBuffer,0x00,5);
 535:FrameMgr.c    ****                         itoa(*pTableData++,asciiBuffer,10);
 536:FrameMgr.c    ****                         UIMgr_txBuffer(asciiBuffer,3); /* 3 ascii bytes for data
 537:FrameMgr.c    ****                                                                                                                 + 1 space */
 538:FrameMgr.c    ****                         UIMgr_txBuffer("\r\n",2);
 539:FrameMgr.c    ****                 }
 540:FrameMgr.c    ****         }
 541:FrameMgr.c    ****         
 542:FrameMgr.c    ****         /* finally, send a new line */
 543:FrameMgr.c    ****         UIMgr_txBuffer("\r\n",2);
 544:FrameMgr.c    ****         
 545:FrameMgr.c    ****         memset(asciiBuffer,0x00,5);
 546:FrameMgr.c    ****         itoa(numCurrTrackedObjects,asciiBuffer,10);
 547:FrameMgr.c    ****         UIMgr_txBuffer(asciiBuffer,3);
 548:FrameMgr.c    ****         UIMgr_txBuffer(" PFC\r\n",5);
 549:FrameMgr.c    **** 
 550:FrameMgr.c    **** #else   
 551:FrameMgr.c    ****         /* we only send tracking packets if there are tracked objects */                
 552:FrameMgr.c    ****     
 553:FrameMgr.c    ****         if (numCurrTrackedObjects > 0)
 108                            .stabn  68,0,553,.LM2-.LFBB1
 109                    .LM2:
 110 0016 8091 0000             lds r24,numCurrTrackedObjects
 111 001a 8823                  tst r24
 112 001c 01F4                  brne .+2
 113 001e 00C0                  rjmp .L2
 114                            .stabn  68,0,523,.LM3-.LFBB1
 115                    .LM3:
 116 0020 E901                  movw r28,r18
 554:FrameMgr.c    ****         {               
 555:FrameMgr.c    ****                 UIMgr_writeTxFifo(0x0A);                                        /* header byte for a tracking packet */
 117                            .stabn  68,0,555,.LM4-.LFBB1
 118                    .LM4:
 119 0022 8AE0                  ldi r24,lo8(10)
 120 0024 00D0                  rcall UIMgr_writeTxFifo
 556:FrameMgr.c    ****         /* reset the pointer */
 557:FrameMgr.c    ****         pTableData = (unsigned char *)pCurrentTrackedObjectTable;
 558:FrameMgr.c    ****         
 559:FrameMgr.c    ****                 UIMgr_writeTxFifo(numCurrTrackedObjects);       /* num of objects tracked */
 121                            .stabn  68,0,559,.LM5-.LFBB1
 122                    .LM5:
 123 0026 8091 0000             lds r24,numCurrTrackedObjects
 124 002a 00D0                  rcall UIMgr_writeTxFifo
 125 002c DD24                  clr r13
GAS LISTING /tmp/cc0XjEMJ.s                    page 13


 126                    .L4:
 560:FrameMgr.c    ****                 for (i=0; i<MAX_TRACKED_OBJECTS; i++)
 561:FrameMgr.c    ****                 {
 562:FrameMgr.c    ****             /* we only want to process objects that have their objectValid flag
 563:FrameMgr.c    ****             set to TRUE */
 564:FrameMgr.c    ****             if ( *(pTableData + VALID_OBJECT_OFFSET) == TRUE)
 127                            .stabn  68,0,564,.LM6-.LFBB1
 128                    .LM6:
 129 002e 8F81                  ldd r24,Y+7
 130 0030 8130                  cpi r24,lo8(1)
 131 0032 01F4                  brne .L5
 565:FrameMgr.c    ****             {
 566:FrameMgr.c    ****                 /* the object is valid...convert the color from bit position to value...remember, 
 567:FrameMgr.c    ****                 each bit in the "color" byte corresponds to a color */
 568:FrameMgr.c    ****                 k=0;
 569:FrameMgr.c    ****                 color = *(pTableData + COLOR_OFFSET);
 132                            .stabn  68,0,569,.LM7-.LFBB1
 133                    .LM7:
 134 0034 8881                  ld r24,Y
 570:FrameMgr.c    ****                 if (color == 128) k=0;
 135                            .stabn  68,0,570,.LM8-.LFBB1
 136                    .LM8:
 137 0036 8038                  cpi r24,lo8(-128)
 138 0038 01F0                  breq .L7
 571:FrameMgr.c    ****                 else if (color == 64) k=1;
 139                            .stabn  68,0,571,.LM9-.LFBB1
 140                    .LM9:
 141 003a 8034                  cpi r24,lo8(64)
 142 003c 01F4                  brne .L9
 143 003e 81E0                  ldi r24,lo8(1)
 144 0040 00C0                  rjmp .L11
 145                    .L9:
 572:FrameMgr.c    ****                 else if (color == 32) k=2;
 146                            .stabn  68,0,572,.LM10-.LFBB1
 147                    .LM10:
 148 0042 8032                  cpi r24,lo8(32)
 149 0044 01F4                  brne .L12
 150 0046 82E0                  ldi r24,lo8(2)
 151 0048 00C0                  rjmp .L11
 152                    .L12:
 573:FrameMgr.c    ****                 else if (color == 16) k=3;
 153                            .stabn  68,0,573,.LM11-.LFBB1
 154                    .LM11:
 155 004a 8031                  cpi r24,lo8(16)
 156 004c 01F4                  brne .L14
 157 004e 83E0                  ldi r24,lo8(3)
 158 0050 00C0                  rjmp .L11
 159                    .L14:
 574:FrameMgr.c    ****                 else if (color == 8)  k=4;
 160                            .stabn  68,0,574,.LM12-.LFBB1
 161                    .LM12:
 162 0052 8830                  cpi r24,lo8(8)
 163 0054 01F4                  brne .L16
 164 0056 84E0                  ldi r24,lo8(4)
 165 0058 00C0                  rjmp .L11
 166                    .L16:
 575:FrameMgr.c    ****                 else if (color == 4)  k=5;
GAS LISTING /tmp/cc0XjEMJ.s                    page 14


 167                            .stabn  68,0,575,.LM13-.LFBB1
 168                    .LM13:
 169 005a 8430                  cpi r24,lo8(4)
 170 005c 01F4                  brne .L18
 171 005e 85E0                  ldi r24,lo8(5)
 172 0060 00C0                  rjmp .L11
 173                    .L18:
 576:FrameMgr.c    ****                 else if (color == 2)  k=6;
 174                            .stabn  68,0,576,.LM14-.LFBB1
 175                    .LM14:
 176 0062 8230                  cpi r24,lo8(2)
 177 0064 01F4                  brne .L20
 178 0066 86E0                  ldi r24,lo8(6)
 179 0068 00C0                  rjmp .L11
 180                    .L20:
 577:FrameMgr.c    ****                 else if (color == 1)  k=7;
 181                            .stabn  68,0,577,.LM15-.LFBB1
 182                    .LM15:
 183 006a 8130                  cpi r24,lo8(1)
 184 006c 01F4                  brne .L7
 185 006e 87E0                  ldi r24,lo8(7)
 186 0070 00C0                  rjmp .L11
 187                    .L7:
 188 0072 80E0                  ldi r24,lo8(0)
 189                    .L11:
 578:FrameMgr.c    ****                 
 579:FrameMgr.c    ****                 tmpUpperLeftX = *(pTableData + X_UPPER_LEFT_OFFSET);        /* get the upper left X */
 190                            .stabn  68,0,579,.LM16-.LFBB1
 191                    .LM16:
 192 0074 1B81                  ldd r17,Y+3
 580:FrameMgr.c    ****                 tmpUpperLeftY = *(pTableData + Y_UPPER_LEFT_OFFSET);            /* get the upper left Y */              
 193                            .stabn  68,0,580,.LM17-.LFBB1
 194                    .LM17:
 195 0076 0C81                  ldd r16,Y+4
 581:FrameMgr.c    ****                 tmpLowerRightX = *(pTableData + X_LOWER_RIGHT_OFFSET);          /* get the lower right X */
 196                            .stabn  68,0,581,.LM18-.LFBB1
 197                    .LM18:
 198 0078 FD80                  ldd r15,Y+5
 582:FrameMgr.c    ****                 tmpLowerRightY = *(pTableData + Y_LOWER_RIGHT_OFFSET);          /* get the lower right Y */
 199                            .stabn  68,0,582,.LM19-.LFBB1
 200                    .LM19:
 201 007a EE80                  ldd r14,Y+6
 583:FrameMgr.c    ****                 
 584:FrameMgr.c    ****                 UIMgr_writeTxFifo(k);                                   /* send the color first */
 202                            .stabn  68,0,584,.LM20-.LFBB1
 203                    .LM20:
 204 007c 00D0                  rcall UIMgr_writeTxFifo
 585:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpUpperLeftX);
 205                            .stabn  68,0,585,.LM21-.LFBB1
 206                    .LM21:
 207 007e 812F                  mov r24,r17
 208 0080 00D0                  rcall UIMgr_writeTxFifo
 586:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpUpperLeftY);
 209                            .stabn  68,0,586,.LM22-.LFBB1
 210                    .LM22:
 211 0082 802F                  mov r24,r16
 212 0084 00D0                  rcall UIMgr_writeTxFifo
GAS LISTING /tmp/cc0XjEMJ.s                    page 15


 587:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpLowerRightX);
 213                            .stabn  68,0,587,.LM23-.LFBB1
 214                    .LM23:
 215 0086 8F2D                  mov r24,r15
 216 0088 00D0                  rcall UIMgr_writeTxFifo
 588:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpLowerRightY);                      
 217                            .stabn  68,0,588,.LM24-.LFBB1
 218                    .LM24:
 219 008a 8E2D                  mov r24,r14
 220 008c 00D0                  rcall UIMgr_writeTxFifo
 221                    .L5:
 222                            .stabn  68,0,560,.LM25-.LFBB1
 223                    .LM25:
 224 008e D394                  inc r13
 225 0090 88E0                  ldi r24,lo8(8)
 226 0092 D816                  cp r13,r24
 227 0094 01F0                  breq .L23
 589:FrameMgr.c    ****             }
 590:FrameMgr.c    **** 
 591:FrameMgr.c    ****             /* move our pointer up to the beginning of the next object */
 592:FrameMgr.c    ****             pTableData += SIZE_OF_TRACKED_OBJECT;
 228                            .stabn  68,0,592,.LM26-.LFBB1
 229                    .LM26:
 230 0096 2896                  adiw r28,8
 231 0098 00C0                  rjmp .L4
 232                    .L23:
 593:FrameMgr.c    ****         }
 594:FrameMgr.c    ****                 
 595:FrameMgr.c    ****                 /* all done...send the end of tracking packets char */
 596:FrameMgr.c    ****                 UIMgr_writeTxFifo(0xFF);
 233                            .stabn  68,0,596,.LM27-.LFBB1
 234                    .LM27:
 235 009a 8FEF                  ldi r24,lo8(-1)
 236 009c 00D0                  rcall UIMgr_writeTxFifo
 237                    .L2:
 597:FrameMgr.c    ****         }       
 598:FrameMgr.c    **** #endif  
 599:FrameMgr.c    **** 
 600:FrameMgr.c    ****     /* the tracked object table will be cleared out right before we start
 601:FrameMgr.c    ****     to wait for VSYNC to indicate a new frame...so it doesn't need to be
 602:FrameMgr.c    ****     done now */
 603:FrameMgr.c    ****     
 604:FrameMgr.c    ****         /* schedule the next action to acquire a new frame */   
 605:FrameMgr.c    ****         PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);
 238                            .stabn  68,0,605,.LM28-.LFBB1
 239                    .LM28:
 240 009e 84E0                  ldi r24,lo8(4)
 241 00a0 00D0                  rcall Exec_writeEventFifo
 242                    /* epilogue: frame size=0 */
 243 00a2 DF91                  pop r29
 244 00a4 CF91                  pop r28
 245 00a6 1F91                  pop r17
 246 00a8 0F91                  pop r16
 247 00aa FF90                  pop r15
 248 00ac EF90                  pop r14
 249 00ae DF90                  pop r13
 250 00b0 0895                  ret
GAS LISTING /tmp/cc0XjEMJ.s                    page 16


 251                    /* epilogue end (size=8) */
 252                    /* function FrameMgr_processFrame size 88 (73) */
 253                            .size   FrameMgr_processFrame, .-FrameMgr_processFrame
 254                            .stabs  "i:r(0,11)",64,0,518,13
 255                            .stabs  "k:r(0,11)",64,0,518,24
 256                            .stabs  "color:r(0,11)",64,0,518,24
 257                            .stabs  "pTableData:r(0,22)=*(0,11)",64,0,523,28
 258                            .stabs  "tmpUpperLeftX:r(0,11)",64,0,524,17
 259                            .stabs  "tmpUpperLeftY:r(0,11)",64,0,524,16
 260                            .stabs  "tmpLowerRightX:r(0,11)",64,0,524,15
 261                            .stabs  "tmpLowerRightY:r(0,11)",64,0,524,14
 262                            .stabn  192,0,0,.LFBB1-.LFBB1
 263                            .stabn  224,0,0,.Lscope1-.LFBB1
 264                    .Lscope1:
 265                            .stabs  "",36,0,0,.Lscope1-.LFBB1
 266                            .stabd  78,0,0
 267                            .stabs  "FrameMgr_processLine:F(0,15)",36,0,342,FrameMgr_processLine
 268                    .global FrameMgr_processLine
 269                            .type   FrameMgr_processLine, @function
 270                    FrameMgr_processLine:
 271                            .stabd  46,0,0
 272                            .stabn  68,0,342,.LM29-.LFBB2
 273                    .LM29:
 274                    .LFBB2:
 275                    /* prologue: frame size=1 */
 276 00b2 2F92                  push r2
 277 00b4 3F92                  push r3
 278 00b6 4F92                  push r4
 279 00b8 5F92                  push r5
 280 00ba 6F92                  push r6
 281 00bc 7F92                  push r7
 282 00be 8F92                  push r8
 283 00c0 9F92                  push r9
 284 00c2 BF92                  push r11
 285 00c4 CF92                  push r12
 286 00c6 DF92                  push r13
 287 00c8 EF92                  push r14
 288 00ca FF92                  push r15
 289 00cc 0F93                  push r16
 290 00ce 1F93                  push r17
 291 00d0 CF93                  push r28
 292 00d2 DF93                  push r29
 293 00d4 CDB7                  in r28,__SP_L__
 294 00d6 DEB7                  in r29,__SP_H__
 295 00d8 2197                  sbiw r28,1
 296 00da 0FB6                  in __tmp_reg__,__SREG__
 297 00dc F894                  cli
 298 00de DEBF                  out __SP_H__,r29
 299 00e0 0FBE                  out __SREG__,__tmp_reg__
 300 00e2 CDBF                  out __SP_L__,r28
 301                    /* prologue end (size=25) */
 302                            .stabn  68,0,345,.LM30-.LFBB2
 303                    .LM30:
 304 00e4 4091 0000             lds r20,pCurrentTrackedObjectTable
 305 00e8 5091 0000             lds r21,(pCurrentTrackedObjectTable)+1
 306                            .stabn  68,0,352,.LM31-.LFBB2
 307                    .LM31:
GAS LISTING /tmp/cc0XjEMJ.s                    page 17


 308 00ec 8091 0000             lds r24,currentState
 309 00f0 8230                  cpi r24,lo8(2)
 310 00f2 01F0                  breq .+2
 311 00f4 00C0                  rjmp .L27
 312                            .stabn  68,0,361,.LM32-.LFBB2
 313                    .LM32:
 314 00f6 8BE0                  ldi r24,lo8(11)
 315 00f8 00D0                  rcall UartInt_txByte
 316                            .stabn  68,0,362,.LM33-.LFBB2
 317                    .LM33:
 318 00fa 8091 0000             lds r24,lineCount
 319 00fe 00D0                  rcall UartInt_txByte
 320 0100 00E0                  ldi r16,lo8(currentLineBuffer)
 321 0102 10E0                  ldi r17,hi8(currentLineBuffer)
 322 0104 0F2E                  mov __tmp_reg__,r31
 323 0106 F0E0                  ldi r31,lo8(previousLineBuffer)
 324 0108 EF2E                  mov r14,r31
 325 010a F0E0                  ldi r31,hi8(previousLineBuffer)
 326 010c FF2E                  mov r15,r31
 327 010e F02D                  mov r31,__tmp_reg__
 328                            .stabn  68,0,363,.LM34-.LFBB2
 329                    .LM34:
 330 0110 0F2E                  mov __tmp_reg__,r31
 331 0112 F0E0                  ldi r31,lo8(currentLineBuffer+176)
 332 0114 CF2E                  mov r12,r31
 333 0116 F0E0                  ldi r31,hi8(currentLineBuffer+176)
 334 0118 DF2E                  mov r13,r31
 335 011a F02D                  mov r31,__tmp_reg__
 336                    .L29:
 337                            .stabn  68,0,370,.LM35-.LFBB2
 338                    .LM35:
 339 011c D801                  movw r26,r16
 340 011e 8C91                  ld r24,X
 341 0120 8983                  std Y+1,r24
 342                            .stabn  68,0,371,.LM36-.LFBB2
 343                    .LM36:
 344 0122 8981                  ldd r24,Y+1
 345 0124 8F70                  andi r24,lo8(15)
 346 0126 8983                  std Y+1,r24
 347                            .stabn  68,0,372,.LM37-.LFBB2
 348                    .LM37:
 349 0128 8981                  ldd r24,Y+1
 350 012a 8295                  swap r24
 351 012c 807F                  andi r24,0xf0
 352 012e 8983                  std Y+1,r24
 353                            .stabn  68,0,373,.LM38-.LFBB2
 354                    .LM38:
 355 0130 9981                  ldd r25,Y+1
 356 0132 F701                  movw r30,r14
 357 0134 8081                  ld r24,Z
 358 0136 8F70                  andi r24,lo8(15)
 359 0138 892B                  or r24,r25
 360 013a 8983                  std Y+1,r24
 361                            .stabn  68,0,376,.LM39-.LFBB2
 362                    .LM39:
 363 013c 8981                  ldd r24,Y+1
 364 013e 00D0                  rcall UartInt_txByte
GAS LISTING /tmp/cc0XjEMJ.s                    page 18


 365                            .stabn  68,0,379,.LM40-.LFBB2
 366                    .LM40:
 367 0140 F701                  movw r30,r14
 368 0142 8181                  ldd r24,Z+1
 369 0144 8983                  std Y+1,r24
 370                            .stabn  68,0,380,.LM41-.LFBB2
 371                    .LM41:
 372 0146 8981                  ldd r24,Y+1
 373 0148 8F70                  andi r24,lo8(15)
 374 014a 8983                  std Y+1,r24
 375                            .stabn  68,0,381,.LM42-.LFBB2
 376                    .LM42:
 377 014c 8981                  ldd r24,Y+1
 378 014e 8295                  swap r24
 379 0150 807F                  andi r24,0xf0
 380 0152 8983                  std Y+1,r24
 381                            .stabn  68,0,382,.LM43-.LFBB2
 382                    .LM43:
 383 0154 9981                  ldd r25,Y+1
 384 0156 F801                  movw r30,r16
 385 0158 8181                  ldd r24,Z+1
 386 015a 8F70                  andi r24,lo8(15)
 387 015c 892B                  or r24,r25
 388 015e 8983                  std Y+1,r24
 389                            .stabn  68,0,385,.LM44-.LFBB2
 390                    .LM44:
 391 0160 8981                  ldd r24,Y+1
 392 0162 00D0                  rcall UartInt_txByte
 393 0164 0E5F                  subi r16,lo8(-(2))
 394 0166 1F4F                  sbci r17,hi8(-(2))
 395 0168 82E0                  ldi r24,lo8(2)
 396 016a 90E0                  ldi r25,hi8(2)
 397 016c E80E                  add r14,r24
 398 016e F91E                  adc r15,r25
 399                            .stabn  68,0,363,.LM45-.LFBB2
 400                    .LM45:
 401 0170 0C15                  cp r16,r12
 402 0172 1D05                  cpc r17,r13
 403 0174 01F4                  brne .L29
 404                            .stabn  68,0,387,.LM46-.LFBB2
 405                    .LM46:
 406 0176 8FE0                  ldi r24,lo8(15)
 407 0178 00D0                  rcall UartInt_txByte
 408                            .stabn  68,0,391,.LM47-.LFBB2
 409                    .LM47:
 410 017a 8091 0000             lds r24,lineCount
 411 017e 8F5F                  subi r24,lo8(-(1))
 412 0180 8093 0000             sts lineCount,r24
 413                            .stabn  68,0,394,.LM48-.LFBB2
 414                    .LM48:
 415 0184 8834                  cpi r24,lo8(72)
 416 0186 00F0                  brlo .L31
 417                            .stabn  68,0,398,.LM49-.LFBB2
 418                    .LM49:
 419 0188 1092 0000             sts lineCount,__zero_reg__
 420                            .stabn  68,0,399,.LM50-.LFBB2
 421                    .LM50:
GAS LISTING /tmp/cc0XjEMJ.s                    page 19


 422 018c 1092 0000             sts currentState,__zero_reg__
 423                            .stabn  68,0,402,.LM51-.LFBB2
 424                    .LM51:
 425 0190 89B7                  in r24,89-0x20
 426 0192 8B7F                  andi r24,lo8(-5)
 427 0194 89BF                  out 89-0x20,r24
 428                            .stabn  68,0,404,.LM52-.LFBB2
 429                    .LM52:
 430 0196 60E0                  ldi r22,lo8(0)
 431 0198 81E1                  ldi r24,lo8(17)
 432 019a 00D0                  rcall CamConfig_setCamReg
 433                            .stabn  68,0,405,.LM53-.LFBB2
 434                    .LM53:
 435 019c 00D0                  rcall CamConfig_sendFifoCmds
 436 019e 00C0                  rjmp .L72
 437                    .L31:
 438                            .stabn  68,0,410,.LM54-.LFBB2
 439                    .LM54:
 440 01a0 8091 0000             lds r24,fastEventBitmask
 441 01a4 8260                  ori r24,lo8(2)
 442 01a6 8093 0000             sts fastEventBitmask,r24
 443 01aa 00C0                  rjmp .L72
 444                    .L27:
 445                            .stabn  68,0,413,.LM55-.LFBB2
 446                    .LM55:
 447 01ac 8130                  cpi r24,lo8(1)
 448 01ae 01F0                  breq .+2
 449 01b0 00C0                  rjmp .L72
 450                    .LBB4:
 451                    .LBB5:
 606:FrameMgr.c    **** }
 607:FrameMgr.c    **** 
 608:FrameMgr.c    **** /***********************************************************
 609:FrameMgr.c    ****         Function Name: FrameMgr_findConnectedness
 610:FrameMgr.c    ****         Function Description: This function is responsible for
 611:FrameMgr.c    ****         finding the connectedness between two particular run-
 612:FrameMgr.c    ****         length encoded lines of pixel data.  It updates the
 613:FrameMgr.c    ****         trackingTable as needed.
 614:FrameMgr.c    ****         Inputs:  none
 615:FrameMgr.c    ****         Outputs: none
 616:FrameMgr.c    **** ***********************************************************/    
 617:FrameMgr.c    **** static void FrameMgr_findConnectedness(void)
 618:FrameMgr.c    **** {
 619:FrameMgr.c    ****         trackedColor_t currColor;
 620:FrameMgr.c    ****         unsigned char *pCurrLineColorInfo = currentLineBuffer;
 621:FrameMgr.c    ****         unsigned char *pTrackedObjectData;
 622:FrameMgr.c    ****         register unsigned char currPixelRunStart=0;
 623:FrameMgr.c    ****         register unsigned char currPixelRunFinish=0; 
 624:FrameMgr.c    ****         register unsigned char lastLineXStart=0;
 625:FrameMgr.c    ****         register unsigned char lastLineXFinish=0;  
 626:FrameMgr.c    ****         register unsigned char runLength=1;
 627:FrameMgr.c    ****         unsigned char i;
 628:FrameMgr.c    ****         bool_t colorConnected;  
 629:FrameMgr.c    ****         
 630:FrameMgr.c    ****         do
 631:FrameMgr.c    ****         {
 632:FrameMgr.c    ****                 /* grab both the current color and the number of pixels
GAS LISTING /tmp/cc0XjEMJ.s                    page 20


 633:FrameMgr.c    ****                 in the run...remember, pixels start at 1, not 0! */
 634:FrameMgr.c    ****                 colorConnected = FALSE;
 635:FrameMgr.c    ****                 currColor = *pCurrLineColorInfo++;
 636:FrameMgr.c    ****                 currPixelRunStart += runLength;
 637:FrameMgr.c    ****                 runLength = *pCurrLineColorInfo++;
 638:FrameMgr.c    ****                 currPixelRunFinish += runLength;
 639:FrameMgr.c    ****       
 640:FrameMgr.c    ****         /* make sure that the run-length is at least as wide as
 641:FrameMgr.c    ****         the minimum horizontal tracking width, and we care about the color */ 
 642:FrameMgr.c    ****         
 643:FrameMgr.c    ****                 if ( (currColor != notTracked) && (runLength > MIN_OBJECT_TRACKING_WIDTH) )
 644:FrameMgr.c    ****                 {                       
 645:FrameMgr.c    ****             /* this run contains a color we care about, so 
 646:FrameMgr.c    ****                         either it will begin a new tracked object, or it
 647:FrameMgr.c    ****                         is connected to a currently tracked object...
 648:FrameMgr.c    ****                         compare it with each object in the tracking
 649:FrameMgr.c    ****                         table...we can't just look at the numTrackedObjects because
 650:FrameMgr.c    ****             it is entirely possible that the first couple of objects could
 651:FrameMgr.c    ****             be invalid...
 652:FrameMgr.c    **** 
 653:FrameMgr.c    ****             NOTE: Instead of accessing each element in the trackedObjectTable
 654:FrameMgr.c    ****             through the 'i' index, and then accessing the fields in each structure,
 655:FrameMgr.c    ****             a pointer to each entry is established each time through the loop, followed
 656:FrameMgr.c    ****             by accessing the elements through specified offsets.  GCC seems to be
 657:FrameMgr.c    ****             able to optimize this code much better than simply accessing the elements
 658:FrameMgr.c    ****             of each structure in the array the more normal way...*/
 659:FrameMgr.c    ****             
 660:FrameMgr.c    ****             pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;
 661:FrameMgr.c    ****                         for (i=0; i<MAX_TRACKED_OBJECTS; i++)
 662:FrameMgr.c    ****                         {
 663:FrameMgr.c    ****                                 if ( (currColor == *(pTrackedObjectData + COLOR_OFFSET)) && 
 452                            .stabn  68,0,663,.LM56-.LFBB2
 453                    .LM56:
 454 01b2 B090 0000             lds r11,trackedLineCount
 455 01b6 EB2C                  mov r14,r11
 456 01b8 FF24                  clr r15
 457 01ba 3701                  movw r6,r14
 458 01bc 0894                  sec
 459 01be 6108                  sbc r6,__zero_reg__
 460 01c0 7108                  sbc r7,__zero_reg__
 461 01c2 0091 0000             lds r16,numCurrTrackedObjects
 462 01c6 10E0                  ldi r17,lo8(0)
 463 01c8 60E0                  ldi r22,lo8(0)
 464 01ca 71E0                  ldi r23,lo8(1)
 465 01cc 0F2E                  mov __tmp_reg__,r31
 466 01ce F0E0                  ldi r31,lo8(currentLineBuffer)
 467 01d0 2F2E                  mov r2,r31
 468 01d2 F0E0                  ldi r31,hi8(currentLineBuffer)
 469 01d4 3F2E                  mov r3,r31
 470 01d6 F02D                  mov r31,__tmp_reg__
 471                    .L35:
 472                            .stabn  68,0,635,.LM57-.LFBB2
 473                    .LM57:
 474 01d8 D101                  movw r26,r2
 475 01da 3C91                  ld r19,X
 476                            .stabn  68,0,636,.LM58-.LFBB2
 477                    .LM58:
GAS LISTING /tmp/cc0XjEMJ.s                    page 21


 478 01dc 170F                  add r17,r23
 479                            .stabn  68,0,637,.LM59-.LFBB2
 480                    .LM59:
 481 01de F101                  movw r30,r2
 482 01e0 7181                  ldd r23,Z+1
 483 01e2 82E0                  ldi r24,lo8(2)
 484 01e4 90E0                  ldi r25,hi8(2)
 485 01e6 280E                  add r2,r24
 486 01e8 391E                  adc r3,r25
 487                            .stabn  68,0,638,.LM60-.LFBB2
 488                    .LM60:
 489 01ea 670F                  add r22,r23
 490                            .stabn  68,0,643,.LM61-.LFBB2
 491                    .LM61:
 492 01ec 3323                  tst r19
 493 01ee 01F4                  brne .+2
 494 01f0 00C0                  rjmp .L36
 495 01f2 7430                  cpi r23,lo8(4)
 496 01f4 00F4                  brsh .+2
 497 01f6 00C0                  rjmp .L36
 498 01f8 FA01                  movw r30,r20
 499 01fa 20E0                  ldi r18,lo8(0)
 500                    .L39:
 501                            .stabn  68,0,663,.LM62-.LFBB2
 502                    .LM62:
 503 01fc 8081                  ld r24,Z
 504 01fe 8317                  cp r24,r19
 505 0200 01F4                  brne .L40
 506 0202 8781                  ldd r24,Z+7
 507 0204 8130                  cpi r24,lo8(1)
 508 0206 01F4                  brne .L40
 509 0208 0F2E                  mov __tmp_reg__,r31
 510 020a F6E0                  ldi r31,lo8(6)
 511 020c CF2E                  mov r12,r31
 512 020e DD24                  clr r13
 513 0210 F02D                  mov r31,__tmp_reg__
 514 0212 CE0E                  add r12,r30
 515 0214 DF1E                  adc r13,r31
 516 0216 8681                  ldd r24,Z+6
 517 0218 9927                  clr r25
 518 021a 8615                  cp r24,r6
 519 021c 9705                  cpc r25,r7
 520 021e 01F4                  brne .L40
 521 0220 2F01                  movw r4,r30
 522 0222 0894                  sec
 523 0224 411C                  adc r4,__zero_reg__
 524 0226 511C                  adc r5,__zero_reg__
 664:FrameMgr.c    ****                      (*(pTrackedObjectData + VALID_OBJECT_OFFSET) == TRUE) &&
 665:FrameMgr.c    ****                      (*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) == trackedLineCount - 1) )
 666:FrameMgr.c    ****                                 {
 667:FrameMgr.c    ****                                         /* found a color match and the object is valid...check to see if there is
 668:FrameMgr.c    ****                                         connectedness */
 669:FrameMgr.c    ****                                         lastLineXStart = *(pTrackedObjectData + LAST_LINE_X_START_OFFSET);
 525                            .stabn  68,0,669,.LM63-.LFBB2
 526                    .LM63:
 527 0228 8181                  ldd r24,Z+1
 528 022a 8824                  clr r8
GAS LISTING /tmp/cc0XjEMJ.s                    page 22


 529 022c 9924                  clr r9
 530 022e 6894                  set
 531 0230 81F8                  bld r8,1
 532 0232 8E0E                  add r8,r30
 533 0234 9F1E                  adc r9,r31
 670:FrameMgr.c    ****                                         lastLineXFinish = *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET);
 534                            .stabn  68,0,670,.LM64-.LFBB2
 535                    .LM64:
 536 0236 9281                  ldd r25,Z+2
 671:FrameMgr.c    ****                                         
 672:FrameMgr.c    ****                                         /* Check for the 5 following types of line connectedness:
 673:FrameMgr.c    ****                                         ---------------------
 674:FrameMgr.c    ****                                         |                   |
 675:FrameMgr.c    ****                                         ---------------------
 676:FrameMgr.c    ****                                                  -------------------------
 677:FrameMgr.c    ****                                                          |                       |
 678:FrameMgr.c    ****                                                          -------------------------  */
 679:FrameMgr.c    ****                                         if ( (  (currPixelRunStart >= lastLineXStart) &&
 537                            .stabn  68,0,679,.LM65-.LFBB2
 538                    .LM65:
 539 0238 1817                  cp r17,r24
 540 023a 00F0                  brlo .L44
 541 023c 9117                  cp r25,r17
 542 023e 00F4                  brsh .L46
 543                    .L44:
 544 0240 6817                  cp r22,r24
 545 0242 00F0                  brlo .L47
 546 0244 9617                  cp r25,r22
 547 0246 00F4                  brsh .L46
 548                    .L47:
 549 0248 8117                  cp r24,r17
 550 024a 00F0                  brlo .L40
 551 024c 6917                  cp r22,r25
 552 024e 00F0                  brlo .L40
 553                    .L46:
 680:FrameMgr.c    ****                                                         (currPixelRunStart <= lastLineXFinish) )  ||
 681:FrameMgr.c    ****                                                         
 682:FrameMgr.c    ****                                         /*               ---------------------
 683:FrameMgr.c    ****                                                          |                   |
 684:FrameMgr.c    ****                                                                          ---------------------
 685:FrameMgr.c    ****                                                 -------------------
 686:FrameMgr.c    ****                                                 |                 |
 687:FrameMgr.c    ****                                                 -------------------  
 688:FrameMgr.c    ****                                                                    OR
 689:FrameMgr.c    ****                                                      ------------------------------
 690:FrameMgr.c    ****                                                          |                            |
 691:FrameMgr.c    ****                                                          ------------------------------
 692:FrameMgr.c    ****                                                                       ---------
 693:FrameMgr.c    ****                                                                                   |       |
 694:FrameMgr.c    ****                                                                                   ---------  */
 695:FrameMgr.c    ****                                                  (      (currPixelRunFinish >= lastLineXStart) && 
 696:FrameMgr.c    ****                                                         (currPixelRunFinish <= lastLineXFinish) ) ||
 697:FrameMgr.c    ****                                                         
 698:FrameMgr.c    ****                                                         
 699:FrameMgr.c    ****                                         /*     -------------------------------
 700:FrameMgr.c    ****                                                |                             |
 701:FrameMgr.c    ****                                                    -------------------------------
GAS LISTING /tmp/cc0XjEMJ.s                    page 23


 702:FrameMgr.c    ****                                                    -------------------------------
 703:FrameMgr.c    ****                                                    |                             |
 704:FrameMgr.c    ****                                                    -------------------------------
 705:FrameMgr.c    ****                                                                   OR
 706:FrameMgr.c    ****                                                                      -------------
 707:FrameMgr.c    ****                                                                          |           |
 708:FrameMgr.c    ****                                                                          -------------
 709:FrameMgr.c    ****                                                         -------------------------------
 710:FrameMgr.c    ****                                                         |                             |
 711:FrameMgr.c    ****                                                         -------------------------------   */
 712:FrameMgr.c    ****                                                  (  (currPixelRunStart <= lastLineXStart) &&
 713:FrameMgr.c    ****                                                         (currPixelRunFinish >= lastLineXFinish) ) )
 714:FrameMgr.c    ****                                         {
 715:FrameMgr.c    ****                                                 /* THERE IS CONNECTEDNESS...update the lastLineXStart and lastLineXFinish
 716:FrameMgr.c    ****                                                 data pointed to by pTrackedObjectData */
 717:FrameMgr.c    ****                                                 *(pTrackedObjectData + LAST_LINE_X_START_OFFSET) = currPixelRunStart;
 554                            .stabn  68,0,717,.LM66-.LFBB2
 555                    .LM66:
 556 0250 D201                  movw r26,r4
 557 0252 1C93                  st X,r17
 718:FrameMgr.c    ****                                                 *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET) = currPixelRunFinish;
 558                            .stabn  68,0,718,.LM67-.LFBB2
 559                    .LM67:
 560 0254 D401                  movw r26,r8
 561 0256 6C93                  st X,r22
 719:FrameMgr.c    ****                                                 
 720:FrameMgr.c    ****                                                 /* check if the bounding box needs to be updated */
 721:FrameMgr.c    ****                                                 if (*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) > currPixelRunStart)
 562                            .stabn  68,0,721,.LM68-.LFBB2
 563                    .LM68:
 564 0258 8381                  ldd r24,Z+3
 565 025a 1817                  cp r17,r24
 566 025c 00F4                  brsh .L50
 722:FrameMgr.c    ****                                                 {
 723:FrameMgr.c    ****                                                         /* need to update the bounding box for the upper left point to 
 724:FrameMgr.c    ****                                                         enclose this new left-most point...we never have to update the
 725:FrameMgr.c    ****                                                         upper left Y point, since each scan line we process moves from
 726:FrameMgr.c    ****                                                         top to bottom */
 727:FrameMgr.c    ****                                                         *(pTrackedObjectData + X_UPPER_LEFT_OFFSET) = currPixelRunStart;
 567                            .stabn  68,0,727,.LM69-.LFBB2
 568                    .LM69:
 569 025e 1383                  std Z+3,r17
 570                    .L50:
 728:FrameMgr.c    ****                                                 }
 729:FrameMgr.c    **** 
 730:FrameMgr.c    ****                                                 if ( *(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) < currPixelRunFinish)
 571                            .stabn  68,0,730,.LM70-.LFBB2
 572                    .LM70:
 573 0260 8581                  ldd r24,Z+5
 574 0262 8617                  cp r24,r22
 575 0264 00F4                  brsh .L52
 731:FrameMgr.c    ****                                                 {
 732:FrameMgr.c    ****                                                         /* need to update the bounding box for the lower right X point to
 733:FrameMgr.c    ****                                                         enclose this new right-most point */
 734:FrameMgr.c    ****                                                         *(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) = currPixelRunFinish;
 576                            .stabn  68,0,734,.LM71-.LFBB2
 577                    .LM71:
GAS LISTING /tmp/cc0XjEMJ.s                    page 24


 578 0266 6583                  std Z+5,r22
 579                    .L52:
 735:FrameMgr.c    ****                                                 }
 736:FrameMgr.c    ****                                                 
 737:FrameMgr.c    ****                                                 /* the lower right 'y' point always gets updated when connectedness is found */
 738:FrameMgr.c    ****                                                 *(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) = trackedLineCount;
 580                            .stabn  68,0,738,.LM72-.LFBB2
 581                    .LM72:
 582 0268 F601                  movw r30,r12
 583 026a B082                  st Z,r11
 584 026c 00C0                  rjmp .L36
 585                    .L40:
 586                            .stabn  68,0,661,.LM73-.LFBB2
 587                    .LM73:
 588 026e 2F5F                  subi r18,lo8(-(1))
 589 0270 2830                  cpi r18,lo8(8)
 590 0272 01F4                  brne .+2
 591 0274 00C0                  rjmp .L54
 739:FrameMgr.c    ****                                                 
 740:FrameMgr.c    ****                                                 /* set a flag indicating that that color run is part of another
 741:FrameMgr.c    ****                                                 object and thus doesn't need to be added as a new entry into the
 742:FrameMgr.c    ****                                                 tracking table */
 743:FrameMgr.c    ****                                                 colorConnected = TRUE;
 744:FrameMgr.c    ****                                                 break;
 745:FrameMgr.c    ****                                         }
 746:FrameMgr.c    ****                                 }
 747:FrameMgr.c    ****                 
 748:FrameMgr.c    ****                 /* go to the next object */
 749:FrameMgr.c    ****                 pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
 592                            .stabn  68,0,749,.LM74-.LFBB2
 593                    .LM74:
 594 0276 3896                  adiw r30,8
 595 0278 00C0                  rjmp .L39
 596                    .L56:
 597 027a FA01                  movw r30,r20
 598 027c 90E0                  ldi r25,lo8(0)
 599                    .L57:
 750:FrameMgr.c    ****                         }
 751:FrameMgr.c    ****                         
 752:FrameMgr.c    ****                         if (colorConnected == FALSE)
 753:FrameMgr.c    ****                         {
 754:FrameMgr.c    ****                                 /* a new entry needs to be made to the tracking table, since we have
 755:FrameMgr.c    ****                                 a run-length with a color, and it isn't connected to anything...but we
 756:FrameMgr.c    ****                                 can only do this if there is space left in the trackedObject table */
 757:FrameMgr.c    ****                                 if (numCurrTrackedObjects < MAX_TRACKED_OBJECTS)
 758:FrameMgr.c    ****                                 {                
 759:FrameMgr.c    ****                     /* space is available...add the object...but first we need to find an
 760:FrameMgr.c    ****                     invalid object in the object tracking table */
 761:FrameMgr.c    ****                     pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;
 762:FrameMgr.c    ****                     for (i=0; i<MAX_TRACKED_OBJECTS; i++)
 763:FrameMgr.c    ****                     {
 764:FrameMgr.c    ****                         if ( *(pTrackedObjectData + VALID_OBJECT_OFFSET) == FALSE)  break;
 600                            .stabn  68,0,764,.LM75-.LFBB2
 601                    .LM75:
 602 027e 8781                  ldd r24,Z+7
 603 0280 8823                  tst r24
 604 0282 01F0                  breq .L58
GAS LISTING /tmp/cc0XjEMJ.s                    page 25


 765:FrameMgr.c    ****                         
 766:FrameMgr.c    ****                         /* if we haven't broken above, then the object must have been valid...
 767:FrameMgr.c    ****                         go ahead and move the pointer to the next object to check it */
 768:FrameMgr.c    ****                         pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
 605                            .stabn  68,0,768,.LM76-.LFBB2
 606                    .LM76:
 607 0284 3896                  adiw r30,8
 608                            .stabn  68,0,762,.LM77-.LFBB2
 609                    .LM77:
 610 0286 9F5F                  subi r25,lo8(-(1))
 611 0288 9830                  cpi r25,lo8(8)
 612 028a 01F4                  brne .L57
 613                    .L58:
 769:FrameMgr.c    ****                     }
 770:FrameMgr.c    ****                     
 771:FrameMgr.c    ****                                         
 772:FrameMgr.c    ****                                         /* now that we have a pointer to the tracked object to be updated, update all
 773:FrameMgr.c    ****                                         the fields */
 774:FrameMgr.c    ****                                         *(pTrackedObjectData + COLOR_OFFSET)                = currColor;                        /* color */
 614                            .stabn  68,0,774,.LM78-.LFBB2
 615                    .LM78:
 616 028c 3083                  st Z,r19
 775:FrameMgr.c    ****                                         *(pTrackedObjectData + LAST_LINE_X_START_OFFSET)    = currPixelRunStart;        /* lastLineXStart */
 617                            .stabn  68,0,775,.LM79-.LFBB2
 618                    .LM79:
 619 028e 1183                  std Z+1,r17
 776:FrameMgr.c    ****                                         *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET)   = currPixelRunFinish;       /* lastLineXFinish *
 620                            .stabn  68,0,776,.LM80-.LFBB2
 621                    .LM80:
 622 0290 6283                  std Z+2,r22
 777:FrameMgr.c    ****                                         *(pTrackedObjectData + X_UPPER_LEFT_OFFSET)         = currPixelRunStart;        /* x_upperLeft */
 623                            .stabn  68,0,777,.LM81-.LFBB2
 624                    .LM81:
 625 0292 1383                  std Z+3,r17
 778:FrameMgr.c    ****                                         *(pTrackedObjectData + Y_UPPER_LEFT_OFFSET)         = trackedLineCount; /* y_upperLeft */
 626                            .stabn  68,0,778,.LM82-.LFBB2
 627                    .LM82:
 628 0294 B482                  std Z+4,r11
 779:FrameMgr.c    ****                                         *(pTrackedObjectData + X_LOWER_RIGHT_OFFSET)        = currPixelRunFinish;       /* x_lowerRight */
 629                            .stabn  68,0,779,.LM83-.LFBB2
 630                    .LM83:
 631 0296 6583                  std Z+5,r22
 780:FrameMgr.c    ****                                         *(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET)        = trackedLineCount; /* y_lowerRight */
 632                            .stabn  68,0,780,.LM84-.LFBB2
 633                    .LM84:
 634 0298 B682                  std Z+6,r11
 781:FrameMgr.c    ****                     *(pTrackedObjectData + VALID_OBJECT_OFFSET)         = TRUE;                /* o
 635                            .stabn  68,0,781,.LM85-.LFBB2
 636                    .LM85:
 637 029a 81E0                  ldi r24,lo8(1)
 638 029c 8783                  std Z+7,r24
 782:FrameMgr.c    ****                                                 
 783:FrameMgr.c    ****                                         numCurrTrackedObjects++;
 639                            .stabn  68,0,783,.LM86-.LFBB2
 640                    .LM86:
 641 029e 0F5F                  subi r16,lo8(-(1))
 642                    .L36:
GAS LISTING /tmp/cc0XjEMJ.s                    page 26


 784:FrameMgr.c    ****                                 }
 785:FrameMgr.c    ****                         }
 786:FrameMgr.c    ****             
 787:FrameMgr.c    ****             /* move the pointer to the beginning of the next tracked object */
 788:FrameMgr.c    ****             pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
 789:FrameMgr.c    ****                 }
 790:FrameMgr.c    ****         } while(currPixelRunFinish < ACTUAL_NUM_PIXELS_IN_A_LINE);
 643                            .stabn  68,0,790,.LM87-.LFBB2
 644                    .LM87:
 645 02a0 603B                  cpi r22,lo8(-80)
 646 02a2 00F4                  brsh .+2
 647 02a4 00C0                  rjmp .L35
 648 02a6 0093 0000             sts numCurrTrackedObjects,r16
 649                    .LBE5:
 650                    .LBE4:
 651                            .stabn  68,0,460,.LM88-.LFBB2
 652                    .LM88:
 653 02aa C701                  movw r24,r14
 654 02ac 8770                  andi r24,lo8(7)
 655 02ae 9070                  andi r25,hi8(7)
 656 02b0 0797                  sbiw r24,7
 657 02b2 01F4                  brne .L61
 658 02b4 60E0                  ldi r22,lo8(0)
 659                    .L63:
 660                            .stabn  68,0,464,.LM89-.LFBB2
 661                    .LM89:
 662 02b6 FA01                  movw r30,r20
 663 02b8 8781                  ldd r24,Z+7
 664 02ba 8130                  cpi r24,lo8(1)
 665 02bc 01F4                  brne .L64
 666                            .stabn  68,0,468,.LM90-.LFBB2
 667                    .LM90:
 668 02be 8681                  ldd r24,Z+6
 669 02c0 282F                  mov r18,r24
 670 02c2 3327                  clr r19
 671 02c4 8481                  ldd r24,Z+4
 672 02c6 D901                  movw r26,r18
 673 02c8 A81B                  sub r26,r24
 674 02ca B109                  sbc r27,__zero_reg__
 675 02cc 1397                  sbiw r26,3
 676 02ce 04F4                  brge .L64
 677                            .stabn  68,0,474,.LM91-.LFBB2
 678                    .LM91:
 679 02d0 C701                  movw r24,r14
 680 02d2 821B                  sub r24,r18
 681 02d4 930B                  sbc r25,r19
 682 02d6 0397                  sbiw r24,3
 683 02d8 04F0                  brlt .L64
 684                            .stabn  68,0,477,.LM92-.LFBB2
 685                    .LM92:
 686 02da 1782                  std Z+7,__zero_reg__
 687                            .stabn  68,0,478,.LM93-.LFBB2
 688                    .LM93:
 689 02dc 0150                  subi r16,lo8(-(-1))
 690                    .L64:
 691                            .stabn  68,0,462,.LM94-.LFBB2
 692                    .LM94:
GAS LISTING /tmp/cc0XjEMJ.s                    page 27


 693 02de 6F5F                  subi r22,lo8(-(1))
 694 02e0 6830                  cpi r22,lo8(8)
 695 02e2 01F0                  breq .L68
 696                            .stabn  68,0,482,.LM95-.LFBB2
 697                    .LM95:
 698 02e4 485F                  subi r20,lo8(-(8))
 699 02e6 5F4F                  sbci r21,hi8(-(8))
 700 02e8 00C0                  rjmp .L63
 701                    .L68:
 702 02ea 0093 0000             sts numCurrTrackedObjects,r16
 703                    .L61:
 704                            .stabn  68,0,486,.LM96-.LFBB2
 705                    .LM96:
 706 02ee 8B2D                  mov r24,r11
 707 02f0 8F5F                  subi r24,lo8(-(1))
 708 02f2 8093 0000             sts trackedLineCount,r24
 709                            .stabn  68,0,487,.LM97-.LFBB2
 710                    .LM97:
 711 02f6 8039                  cpi r24,lo8(-112)
 712 02f8 01F4                  brne .L70
 713                            .stabn  68,0,491,.LM98-.LFBB2
 714                    .LM98:
 715 02fa 80E2                  ldi r24,lo8(32)
 716 02fc 00D0                  rcall Exec_writeEventFifo
 717                            .stabn  68,0,493,.LM99-.LFBB2
 718                    .LM99:
 719 02fe 89B7                  in r24,89-0x20
 720 0300 8B7F                  andi r24,lo8(-5)
 721 0302 89BF                  out 89-0x20,r24
 722                            .stabn  68,0,494,.LM100-.LFBB2
 723                    .LM100:
 724 0304 1092 0000             sts trackedLineCount,__zero_reg__
 725 0308 00C0                  rjmp .L72
 726                    .L70:
 727                            .stabn  68,0,498,.LM101-.LFBB2
 728                    .LM101:
 729 030a 8091 0000             lds r24,fastEventBitmask
 730 030e 8260                  ori r24,lo8(2)
 731 0310 8093 0000             sts fastEventBitmask,r24
 732 0314 00C0                  rjmp .L72
 733                    .L54:
 734                    .LBB7:
 735                    .LBB6:
 736                            .stabn  68,0,757,.LM102-.LFBB2
 737                    .LM102:
 738 0316 0830                  cpi r16,lo8(8)
 739 0318 00F4                  brsh .+2
 740 031a 00C0                  rjmp .L56
 741 031c 00C0                  rjmp .L36
 742                    .L72:
 743                    .LBE6:
 744                    .LBE7:
 745                    /* epilogue: frame size=1 */
 746 031e 2196                  adiw r28,1
 747 0320 0FB6                  in __tmp_reg__,__SREG__
 748 0322 F894                  cli
 749 0324 DEBF                  out __SP_H__,r29
GAS LISTING /tmp/cc0XjEMJ.s                    page 28


 750 0326 0FBE                  out __SREG__,__tmp_reg__
 751 0328 CDBF                  out __SP_L__,r28
 752 032a DF91                  pop r29
 753 032c CF91                  pop r28
 754 032e 1F91                  pop r17
 755 0330 0F91                  pop r16
 756 0332 FF90                  pop r15
 757 0334 EF90                  pop r14
 758 0336 DF90                  pop r13
 759 0338 CF90                  pop r12
 760 033a BF90                  pop r11
 761 033c 9F90                  pop r9
 762 033e 8F90                  pop r8
 763 0340 7F90                  pop r7
 764 0342 6F90                  pop r6
 765 0344 5F90                  pop r5
 766 0346 4F90                  pop r4
 767 0348 3F90                  pop r3
 768 034a 2F90                  pop r2
 769 034c 0895                  ret
 770                    /* epilogue end (size=24) */
 771                    /* function FrameMgr_processLine size 337 (288) */
 772                            .size   FrameMgr_processLine, .-FrameMgr_processLine
 773                            .stabs  "i:r(0,11)",64,0,343,22
 774                            .stabs  "dataToSend:(0,23)=B(0,11)",128,0,344,1
 775                            .stabs  "pTrackedObjectData:r(0,22)",64,0,345,20
 776                            .stabn  192,0,0,.LFBB2-.LFBB2
 777                            .stabn  224,0,0,.Lscope2-.LFBB2
 778                    .Lscope2:
 779                            .stabs  "",36,0,0,.Lscope2-.LFBB2
 780                            .stabd  78,0,0
 781                            .stabs  "FrameMgr_init:F(0,15)",36,0,191,FrameMgr_init
 782                    .global FrameMgr_init
 783                            .type   FrameMgr_init, @function
 784                    FrameMgr_init:
 785                            .stabd  46,0,0
 786                            .stabn  68,0,191,.LM103-.LFBB3
 787                    .LM103:
 788                    .LFBB3:
 789                    /* prologue: frame size=0 */
 790                    /* prologue end (size=0) */
 791                            .stabn  68,0,192,.LM104-.LFBB3
 792                    .LM104:
 793 034e 80E4                  ldi r24,lo8(64)
 794 0350 E0E0                  ldi r30,lo8(trackedObjectTable)
 795 0352 F0E0                  ldi r31,hi8(trackedObjectTable)
 796 0354 1192                  st Z+,__zero_reg__
 797 0356 8A95                  dec r24
 798 0358 01F4                  brne .-6
 799                    /* epilogue: frame size=0 */
 800 035a 0895                  ret
 801                    /* epilogue end (size=1) */
 802                    /* function FrameMgr_init size 7 (6) */
 803                            .size   FrameMgr_init, .-FrameMgr_init
 804                    .Lscope3:
 805                            .stabs  "",36,0,0,.Lscope3-.LFBB3
 806                            .stabd  78,0,0
GAS LISTING /tmp/cc0XjEMJ.s                    page 29


 807                            .stabs  "FrameMgr_acquireLine:F(0,15)",36,0,287,FrameMgr_acquireLine
 808                    .global FrameMgr_acquireLine
 809                            .type   FrameMgr_acquireLine, @function
 810                    FrameMgr_acquireLine:
 811                            .stabd  46,0,0
 812                            .stabn  68,0,287,.LM105-.LFBB4
 813                    .LM105:
 814                    .LFBB4:
 815                    /* prologue: frame size=0 */
 816                    /* prologue end (size=0) */
 817                            .stabn  68,0,297,.LM106-.LFBB4
 818                    .LM106:
 819 035c 8091 0000             lds r24,currentState
 820 0360 8230                  cpi r24,lo8(2)
 821 0362 01F4                  brne .L81
 822                            .stabn  68,0,299,.LM107-.LFBB4
 823                    .LM107:
 824 0364 8091 0000             lds r24,lineCount
 825 0368 982F                  mov r25,r24
 826 036a 990F                  lsl r25
 827                            .stabn  68,0,305,.LM108-.LFBB4
 828                    .LM108:
 829 036c 80EB                  ldi r24,lo8(-80)
 830 036e E0E0                  ldi r30,lo8(currentLineBuffer)
 831 0370 F0E0                  ldi r31,hi8(currentLineBuffer)
 832 0372 282F                  mov r18,r24
 833 0374 1192                  st Z+,__zero_reg__
 834 0376 2A95                  dec r18
 835 0378 01F4                  brne .-6
 836                            .stabn  68,0,306,.LM109-.LFBB4
 837                    .LM109:
 838 037a E0E0                  ldi r30,lo8(previousLineBuffer)
 839 037c F0E0                  ldi r31,hi8(previousLineBuffer)
 840 037e 1192                  st Z+,__zero_reg__
 841 0380 8A95                  dec r24
 842 0382 01F4                  brne .-6
 843                    .L83:
 844                            .stabn  68,0,309,.LM110-.LFBB4
 845                    .LM110:
 846 0384 829B                  sbis 48-0x20,2
 847 0386 00C0                  rjmp .L83
 848                    .L98:
 849                            .stabn  68,0,310,.LM111-.LFBB4
 850                    .LM111:
 851 0388 829B                  sbis 48-0x20,2
 852 038a 00C0                  rjmp .L106
 853 038c 00C0                  rjmp .L98
 854                    .L111:
 855                            .stabn  68,0,316,.LM112-.LFBB4
 856                    .LM112:
 857 038e 849B                  sbis 48-0x20,4
 858 0390 00C0                  rjmp .L111
 859                            .stabn  68,0,317,.LM113-.LFBB4
 860                    .LM113:
 861 0392 9150                  subi r25,lo8(-(-1))
 862                    .L88:
 863                            .stabn  68,0,318,.LM114-.LFBB4
GAS LISTING /tmp/cc0XjEMJ.s                    page 30


 864                    .LM114:
 865 0394 849B                  sbis 48-0x20,4
 866 0396 00C0                  rjmp .L108
 867 0398 00C0                  rjmp .L88
 868                    .L106:
 869                            .stabn  68,0,314,.LM115-.LFBB4
 870                    .LM115:
 871 039a 9923                  tst r25
 872 039c 01F4                  brne .L111
 873 039e 00C0                  rjmp .L90
 874                    .L108:
 875 03a0 9923                  tst r25
 876 03a2 01F4                  brne .L111
 877                    .L90:
 878                            .stabn  68,0,322,.LM116-.LFBB4
 879                    .LM116:
 880 03a4 60E0                  ldi r22,lo8(previousLineBuffer)
 881 03a6 70E0                  ldi r23,hi8(previousLineBuffer)
 882 03a8 80E0                  ldi r24,lo8(currentLineBuffer)
 883 03aa 90E0                  ldi r25,hi8(currentLineBuffer)
 884 03ac 00D0                  rcall CamIntAsm_acquireDumpLine
 885 03ae 0895                  ret
 886                    .L81:
 887                            .stabn  68,0,324,.LM117-.LFBB4
 888                    .LM117:
 889 03b0 8130                  cpi r24,lo8(1)
 890 03b2 01F4                  brne .L94
 891                    .L97:
 892                            .stabn  68,0,326,.LM118-.LFBB4
 893                    .LM118:
 894 03b4 8499                  sbic 48-0x20,4
 895 03b6 00C0                  rjmp .L97
 896                            .stabn  68,0,327,.LM119-.LFBB4
 897                    .LM119:
 898 03b8 60E0                  ldi r22,lo8(colorMap)
 899 03ba 70E0                  ldi r23,hi8(colorMap)
 900 03bc 80E0                  ldi r24,lo8(currentLineBuffer)
 901 03be 90E0                  ldi r25,hi8(currentLineBuffer)
 902 03c0 00D0                  rcall CamIntAsm_acquireTrackingLine
 903                    .L94:
 904 03c2 0895                  ret
 905                    /* epilogue: frame size=0 */
 906                    /* epilogue: noreturn */
 907                    /* epilogue end (size=0) */
 908                    /* function FrameMgr_acquireLine size 52 (52) */
 909                            .size   FrameMgr_acquireLine, .-FrameMgr_acquireLine
 910                            .stabs  "tmpLineCount:r(0,11)",64,0,288,25
 911                            .stabn  192,0,0,.LFBB4-.LFBB4
 912                            .stabn  224,0,0,.Lscope4-.LFBB4
 913                    .Lscope4:
 914                            .stabs  "",36,0,0,.Lscope4-.LFBB4
 915                            .stabd  78,0,0
 916                            .stabs  "FrameMgr_acquireFrame:F(0,15)",36,0,261,FrameMgr_acquireFrame
 917                    .global FrameMgr_acquireFrame
 918                            .type   FrameMgr_acquireFrame, @function
 919                    FrameMgr_acquireFrame:
 920                            .stabd  46,0,0
GAS LISTING /tmp/cc0XjEMJ.s                    page 31


 921                            .stabn  68,0,261,.LM120-.LFBB5
 922                    .LM120:
 923                    .LFBB5:
 924                    /* prologue: frame size=0 */
 925                    /* prologue end (size=0) */
 926                            .stabn  68,0,262,.LM121-.LFBB5
 927                    .LM121:
 928 03c4 8091 0000             lds r24,currentState
 929 03c8 8130                  cpi r24,lo8(1)
 930 03ca 01F4                  brne .L117
 931                            .stabn  68,0,264,.LM122-.LFBB5
 932                    .LM122:
 933 03cc 1092 0000             sts trackedLineCount,__zero_reg__
 934                            .stabn  68,0,265,.LM123-.LFBB5
 935                    .LM123:
 936 03d0 8091 0000             lds r24,numCurrTrackedObjects
 937 03d4 8093 0000             sts numPrevTrackedObjects,r24
 938                            .stabn  68,0,266,.LM124-.LFBB5
 939                    .LM124:
 940 03d8 1092 0000             sts numCurrTrackedObjects,__zero_reg__
 941                            .stabn  68,0,270,.LM125-.LFBB5
 942                    .LM125:
 943 03dc 80E4                  ldi r24,lo8(64)
 944 03de E0E0                  ldi r30,lo8(trackedObjectTable)
 945 03e0 F0E0                  ldi r31,hi8(trackedObjectTable)
 946 03e2 1192                  st Z+,__zero_reg__
 947 03e4 8A95                  dec r24
 948 03e6 01F4                  brne .-6
 949                    .L115:
 950                            .stabn  68,0,272,.LM126-.LFBB5
 951                    .LM126:
 952 03e8 829B                  sbis 48-0x20,2
 953 03ea 00C0                  rjmp .L115
 954                            .stabn  68,0,273,.LM127-.LFBB5
 955                    .LM127:
 956 03ec 60E0                  ldi r22,lo8(colorMap)
 957 03ee 70E0                  ldi r23,hi8(colorMap)
 958 03f0 80E0                  ldi r24,lo8(currentLineBuffer)
 959 03f2 90E0                  ldi r25,hi8(currentLineBuffer)
 960 03f4 00D0                  rcall CamIntAsm_acquireTrackingLine
 961                    .L117:
 962 03f6 0895                  ret
 963                    /* epilogue: frame size=0 */
 964                    /* epilogue: noreturn */
 965                    /* epilogue end (size=0) */
 966                    /* function FrameMgr_acquireFrame size 26 (26) */
 967                            .size   FrameMgr_acquireFrame, .-FrameMgr_acquireFrame
 968                    .Lscope5:
 969                            .stabs  "",36,0,0,.Lscope5-.LFBB5
 970                            .stabd  78,0,0
 971                            .stabs  "FrameMgr_dispatchEvent:F(0,15)",36,0,205,FrameMgr_dispatchEvent
 972                            .stabs  "event:P(0,11)",64,0,204,24
 973                    .global FrameMgr_dispatchEvent
 974                            .type   FrameMgr_dispatchEvent, @function
 975                    FrameMgr_dispatchEvent:
 976                            .stabd  46,0,0
 977                            .stabn  68,0,205,.LM128-.LFBB6
GAS LISTING /tmp/cc0XjEMJ.s                    page 32


 978                    .LM128:
 979                    .LFBB6:
 980                    /* prologue: frame size=0 */
 981                    /* prologue end (size=0) */
 982                            .stabn  68,0,206,.LM129-.LFBB6
 983                    .LM129:
 984 03f8 8430                  cpi r24,lo8(4)
 985 03fa 01F0                  breq .L124
 986                            .stabn  68,0,206,.LM130-.LFBB6
 987                    .LM130:
 988 03fc 8530                  cpi r24,lo8(5)
 989 03fe 00F4                  brsh .L128
 990 0400 8130                  cpi r24,lo8(1)
 991 0402 01F0                  breq .L122
 992 0404 8230                  cpi r24,lo8(2)
 993 0406 01F4                  brne .L130
 994 0408 00C0                  rjmp .L123
 995                    .L128:
 996 040a 8038                  cpi r24,lo8(-128)
 997 040c 01F0                  breq .L126
 998 040e 8138                  cpi r24,lo8(-127)
 999 0410 01F0                  breq .L127
 1000 0412 8032                 cpi r24,lo8(32)
 1001 0414 01F4                 brne .L130
 1002 0416 00C0                 rjmp .L125
 1003                   .L123:
 1004                           .stabn  68,0,211,.LM131-.LFBB6
 1005                   .LM131:
 1006 0418 61E0                 ldi r22,lo8(1)
 1007 041a 81E1                 ldi r24,lo8(17)
 1008 041c 00D0                 rcall CamConfig_setCamReg
 1009                           .stabn  68,0,212,.LM132-.LFBB6
 1010                   .LM132:
 1011 041e 00D0                 rcall CamConfig_sendFifoCmds
 1012                           .stabn  68,0,213,.LM133-.LFBB6
 1013                   .LM133:
 1014 0420 88EE                 ldi r24,lo8(1000)
 1015 0422 93E0                 ldi r25,hi8(1000)
 1016 0424 00D0                 rcall Utility_delay
 1017                           .stabn  68,0,214,.LM134-.LFBB6
 1018                   .LM134:
 1019 0426 1092 0000            sts lineCount,__zero_reg__
 1020                           .stabn  68,0,215,.LM135-.LFBB6
 1021                   .LM135:
 1022 042a 82E0                 ldi r24,lo8(2)
 1023 042c 8093 0000            sts currentState,r24
 1024                           .stabn  68,0,217,.LM136-.LFBB6
 1025                   .LM136:
 1026 0430 00D0                 rcall FrameMgr_acquireLine
 1027 0432 0895                 ret
 1028                   .L126:
 1029                           .stabn  68,0,221,.LM137-.LFBB6
 1030                   .LM137:
 1031 0434 81E0                 ldi r24,lo8(1)
 1032 0436 8093 0000            sts currentState,r24
 1033                           .stabn  68,0,222,.LM138-.LFBB6
 1034                   .LM138:
GAS LISTING /tmp/cc0XjEMJ.s                    page 33


 1035 043a 00D0                 rcall FrameMgr_acquireFrame
 1036 043c 0895                 ret
 1037                   .L125:
 1038                           .stabn  68,0,226,.LM139-.LFBB6
 1039                   .LM139:
 1040 043e 00D0                 rcall FrameMgr_processFrame
 1041 0440 0895                 ret
 1042                   .L124:
 1043                           .stabn  68,0,230,.LM140-.LFBB6
 1044                   .LM140:
 1045 0442 00D0                 rcall FrameMgr_acquireFrame
 1046 0444 0895                 ret
 1047                   .L122:
 1048                           .stabn  68,0,234,.LM141-.LFBB6
 1049                   .LM141:
 1050 0446 8091 0000            lds r24,currentState
 1051 044a 8823                 tst r24
 1052 044c 01F0                 breq .L130
 1053                           .stabn  68,0,240,.LM142-.LFBB6
 1054                   .LM142:
 1055 044e 84E0                 ldi r24,lo8(4)
 1056 0450 00D0                 rcall Exec_writeEventFifo
 1057 0452 0895                 ret
 1058                   .L127:
 1059                           .stabn  68,0,246,.LM143-.LFBB6
 1060                   .LM143:
 1061 0454 1092 0000            sts currentState,__zero_reg__
 1062                   .L130:
 1063 0458 0895                 ret
 1064                   /* epilogue: frame size=0 */
 1065                   /* epilogue: noreturn */
 1066                   /* epilogue end (size=0) */
 1067                   /* function FrameMgr_dispatchEvent size 49 (49) */
 1068                           .size   FrameMgr_dispatchEvent, .-FrameMgr_dispatchEvent
 1069                   .Lscope6:
 1070                           .stabs  "",36,0,0,.Lscope6-.LFBB6
 1071                           .stabd  78,0,0
 1072                           .data
 1073                           .type   pCurrentTrackedObjectTable, @object
 1074                           .size   pCurrentTrackedObjectTable, 2
 1075                   pCurrentTrackedObjectTable:
 1076 0000 0000                 .word   trackedObjectTable
 1077                           .lcomm numCurrTrackedObjects,1
 1078                           .lcomm currentState,1
 1079                           .lcomm lineCount,1
 1080                           .lcomm trackedLineCount,1
 1081                           .lcomm numPrevTrackedObjects,1
 1082                           .lcomm trackedObjectTable,64
 1083                           .stabs  "trackedObjectTable:S(0,24)=ar(0,25)=r(0,25);0;0177777;;0;7;(0,20)",40,0,162,trackedObjectT
 1084                           .stabs  "pCurrentTrackedObjectTable:S(0,26)=*(0,20)",38,0,163,pCurrentTrackedObjectTable
 1085                           .stabs  "lineCount:S(0,11)",38,0,164,lineCount
 1086                           .stabs  "currentState:S(0,17)",38,0,165,currentState
 1087                           .stabs  "numCurrTrackedObjects:S(0,11)",38,0,166,numCurrTrackedObjects
 1088                           .stabs  "numPrevTrackedObjects:S(0,11)",38,0,167,numPrevTrackedObjects
 1089                           .stabs  "trackedLineCount:S(0,11)",38,0,168,trackedLineCount
 1090                           .text
 1091                           .stabs  "",100,0,0,.Letext0
GAS LISTING /tmp/cc0XjEMJ.s                    page 34


 1092                   .Letext0:
 1093                   /* File "FrameMgr.c": code  559 = 0x022f ( 494), prologues  32, epilogues  33 */
GAS LISTING /tmp/cc0XjEMJ.s                    page 35


DEFINED SYMBOLS
                            *ABS*:00000000 FrameMgr.c
     /tmp/cc0XjEMJ.s:2      *ABS*:0000003f __SREG__
     /tmp/cc0XjEMJ.s:3      *ABS*:0000003e __SP_H__
     /tmp/cc0XjEMJ.s:4      *ABS*:0000003d __SP_L__
     /tmp/cc0XjEMJ.s:5      *ABS*:00000000 __tmp_reg__
     /tmp/cc0XjEMJ.s:6      *ABS*:00000001 __zero_reg__
     /tmp/cc0XjEMJ.s:90     .text:00000000 FrameMgr_processFrame
     /tmp/cc0XjEMJ.s:1075   .data:00000000 pCurrentTrackedObjectTable
                             .bss:00000000 numCurrTrackedObjects
     /tmp/cc0XjEMJ.s:270    .text:000000b2 FrameMgr_processLine
     /tmp/cc0XjEMJ.s:1077   .bss:00000001 currentState
     /tmp/cc0XjEMJ.s:1078   .bss:00000002 lineCount
     /tmp/cc0XjEMJ.s:1079   .bss:00000003 trackedLineCount
     /tmp/cc0XjEMJ.s:784    .text:0000034e FrameMgr_init
     /tmp/cc0XjEMJ.s:1081   .bss:00000005 trackedObjectTable
     /tmp/cc0XjEMJ.s:810    .text:0000035c FrameMgr_acquireLine
     /tmp/cc0XjEMJ.s:919    .text:000003c4 FrameMgr_acquireFrame
     /tmp/cc0XjEMJ.s:1080   .bss:00000004 numPrevTrackedObjects
     /tmp/cc0XjEMJ.s:975    .text:000003f8 FrameMgr_dispatchEvent

UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss
UIMgr_writeTxFifo
Exec_writeEventFifo
UartInt_txByte
currentLineBuffer
previousLineBuffer
CamConfig_setCamReg
CamConfig_sendFifoCmds
fastEventBitmask
CamIntAsm_acquireDumpLine
colorMap
CamIntAsm_acquireTrackingLine
Utility_delay