Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

GAS LISTING /tmp/ccf43P2i.s                     page 1


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


  58                            .stabs  "uint_least32_t:t(6,16)=(6,6)",128,0,177,0
  59                            .stabs  "int_least64_t:t(6,17)=(6,7)",128,0,182,0
  60                            .stabs  "uint_least64_t:t(6,18)=(6,8)",128,0,187,0
  61                            .stabs  "int_fast8_t:t(6,19)=(6,1)",128,0,200,0
  62                            .stabs  "uint_fast8_t:t(6,20)=(6,2)",128,0,205,0
  63                            .stabs  "int_fast16_t:t(6,21)=(6,3)",128,0,210,0
  64                            .stabs  "uint_fast16_t:t(6,22)=(6,4)",128,0,215,0
  65                            .stabs  "int_fast32_t:t(6,23)=(6,5)",128,0,220,0
  66                            .stabs  "uint_fast32_t:t(6,24)=(6,6)",128,0,225,0
  67                            .stabs  "int_fast64_t:t(6,25)=(6,7)",128,0,230,0
  68                            .stabs  "uint_fast64_t:t(6,26)=(6,8)",128,0,235,0
  69                            .stabs  "intmax_t:t(6,27)=(6,7)",128,0,249,0
  70                            .stabs  "uintmax_t:t(6,28)=(6,8)",128,0,254,0
  71                            .stabn  162,0,0,0
  72                            .stabs  "int_farptr_t:t(5,1)=(6,5)",128,0,76,0
  73                            .stabs  "uint_farptr_t:t(5,2)=(6,6)",128,0,80,0
  74                            .stabn  162,0,0,0
  75                            .stabn  162,0,0,0
  76                            .stabn  162,0,0,0
  77                            .stabs  "I2CInterface.h",130,0,0,0
  78                            .stabs  "CommonDefs.h",130,0,0,0
  79                            .stabs  "bool_t:t(8,1)=(0,11)",128,0,56,0
  80                            .stabn  162,0,0,0
  81                            .stabs  "i2cCmd_t:t(7,1)=(7,2)=s2configReg:(0,11),0,8;data:(0,11),8,8;;",128,0,53,0
  82                            .stabn  162,0,0,0
  83                            .stabs  " :T(0,16)=@s8;eST_FrameMgr_idle:0,ST_FrameMgr_TrackingFrame:1,ST_FrameMgr_DumpingFrame:2,;
  84                            .stabs  "FrameMgr_State_t:t(0,17)=(0,11)",128,0,72,0
  85                            .stabs  " :T(0,18)=@s8;enotTracked:0,color1:1,color2:2,color3:3,color4:4,color5:5,color6:6,color7:7
  86                            .stabs  "trackedColor_t:t(0,19)=(0,11)",128,0,127,0
  87                            .stabs  "trackedObject_t:t(0,20)=(0,21)=s8color:(0,19),0,8;lastLineXStart:(0,11),8,8;lastLineXFinis
  88                            .stabs  "FrameMgr_processFrame:F(0,15)",36,0,517,FrameMgr_processFrame
  89                    .global FrameMgr_processFrame
  90                            .type   FrameMgr_processFrame, @function
  91                    FrameMgr_processFrame:
  92                            .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
GAS LISTING /tmp/ccf43P2i.s                    page 3


  23:FrameMgr.c    **** 
  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
GAS LISTING /tmp/ccf43P2i.s                    page 4


  80:FrameMgr.c    **** we had enough room and cycles to process objects between lines */
  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;
GAS LISTING /tmp/ccf43P2i.s                    page 5


 137:FrameMgr.c    ****         unsigned char y_upperLeft;
 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    **** }
GAS LISTING /tmp/ccf43P2i.s                    page 6


 194:FrameMgr.c    **** 
 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    **** 
GAS LISTING /tmp/ccf43P2i.s                    page 7


 251:FrameMgr.c    **** /***********************************************************
 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 
GAS LISTING /tmp/ccf43P2i.s                    page 8


 308:FrameMgr.c    ****                 to start looking for a line to receive */
 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    ****                 {
GAS LISTING /tmp/ccf43P2i.s                    page 9


 365:FrameMgr.c    ****                         /* when a dump line is sampled, the upper byte can potentially
 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);
GAS LISTING /tmp/ccf43P2i.s                    page 10


 422:FrameMgr.c    ****                 while(pixelCount < ACTUAL_NUM_PIXELS_IN_A_LINE)  
 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--;
GAS LISTING /tmp/ccf43P2i.s                    page 11


 479:FrameMgr.c    ****                         }
 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    **** {
  93                            .stabn  68,0,517,.LM0-FrameMgr_processFrame
  94                    .LM0:
  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-FrameMgr_processFrame
GAS LISTING /tmp/ccf43P2i.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-FrameMgr_processFrame
 109                    .LM2:
 110 0016 8091 0000             lds r24,numCurrTrackedObjects
 111 001a 8823                  tst r24
 112 001c 09F4                  brne .+2
 113 001e 3FC0                  rjmp .L2
 114                            .stabn  68,0,523,.LM3-FrameMgr_processFrame
 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-FrameMgr_processFrame
 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-FrameMgr_processFrame
 122                    .LM5:
 123 0026 8091 0000             lds r24,numCurrTrackedObjects
 124 002a 00D0                  rcall UIMgr_writeTxFifo
 125 002c DD24                  clr r13
GAS LISTING /tmp/ccf43P2i.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-FrameMgr_processFrame
 128                    .LM6:
 129 002e 8F81                  ldd r24,Y+7
 130 0030 8130                  cpi r24,lo8(1)
 131 0032 69F5                  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-FrameMgr_processFrame
 133                    .LM7:
 134 0034 8881                  ld r24,Y
 570:FrameMgr.c    ****                 if (color == 128) k=0;
 135                            .stabn  68,0,570,.LM8-FrameMgr_processFrame
 136                    .LM8:
 137 0036 8038                  cpi r24,lo8(-128)
 138 0038 E1F0                  breq .L7
 571:FrameMgr.c    ****                 else if (color == 64) k=1;
 139                            .stabn  68,0,571,.LM9-FrameMgr_processFrame
 140                    .LM9:
 141 003a 8034                  cpi r24,lo8(64)
 142 003c 11F4                  brne .L9
 143 003e 81E0                  ldi r24,lo8(1)
 144 0040 19C0                  rjmp .L11
 145                    .L9:
 572:FrameMgr.c    ****                 else if (color == 32) k=2;
 146                            .stabn  68,0,572,.LM10-FrameMgr_processFrame
 147                    .LM10:
 148 0042 8032                  cpi r24,lo8(32)
 149 0044 11F4                  brne .L12
 150 0046 82E0                  ldi r24,lo8(2)
 151 0048 15C0                  rjmp .L11
 152                    .L12:
 573:FrameMgr.c    ****                 else if (color == 16) k=3;
 153                            .stabn  68,0,573,.LM11-FrameMgr_processFrame
 154                    .LM11:
 155 004a 8031                  cpi r24,lo8(16)
 156 004c 11F4                  brne .L14
 157 004e 83E0                  ldi r24,lo8(3)
 158 0050 11C0                  rjmp .L11
 159                    .L14:
 574:FrameMgr.c    ****                 else if (color == 8)  k=4;
 160                            .stabn  68,0,574,.LM12-FrameMgr_processFrame
 161                    .LM12:
 162 0052 8830                  cpi r24,lo8(8)
 163 0054 11F4                  brne .L16
 164 0056 84E0                  ldi r24,lo8(4)
 165 0058 0DC0                  rjmp .L11
 166                    .L16:
 575:FrameMgr.c    ****                 else if (color == 4)  k=5;
GAS LISTING /tmp/ccf43P2i.s                    page 14


 167                            .stabn  68,0,575,.LM13-FrameMgr_processFrame
 168                    .LM13:
 169 005a 8430                  cpi r24,lo8(4)
 170 005c 11F4                  brne .L18
 171 005e 85E0                  ldi r24,lo8(5)
 172 0060 09C0                  rjmp .L11
 173                    .L18:
 576:FrameMgr.c    ****                 else if (color == 2)  k=6;
 174                            .stabn  68,0,576,.LM14-FrameMgr_processFrame
 175                    .LM14:
 176 0062 8230                  cpi r24,lo8(2)
 177 0064 11F4                  brne .L20
 178 0066 86E0                  ldi r24,lo8(6)
 179 0068 05C0                  rjmp .L11
 180                    .L20:
 577:FrameMgr.c    ****                 else if (color == 1)  k=7;
 181                            .stabn  68,0,577,.LM15-FrameMgr_processFrame
 182                    .LM15:
 183 006a 8130                  cpi r24,lo8(1)
 184 006c 11F4                  brne .L7
 185 006e 87E0                  ldi r24,lo8(7)
 186 0070 01C0                  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-FrameMgr_processFrame
 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-FrameMgr_processFrame
 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-FrameMgr_processFrame
 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-FrameMgr_processFrame
 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-FrameMgr_processFrame
 203                    .LM20:
 204 007c 00D0                  rcall UIMgr_writeTxFifo
 585:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpUpperLeftX);
 205                            .stabn  68,0,585,.LM21-FrameMgr_processFrame
 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-FrameMgr_processFrame
 210                    .LM22:
 211 0082 802F                  mov r24,r16
 212 0084 00D0                  rcall UIMgr_writeTxFifo
GAS LISTING /tmp/ccf43P2i.s                    page 15


 587:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpLowerRightX);
 213                            .stabn  68,0,587,.LM23-FrameMgr_processFrame
 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-FrameMgr_processFrame
 218                    .LM24:
 219 008a 8E2D                  mov r24,r14
 220 008c 00D0                  rcall UIMgr_writeTxFifo
 221                    .L5:
 222                            .stabn  68,0,560,.LM25-FrameMgr_processFrame
 223                    .LM25:
 224 008e D394                  inc r13
 225 0090 88E0                  ldi r24,lo8(8)
 226 0092 D816                  cp r13,r24
 227 0094 11F0                  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-FrameMgr_processFrame
 229                    .LM26:
 230 0096 2896                  adiw r28,8
 231 0098 CACF                  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-FrameMgr_processFrame
 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-FrameMgr_processFrame
 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/ccf43P2i.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,FrameMgr_processFrame-FrameMgr_processFrame
 263                            .stabn  224,0,0,.Lscope0-FrameMgr_processFrame
 264                    .Lscope0:
 265                            .stabs  "",36,0,0,.Lscope0-FrameMgr_processFrame
 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-FrameMgr_processLine
 273                    .LM29:
 274                    /* prologue: frame size=1 */
 275 00b2 2F92                  push r2
 276 00b4 3F92                  push r3
 277 00b6 4F92                  push r4
 278 00b8 5F92                  push r5
 279 00ba 6F92                  push r6
 280 00bc 7F92                  push r7
 281 00be 8F92                  push r8
 282 00c0 9F92                  push r9
 283 00c2 AF92                  push r10
 284 00c4 BF92                  push r11
 285 00c6 CF92                  push r12
 286 00c8 DF92                  push r13
 287 00ca EF92                  push r14
 288 00cc FF92                  push r15
 289 00ce 0F93                  push r16
 290 00d0 1F93                  push r17
 291 00d2 CF93                  push r28
 292 00d4 DF93                  push r29
 293 00d6 CDB7                  in r28,__SP_L__
 294 00d8 DEB7                  in r29,__SP_H__
 295 00da 2197                  sbiw r28,1
 296 00dc 0FB6                  in __tmp_reg__,__SREG__
 297 00de F894                  cli
 298 00e0 DEBF                  out __SP_H__,r29
 299 00e2 0FBE                  out __SREG__,__tmp_reg__
 300 00e4 CDBF                  out __SP_L__,r28
 301                    /* prologue end (size=26) */
 302                            .stabn  68,0,345,.LM30-FrameMgr_processLine
 303                    .LM30:
 304 00e6 0091 0000             lds r16,pCurrentTrackedObjectTable
 305 00ea 1091 0000             lds r17,(pCurrentTrackedObjectTable)+1
 306                            .stabn  68,0,352,.LM31-FrameMgr_processLine
 307                    .LM31:
GAS LISTING /tmp/ccf43P2i.s                    page 17


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


 365 0142 D801                  movw r26,r16
 366 0144 1196                  adiw r26,1
 367 0146 FD01                  movw r30,r26
 368 0148 E050                  subi r30,lo8(-(previousLineBuffer))
 369 014a F040                  sbci r31,hi8(-(previousLineBuffer))
 370 014c 8081                  ld r24,Z
 371 014e 8983                  std Y+1,r24
 372                            .stabn  68,0,380,.LM40-FrameMgr_processLine
 373                    .LM40:
 374 0150 8981                  ldd r24,Y+1
 375 0152 8F70                  andi r24,lo8(15)
 376 0154 8983                  std Y+1,r24
 377                            .stabn  68,0,381,.LM41-FrameMgr_processLine
 378                    .LM41:
 379 0156 8981                  ldd r24,Y+1
 380 0158 8295                  swap r24
 381 015a 807F                  andi r24,0xf0
 382 015c 8983                  std Y+1,r24
 383                            .stabn  68,0,382,.LM42-FrameMgr_processLine
 384                    .LM42:
 385 015e 9981                  ldd r25,Y+1
 386 0160 A050                  subi r26,lo8(-(currentLineBuffer))
 387 0162 B040                  sbci r27,hi8(-(currentLineBuffer))
 388 0164 8C91                  ld r24,X
 389 0166 8F70                  andi r24,lo8(15)
 390 0168 892B                  or r24,r25
 391 016a 8983                  std Y+1,r24
 392                            .stabn  68,0,385,.LM43-FrameMgr_processLine
 393                    .LM43:
 394 016c 8981                  ldd r24,Y+1
 395 016e 00D0                  rcall UartInt_txByte
 396 0170 82E0                  ldi r24,lo8(2)
 397 0172 90E0                  ldi r25,hi8(2)
 398 0174 C80E                  add r12,r24
 399 0176 D91E                  adc r13,r25
 400 0178 0E5F                  subi r16,lo8(-(2))
 401 017a 1F4F                  sbci r17,hi8(-(2))
 402 017c E80E                  add r14,r24
 403 017e F91E                  adc r15,r25
 404                            .stabn  68,0,363,.LM44-FrameMgr_processLine
 405                    .LM44:
 406 0180 003B                  cpi r16,176
 407 0182 1105                  cpc r17,__zero_reg__
 408 0184 61F6                  brne .L29
 409                            .stabn  68,0,387,.LM45-FrameMgr_processLine
 410                    .LM45:
 411 0186 8FE0                  ldi r24,lo8(15)
 412 0188 00D0                  rcall UartInt_txByte
 413                            .stabn  68,0,391,.LM46-FrameMgr_processLine
 414                    .LM46:
 415 018a 8091 0000             lds r24,lineCount
 416 018e 8F5F                  subi r24,lo8(-(1))
 417 0190 8093 0000             sts lineCount,r24
 418                            .stabn  68,0,394,.LM47-FrameMgr_processLine
 419                    .LM47:
 420 0194 8834                  cpi r24,lo8(72)
 421 0196 60F0                  brlo .L31
GAS LISTING /tmp/ccf43P2i.s                    page 19


 422                            .stabn  68,0,398,.LM48-FrameMgr_processLine
 423                    .LM48:
 424 0198 1092 0000             sts lineCount,__zero_reg__
 425                            .stabn  68,0,399,.LM49-FrameMgr_processLine
 426                    .LM49:
 427 019c 1092 0000             sts currentState,__zero_reg__
 428                            .stabn  68,0,402,.LM50-FrameMgr_processLine
 429                    .LM50:
 430 01a0 89B7                  in r24,89-0x20
 431 01a2 8B7F                  andi r24,lo8(-5)
 432 01a4 89BF                  out 89-0x20,r24
 433                            .stabn  68,0,404,.LM51-FrameMgr_processLine
 434                    .LM51:
 435 01a6 60E0                  ldi r22,lo8(0)
 436 01a8 81E1                  ldi r24,lo8(17)
 437 01aa 00D0                  rcall CamConfig_setCamReg
 438                            .stabn  68,0,405,.LM52-FrameMgr_processLine
 439                    .LM52:
 440 01ac 00D0                  rcall CamConfig_sendFifoCmds
 441 01ae C8C0                  rjmp .L71
 442                    .L31:
 443                            .stabn  68,0,410,.LM53-FrameMgr_processLine
 444                    .LM53:
 445 01b0 8091 0000             lds r24,fastEventBitmask
 446 01b4 8260                  ori r24,lo8(2)
 447 01b6 8093 0000             sts fastEventBitmask,r24
 448 01ba C2C0                  rjmp .L71
 449                    .L72:
 450                            .stabn  68,0,491,.LM54-FrameMgr_processLine
 451                    .LM54:
 452 01bc 80E2                  ldi r24,lo8(32)
 453 01be 00D0                  rcall Exec_writeEventFifo
 454                            .stabn  68,0,493,.LM55-FrameMgr_processLine
 455                    .LM55:
 456 01c0 89B7                  in r24,89-0x20
 457 01c2 8B7F                  andi r24,lo8(-5)
 458 01c4 89BF                  out 89-0x20,r24
 459                            .stabn  68,0,494,.LM56-FrameMgr_processLine
 460                    .LM56:
 461 01c6 1092 0000             sts trackedLineCount,__zero_reg__
 462 01ca BAC0                  rjmp .L71
 463                    .L27:
 464                            .stabn  68,0,413,.LM57-FrameMgr_processLine
 465                    .LM57:
 466 01cc 8130                  cpi r24,lo8(1)
 467 01ce 09F0                  breq .+2
 468 01d0 B7C0                  rjmp .L71
 469                    .LBB4:
 470                    .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.
GAS LISTING /tmp/ccf43P2i.s                    page 20


 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
 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)) && 
 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);
 670:FrameMgr.c    ****                                         lastLineXFinish = *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET);
GAS LISTING /tmp/ccf43P2i.s                    page 21


 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) &&
 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    ****                                                    -------------------------------
 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;
 718:FrameMgr.c    ****                                                 *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET) = currPixelRunFinish;
 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)
 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;
GAS LISTING /tmp/ccf43P2i.s                    page 22


 728:FrameMgr.c    ****                                                 }
 729:FrameMgr.c    **** 
 730:FrameMgr.c    ****                                                 if ( *(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) < currPixelRunFinish)
 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;
 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;
 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;
 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;
 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;
 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 */
 775:FrameMgr.c    ****                                         *(pTrackedObjectData + LAST_LINE_X_START_OFFSET)    = currPixelRunStart;        /* lastLineXStart */
 776:FrameMgr.c    ****                                         *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET)   = currPixelRunFinish;       /* lastLineXFinish *
 777:FrameMgr.c    ****                                         *(pTrackedObjectData + X_UPPER_LEFT_OFFSET)         = currPixelRunStart;        /* x_upperLeft */
 778:FrameMgr.c    ****                                         *(pTrackedObjectData + Y_UPPER_LEFT_OFFSET)         = trackedLineCount; /* y_upperLeft */
 471                            .stabn  68,0,778,.LM58-FrameMgr_processLine
 472                    .LM58:
 473 01d2 F090 0000             lds r15,trackedLineCount
 474                            .stabn  68,0,663,.LM59-FrameMgr_processLine
 475                    .LM59:
 476 01d6 CF2C                  mov r12,r15
GAS LISTING /tmp/ccf43P2i.s                    page 23


 477 01d8 DD24                  clr r13
 478 01da 3601                  movw r6,r12
 479 01dc 0894                  sec
 480 01de 6108                  sbc r6,__zero_reg__
 481 01e0 7108                  sbc r7,__zero_reg__
 482 01e2 7091 0000             lds r23,numCurrTrackedObjects
 483 01e6 0F2E                  mov __tmp_reg__,r31
 484 01e8 F0E0                  ldi r31,lo8(currentLineBuffer)
 485 01ea 2F2E                  mov r2,r31
 486 01ec F0E0                  ldi r31,hi8(currentLineBuffer)
 487 01ee 3F2E                  mov r3,r31
 488 01f0 F02D                  mov r31,__tmp_reg__
 489 01f2 50E0                  ldi r21,lo8(0)
 490 01f4 40E0                  ldi r20,lo8(0)
 491 01f6 61E0                  ldi r22,lo8(1)
 492 01f8 EF2C                  mov r14,r15
 493 01fa E394                  inc r14
 494                    .L35:
 495                            .stabn  68,0,635,.LM60-FrameMgr_processLine
 496                    .LM60:
 497 01fc F101                  movw r30,r2
 498 01fe 3081                  ld r19,Z
 499                            .stabn  68,0,636,.LM61-FrameMgr_processLine
 500                    .LM61:
 501 0200 560F                  add r21,r22
 502                            .stabn  68,0,637,.LM62-FrameMgr_processLine
 503                    .LM62:
 504 0202 6181                  ldd r22,Z+1
 505 0204 82E0                  ldi r24,lo8(2)
 506 0206 90E0                  ldi r25,hi8(2)
 507 0208 280E                  add r2,r24
 508 020a 391E                  adc r3,r25
 509                            .stabn  68,0,638,.LM63-FrameMgr_processLine
 510                    .LM63:
 511 020c 460F                  add r20,r22
 512                            .stabn  68,0,643,.LM64-FrameMgr_processLine
 513                    .LM64:
 514 020e 3323                  tst r19
 515 0210 09F4                  brne .+2
 516 0212 5CC0                  rjmp .L36
 517 0214 6430                  cpi r22,lo8(4)
 518 0216 08F4                  brsh .+2
 519 0218 59C0                  rjmp .L36
 520 021a D801                  movw r26,r16
 521 021c 20E0                  ldi r18,lo8(0)
 522                    .L39:
 523                            .stabn  68,0,663,.LM65-FrameMgr_processLine
 524                    .LM65:
 525 021e 8C91                  ld r24,X
 526 0220 3817                  cp r19,r24
 527 0222 C9F5                  brne .L40
 528 0224 FD01                  movw r30,r26
 529 0226 8781                  ldd r24,Z+7
 530 0228 8130                  cpi r24,lo8(1)
 531 022a A9F5                  brne .L40
 532 022c 0F2E                  mov __tmp_reg__,r31
 533 022e F6E0                  ldi r31,lo8(6)
GAS LISTING /tmp/ccf43P2i.s                    page 24


 534 0230 AF2E                  mov r10,r31
 535 0232 BB24                  clr r11
 536 0234 F02D                  mov r31,__tmp_reg__
 537 0236 AA0E                  add r10,r26
 538 0238 BB1E                  adc r11,r27
 539 023a 8681                  ldd r24,Z+6
 540 023c 9927                  clr r25
 541 023e 8615                  cp r24,r6
 542 0240 9705                  cpc r25,r7
 543 0242 49F5                  brne .L40
 544 0244 2D01                  movw r4,r26
 545 0246 0894                  sec
 546 0248 411C                  adc r4,__zero_reg__
 547 024a 511C                  adc r5,__zero_reg__
 548                            .stabn  68,0,669,.LM66-FrameMgr_processLine
 549                    .LM66:
 550 024c 8181                  ldd r24,Z+1
 551 024e 8824                  clr r8
 552 0250 9924                  clr r9
 553 0252 6894                  set
 554 0254 81F8                  bld r8,1
 555 0256 8A0E                  add r8,r26
 556 0258 9B1E                  adc r9,r27
 557                            .stabn  68,0,670,.LM67-FrameMgr_processLine
 558                    .LM67:
 559 025a 9281                  ldd r25,Z+2
 560                            .stabn  68,0,679,.LM68-FrameMgr_processLine
 561                    .LM68:
 562 025c 5817                  cp r21,r24
 563 025e 10F0                  brlo .L44
 564 0260 9517                  cp r25,r21
 565 0262 40F4                  brsh .L46
 566                    .L44:
 567 0264 4817                  cp r20,r24
 568 0266 10F0                  brlo .L47
 569 0268 9417                  cp r25,r20
 570 026a 20F4                  brsh .L46
 571                    .L47:
 572 026c 8517                  cp r24,r21
 573 026e 98F0                  brlo .L40
 574 0270 4917                  cp r20,r25
 575 0272 88F0                  brlo .L40
 576                    .L46:
 577                            .stabn  68,0,717,.LM69-FrameMgr_processLine
 578                    .LM69:
 579 0274 F201                  movw r30,r4
 580 0276 5083                  st Z,r21
 581                            .stabn  68,0,718,.LM70-FrameMgr_processLine
 582                    .LM70:
 583 0278 F401                  movw r30,r8
 584 027a 4083                  st Z,r20
 585                            .stabn  68,0,721,.LM71-FrameMgr_processLine
 586                    .LM71:
 587 027c FD01                  movw r30,r26
 588 027e 8381                  ldd r24,Z+3
 589 0280 5817                  cp r21,r24
 590 0282 08F4                  brsh .L50
GAS LISTING /tmp/ccf43P2i.s                    page 25


 591                            .stabn  68,0,727,.LM72-FrameMgr_processLine
 592                    .LM72:
 593 0284 5383                  std Z+3,r21
 594                    .L50:
 595                            .stabn  68,0,730,.LM73-FrameMgr_processLine
 596                    .LM73:
 597 0286 FD01                  movw r30,r26
 598 0288 8581                  ldd r24,Z+5
 599 028a 8417                  cp r24,r20
 600 028c 08F4                  brsh .L52
 601                            .stabn  68,0,734,.LM74-FrameMgr_processLine
 602                    .LM74:
 603 028e 4583                  std Z+5,r20
 604                    .L52:
 605                            .stabn  68,0,738,.LM75-FrameMgr_processLine
 606                    .LM75:
 607 0290 F501                  movw r30,r10
 608 0292 F082                  st Z,r15
 609 0294 1BC0                  rjmp .L36
 610                    .L40:
 611                            .stabn  68,0,661,.LM76-FrameMgr_processLine
 612                    .LM76:
 613 0296 2F5F                  subi r18,lo8(-(1))
 614 0298 2830                  cpi r18,lo8(8)
 615 029a 09F4                  brne .+2
 616 029c 4DC0                  rjmp .L54
 617                            .stabn  68,0,749,.LM77-FrameMgr_processLine
 618                    .LM77:
 619 029e 1896                  adiw r26,8
 620 02a0 BECF                  rjmp .L39
 621                    .L56:
 622 02a2 D801                  movw r26,r16
 623 02a4 90E0                  ldi r25,lo8(0)
 624                    .L57:
 625                            .stabn  68,0,764,.LM78-FrameMgr_processLine
 626                    .LM78:
 627 02a6 FD01                  movw r30,r26
 628 02a8 8781                  ldd r24,Z+7
 629 02aa 8823                  tst r24
 630 02ac 21F0                  breq .L58
 631                            .stabn  68,0,768,.LM79-FrameMgr_processLine
 632                    .LM79:
 633 02ae 1896                  adiw r26,8
 634                            .stabn  68,0,762,.LM80-FrameMgr_processLine
 635                    .LM80:
 636 02b0 9F5F                  subi r25,lo8(-(1))
 637 02b2 9830                  cpi r25,lo8(8)
 638 02b4 C1F7                  brne .L57
 639                    .L58:
 640                            .stabn  68,0,774,.LM81-FrameMgr_processLine
 641                    .LM81:
 642 02b6 3C93                  st X,r19
 643                            .stabn  68,0,775,.LM82-FrameMgr_processLine
 644                    .LM82:
 645 02b8 FD01                  movw r30,r26
 646 02ba 5183                  std Z+1,r21
 647                            .stabn  68,0,776,.LM83-FrameMgr_processLine
GAS LISTING /tmp/ccf43P2i.s                    page 26


 648                    .LM83:
 649 02bc 4283                  std Z+2,r20
 650                            .stabn  68,0,777,.LM84-FrameMgr_processLine
 651                    .LM84:
 652 02be 5383                  std Z+3,r21
 653                            .stabn  68,0,778,.LM85-FrameMgr_processLine
 654                    .LM85:
 655 02c0 F482                  std Z+4,r15
 779:FrameMgr.c    ****                                         *(pTrackedObjectData + X_LOWER_RIGHT_OFFSET)        = currPixelRunFinish;       /* x_lowerRight */
 656                            .stabn  68,0,779,.LM86-FrameMgr_processLine
 657                    .LM86:
 658 02c2 4583                  std Z+5,r20
 780:FrameMgr.c    ****                                         *(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET)        = trackedLineCount; /* y_lowerRight */
 659                            .stabn  68,0,780,.LM87-FrameMgr_processLine
 660                    .LM87:
 661 02c4 F682                  std Z+6,r15
 781:FrameMgr.c    ****                     *(pTrackedObjectData + VALID_OBJECT_OFFSET)         = TRUE;                /* o
 662                            .stabn  68,0,781,.LM88-FrameMgr_processLine
 663                    .LM88:
 664 02c6 81E0                  ldi r24,lo8(1)
 665 02c8 8783                  std Z+7,r24
 782:FrameMgr.c    ****                                                 
 783:FrameMgr.c    ****                                         numCurrTrackedObjects++;
 666                            .stabn  68,0,783,.LM89-FrameMgr_processLine
 667                    .LM89:
 668 02ca 7F5F                  subi r23,lo8(-(1))
 669                    .L36:
 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);
 670                            .stabn  68,0,790,.LM90-FrameMgr_processLine
 671                    .LM90:
 672 02cc 403B                  cpi r20,lo8(-80)
 673 02ce 08F4                  brsh .+2
 674 02d0 95CF                  rjmp .L35
 675 02d2 7093 0000             sts numCurrTrackedObjects,r23
 676                    .LBE5:
 677                    .LBE4:
 678                            .stabn  68,0,460,.LM91-FrameMgr_processLine
 679                    .LM91:
 680 02d6 C601                  movw r24,r12
 681 02d8 8770                  andi r24,lo8(7)
 682 02da 9070                  andi r25,hi8(7)
 683 02dc 0797                  sbiw r24,7
 684 02de 01F5                  brne .L61
 685 02e0 D801                  movw r26,r16
 686 02e2 1796                  adiw r26,7
 687 02e4 40E0                  ldi r20,lo8(0)
 688                    .L63:
 689                            .stabn  68,0,464,.LM92-FrameMgr_processLine
 690                    .LM92:
 691 02e6 8C91                  ld r24,X
 692 02e8 8130                  cpi r24,lo8(1)
GAS LISTING /tmp/ccf43P2i.s                    page 27


 693 02ea A1F4                  brne .L64
 694 02ec FD01                  movw r30,r26
 695 02ee 3197                  sbiw r30,1
 696                            .stabn  68,0,468,.LM93-FrameMgr_processLine
 697                    .LM93:
 698 02f0 9081                  ld r25,Z
 699 02f2 FD01                  movw r30,r26
 700 02f4 3397                  sbiw r30,3
 701 02f6 8081                  ld r24,Z
 702 02f8 292F                  mov r18,r25
 703 02fa 3327                  clr r19
 704 02fc F901                  movw r30,r18
 705 02fe E81B                  sub r30,r24
 706 0300 F109                  sbc r31,__zero_reg__
 707 0302 3397                  sbiw r30,3
 708 0304 3CF4                  brge .L64
 709                            .stabn  68,0,474,.LM94-FrameMgr_processLine
 710                    .LM94:
 711 0306 C601                  movw r24,r12
 712 0308 821B                  sub r24,r18
 713 030a 930B                  sbc r25,r19
 714 030c 0397                  sbiw r24,3
 715 030e 14F0                  brlt .L64
 716                            .stabn  68,0,477,.LM95-FrameMgr_processLine
 717                    .LM95:
 718 0310 1C92                  st X,__zero_reg__
 719                            .stabn  68,0,478,.LM96-FrameMgr_processLine
 720                    .LM96:
 721 0312 7150                  subi r23,lo8(-(-1))
 722                    .L64:
 723                            .stabn  68,0,462,.LM97-FrameMgr_processLine
 724                    .LM97:
 725 0314 4F5F                  subi r20,lo8(-(1))
 726 0316 1896                  adiw r26,8
 727 0318 4830                  cpi r20,lo8(8)
 728 031a 29F7                  brne .L63
 729 031c 7093 0000             sts numCurrTrackedObjects,r23
 730                    .L61:
 731                            .stabn  68,0,486,.LM98-FrameMgr_processLine
 732                    .LM98:
 733 0320 E092 0000             sts trackedLineCount,r14
 734                            .stabn  68,0,487,.LM99-FrameMgr_processLine
 735                    .LM99:
 736 0324 F0E9                  ldi r31,lo8(-112)
 737 0326 EF16                  cp r14,r31
 738 0328 09F4                  brne .+2
 739 032a 48CF                  rjmp .L72
 740                            .stabn  68,0,498,.LM100-FrameMgr_processLine
 741                    .LM100:
 742 032c 8091 0000             lds r24,fastEventBitmask
 743 0330 8260                  ori r24,lo8(2)
 744 0332 8093 0000             sts fastEventBitmask,r24
 745 0336 04C0                  rjmp .L71
 746                    .L54:
 747                    .LBB6:
 748                    .LBB7:
 749                            .stabn  68,0,757,.LM101-FrameMgr_processLine
GAS LISTING /tmp/ccf43P2i.s                    page 28


 750                    .LM101:
 751 0338 7830                  cpi r23,lo8(8)
 752 033a 08F4                  brsh .+2
 753 033c B2CF                  rjmp .L56
 754 033e C6CF                  rjmp .L36
 755                    .L71:
 756                    .LBE7:
 757                    .LBE6:
 758                    /* epilogue: frame size=1 */
 759 0340 2196                  adiw r28,1
 760 0342 0FB6                  in __tmp_reg__,__SREG__
 761 0344 F894                  cli
 762 0346 DEBF                  out __SP_H__,r29
 763 0348 0FBE                  out __SREG__,__tmp_reg__
 764 034a CDBF                  out __SP_L__,r28
 765 034c DF91                  pop r29
 766 034e CF91                  pop r28
 767 0350 1F91                  pop r17
 768 0352 0F91                  pop r16
 769 0354 FF90                  pop r15
 770 0356 EF90                  pop r14
 771 0358 DF90                  pop r13
 772 035a CF90                  pop r12
 773 035c BF90                  pop r11
 774 035e AF90                  pop r10
 775 0360 9F90                  pop r9
 776 0362 8F90                  pop r8
 777 0364 7F90                  pop r7
 778 0366 6F90                  pop r6
 779 0368 5F90                  pop r5
 780 036a 4F90                  pop r4
 781 036c 3F90                  pop r3
 782 036e 2F90                  pop r2
 783 0370 0895                  ret
 784                    /* epilogue end (size=25) */
 785                    /* function FrameMgr_processLine size 355 (304) */
 786                            .size   FrameMgr_processLine, .-FrameMgr_processLine
 787                            .stabs  "i:r(0,11)",64,0,343,20
 788                            .stabs  "dataToSend:(0,23)=B(0,11)",128,0,344,1
 789                            .stabs  "pTrackedObjectData:r(0,22)",64,0,345,26
 790                            .stabn  192,0,0,FrameMgr_processLine-FrameMgr_processLine
 791                            .stabn  224,0,0,.Lscope1-FrameMgr_processLine
 792                    .Lscope1:
 793                            .stabs  "",36,0,0,.Lscope1-FrameMgr_processLine
 794                            .stabd  78,0,0
 795                            .stabs  "FrameMgr_init:F(0,15)",36,0,191,FrameMgr_init
 796                    .global FrameMgr_init
 797                            .type   FrameMgr_init, @function
 798                    FrameMgr_init:
 799                            .stabd  46,0,0
 800                            .stabn  68,0,191,.LM102-FrameMgr_init
 801                    .LM102:
 802                    /* prologue: frame size=0 */
 803                    /* prologue end (size=0) */
 804                            .stabn  68,0,192,.LM103-FrameMgr_init
 805                    .LM103:
 806 0372 80E4                  ldi r24,lo8(64)
GAS LISTING /tmp/ccf43P2i.s                    page 29


 807 0374 E0E0                  ldi r30,lo8(trackedObjectTable)
 808 0376 F0E0                  ldi r31,hi8(trackedObjectTable)
 809 0378 1192                  st Z+,__zero_reg__
 810 037a 8A95                  dec r24
 811 037c E9F7                  brne .-6
 812                    /* epilogue: frame size=0 */
 813 037e 0895                  ret
 814                    /* epilogue end (size=1) */
 815                    /* function FrameMgr_init size 7 (6) */
 816                            .size   FrameMgr_init, .-FrameMgr_init
 817                    .Lscope2:
 818                            .stabs  "",36,0,0,.Lscope2-FrameMgr_init
 819                            .stabd  78,0,0
 820                            .stabs  "FrameMgr_acquireLine:F(0,15)",36,0,287,FrameMgr_acquireLine
 821                    .global FrameMgr_acquireLine
 822                            .type   FrameMgr_acquireLine, @function
 823                    FrameMgr_acquireLine:
 824                            .stabd  46,0,0
 825                            .stabn  68,0,287,.LM104-FrameMgr_acquireLine
 826                    .LM104:
 827                    /* prologue: frame size=0 */
 828                    /* prologue end (size=0) */
 829                            .stabn  68,0,297,.LM105-FrameMgr_acquireLine
 830                    .LM105:
 831 0380 8091 0000             lds r24,currentState
 832 0384 8230                  cpi r24,lo8(2)
 833 0386 49F5                  brne .L83
 834                            .stabn  68,0,299,.LM106-FrameMgr_acquireLine
 835                    .LM106:
 836 0388 8091 0000             lds r24,lineCount
 837 038c 282F                  mov r18,r24
 838 038e 220F                  lsl r18
 839                            .stabn  68,0,305,.LM107-FrameMgr_acquireLine
 840                    .LM107:
 841 0390 80EB                  ldi r24,lo8(-80)
 842 0392 E0E0                  ldi r30,lo8(currentLineBuffer)
 843 0394 F0E0                  ldi r31,hi8(currentLineBuffer)
 844 0396 982F                  mov r25,r24
 845 0398 1192                  st Z+,__zero_reg__
 846 039a 9A95                  dec r25
 847 039c E9F7                  brne .-6
 848                            .stabn  68,0,306,.LM108-FrameMgr_acquireLine
 849                    .LM108:
 850 039e E0E0                  ldi r30,lo8(previousLineBuffer)
 851 03a0 F0E0                  ldi r31,hi8(previousLineBuffer)
 852 03a2 1192                  st Z+,__zero_reg__
 853 03a4 8A95                  dec r24
 854 03a6 E9F7                  brne .-6
 855                    .L85:
 856                            .stabn  68,0,309,.LM109-FrameMgr_acquireLine
 857                    .LM109:
 858 03a8 829B                  sbis 48-0x20,2
 859 03aa FECF                  rjmp .L85
 860                    .L101:
 861                            .stabn  68,0,310,.LM110-FrameMgr_acquireLine
 862                    .LM110:
 863 03ac 829B                  sbis 48-0x20,2
GAS LISTING /tmp/ccf43P2i.s                    page 30


 864 03ae 07C0                  rjmp .L110
 865 03b0 FDCF                  rjmp .L101
 866                    .L88:
 867 03b2 90E0                  ldi r25,lo8(0)
 868                    .L114:
 869                            .stabn  68,0,316,.LM111-FrameMgr_acquireLine
 870                    .LM111:
 871 03b4 849B                  sbis 48-0x20,4
 872 03b6 FECF                  rjmp .L114
 873                    .L102:
 874                            .stabn  68,0,318,.LM112-FrameMgr_acquireLine
 875                    .LM112:
 876 03b8 849B                  sbis 48-0x20,4
 877 03ba 04C0                  rjmp .L111
 878 03bc FDCF                  rjmp .L102
 879                    .L110:
 880                            .stabn  68,0,314,.LM113-FrameMgr_acquireLine
 881                    .LM113:
 882 03be 2223                  tst r18
 883 03c0 C1F7                  brne .L88
 884 03c2 05C0                  rjmp .L92
 885                    .L111:
 886 03c4 9150                  subi r25,lo8(-(-1))
 887 03c6 822F                  mov r24,r18
 888 03c8 8195                  neg r24
 889 03ca 9817                  cp r25,r24
 890 03cc 99F7                  brne .L114
 891                    .L92:
 892                            .stabn  68,0,322,.LM114-FrameMgr_acquireLine
 893                    .LM114:
 894 03ce 60E0                  ldi r22,lo8(previousLineBuffer)
 895 03d0 70E0                  ldi r23,hi8(previousLineBuffer)
 896 03d2 80E0                  ldi r24,lo8(currentLineBuffer)
 897 03d4 90E0                  ldi r25,hi8(currentLineBuffer)
 898 03d6 00D0                  rcall CamIntAsm_acquireDumpLine
 899 03d8 0895                  ret
 900                    .L83:
 901                            .stabn  68,0,324,.LM115-FrameMgr_acquireLine
 902                    .LM115:
 903 03da 8130                  cpi r24,lo8(1)
 904 03dc 39F4                  brne .L96
 905                    .L103:
 906                            .stabn  68,0,326,.LM116-FrameMgr_acquireLine
 907                    .LM116:
 908 03de 8499                  sbic 48-0x20,4
 909 03e0 FECF                  rjmp .L103
 910                            .stabn  68,0,327,.LM117-FrameMgr_acquireLine
 911                    .LM117:
 912 03e2 60E0                  ldi r22,lo8(colorMap)
 913 03e4 70E0                  ldi r23,hi8(colorMap)
 914 03e6 80E0                  ldi r24,lo8(currentLineBuffer)
 915 03e8 90E0                  ldi r25,hi8(currentLineBuffer)
 916 03ea 00D0                  rcall CamIntAsm_acquireTrackingLine
 917                    .L96:
 918 03ec 0895                  ret
 919                    /* epilogue: frame size=0 */
 920                    /* epilogue: noreturn */
GAS LISTING /tmp/ccf43P2i.s                    page 31


 921                    /* epilogue end (size=0) */
 922                    /* function FrameMgr_acquireLine size 55 (55) */
 923                            .size   FrameMgr_acquireLine, .-FrameMgr_acquireLine
 924                            .stabs  "tmpLineCount:r(0,11)",64,0,288,18
 925                            .stabn  192,0,0,FrameMgr_acquireLine-FrameMgr_acquireLine
 926                            .stabn  224,0,0,.Lscope3-FrameMgr_acquireLine
 927                    .Lscope3:
 928                            .stabs  "",36,0,0,.Lscope3-FrameMgr_acquireLine
 929                            .stabd  78,0,0
 930                            .stabs  "FrameMgr_acquireFrame:F(0,15)",36,0,261,FrameMgr_acquireFrame
 931                    .global FrameMgr_acquireFrame
 932                            .type   FrameMgr_acquireFrame, @function
 933                    FrameMgr_acquireFrame:
 934                            .stabd  46,0,0
 935                            .stabn  68,0,261,.LM118-FrameMgr_acquireFrame
 936                    .LM118:
 937                    /* prologue: frame size=0 */
 938                    /* prologue end (size=0) */
 939                            .stabn  68,0,262,.LM119-FrameMgr_acquireFrame
 940                    .LM119:
 941 03ee 8091 0000             lds r24,currentState
 942 03f2 8130                  cpi r24,lo8(1)
 943 03f4 A9F4                  brne .L120
 944                            .stabn  68,0,264,.LM120-FrameMgr_acquireFrame
 945                    .LM120:
 946 03f6 1092 0000             sts trackedLineCount,__zero_reg__
 947                            .stabn  68,0,265,.LM121-FrameMgr_acquireFrame
 948                    .LM121:
 949 03fa 8091 0000             lds r24,numCurrTrackedObjects
 950 03fe 8093 0000             sts numPrevTrackedObjects,r24
 951                            .stabn  68,0,266,.LM122-FrameMgr_acquireFrame
 952                    .LM122:
 953 0402 1092 0000             sts numCurrTrackedObjects,__zero_reg__
 954                            .stabn  68,0,270,.LM123-FrameMgr_acquireFrame
 955                    .LM123:
 956 0406 80E4                  ldi r24,lo8(64)
 957 0408 E0E0                  ldi r30,lo8(trackedObjectTable)
 958 040a F0E0                  ldi r31,hi8(trackedObjectTable)
 959 040c 1192                  st Z+,__zero_reg__
 960 040e 8A95                  dec r24
 961 0410 E9F7                  brne .-6
 962                    .L118:
 963                            .stabn  68,0,272,.LM124-FrameMgr_acquireFrame
 964                    .LM124:
 965 0412 829B                  sbis 48-0x20,2
 966 0414 FECF                  rjmp .L118
 967                            .stabn  68,0,273,.LM125-FrameMgr_acquireFrame
 968                    .LM125:
 969 0416 60E0                  ldi r22,lo8(colorMap)
 970 0418 70E0                  ldi r23,hi8(colorMap)
 971 041a 80E0                  ldi r24,lo8(currentLineBuffer)
 972 041c 90E0                  ldi r25,hi8(currentLineBuffer)
 973 041e 00D0                  rcall CamIntAsm_acquireTrackingLine
 974                    .L120:
 975 0420 0895                  ret
 976                    /* epilogue: frame size=0 */
 977                    /* epilogue: noreturn */
GAS LISTING /tmp/ccf43P2i.s                    page 32


 978                    /* epilogue end (size=0) */
 979                    /* function FrameMgr_acquireFrame size 26 (26) */
 980                            .size   FrameMgr_acquireFrame, .-FrameMgr_acquireFrame
 981                    .Lscope4:
 982                            .stabs  "",36,0,0,.Lscope4-FrameMgr_acquireFrame
 983                            .stabd  78,0,0
 984                            .stabs  "FrameMgr_dispatchEvent:F(0,15)",36,0,205,FrameMgr_dispatchEvent
 985                            .stabs  "event:P(0,11)",64,0,204,24
 986                    .global FrameMgr_dispatchEvent
 987                            .type   FrameMgr_dispatchEvent, @function
 988                    FrameMgr_dispatchEvent:
 989                            .stabd  46,0,0
 990                            .stabn  68,0,205,.LM126-FrameMgr_dispatchEvent
 991                    .LM126:
 992                    /* prologue: frame size=0 */
 993                    /* prologue end (size=0) */
 994                            .stabn  68,0,206,.LM127-FrameMgr_dispatchEvent
 995                    .LM127:
 996 0422 8430                  cpi r24,lo8(4)
 997 0424 19F1                  breq .L127
 998                            .stabn  68,0,206,.LM128-FrameMgr_dispatchEvent
 999                    .LM128:
 1000 0426 8530                 cpi r24,lo8(5)
 1001 0428 28F4                 brsh .L131
 1002 042a 8130                 cpi r24,lo8(1)
 1003 042c 09F1                 breq .L125
 1004 042e 8230                 cpi r24,lo8(2)
 1005 0430 41F5                 brne .L133
 1006 0432 07C0                 rjmp .L126
 1007                   .L131:
 1008 0434 8038                 cpi r24,lo8(-128)
 1009 0436 99F0                 breq .L129
 1010 0438 8138                 cpi r24,lo8(-127)
 1011 043a 09F1                 breq .L130
 1012 043c 8032                 cpi r24,lo8(32)
 1013 043e 09F5                 brne .L133
 1014 0440 13C0                 rjmp .L128
 1015                   .L126:
 1016                           .stabn  68,0,211,.LM129-FrameMgr_dispatchEvent
 1017                   .LM129:
 1018 0442 61E0                 ldi r22,lo8(1)
 1019 0444 81E1                 ldi r24,lo8(17)
 1020 0446 00D0                 rcall CamConfig_setCamReg
 1021                           .stabn  68,0,212,.LM130-FrameMgr_dispatchEvent
 1022                   .LM130:
 1023 0448 00D0                 rcall CamConfig_sendFifoCmds
 1024                           .stabn  68,0,213,.LM131-FrameMgr_dispatchEvent
 1025                   .LM131:
 1026 044a 88EE                 ldi r24,lo8(1000)
 1027 044c 93E0                 ldi r25,hi8(1000)
 1028 044e 00D0                 rcall Utility_delay
 1029                           .stabn  68,0,214,.LM132-FrameMgr_dispatchEvent
 1030                   .LM132:
 1031 0450 1092 0000            sts lineCount,__zero_reg__
 1032                           .stabn  68,0,215,.LM133-FrameMgr_dispatchEvent
 1033                   .LM133:
 1034 0454 82E0                 ldi r24,lo8(2)
GAS LISTING /tmp/ccf43P2i.s                    page 33


 1035 0456 8093 0000            sts currentState,r24
 1036                           .stabn  68,0,217,.LM134-FrameMgr_dispatchEvent
 1037                   .LM134:
 1038 045a 92DF                 rcall FrameMgr_acquireLine
 1039 045c 0895                 ret
 1040                   .L129:
 1041                           .stabn  68,0,221,.LM135-FrameMgr_dispatchEvent
 1042                   .LM135:
 1043 045e 81E0                 ldi r24,lo8(1)
 1044 0460 8093 0000            sts currentState,r24
 1045                           .stabn  68,0,222,.LM136-FrameMgr_dispatchEvent
 1046                   .LM136:
 1047 0464 C4DF                 rcall FrameMgr_acquireFrame
 1048 0466 0895                 ret
 1049                   .L128:
 1050                           .stabn  68,0,226,.LM137-FrameMgr_dispatchEvent
 1051                   .LM137:
 1052 0468 CBDD                 rcall FrameMgr_processFrame
 1053 046a 0895                 ret
 1054                   .L127:
 1055                           .stabn  68,0,230,.LM138-FrameMgr_dispatchEvent
 1056                   .LM138:
 1057 046c C0DF                 rcall FrameMgr_acquireFrame
 1058 046e 0895                 ret
 1059                   .L125:
 1060                           .stabn  68,0,234,.LM139-FrameMgr_dispatchEvent
 1061                   .LM139:
 1062 0470 8091 0000            lds r24,currentState
 1063 0474 8823                 tst r24
 1064 0476 29F0                 breq .L133
 1065                           .stabn  68,0,240,.LM140-FrameMgr_dispatchEvent
 1066                   .LM140:
 1067 0478 84E0                 ldi r24,lo8(4)
 1068 047a 00D0                 rcall Exec_writeEventFifo
 1069 047c 0895                 ret
 1070                   .L130:
 1071                           .stabn  68,0,246,.LM141-FrameMgr_dispatchEvent
 1072                   .LM141:
 1073 047e 1092 0000            sts currentState,__zero_reg__
 1074                   .L133:
 1075 0482 0895                 ret
 1076                   /* epilogue: frame size=0 */
 1077                   /* epilogue: noreturn */
 1078                   /* epilogue end (size=0) */
 1079                   /* function FrameMgr_dispatchEvent size 49 (49) */
 1080                           .size   FrameMgr_dispatchEvent, .-FrameMgr_dispatchEvent
 1081                   .Lscope5:
 1082                           .stabs  "",36,0,0,.Lscope5-FrameMgr_dispatchEvent
 1083                           .stabd  78,0,0
 1084                           .data
 1085                           .type   pCurrentTrackedObjectTable, @object
 1086                           .size   pCurrentTrackedObjectTable, 2
 1087                   pCurrentTrackedObjectTable:
 1088 0000 0000                 .word   trackedObjectTable
 1089                           .lcomm numCurrTrackedObjects,1
 1090                           .lcomm currentState,1
 1091                           .lcomm lineCount,1
GAS LISTING /tmp/ccf43P2i.s                    page 34


 1092                           .lcomm trackedLineCount,1
 1093                           .lcomm numPrevTrackedObjects,1
 1094                           .lcomm trackedObjectTable,64
 1095                           .stabs  "trackedObjectTable:S(0,24)=ar(0,25)=r(0,25);0;0177777;;0;7;(0,20)",40,0,162,trackedObjectT
 1096                           .stabs  "pCurrentTrackedObjectTable:S(0,26)=*(0,20)",38,0,163,pCurrentTrackedObjectTable
 1097                           .stabs  "lineCount:S(0,11)",38,0,164,lineCount
 1098                           .stabs  "currentState:S(0,17)",38,0,165,currentState
 1099                           .stabs  "numCurrTrackedObjects:S(0,11)",38,0,166,numCurrTrackedObjects
 1100                           .stabs  "numPrevTrackedObjects:S(0,11)",38,0,167,numPrevTrackedObjects
 1101                           .stabs  "trackedLineCount:S(0,11)",38,0,168,trackedLineCount
 1102                           .text
 1103                           .stabs  "",100,0,0,.Letext0
 1104                   .Letext0:
 1105                   /* File "FrameMgr.c": code  580 = 0x0244 ( 513), prologues  33, epilogues  34 */
GAS LISTING /tmp/ccf43P2i.s                    page 35


DEFINED SYMBOLS
                            *ABS*:00000000 FrameMgr.c
     /tmp/ccf43P2i.s:3      *ABS*:0000003f __SREG__
     /tmp/ccf43P2i.s:4      *ABS*:0000003e __SP_H__
     /tmp/ccf43P2i.s:5      *ABS*:0000003d __SP_L__
     /tmp/ccf43P2i.s:6      *ABS*:00000000 __tmp_reg__
     /tmp/ccf43P2i.s:7      *ABS*:00000001 __zero_reg__
     /tmp/ccf43P2i.s:91     .text:00000000 FrameMgr_processFrame
     /tmp/ccf43P2i.s:1087   .data:00000000 pCurrentTrackedObjectTable
                             .bss:00000000 numCurrTrackedObjects
     /tmp/ccf43P2i.s:270    .text:000000b2 FrameMgr_processLine
     /tmp/ccf43P2i.s:1089   .bss:00000001 currentState
     /tmp/ccf43P2i.s:1090   .bss:00000002 lineCount
     /tmp/ccf43P2i.s:1091   .bss:00000003 trackedLineCount
     /tmp/ccf43P2i.s:798    .text:00000372 FrameMgr_init
     /tmp/ccf43P2i.s:1093   .bss:00000005 trackedObjectTable
     /tmp/ccf43P2i.s:823    .text:00000380 FrameMgr_acquireLine
     /tmp/ccf43P2i.s:933    .text:000003ee FrameMgr_acquireFrame
     /tmp/ccf43P2i.s:1092   .bss:00000004 numPrevTrackedObjects
     /tmp/ccf43P2i.s:988    .text:00000422 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