Subversion Repositories svnkaklik

Rev

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

Rev Author Line No. Line
484 kaklik 1
GAS LISTING /tmp/cc0XjEMJ.s 			page 1
151 kaklik 2
 
3
 
4
   1               		.file	"FrameMgr.c"
484 kaklik 5
   2               	__SREG__ = 0x3f
6
   3               	__SP_H__ = 0x3e
7
   4               	__SP_L__ = 0x3d
8
   5               	__tmp_reg__ = 0
9
   6               	__zero_reg__ = 1
10
   7               		.global __do_copy_data
11
   8               		.global __do_clear_bss
12
   9               		.stabs	"/home/kaklik/projects/programy/C/avr/AVRcam/",100,0,2,.Ltext0
13
  10               		.stabs	"FrameMgr.c",100,0,2,.Ltext0
14
  11               		.text
15
  12               	.Ltext0:
16
  13               		.stabs	"gcc2_compiled.",60,0,0,0
17
  14               		.stabs	"int:t(0,1)=r(0,1);-32768;32767;",128,0,0,0
18
  15               		.stabs	"char:t(0,2)=@s8;r(0,2);0;255;",128,0,0,0
19
  16               		.stabs	"long int:t(0,3)=@s32;r(0,3);020000000000;017777777777;",128,0,0,0
20
  17               		.stabs	"unsigned int:t(0,4)=r(0,4);0;0177777;",128,0,0,0
21
  18               		.stabs	"long unsigned int:t(0,5)=@s32;r(0,5);0;037777777777;",128,0,0,0
22
  19               		.stabs	"long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;",128,0,0,
23
  20               		.stabs	"long long unsigned int:t(0,7)=@s64;r(0,7);0;01777777777777777777777;",128,0,0,0
24
  21               		.stabs	"short int:t(0,8)=r(0,8);-32768;32767;",128,0,0,0
25
  22               		.stabs	"short unsigned int:t(0,9)=r(0,9);0;0177777;",128,0,0,0
26
  23               		.stabs	"signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,0
27
  24               		.stabs	"unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,0
28
  25               		.stabs	"float:t(0,12)=r(0,1);4;0;",128,0,0,0
29
  26               		.stabs	"double:t(0,13)=r(0,1);4;0;",128,0,0,0
30
  27               		.stabs	"long double:t(0,14)=r(0,1);4;0;",128,0,0,0
31
  28               		.stabs	"void:t(0,15)=(0,15)",128,0,0,0
32
  29               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/stdlib.h",130,0,0,0
33
  30               		.stabs	"/usr/lib/gcc/avr/4.2.1/include/stddef.h",130,0,0,0
34
  31               		.stabs	"size_t:t(2,1)=(0,4)",128,0,214,0
35
  32               		.stabs	"wchar_t:t(2,2)=(0,1)",128,0,326,0
36
  33               		.stabn	162,0,0,0
37
  34               		.stabs	"div_t:t(1,1)=(1,2)=s4quot:(0,1),0,16;rem:(0,1),16,16;;",128,0,69,0
38
  35               		.stabs	"ldiv_t:t(1,3)=(1,4)=s8quot:(0,3),0,32;rem:(0,3),32,32;;",128,0,75,0
39
  36               		.stabs	"__compar_fn_t:t(1,5)=(1,6)=*(1,7)=f(0,1)",128,0,78,0
40
  37               		.stabn	162,0,0,0
41
  38               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/avr/io.h",130,0,0,0
42
  39               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/avr/sfr_defs.h",130,0,0,0
43
  40               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/inttypes.h",130,0,0,0
44
  41               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/stdint.h",130,0,0,0
45
  42               		.stabs	"int8_t:t(6,1)=(0,10)",128,0,116,0
46
  43               		.stabs	"uint8_t:t(6,2)=(0,11)",128,0,117,0
47
  44               		.stabs	"int16_t:t(6,3)=(0,1)",128,0,118,0
48
  45               		.stabs	"uint16_t:t(6,4)=(0,4)",128,0,119,0
49
  46               		.stabs	"int32_t:t(6,5)=(0,3)",128,0,120,0
50
  47               		.stabs	"uint32_t:t(6,6)=(0,5)",128,0,121,0
51
  48               		.stabs	"int64_t:t(6,7)=(0,6)",128,0,122,0
52
  49               		.stabs	"uint64_t:t(6,8)=(0,7)",128,0,123,0
53
  50               		.stabs	"intptr_t:t(6,9)=(6,3)",128,0,135,0
54
  51               		.stabs	"uintptr_t:t(6,10)=(6,4)",128,0,140,0
55
  52               		.stabs	"int_least8_t:t(6,11)=(6,1)",128,0,152,0
56
  53               		.stabs	"uint_least8_t:t(6,12)=(6,2)",128,0,157,0
57
  54               		.stabs	"int_least16_t:t(6,13)=(6,3)",128,0,162,0
58
  55               		.stabs	"uint_least16_t:t(6,14)=(6,4)",128,0,167,0
59
  56               		.stabs	"int_least32_t:t(6,15)=(6,5)",128,0,172,0
60
  57               		.stabs	"uint_least32_t:t(6,16)=(6,6)",128,0,177,0
61
GAS LISTING /tmp/cc0XjEMJ.s 			page 2
151 kaklik 62
 
63
 
484 kaklik 64
  58               		.stabs	"int_least64_t:t(6,17)=(6,7)",128,0,182,0
65
  59               		.stabs	"uint_least64_t:t(6,18)=(6,8)",128,0,187,0
66
  60               		.stabs	"int_fast8_t:t(6,19)=(6,1)",128,0,200,0
67
  61               		.stabs	"uint_fast8_t:t(6,20)=(6,2)",128,0,205,0
68
  62               		.stabs	"int_fast16_t:t(6,21)=(6,3)",128,0,210,0
69
  63               		.stabs	"uint_fast16_t:t(6,22)=(6,4)",128,0,215,0
70
  64               		.stabs	"int_fast32_t:t(6,23)=(6,5)",128,0,220,0
71
  65               		.stabs	"uint_fast32_t:t(6,24)=(6,6)",128,0,225,0
72
  66               		.stabs	"int_fast64_t:t(6,25)=(6,7)",128,0,230,0
73
  67               		.stabs	"uint_fast64_t:t(6,26)=(6,8)",128,0,235,0
74
  68               		.stabs	"intmax_t:t(6,27)=(6,7)",128,0,249,0
75
  69               		.stabs	"uintmax_t:t(6,28)=(6,8)",128,0,254,0
76
  70               		.stabn	162,0,0,0
77
  71               		.stabs	"int_farptr_t:t(5,1)=(6,5)",128,0,76,0
78
  72               		.stabs	"uint_farptr_t:t(5,2)=(6,6)",128,0,80,0
79
  73               		.stabn	162,0,0,0
151 kaklik 80
  74               		.stabn	162,0,0,0
81
  75               		.stabn	162,0,0,0
484 kaklik 82
  76               		.stabs	"I2CInterface.h",130,0,0,0
83
  77               		.stabs	"CommonDefs.h",130,0,0,0
84
  78               		.stabs	"bool_t:t(8,1)=(0,11)",128,0,56,0
85
  79               		.stabn	162,0,0,0
86
  80               		.stabs	"i2cCmd_t:t(7,1)=(7,2)=s2configReg:(0,11),0,8;data:(0,11),8,8;;",128,0,53,0
87
  81               		.stabn	162,0,0,0
88
  82               		.stabs	" :T(0,16)=@s8;eST_FrameMgr_idle:0,ST_FrameMgr_TrackingFrame:1,ST_FrameMgr_DumpingFrame:2,;
89
  83               		.stabs	"FrameMgr_State_t:t(0,17)=(0,11)",128,0,72,0
90
  84               		.stabs	" :T(0,18)=@s8;enotTracked:0,color1:1,color2:2,color3:3,color4:4,color5:5,color6:6,color7:7
91
  85               		.stabs	"trackedColor_t:t(0,19)=(0,11)",128,0,127,0
92
  86               		.stabs	"trackedObject_t:t(0,20)=(0,21)=s8color:(0,19),0,8;lastLineXStart:(0,11),8,8;lastLineXFinis
93
  87               		.stabs	"FrameMgr_processFrame:F(0,15)",36,0,517,FrameMgr_processFrame
94
  88               	.global	FrameMgr_processFrame
95
  89               		.type	FrameMgr_processFrame, @function
96
  90               	FrameMgr_processFrame:
97
  91               		.stabd	46,0,0
151 kaklik 98
   1:FrameMgr.c    **** /*
99
   2:FrameMgr.c    ****     Copyright (C) 2004    John Orlando
100
   3:FrameMgr.c    ****     
101
   4:FrameMgr.c    ****    AVRcam: a small real-time image processing engine.
102
   5:FrameMgr.c    **** 
103
   6:FrameMgr.c    ****     This program is free software; you can redistribute it and/or
104
   7:FrameMgr.c    ****     modify it under the terms of the GNU General Public
105
   8:FrameMgr.c    ****     License as published by the Free Software Foundation; either
106
   9:FrameMgr.c    ****     version 2 of the License, or (at your option) any later version.
107
  10:FrameMgr.c    **** 
108
  11:FrameMgr.c    ****     This program is distributed in the hope that it will be useful,
109
  12:FrameMgr.c    ****     but WITHOUT ANY WARRANTY; without even the implied warranty of
110
  13:FrameMgr.c    ****     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
111
  14:FrameMgr.c    ****     General Public License for more details.
112
  15:FrameMgr.c    **** 
113
  16:FrameMgr.c    ****     You should have received a copy of the GNU General Public
114
  17:FrameMgr.c    ****     License along with this program; if not, write to the Free Software
115
  18:FrameMgr.c    ****     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
116
  19:FrameMgr.c    **** 
117
  20:FrameMgr.c    ****    For more information on the AVRcam, please contact:
118
  21:FrameMgr.c    **** 
119
  22:FrameMgr.c    ****    john@jrobot.net
484 kaklik 120
  23:FrameMgr.c    **** 
121
GAS LISTING /tmp/cc0XjEMJ.s 			page 3
151 kaklik 122
 
123
 
124
  24:FrameMgr.c    ****    or go to www.jrobot.net for more details regarding the system.
125
  25:FrameMgr.c    **** */
126
  26:FrameMgr.c    **** /*********************************************************
127
  27:FrameMgr.c    **** 	Module Name: FrameMgr.c
128
  28:FrameMgr.c    **** 	Module Date: 04/10/2004
129
  29:FrameMgr.c    **** 	Module Auth: John Orlando
130
  30:FrameMgr.c    **** 	
131
  31:FrameMgr.c    **** 	Description: This modules is responsible for performing
132
  32:FrameMgr.c    **** 	both medium and high level processing on image data.
133
  33:FrameMgr.c    **** 	This is performed at both the line level as well as
134
  34:FrameMgr.c    **** 	the frame level.  It controls the main flow of the
135
  35:FrameMgr.c    **** 	system, adhering to all the critical timing 
136
  36:FrameMgr.c    **** 	requirements (such as when serial data can be transferred,
137
  37:FrameMgr.c    **** 	etc).
138
  38:FrameMgr.c    ****     
139
  39:FrameMgr.c    ****     Revision History:
140
  40:FrameMgr.c    ****     Date        Rel Ver.    Notes
141
  41:FrameMgr.c    ****     4/10/2004      0.1     Module created
142
  42:FrameMgr.c    ****     6/30/2004      1.0     Initial release for Circuit Cellar
143
  43:FrameMgr.c    ****                            contest.
144
  44:FrameMgr.c    ****     11/15/2004     1.2     Updated processLine() function so 
145
  45:FrameMgr.c    ****                            it will remove objects less than
146
  46:FrameMgr.c    ****                            a specified length/width (reduces
147
  47:FrameMgr.c    ****                            shot noise)
148
  48:FrameMgr.c    **** *********************************************************/
149
  49:FrameMgr.c    **** 
150
  50:FrameMgr.c    **** /*	Includes */
151
  51:FrameMgr.c    **** #include <stdlib.h>
152
  52:FrameMgr.c    **** #include <string.h>
153
  53:FrameMgr.c    **** #include <avr/io.h>
154
  54:FrameMgr.c    **** #include "Executive.h"
155
  55:FrameMgr.c    **** #include "UIMgr.h"
156
  56:FrameMgr.c    **** #include "FrameMgr.h"
157
  57:FrameMgr.c    **** #include "CamInterface.h"
158
  58:FrameMgr.c    **** #include "UartInterface.h"
159
  59:FrameMgr.c    **** #include "Utility.h"
160
  60:FrameMgr.c    **** #include "I2CInterface.h"
161
  61:FrameMgr.c    **** #include "CamConfig.h"
162
  62:FrameMgr.c    **** #include "CommonDefs.h"
163
  63:FrameMgr.c    **** 
164
  64:FrameMgr.c    **** /* 	Local Structures and Typedefs */
165
  65:FrameMgr.c    **** enum
166
  66:FrameMgr.c    **** {
167
  67:FrameMgr.c    **** 	ST_FrameMgr_idle,
168
  68:FrameMgr.c    **** 	ST_FrameMgr_TrackingFrame,
169
  69:FrameMgr.c    **** 	ST_FrameMgr_DumpingFrame
170
  70:FrameMgr.c    **** };
171
  71:FrameMgr.c    **** 
172
  72:FrameMgr.c    **** typedef unsigned char FrameMgr_State_t;
173
  73:FrameMgr.c    **** 
174
  74:FrameMgr.c    **** /*  Definitions */
175
  75:FrameMgr.c    **** /* The most objects that can be tracked at any one time is 8.  
176
  76:FrameMgr.c    **** This number is determined by the number of bytes that can be
177
  77:FrameMgr.c    **** sent out during a frame (one byte per line, 144 lines per frame) 
178
  78:FrameMgr.c    **** with the number of bytes in a tracked object (7) + some wiggle
179
  79:FrameMgr.c    **** room :-) ... I guess this could be increased to around 20 if
484 kaklik 180
  80:FrameMgr.c    **** we had enough room and cycles to process objects between lines */
181
GAS LISTING /tmp/cc0XjEMJ.s 			page 4
151 kaklik 182
 
183
 
184
  81:FrameMgr.c    **** #define MAX_TRACKED_OBJECTS	8
185
  82:FrameMgr.c    **** 
186
  83:FrameMgr.c    **** /* This defines the number of bytes that make up a trackedObject_t
187
  84:FrameMgr.c    **** structure... */
188
  85:FrameMgr.c    **** #define SIZE_OF_TRACKED_OBJECT 8
189
  86:FrameMgr.c    **** 
190
  87:FrameMgr.c    **** /* This define is used to turn off the timer overflow interrupt
191
  88:FrameMgr.c    **** that is generated when the PCLK overflows TIMER1 */
192
  89:FrameMgr.c    **** #define DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK 0xFB
193
  90:FrameMgr.c    **** 
194
  91:FrameMgr.c    **** /* This define is used to determine if a run length is too small
195
  92:FrameMgr.c    **** to be concerned with.  This helps to reduce the number of false
196
  93:FrameMgr.c    **** positives. */
197
  94:FrameMgr.c    **** #define MIN_OBJECT_TRACKING_WIDTH 3
198
  95:FrameMgr.c    **** 
199
  96:FrameMgr.c    **** /* This define is used to determine if an object has enough
200
  97:FrameMgr.c    **** height to be considered worth tracking...it is used to reduce
201
  98:FrameMgr.c    **** shot noise */
202
  99:FrameMgr.c    **** #define MIN_OBJECT_TRACKING_HEIGHT 3
203
 100:FrameMgr.c    **** 
204
 101:FrameMgr.c    **** /* This define is used to indicate how often the filter routine
205
 102:FrameMgr.c    **** that removes objects less than MIN_OBJECT_TRACKING_HEIGHT should
206
 103:FrameMgr.c    **** be executed.  It is measured in a number of lines (7 nominally). */
207
 104:FrameMgr.c    **** #define RUN_OBJECT_FILTER_MASK 0x07
208
 105:FrameMgr.c    **** 
209
 106:FrameMgr.c    **** /* This enum describes the possible colors that can
210
 107:FrameMgr.c    **** be tracked by the system.  This can't be represented as
211
 108:FrameMgr.c    **** simple color names (red, brown, etc) due to the fact that
212
 109:FrameMgr.c    **** the user sets which colors will be associated with which
213
 110:FrameMgr.c    **** bits.  Remember...after the AND operation of the indexed
214
 111:FrameMgr.c    **** color map values executes, either a single bit indicating
215
 112:FrameMgr.c    **** the color should be set, or no bits indicating that the
216
 113:FrameMgr.c    **** color isn't represented in the color map (notTracked). */
217
 114:FrameMgr.c    **** enum
218
 115:FrameMgr.c    **** {
219
 116:FrameMgr.c    **** 	notTracked,
220
 117:FrameMgr.c    **** 	color1,		/* bit 1 color */
221
 118:FrameMgr.c    **** 	color2,		/* bit 2 color */
222
 119:FrameMgr.c    **** 	color3,		/* bit 3 color */
223
 120:FrameMgr.c    **** 	color4,		/* bit 4 color */
224
 121:FrameMgr.c    **** 	color5,		/* bit 5 color */
225
 122:FrameMgr.c    **** 	color6,		/* bit 6 color */
226
 123:FrameMgr.c    **** 	color7,		/* bit 7 color */
227
 124:FrameMgr.c    **** 	color8		/* bit 8 color */
228
 125:FrameMgr.c    **** };
229
 126:FrameMgr.c    **** 
230
 127:FrameMgr.c    **** typedef unsigned char trackedColor_t;
231
 128:FrameMgr.c    **** 
232
 129:FrameMgr.c    **** /* This structure defines the info that needs to be
233
 130:FrameMgr.c    **** maintained for each trackedObject in the trackingTable */
234
 131:FrameMgr.c    **** typedef struct
235
 132:FrameMgr.c    **** {
236
 133:FrameMgr.c    **** 	trackedColor_t  color;
237
 134:FrameMgr.c    **** 	unsigned char lastLineXStart;
238
 135:FrameMgr.c    **** 	unsigned char lastLineXFinish;
239
 136:FrameMgr.c    **** 	unsigned char x_upperLeft;
484 kaklik 240
 137:FrameMgr.c    **** 	unsigned char y_upperLeft;
241
GAS LISTING /tmp/cc0XjEMJ.s 			page 5
151 kaklik 242
 
243
 
244
 138:FrameMgr.c    **** 	unsigned char x_lowerRight;
245
 139:FrameMgr.c    **** 	unsigned char y_lowerRight;
246
 140:FrameMgr.c    **** 	unsigned char objectValid;  /* used to be a fill byte...now it is
247
 141:FrameMgr.c    ****                                      used to determine if the object is valid
248
 142:FrameMgr.c    ****                                      or not...it gets invalidated if it is
249
 143:FrameMgr.c    ****                                      determined that it is too small, or
250
 144:FrameMgr.c    ****                                      that the object is within another object */
251
 145:FrameMgr.c    **** } trackedObject_t;
252
 146:FrameMgr.c    **** 
253
 147:FrameMgr.c    **** /* These defines are used to index into each individual element in the
254
 148:FrameMgr.c    **** trackedObject_t structure.  This seems to be MUCH more efficient than
255
 149:FrameMgr.c    **** accessing the elements in GCC. */
256
 150:FrameMgr.c    **** #define COLOR_OFFSET                0
257
 151:FrameMgr.c    **** #define LAST_LINE_X_START_OFFSET    1
258
 152:FrameMgr.c    **** #define LAST_LINE_X_FINISH_OFFSET   2
259
 153:FrameMgr.c    **** #define X_UPPER_LEFT_OFFSET         3
260
 154:FrameMgr.c    **** #define Y_UPPER_LEFT_OFFSET         4
261
 155:FrameMgr.c    **** #define X_LOWER_RIGHT_OFFSET        5
262
 156:FrameMgr.c    **** #define Y_LOWER_RIGHT_OFFSET        6
263
 157:FrameMgr.c    **** #define VALID_OBJECT_OFFSET         7
264
 158:FrameMgr.c    **** 
265
 159:FrameMgr.c    **** /*  Local Variables */
266
 160:FrameMgr.c    **** /* The trackedObjectTable is used to hold up to eight tracked objects
267
 161:FrameMgr.c    **** while they are being acquired. */
268
 162:FrameMgr.c    **** static trackedObject_t trackedObjectTable[MAX_TRACKED_OBJECTS];
269
 163:FrameMgr.c    **** static trackedObject_t *pCurrentTrackedObjectTable = trackedObjectTable;
270
 164:FrameMgr.c    **** static unsigned char lineCount = 0;
271
 165:FrameMgr.c    **** static FrameMgr_State_t currentState = ST_FrameMgr_idle;
272
 166:FrameMgr.c    **** static unsigned char numCurrTrackedObjects = 0;
273
 167:FrameMgr.c    **** static unsigned char numPrevTrackedObjects = 0;
274
 168:FrameMgr.c    **** static unsigned char trackedLineCount = 0;
275
 169:FrameMgr.c    **** 
276
 170:FrameMgr.c    **** /*  Local Functions  */
277
 171:FrameMgr.c    **** static void FrameMgr_findConnectedness(void);
278
 172:FrameMgr.c    **** 
279
 173:FrameMgr.c    **** /*  Extern Functions */
280
 174:FrameMgr.c    **** /* These functions are located in assembly files, and thus
281
 175:FrameMgr.c    **** must be externed here so they can be referenced in the source below. */
282
 176:FrameMgr.c    **** extern void CamIntAsm_waitForNewTrackingFrame(unsigned char *pBuffer, unsigned char *pMemLookup);
283
 177:FrameMgr.c    **** extern void CamIntAsm_waitForNewDumpFrame(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);
284
 178:FrameMgr.c    **** extern void CamIntAsm_acquireTrackingLine(unsigned char *pBuffer, unsigned char *pMemLookup);
285
 179:FrameMgr.c    **** extern void CamIntAsm_acquireDumpLine(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);
286
 180:FrameMgr.c    **** 
287
 181:FrameMgr.c    **** /***********************************************************
288
 182:FrameMgr.c    **** 	Function Name: FrameMgr_init
289
 183:FrameMgr.c    **** 	Function Description: This function is responsible
290
 184:FrameMgr.c    **** 	for initializing the FrameMgr.  This includes 
291
 185:FrameMgr.c    **** 	setting up the various buffers and data needed to 
292
 186:FrameMgr.c    **** 	process each frame of image data.
293
 187:FrameMgr.c    **** 	Inputs:  none
294
 188:FrameMgr.c    **** 	Outputs: none
295
 189:FrameMgr.c    **** ***********************************************************/	
296
 190:FrameMgr.c    **** void FrameMgr_init(void)
297
 191:FrameMgr.c    **** {
298
 192:FrameMgr.c    **** 	memset(trackedObjectTable,0x00,sizeof(trackedObjectTable));
299
 193:FrameMgr.c    **** }
484 kaklik 300
 194:FrameMgr.c    **** 
301
GAS LISTING /tmp/cc0XjEMJ.s 			page 6
151 kaklik 302
 
303
 
304
 195:FrameMgr.c    **** 
305
 196:FrameMgr.c    **** /***********************************************************
306
 197:FrameMgr.c    **** 	Function Name: FrameMgr_dispatchEvent
307
 198:FrameMgr.c    **** 	Function Description: This function is responsible for
308
 199:FrameMgr.c    **** 	taking an incoming event and performing the needed
309
 200:FrameMgr.c    **** 	actions with it as pertains to the FrameMgr.
310
 201:FrameMgr.c    **** 	Inputs:  event - the generated event
311
 202:FrameMgr.c    **** 	Outputs: none
312
 203:FrameMgr.c    **** ***********************************************************/	
313
 204:FrameMgr.c    **** void FrameMgr_dispatchEvent(unsigned char event)
314
 205:FrameMgr.c    **** {	
315
 206:FrameMgr.c    **** 	switch(event)
316
 207:FrameMgr.c    **** 	{
317
 208:FrameMgr.c    **** 		case EV_DUMP_FRAME:
318
 209:FrameMgr.c    ****             /* try re-initializing the camera before we start dumping */
319
 210:FrameMgr.c    ****             
320
 211:FrameMgr.c    **** 			CamConfig_setCamReg(0x11,0x01);  /* reduce the frame rate for dumping*/
321
 212:FrameMgr.c    **** 			CamConfig_sendFifoCmds();
322
 213:FrameMgr.c    **** 			Utility_delay(1000);		/* allow the new frame rate to settle */
323
 214:FrameMgr.c    **** 			lineCount = 0;
324
 215:FrameMgr.c    **** 			currentState = ST_FrameMgr_DumpingFrame;
325
 216:FrameMgr.c    **** 			//CamIntAsm_waitForNewDumpFrame(currentLineBuffer,previousLineBuffer);
326
 217:FrameMgr.c    ****             FrameMgr_acquireLine();
327
 218:FrameMgr.c    **** 			break;
328
 219:FrameMgr.c    **** 		
329
 220:FrameMgr.c    **** 		case EV_ENABLE_TRACKING:
330
 221:FrameMgr.c    **** 			currentState = ST_FrameMgr_TrackingFrame;					
331
 222:FrameMgr.c    **** 			FrameMgr_acquireFrame();
332
 223:FrameMgr.c    **** 			break;
333
 224:FrameMgr.c    **** 			
334
 225:FrameMgr.c    **** 		case EV_ACQUIRE_FRAME_COMPLETE:
335
 226:FrameMgr.c    **** 			FrameMgr_processFrame();
336
 227:FrameMgr.c    **** 			break;
337
 228:FrameMgr.c    **** 		
338
 229:FrameMgr.c    **** 		case EV_PROCESS_FRAME_COMPLETE:
339
 230:FrameMgr.c    **** 			FrameMgr_acquireFrame();
340
 231:FrameMgr.c    **** 			break;
341
 232:FrameMgr.c    **** 
342
 233:FrameMgr.c    **** 		case EV_SERIAL_DATA_RECEIVED:
343
 234:FrameMgr.c    **** 			if (currentState != ST_FrameMgr_idle)
344
 235:FrameMgr.c    **** 			{
345
 236:FrameMgr.c    **** 				/* we need to go back to processing line data, since
346
 237:FrameMgr.c    **** 				serial data reception interrupted us....just trash the
347
 238:FrameMgr.c    **** 				frame and act like the frame has been processed, which
348
 239:FrameMgr.c    **** 				will kick off the system to wait for the next line */
349
 240:FrameMgr.c    **** 				PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);
350
 241:FrameMgr.c    **** 			}
351
 242:FrameMgr.c    **** 			break;
352
 243:FrameMgr.c    **** 			
353
 244:FrameMgr.c    **** 		case EV_DISABLE_TRACKING:
354
 245:FrameMgr.c    **** 			/* tracking needs to be turned off */
355
 246:FrameMgr.c    **** 			currentState = ST_FrameMgr_idle;
356
 247:FrameMgr.c    **** 			break;
357
 248:FrameMgr.c    **** 	}
358
 249:FrameMgr.c    **** }
359
 250:FrameMgr.c    **** 
484 kaklik 360
 251:FrameMgr.c    **** /***********************************************************
361
GAS LISTING /tmp/cc0XjEMJ.s 			page 7
151 kaklik 362
 
363
 
364
 252:FrameMgr.c    **** 	Function Name: FrameMgr_acquireFrame
365
 253:FrameMgr.c    **** 	Function Description: This function is responsible for
366
 254:FrameMgr.c    **** 	beginning of the acquisition of a new frame of data
367
 255:FrameMgr.c    **** 	from the camera interface. The acquisition of this line 
368
 256:FrameMgr.c    **** 	depends on the current state of the FrameMgr.
369
 257:FrameMgr.c    **** 	Inputs:  none
370
 258:FrameMgr.c    **** 	Outputs: none
371
 259:FrameMgr.c    **** ***********************************************************/	
372
 260:FrameMgr.c    **** void FrameMgr_acquireFrame(void)
373
 261:FrameMgr.c    **** {
374
 262:FrameMgr.c    **** 	if (currentState == ST_FrameMgr_TrackingFrame)
375
 263:FrameMgr.c    **** 	{
376
 264:FrameMgr.c    **** 		trackedLineCount = 0;
377
 265:FrameMgr.c    **** 		numPrevTrackedObjects = numCurrTrackedObjects;
378
 266:FrameMgr.c    **** 		numCurrTrackedObjects = 0;
379
 267:FrameMgr.c    **** 		
380
 268:FrameMgr.c    **** 		/* clear out the tracking table, and wait for the new frame
381
 269:FrameMgr.c    **** 		to start */
382
 270:FrameMgr.c    **** 		memset(trackedObjectTable,0x00,sizeof(trackedObjectTable));
383
 271:FrameMgr.c    **** 		//CamIntAsm_waitForNewTrackingFrame(currentLineBuffer,colorMap);
384
 272:FrameMgr.c    ****         WAIT_FOR_VSYNC_HIGH();
385
 273:FrameMgr.c    ****         CamIntAsm_acquireTrackingLine(currentLineBuffer,colorMap);
386
 274:FrameMgr.c    **** 	}
387
 275:FrameMgr.c    **** }
388
 276:FrameMgr.c    **** 
389
 277:FrameMgr.c    **** /***********************************************************
390
 278:FrameMgr.c    **** 	Function Name: FrameMgr_acquireLine
391
 279:FrameMgr.c    **** 	Function Description: This function is responsible for
392
 280:FrameMgr.c    **** 	acquiring a line of data from the camera interface.
393
 281:FrameMgr.c    **** 	The acquisition of this line depends on the current
394
 282:FrameMgr.c    **** 	state of the FrameMgr.
395
 283:FrameMgr.c    **** 	Inputs:  none
396
 284:FrameMgr.c    **** 	Outputs: none
397
 285:FrameMgr.c    **** ***********************************************************/	
398
 286:FrameMgr.c    **** void FrameMgr_acquireLine(void)
399
 287:FrameMgr.c    **** {
400
 288:FrameMgr.c    **** 	unsigned char tmpLineCount;
401
 289:FrameMgr.c    **** 	
402
 290:FrameMgr.c    **** 	/* clearing out the buffers takes too long...we should
403
 291:FrameMgr.c    **** 	just overwrite the data here without a problem when
404
 292:FrameMgr.c    **** 	we start acquiring...at no point do we check for 
405
 293:FrameMgr.c    **** 	a 0x00 value in the current or previous lineBuffers,
406
 294:FrameMgr.c    **** 	so it was a bit excessive :-)  */
407
 295:FrameMgr.c    **** 	
408
 296:FrameMgr.c    **** 	/* check which state we are in and proceed as needed */
409
 297:FrameMgr.c    **** 	if (currentState == ST_FrameMgr_DumpingFrame)
410
 298:FrameMgr.c    **** 	{
411
 299:FrameMgr.c    **** 		tmpLineCount = lineCount*2;
412
 300:FrameMgr.c    ****         
413
 301:FrameMgr.c    ****         /* clearing out the line data in dump mode is ok, and actually
414
 302:FrameMgr.c    ****         is needed, since it is possible for the first dump line in
415
 303:FrameMgr.c    ****         a frame to come back with the last line captured of the
416
 304:FrameMgr.c    ****         last capture session...*/
417
 305:FrameMgr.c    ****         memset(currentLineBuffer,0x00,LENGTH_OF_LINE_BUFFER);
418
 306:FrameMgr.c    ****         memset(previousLineBuffer,0x00,LENGTH_OF_LINE_BUFFER);
419
 307:FrameMgr.c    **** 		/* wait for another VSYNC so we know which frame to use 
484 kaklik 420
 308:FrameMgr.c    **** 		to start looking for a line to receive */
421
GAS LISTING /tmp/cc0XjEMJ.s 			page 8
151 kaklik 422
 
423
 
424
 309:FrameMgr.c    **** 		WAIT_FOR_VSYNC_HIGH();  
425
 310:FrameMgr.c    **** 		WAIT_FOR_VSYNC_LOW();
426
 311:FrameMgr.c    **** 		
427
 312:FrameMgr.c    **** 		/* look at lineCount to determine how many HREFs we should
428
 313:FrameMgr.c    **** 		wait before we start sampling */
429
 314:FrameMgr.c    **** 		while(tmpLineCount != 0)
430
 315:FrameMgr.c    **** 		{
431
 316:FrameMgr.c    **** 			WAIT_FOR_HREF_HIGH(); 
432
 317:FrameMgr.c    **** 			tmpLineCount--;
433
 318:FrameMgr.c    **** 			WAIT_FOR_HREF_LOW(); 
434
 319:FrameMgr.c    **** 		}
435
 320:FrameMgr.c    **** 		
436
 321:FrameMgr.c    **** 		/*  we should now be ready to sample our line...*/
437
 322:FrameMgr.c    **** 		CamIntAsm_acquireDumpLine(currentLineBuffer,previousLineBuffer);
438
 323:FrameMgr.c    **** 	}		
439
 324:FrameMgr.c    **** 	else if (currentState == ST_FrameMgr_TrackingFrame)
440
 325:FrameMgr.c    **** 	{
441
 326:FrameMgr.c    **** 		WAIT_FOR_HREF_LOW();
442
 327:FrameMgr.c    **** 		CamIntAsm_acquireTrackingLine(currentLineBuffer,colorMap);
443
 328:FrameMgr.c    **** 	}
444
 329:FrameMgr.c    **** }
445
 330:FrameMgr.c    **** 
446
 331:FrameMgr.c    **** /***********************************************************
447
 332:FrameMgr.c    **** 	Function Name: FrameMgr_processLine
448
 333:FrameMgr.c    **** 	Function Description: This function is responsible for
449
 334:FrameMgr.c    **** 	parsing the received image line and performing either
450
 335:FrameMgr.c    **** 	connected region mapping (if in the Tracking state) or
451
 336:FrameMgr.c    **** 	sending out the raw sampled data (if in the Dumping
452
 337:FrameMgr.c    **** 	state).
453
 338:FrameMgr.c    **** 	Inputs:  none
454
 339:FrameMgr.c    **** 	Outputs: none
455
 340:FrameMgr.c    **** ***********************************************************/	
456
 341:FrameMgr.c    **** void FrameMgr_processLine(void)
457
 342:FrameMgr.c    **** {
458
 343:FrameMgr.c    **** 	unsigned char i;
459
 344:FrameMgr.c    **** 	volatile unsigned char dataToSend;
460
 345:FrameMgr.c    **** 	unsigned char *pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;
461
 346:FrameMgr.c    **** #ifdef DEBUG_TRACKED_LINE    
462
 347:FrameMgr.c    **** 	unsigned char *pSendData;
463
 348:FrameMgr.c    ****     unsigned char asciiBuffer[5];
464
 349:FrameMgr.c    ****     unsigned char pixelCount = 0;
465
 350:FrameMgr.c    **** #endif    
466
 351:FrameMgr.c    **** 	
467
 352:FrameMgr.c    **** 	if (currentState == ST_FrameMgr_DumpingFrame)
468
 353:FrameMgr.c    **** 	{
469
 354:FrameMgr.c    **** 		/* we want to sit in a tight loop and send the acquired data
470
 355:FrameMgr.c    **** 		sitting in current and previous line buffers out the serial
471
 356:FrameMgr.c    **** 		port...it is sent out the serial port immediately instead
472
 357:FrameMgr.c    **** 		of going into the UIMgr tx fifo because we can't do anything
473
 358:FrameMgr.c    **** 		until its sent out anyway...may as well just get it out now	*/
474
 359:FrameMgr.c    **** 		
475
 360:FrameMgr.c    **** 		/* currentLineBuffer is getting "g" previousLineBuffer is getting "b-r" */
476
 361:FrameMgr.c    **** 		UartInt_txByte(0x0B);			/* send the header byte */
477
 362:FrameMgr.c    **** 		UartInt_txByte(lineCount);		/* send the line count */
478
 363:FrameMgr.c    **** 		for (i=0; i<NUM_PIXELS_IN_A_DUMP_LINE; i+=2)
479
 364:FrameMgr.c    **** 		{
484 kaklik 480
 365:FrameMgr.c    **** 			/* when a dump line is sampled, the upper byte can potentially
481
GAS LISTING /tmp/cc0XjEMJ.s 			page 9
151 kaklik 482
 
483
 
484
 366:FrameMgr.c    **** 			have garbage in it...we don't have time to mask it off as we're
485
 367:FrameMgr.c    **** 			sampling, so it is done here before we send it out...we also
486
 368:FrameMgr.c    **** 			combine the samples together so we really are sending up a
487
 369:FrameMgr.c    **** 			sample for line N as well as line N+1 */
488
 370:FrameMgr.c    **** 			dataToSend = currentLineBuffer[i];
489
 371:FrameMgr.c    **** 			dataToSend &= 0x0F;
490
 372:FrameMgr.c    **** 			dataToSend <<= 4;
491
 373:FrameMgr.c    **** 			dataToSend |= (previousLineBuffer[i] & 0x0F);
492
 374:FrameMgr.c    **** 			
493
 375:FrameMgr.c    **** 			/* dataToSend should be packed now */
494
 376:FrameMgr.c    **** 			UartInt_txByte(dataToSend);
495
 377:FrameMgr.c    **** 			
496
 378:FrameMgr.c    **** 			/* flip the colors around since we are doing all G on Y and BR on UV */
497
 379:FrameMgr.c    **** 			dataToSend = previousLineBuffer[i+1];
498
 380:FrameMgr.c    **** 			dataToSend &= 0x0F;
499
 381:FrameMgr.c    **** 			dataToSend <<= 4;
500
 382:FrameMgr.c    **** 			dataToSend |= (currentLineBuffer[i+1] & 0x0F);
501
 383:FrameMgr.c    **** 			
502
 384:FrameMgr.c    **** 			/* dataToSend should be packed now */
503
 385:FrameMgr.c    **** 			UartInt_txByte(dataToSend);
504
 386:FrameMgr.c    **** 		}
505
 387:FrameMgr.c    **** 		UartInt_txByte(0x0F);  /* send line end */
506
 388:FrameMgr.c    **** 		/* once all the data is sent, increment out line count by 2 since
507
 389:FrameMgr.c    **** 		we really get 2 lines worth of pixels on each pass */
508
 390:FrameMgr.c    **** 		/* Update...increment only by 1, but only send 72 double-lines */
509
 391:FrameMgr.c    **** 		lineCount++;
510
 392:FrameMgr.c    **** 		
511
 393:FrameMgr.c    **** 		/* check to see if we have retrieved all of the needed lines */
512
 394:FrameMgr.c    **** 		if (lineCount >= 72)  /* half 144, since we send two lines at a time */
513
 395:FrameMgr.c    **** 		{
514
 396:FrameMgr.c    **** 			/* we're done, so send the dump complete?...nope, just change
515
 397:FrameMgr.c    **** 			states and we should be fine */
516
 398:FrameMgr.c    **** 			lineCount = 0;
517
 399:FrameMgr.c    **** 			currentState = ST_FrameMgr_idle;
518
 400:FrameMgr.c    **** 			
519
 401:FrameMgr.c    **** 			/* disable the PCLK counting overflow interrupt */
520
 402:FrameMgr.c    **** 			TIMSK &= DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK;
521
 403:FrameMgr.c    **** 			
522
 404:FrameMgr.c    **** 			CamConfig_setCamReg(0x11,0x00);  /* reset the frame rate to normal*/
523
 405:FrameMgr.c    **** 			CamConfig_sendFifoCmds();
524
 406:FrameMgr.c    **** 		}
525
 407:FrameMgr.c    **** 		else
526
 408:FrameMgr.c    **** 		{
527
 409:FrameMgr.c    **** 			/* we have more lines to acquire in this frame, so keep on truckin...*/
528
 410:FrameMgr.c    **** 			PUBLISH_FAST_EVENT(FEV_PROCESS_LINE_COMPLETE);
529
 411:FrameMgr.c    **** 		}
530
 412:FrameMgr.c    **** 	}
531
 413:FrameMgr.c    **** 	else if (currentState == ST_FrameMgr_TrackingFrame)
532
 414:FrameMgr.c    **** 	{
533
 415:FrameMgr.c    **** #ifdef DEBUG_TRACKED_LINE	
534
 416:FrameMgr.c    **** 		/* send the received line over serial...this should only send
535
 417:FrameMgr.c    **** 		until a pixelCount == 176 */
536
 418:FrameMgr.c    **** 		pSendData = currentLineBuffer;
537
 419:FrameMgr.c    **** 		itoa(trackedLineCount,asciiBuffer,10);
538
 420:FrameMgr.c    **** 		UIMgr_txBuffer(asciiBuffer,3);
539
 421:FrameMgr.c    **** 		UIMgr_txBuffer(" ",1);
484 kaklik 540
 422:FrameMgr.c    **** 		while(pixelCount < ACTUAL_NUM_PIXELS_IN_A_LINE)  
541
GAS LISTING /tmp/cc0XjEMJ.s 			page 10
151 kaklik 542
 
543
 
544
 423:FrameMgr.c    **** 		{
545
 424:FrameMgr.c    **** 			memset(asciiBuffer,0x00,5);
546
 425:FrameMgr.c    **** 			itoa(*pSendData++,asciiBuffer,10);	/* color is first byte */
547
 426:FrameMgr.c    **** 			UIMgr_txBuffer(asciiBuffer,3); /* 3 ascii bytes for data */
548
 427:FrameMgr.c    **** 			UIMgr_txBuffer(" ",1);
549
 428:FrameMgr.c    **** 
550
 429:FrameMgr.c    **** 			pixelCount += *pSendData;	/* run-length is second byte */
551
 430:FrameMgr.c    **** 			memset(asciiBuffer,0x00,5);
552
 431:FrameMgr.c    **** 			itoa(*pSendData++,asciiBuffer,10);
553
 432:FrameMgr.c    **** 			UIMgr_txBuffer(asciiBuffer,3);
554
 433:FrameMgr.c    **** 			UIMgr_txBuffer(" ",1);
555
 434:FrameMgr.c    **** 		}
556
 435:FrameMgr.c    **** 		UIMgr_txBuffer("\n\r",2);
557
 436:FrameMgr.c    **** 
558
 437:FrameMgr.c    **** 		trackedLineCount++;
559
 438:FrameMgr.c    **** 		if (trackedLineCount == 144)
560
 439:FrameMgr.c    **** 		{
561
 440:FrameMgr.c    **** 			UIMgr_txBuffer("  FC  \n\r",8);
562
 441:FrameMgr.c    **** 			trackedLineCount = 0;
563
 442:FrameMgr.c    **** 			PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);
564
 443:FrameMgr.c    **** 		}
565
 444:FrameMgr.c    **** 		else
566
 445:FrameMgr.c    **** 		{
567
 446:FrameMgr.c    **** 			PUBLISH_EVENT(EV_PROCESS_LINE_COMPLETE);
568
 447:FrameMgr.c    **** 		}	
569
 448:FrameMgr.c    **** #else
570
 449:FrameMgr.c    ****         /* determine if any of the RLE blocks overlap */
571
 450:FrameMgr.c    **** 		FrameMgr_findConnectedness();
572
 451:FrameMgr.c    ****         
573
 452:FrameMgr.c    ****         /* we also want to remove any objects that are less than
574
 453:FrameMgr.c    ****         a minimum height...we already removed portions of the 
575
 454:FrameMgr.c    ****         run-length that are less than MIN_PIXEL_WIDTH in the
576
 455:FrameMgr.c    ****         findConnectedness() routine...doing it here instead of 
577
 456:FrameMgr.c    ****         a function to speed things up...this may end up slowing down the
578
 457:FrameMgr.c    ****         frame rate slightly, and can be removed if this isn't needed */
579
 458:FrameMgr.c    ****   
580
 459:FrameMgr.c    ****         /* run this routine once every 8 lines */       
581
 460:FrameMgr.c    ****         if ( (trackedLineCount & RUN_OBJECT_FILTER_MASK) == RUN_OBJECT_FILTER_MASK)
582
 461:FrameMgr.c    ****         {
583
 462:FrameMgr.c    ****             for (i=0; i<MAX_TRACKED_OBJECTS; i++)
584
 463:FrameMgr.c    ****             {
585
 464:FrameMgr.c    ****                 if ( *(pTrackedObjectData + VALID_OBJECT_OFFSET) == TRUE)
586
 465:FrameMgr.c    ****                 {
587
 466:FrameMgr.c    ****                     /* check to see if the object is already in
588
 467:FrameMgr.c    ****                     our past...i.e., its last */
589
 468:FrameMgr.c    ****                     if ( (*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) - 
590
 469:FrameMgr.c    ****                           *(pTrackedObjectData + Y_UPPER_LEFT_OFFSET)) < MIN_OBJECT_TRACKING_HEIGHT
591
 470:FrameMgr.c    ****                     {
592
 471:FrameMgr.c    ****                         /* the object is less than the minimum height...see if it is adjacent
593
 472:FrameMgr.c    ****                         to the current line we just processed...if so, leave it here...otherwise,
594
 473:FrameMgr.c    ****                         it needs to be invalidated since its too small */
595
 474:FrameMgr.c    ****                         if ( trackedLineCount - *(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) > 2)
596
 475:FrameMgr.c    ****                         {
597
 476:FrameMgr.c    ****                             /* invalidate the object */
598
 477:FrameMgr.c    ****                             *(pTrackedObjectData + VALID_OBJECT_OFFSET) = FALSE;
599
 478:FrameMgr.c    ****                             numCurrTrackedObjects--;
484 kaklik 600
 479:FrameMgr.c    ****                         }
601
GAS LISTING /tmp/cc0XjEMJ.s 			page 11
151 kaklik 602
 
603
 
604
 480:FrameMgr.c    ****                     }
605
 481:FrameMgr.c    ****                 }
606
 482:FrameMgr.c    ****                 pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
607
 483:FrameMgr.c    ****             }
608
 484:FrameMgr.c    ****         }     
609
 485:FrameMgr.c    ****  
610
 486:FrameMgr.c    **** 		trackedLineCount++;
611
 487:FrameMgr.c    **** 		if (trackedLineCount == ACTUAL_NUM_LINES_IN_A_FRAME)
612
 488:FrameMgr.c    **** 		{
613
 489:FrameMgr.c    **** 			/* an entire frame of tracking data has been acquired, so
614
 490:FrameMgr.c    **** 			publish an event letting the system know this fact */
615
 491:FrameMgr.c    **** 			PUBLISH_EVENT(EV_ACQUIRE_FRAME_COMPLETE);
616
 492:FrameMgr.c    **** 			/* disable the PCLK counting overflow interrupt */
617
 493:FrameMgr.c    **** 			TIMSK &= DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK;
618
 494:FrameMgr.c    **** 			trackedLineCount = 0;
619
 495:FrameMgr.c    **** 		}
620
 496:FrameMgr.c    **** 		else
621
 497:FrameMgr.c    **** 		{
622
 498:FrameMgr.c    **** 			PUBLISH_FAST_EVENT(FEV_PROCESS_LINE_COMPLETE);
623
 499:FrameMgr.c    **** 		}
624
 500:FrameMgr.c    **** #endif		
625
 501:FrameMgr.c    **** 	}
626
 502:FrameMgr.c    **** 	else
627
 503:FrameMgr.c    **** 	{
628
 504:FrameMgr.c    **** 		/* ...and here? */
629
 505:FrameMgr.c    **** 	}
630
 506:FrameMgr.c    **** }
631
 507:FrameMgr.c    **** 
632
 508:FrameMgr.c    **** /***********************************************************
633
 509:FrameMgr.c    **** 	Function Name: FrameMgr_processFrame
634
 510:FrameMgr.c    **** 	Function Description: This function is responsible for
635
 511:FrameMgr.c    **** 	parsing the completed frame and performing all actions
636
 512:FrameMgr.c    **** 	needed at this level.
637
 513:FrameMgr.c    **** 	Inputs:  none
638
 514:FrameMgr.c    **** 	Outputs: none
639
 515:FrameMgr.c    **** ***********************************************************/	
640
 516:FrameMgr.c    **** void FrameMgr_processFrame(void)
641
 517:FrameMgr.c    **** {
484 kaklik 642
  92               		.stabn	68,0,517,.LM0-.LFBB1
643
  93               	.LM0:
644
  94               	.LFBB1:
151 kaklik 645
  95               	/* prologue: frame size=0 */
646
  96 0000 DF92      		push r13
647
  97 0002 EF92      		push r14
648
  98 0004 FF92      		push r15
649
  99 0006 0F93      		push r16
650
 100 0008 1F93      		push r17
651
 101 000a CF93      		push r28
652
 102 000c DF93      		push r29
653
 103               	/* prologue end (size=7) */
654
 518:FrameMgr.c    **** 	unsigned char i,k,color;
655
 519:FrameMgr.c    **** #if DEBUG_FRAME_DATA    
656
 520:FrameMgr.c    **** 	unsigned char asciiBuffer[5];
657
 521:FrameMgr.c    ****     unsigned char j;
658
 522:FrameMgr.c    **** #endif    
659
 523:FrameMgr.c    **** 	unsigned char *pTableData = (unsigned char *)pCurrentTrackedObjectTable;
484 kaklik 660
 104               		.stabn	68,0,523,.LM1-.LFBB1
661
GAS LISTING /tmp/cc0XjEMJ.s 			page 12
151 kaklik 662
 
663
 
664
 105               	.LM1:
665
 106 000e 2091 0000 		lds r18,pCurrentTrackedObjectTable
666
 107 0012 3091 0000 		lds r19,(pCurrentTrackedObjectTable)+1
667
 524:FrameMgr.c    **** 	unsigned char tmpUpperLeftX,tmpUpperLeftY,tmpLowerRightX,tmpLowerRightY;
668
 525:FrameMgr.c    **** 	
669
 526:FrameMgr.c    **** #if DEBUG_FRAME_DATA	
670
 527:FrameMgr.c    **** 	/* we want to send all of the currently tracked table out
671
 528:FrameMgr.c    **** 	the serial port for debugging */
672
 529:FrameMgr.c    **** 	for (i=0; i<numCurrTrackedObjects; i++)
673
 530:FrameMgr.c    **** 	{
674
 531:FrameMgr.c    **** 		UIMgr_txBuffer("----------\r\n",12);
675
 532:FrameMgr.c    **** 		for (j=0; j<SIZE_OF_TRACKED_OBJECT; j++)
676
 533:FrameMgr.c    **** 		{
677
 534:FrameMgr.c    **** 			memset(asciiBuffer,0x00,5);
678
 535:FrameMgr.c    **** 			itoa(*pTableData++,asciiBuffer,10);
679
 536:FrameMgr.c    **** 			UIMgr_txBuffer(asciiBuffer,3); /* 3 ascii bytes for data
680
 537:FrameMgr.c    **** 														+ 1 space */
681
 538:FrameMgr.c    **** 			UIMgr_txBuffer("\r\n",2);
682
 539:FrameMgr.c    **** 		}
683
 540:FrameMgr.c    **** 	}
684
 541:FrameMgr.c    **** 	
685
 542:FrameMgr.c    **** 	/* finally, send a new line */
686
 543:FrameMgr.c    **** 	UIMgr_txBuffer("\r\n",2);
687
 544:FrameMgr.c    **** 	
688
 545:FrameMgr.c    **** 	memset(asciiBuffer,0x00,5);
689
 546:FrameMgr.c    **** 	itoa(numCurrTrackedObjects,asciiBuffer,10);
690
 547:FrameMgr.c    **** 	UIMgr_txBuffer(asciiBuffer,3);
691
 548:FrameMgr.c    **** 	UIMgr_txBuffer(" PFC\r\n",5);
692
 549:FrameMgr.c    **** 
693
 550:FrameMgr.c    **** #else	
694
 551:FrameMgr.c    **** 	/* we only send tracking packets if there are tracked objects */	        
695
 552:FrameMgr.c    ****     
696
 553:FrameMgr.c    **** 	if (numCurrTrackedObjects > 0)
484 kaklik 697
 108               		.stabn	68,0,553,.LM2-.LFBB1
151 kaklik 698
 109               	.LM2:
699
 110 0016 8091 0000 		lds r24,numCurrTrackedObjects
700
 111 001a 8823      		tst r24
484 kaklik 701
 112 001c 01F4      		brne .+2
702
 113 001e 00C0      		rjmp .L2
703
 114               		.stabn	68,0,523,.LM3-.LFBB1
151 kaklik 704
 115               	.LM3:
705
 116 0020 E901      		movw r28,r18
706
 554:FrameMgr.c    **** 	{		
707
 555:FrameMgr.c    **** 		UIMgr_writeTxFifo(0x0A);					/* header byte for a tracking packet */
484 kaklik 708
 117               		.stabn	68,0,555,.LM4-.LFBB1
151 kaklik 709
 118               	.LM4:
710
 119 0022 8AE0      		ldi r24,lo8(10)
711
 120 0024 00D0      		rcall UIMgr_writeTxFifo
712
 556:FrameMgr.c    ****         /* reset the pointer */
713
 557:FrameMgr.c    ****         pTableData = (unsigned char *)pCurrentTrackedObjectTable;
714
 558:FrameMgr.c    ****         
715
 559:FrameMgr.c    **** 		UIMgr_writeTxFifo(numCurrTrackedObjects);	/* num of objects tracked */
484 kaklik 716
 121               		.stabn	68,0,559,.LM5-.LFBB1
151 kaklik 717
 122               	.LM5:
718
 123 0026 8091 0000 		lds r24,numCurrTrackedObjects
719
 124 002a 00D0      		rcall UIMgr_writeTxFifo
720
 125 002c DD24      		clr r13
484 kaklik 721
GAS LISTING /tmp/cc0XjEMJ.s 			page 13
151 kaklik 722
 
723
 
724
 126               	.L4:
725
 560:FrameMgr.c    **** 		for (i=0; i<MAX_TRACKED_OBJECTS; i++)
726
 561:FrameMgr.c    **** 		{
727
 562:FrameMgr.c    ****             /* we only want to process objects that have their objectValid flag
728
 563:FrameMgr.c    ****             set to TRUE */
729
 564:FrameMgr.c    ****             if ( *(pTableData + VALID_OBJECT_OFFSET) == TRUE)
484 kaklik 730
 127               		.stabn	68,0,564,.LM6-.LFBB1
151 kaklik 731
 128               	.LM6:
732
 129 002e 8F81      		ldd r24,Y+7
733
 130 0030 8130      		cpi r24,lo8(1)
484 kaklik 734
 131 0032 01F4      		brne .L5
151 kaklik 735
 565:FrameMgr.c    ****             {
736
 566:FrameMgr.c    ****                 /* the object is valid...convert the color from bit position to value...remember, 
737
 567:FrameMgr.c    ****                 each bit in the "color" byte corresponds to a color */
738
 568:FrameMgr.c    ****                 k=0;
739
 569:FrameMgr.c    ****                 color = *(pTableData + COLOR_OFFSET);
484 kaklik 740
 132               		.stabn	68,0,569,.LM7-.LFBB1
151 kaklik 741
 133               	.LM7:
742
 134 0034 8881      		ld r24,Y
743
 570:FrameMgr.c    ****                 if (color == 128) k=0;
484 kaklik 744
 135               		.stabn	68,0,570,.LM8-.LFBB1
151 kaklik 745
 136               	.LM8:
746
 137 0036 8038      		cpi r24,lo8(-128)
484 kaklik 747
 138 0038 01F0      		breq .L7
151 kaklik 748
 571:FrameMgr.c    ****                 else if (color == 64) k=1;
484 kaklik 749
 139               		.stabn	68,0,571,.LM9-.LFBB1
151 kaklik 750
 140               	.LM9:
751
 141 003a 8034      		cpi r24,lo8(64)
484 kaklik 752
 142 003c 01F4      		brne .L9
151 kaklik 753
 143 003e 81E0      		ldi r24,lo8(1)
484 kaklik 754
 144 0040 00C0      		rjmp .L11
151 kaklik 755
 145               	.L9:
756
 572:FrameMgr.c    ****                 else if (color == 32) k=2;
484 kaklik 757
 146               		.stabn	68,0,572,.LM10-.LFBB1
151 kaklik 758
 147               	.LM10:
759
 148 0042 8032      		cpi r24,lo8(32)
484 kaklik 760
 149 0044 01F4      		brne .L12
151 kaklik 761
 150 0046 82E0      		ldi r24,lo8(2)
484 kaklik 762
 151 0048 00C0      		rjmp .L11
151 kaklik 763
 152               	.L12:
764
 573:FrameMgr.c    ****                 else if (color == 16) k=3;
484 kaklik 765
 153               		.stabn	68,0,573,.LM11-.LFBB1
151 kaklik 766
 154               	.LM11:
767
 155 004a 8031      		cpi r24,lo8(16)
484 kaklik 768
 156 004c 01F4      		brne .L14
151 kaklik 769
 157 004e 83E0      		ldi r24,lo8(3)
484 kaklik 770
 158 0050 00C0      		rjmp .L11
151 kaklik 771
 159               	.L14:
772
 574:FrameMgr.c    ****                 else if (color == 8)  k=4;
484 kaklik 773
 160               		.stabn	68,0,574,.LM12-.LFBB1
151 kaklik 774
 161               	.LM12:
775
 162 0052 8830      		cpi r24,lo8(8)
484 kaklik 776
 163 0054 01F4      		brne .L16
151 kaklik 777
 164 0056 84E0      		ldi r24,lo8(4)
484 kaklik 778
 165 0058 00C0      		rjmp .L11
151 kaklik 779
 166               	.L16:
780
 575:FrameMgr.c    ****                 else if (color == 4)  k=5;
484 kaklik 781
GAS LISTING /tmp/cc0XjEMJ.s 			page 14
151 kaklik 782
 
783
 
484 kaklik 784
 167               		.stabn	68,0,575,.LM13-.LFBB1
151 kaklik 785
 168               	.LM13:
786
 169 005a 8430      		cpi r24,lo8(4)
484 kaklik 787
 170 005c 01F4      		brne .L18
151 kaklik 788
 171 005e 85E0      		ldi r24,lo8(5)
484 kaklik 789
 172 0060 00C0      		rjmp .L11
151 kaklik 790
 173               	.L18:
791
 576:FrameMgr.c    ****                 else if (color == 2)  k=6;
484 kaklik 792
 174               		.stabn	68,0,576,.LM14-.LFBB1
151 kaklik 793
 175               	.LM14:
794
 176 0062 8230      		cpi r24,lo8(2)
484 kaklik 795
 177 0064 01F4      		brne .L20
151 kaklik 796
 178 0066 86E0      		ldi r24,lo8(6)
484 kaklik 797
 179 0068 00C0      		rjmp .L11
151 kaklik 798
 180               	.L20:
799
 577:FrameMgr.c    ****                 else if (color == 1)  k=7;
484 kaklik 800
 181               		.stabn	68,0,577,.LM15-.LFBB1
151 kaklik 801
 182               	.LM15:
802
 183 006a 8130      		cpi r24,lo8(1)
484 kaklik 803
 184 006c 01F4      		brne .L7
151 kaklik 804
 185 006e 87E0      		ldi r24,lo8(7)
484 kaklik 805
 186 0070 00C0      		rjmp .L11
151 kaklik 806
 187               	.L7:
807
 188 0072 80E0      		ldi r24,lo8(0)
808
 189               	.L11:
809
 578:FrameMgr.c    ****                 
810
 579:FrameMgr.c    ****                 tmpUpperLeftX = *(pTableData + X_UPPER_LEFT_OFFSET);	    /* get the upper left X */
484 kaklik 811
 190               		.stabn	68,0,579,.LM16-.LFBB1
151 kaklik 812
 191               	.LM16:
813
 192 0074 1B81      		ldd r17,Y+3
814
 580:FrameMgr.c    ****                 tmpUpperLeftY = *(pTableData + Y_UPPER_LEFT_OFFSET);		/* get the upper left Y */		
484 kaklik 815
 193               		.stabn	68,0,580,.LM17-.LFBB1
151 kaklik 816
 194               	.LM17:
817
 195 0076 0C81      		ldd r16,Y+4
818
 581:FrameMgr.c    ****                 tmpLowerRightX = *(pTableData + X_LOWER_RIGHT_OFFSET);		/* get the lower right X */
484 kaklik 819
 196               		.stabn	68,0,581,.LM18-.LFBB1
151 kaklik 820
 197               	.LM18:
821
 198 0078 FD80      		ldd r15,Y+5
822
 582:FrameMgr.c    ****                 tmpLowerRightY = *(pTableData + Y_LOWER_RIGHT_OFFSET);		/* get the lower right Y */
484 kaklik 823
 199               		.stabn	68,0,582,.LM19-.LFBB1
151 kaklik 824
 200               	.LM19:
825
 201 007a EE80      		ldd r14,Y+6
826
 583:FrameMgr.c    ****                 
827
 584:FrameMgr.c    ****                 UIMgr_writeTxFifo(k);				  	/* send the color first */
484 kaklik 828
 202               		.stabn	68,0,584,.LM20-.LFBB1
151 kaklik 829
 203               	.LM20:
830
 204 007c 00D0      		rcall UIMgr_writeTxFifo
831
 585:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpUpperLeftX);
484 kaklik 832
 205               		.stabn	68,0,585,.LM21-.LFBB1
151 kaklik 833
 206               	.LM21:
834
 207 007e 812F      		mov r24,r17
835
 208 0080 00D0      		rcall UIMgr_writeTxFifo
836
 586:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpUpperLeftY);
484 kaklik 837
 209               		.stabn	68,0,586,.LM22-.LFBB1
151 kaklik 838
 210               	.LM22:
839
 211 0082 802F      		mov r24,r16
840
 212 0084 00D0      		rcall UIMgr_writeTxFifo
484 kaklik 841
GAS LISTING /tmp/cc0XjEMJ.s 			page 15
151 kaklik 842
 
843
 
844
 587:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpLowerRightX);
484 kaklik 845
 213               		.stabn	68,0,587,.LM23-.LFBB1
151 kaklik 846
 214               	.LM23:
847
 215 0086 8F2D      		mov r24,r15
848
 216 0088 00D0      		rcall UIMgr_writeTxFifo
849
 588:FrameMgr.c    ****                 UIMgr_writeTxFifo(tmpLowerRightY);			
484 kaklik 850
 217               		.stabn	68,0,588,.LM24-.LFBB1
151 kaklik 851
 218               	.LM24:
852
 219 008a 8E2D      		mov r24,r14
853
 220 008c 00D0      		rcall UIMgr_writeTxFifo
854
 221               	.L5:
484 kaklik 855
 222               		.stabn	68,0,560,.LM25-.LFBB1
151 kaklik 856
 223               	.LM25:
857
 224 008e D394      		inc r13
858
 225 0090 88E0      		ldi r24,lo8(8)
859
 226 0092 D816      		cp r13,r24
484 kaklik 860
 227 0094 01F0      		breq .L23
151 kaklik 861
 589:FrameMgr.c    ****             }
862
 590:FrameMgr.c    **** 
863
 591:FrameMgr.c    ****             /* move our pointer up to the beginning of the next object */
864
 592:FrameMgr.c    ****             pTableData += SIZE_OF_TRACKED_OBJECT;
484 kaklik 865
 228               		.stabn	68,0,592,.LM26-.LFBB1
151 kaklik 866
 229               	.LM26:
867
 230 0096 2896      		adiw r28,8
484 kaklik 868
 231 0098 00C0      		rjmp .L4
151 kaklik 869
 232               	.L23:
870
 593:FrameMgr.c    ****         }
871
 594:FrameMgr.c    **** 		
872
 595:FrameMgr.c    **** 		/* all done...send the end of tracking packets char */
873
 596:FrameMgr.c    **** 		UIMgr_writeTxFifo(0xFF);
484 kaklik 874
 233               		.stabn	68,0,596,.LM27-.LFBB1
151 kaklik 875
 234               	.LM27:
876
 235 009a 8FEF      		ldi r24,lo8(-1)
877
 236 009c 00D0      		rcall UIMgr_writeTxFifo
878
 237               	.L2:
879
 597:FrameMgr.c    **** 	}	
880
 598:FrameMgr.c    **** #endif	
881
 599:FrameMgr.c    **** 
882
 600:FrameMgr.c    ****     /* the tracked object table will be cleared out right before we start
883
 601:FrameMgr.c    ****     to wait for VSYNC to indicate a new frame...so it doesn't need to be
884
 602:FrameMgr.c    ****     done now */
885
 603:FrameMgr.c    ****     
886
 604:FrameMgr.c    **** 	/* schedule the next action to acquire a new frame */	
887
 605:FrameMgr.c    **** 	PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);
484 kaklik 888
 238               		.stabn	68,0,605,.LM28-.LFBB1
151 kaklik 889
 239               	.LM28:
890
 240 009e 84E0      		ldi r24,lo8(4)
891
 241 00a0 00D0      		rcall Exec_writeEventFifo
892
 242               	/* epilogue: frame size=0 */
893
 243 00a2 DF91      		pop r29
894
 244 00a4 CF91      		pop r28
895
 245 00a6 1F91      		pop r17
896
 246 00a8 0F91      		pop r16
897
 247 00aa FF90      		pop r15
898
 248 00ac EF90      		pop r14
899
 249 00ae DF90      		pop r13
900
 250 00b0 0895      		ret
484 kaklik 901
GAS LISTING /tmp/cc0XjEMJ.s 			page 16
151 kaklik 902
 
903
 
904
 251               	/* epilogue end (size=8) */
905
 252               	/* function FrameMgr_processFrame size 88 (73) */
906
 253               		.size	FrameMgr_processFrame, .-FrameMgr_processFrame
907
 254               		.stabs	"i:r(0,11)",64,0,518,13
908
 255               		.stabs	"k:r(0,11)",64,0,518,24
909
 256               		.stabs	"color:r(0,11)",64,0,518,24
910
 257               		.stabs	"pTableData:r(0,22)=*(0,11)",64,0,523,28
911
 258               		.stabs	"tmpUpperLeftX:r(0,11)",64,0,524,17
912
 259               		.stabs	"tmpUpperLeftY:r(0,11)",64,0,524,16
913
 260               		.stabs	"tmpLowerRightX:r(0,11)",64,0,524,15
914
 261               		.stabs	"tmpLowerRightY:r(0,11)",64,0,524,14
484 kaklik 915
 262               		.stabn	192,0,0,.LFBB1-.LFBB1
916
 263               		.stabn	224,0,0,.Lscope1-.LFBB1
917
 264               	.Lscope1:
918
 265               		.stabs	"",36,0,0,.Lscope1-.LFBB1
151 kaklik 919
 266               		.stabd	78,0,0
920
 267               		.stabs	"FrameMgr_processLine:F(0,15)",36,0,342,FrameMgr_processLine
921
 268               	.global	FrameMgr_processLine
922
 269               		.type	FrameMgr_processLine, @function
923
 270               	FrameMgr_processLine:
924
 271               		.stabd	46,0,0
484 kaklik 925
 272               		.stabn	68,0,342,.LM29-.LFBB2
151 kaklik 926
 273               	.LM29:
484 kaklik 927
 274               	.LFBB2:
928
 275               	/* prologue: frame size=1 */
929
 276 00b2 2F92      		push r2
930
 277 00b4 3F92      		push r3
931
 278 00b6 4F92      		push r4
932
 279 00b8 5F92      		push r5
933
 280 00ba 6F92      		push r6
934
 281 00bc 7F92      		push r7
935
 282 00be 8F92      		push r8
936
 283 00c0 9F92      		push r9
937
 284 00c2 BF92      		push r11
938
 285 00c4 CF92      		push r12
939
 286 00c6 DF92      		push r13
940
 287 00c8 EF92      		push r14
941
 288 00ca FF92      		push r15
942
 289 00cc 0F93      		push r16
943
 290 00ce 1F93      		push r17
944
 291 00d0 CF93      		push r28
945
 292 00d2 DF93      		push r29
946
 293 00d4 CDB7      		in r28,__SP_L__
947
 294 00d6 DEB7      		in r29,__SP_H__
948
 295 00d8 2197      		sbiw r28,1
949
 296 00da 0FB6      		in __tmp_reg__,__SREG__
950
 297 00dc F894      		cli
951
 298 00de DEBF      		out __SP_H__,r29
952
 299 00e0 0FBE      		out __SREG__,__tmp_reg__
953
 300 00e2 CDBF      		out __SP_L__,r28
954
 301               	/* prologue end (size=25) */
955
 302               		.stabn	68,0,345,.LM30-.LFBB2
151 kaklik 956
 303               	.LM30:
484 kaklik 957
 304 00e4 4091 0000 		lds r20,pCurrentTrackedObjectTable
958
 305 00e8 5091 0000 		lds r21,(pCurrentTrackedObjectTable)+1
959
 306               		.stabn	68,0,352,.LM31-.LFBB2
151 kaklik 960
 307               	.LM31:
484 kaklik 961
GAS LISTING /tmp/cc0XjEMJ.s 			page 17
151 kaklik 962
 
963
 
484 kaklik 964
 308 00ec 8091 0000 		lds r24,currentState
965
 309 00f0 8230      		cpi r24,lo8(2)
966
 310 00f2 01F0      		breq .+2
967
 311 00f4 00C0      		rjmp .L27
968
 312               		.stabn	68,0,361,.LM32-.LFBB2
151 kaklik 969
 313               	.LM32:
484 kaklik 970
 314 00f6 8BE0      		ldi r24,lo8(11)
971
 315 00f8 00D0      		rcall UartInt_txByte
972
 316               		.stabn	68,0,362,.LM33-.LFBB2
151 kaklik 973
 317               	.LM33:
484 kaklik 974
 318 00fa 8091 0000 		lds r24,lineCount
975
 319 00fe 00D0      		rcall UartInt_txByte
976
 320 0100 00E0      		ldi r16,lo8(currentLineBuffer)
977
 321 0102 10E0      		ldi r17,hi8(currentLineBuffer)
978
 322 0104 0F2E      		mov __tmp_reg__,r31
979
 323 0106 F0E0      		ldi r31,lo8(previousLineBuffer)
980
 324 0108 EF2E      		mov r14,r31
981
 325 010a F0E0      		ldi r31,hi8(previousLineBuffer)
982
 326 010c FF2E      		mov r15,r31
983
 327 010e F02D      		mov r31,__tmp_reg__
984
 328               		.stabn	68,0,363,.LM34-.LFBB2
985
 329               	.LM34:
986
 330 0110 0F2E      		mov __tmp_reg__,r31
987
 331 0112 F0E0      		ldi r31,lo8(currentLineBuffer+176)
988
 332 0114 CF2E      		mov r12,r31
989
 333 0116 F0E0      		ldi r31,hi8(currentLineBuffer+176)
990
 334 0118 DF2E      		mov r13,r31
991
 335 011a F02D      		mov r31,__tmp_reg__
992
 336               	.L29:
993
 337               		.stabn	68,0,370,.LM35-.LFBB2
994
 338               	.LM35:
995
 339 011c D801      		movw r26,r16
996
 340 011e 8C91      		ld r24,X
997
 341 0120 8983      		std Y+1,r24
998
 342               		.stabn	68,0,371,.LM36-.LFBB2
999
 343               	.LM36:
1000
 344 0122 8981      		ldd r24,Y+1
1001
 345 0124 8F70      		andi r24,lo8(15)
1002
 346 0126 8983      		std Y+1,r24
1003
 347               		.stabn	68,0,372,.LM37-.LFBB2
1004
 348               	.LM37:
1005
 349 0128 8981      		ldd r24,Y+1
1006
 350 012a 8295      		swap r24
1007
 351 012c 807F      		andi r24,0xf0
1008
 352 012e 8983      		std Y+1,r24
1009
 353               		.stabn	68,0,373,.LM38-.LFBB2
1010
 354               	.LM38:
1011
 355 0130 9981      		ldd r25,Y+1
1012
 356 0132 F701      		movw r30,r14
1013
 357 0134 8081      		ld r24,Z
1014
 358 0136 8F70      		andi r24,lo8(15)
1015
 359 0138 892B      		or r24,r25
1016
 360 013a 8983      		std Y+1,r24
1017
 361               		.stabn	68,0,376,.LM39-.LFBB2
1018
 362               	.LM39:
1019
 363 013c 8981      		ldd r24,Y+1
1020
 364 013e 00D0      		rcall UartInt_txByte
1021
GAS LISTING /tmp/cc0XjEMJ.s 			page 18
151 kaklik 1022
 
1023
 
484 kaklik 1024
 365               		.stabn	68,0,379,.LM40-.LFBB2
1025
 366               	.LM40:
1026
 367 0140 F701      		movw r30,r14
1027
 368 0142 8181      		ldd r24,Z+1
1028
 369 0144 8983      		std Y+1,r24
1029
 370               		.stabn	68,0,380,.LM41-.LFBB2
1030
 371               	.LM41:
1031
 372 0146 8981      		ldd r24,Y+1
1032
 373 0148 8F70      		andi r24,lo8(15)
1033
 374 014a 8983      		std Y+1,r24
1034
 375               		.stabn	68,0,381,.LM42-.LFBB2
1035
 376               	.LM42:
1036
 377 014c 8981      		ldd r24,Y+1
1037
 378 014e 8295      		swap r24
1038
 379 0150 807F      		andi r24,0xf0
1039
 380 0152 8983      		std Y+1,r24
1040
 381               		.stabn	68,0,382,.LM43-.LFBB2
1041
 382               	.LM43:
1042
 383 0154 9981      		ldd r25,Y+1
1043
 384 0156 F801      		movw r30,r16
1044
 385 0158 8181      		ldd r24,Z+1
1045
 386 015a 8F70      		andi r24,lo8(15)
1046
 387 015c 892B      		or r24,r25
1047
 388 015e 8983      		std Y+1,r24
1048
 389               		.stabn	68,0,385,.LM44-.LFBB2
1049
 390               	.LM44:
1050
 391 0160 8981      		ldd r24,Y+1
1051
 392 0162 00D0      		rcall UartInt_txByte
1052
 393 0164 0E5F      		subi r16,lo8(-(2))
1053
 394 0166 1F4F      		sbci r17,hi8(-(2))
1054
 395 0168 82E0      		ldi r24,lo8(2)
1055
 396 016a 90E0      		ldi r25,hi8(2)
1056
 397 016c E80E      		add r14,r24
1057
 398 016e F91E      		adc r15,r25
1058
 399               		.stabn	68,0,363,.LM45-.LFBB2
1059
 400               	.LM45:
1060
 401 0170 0C15      		cp r16,r12
1061
 402 0172 1D05      		cpc r17,r13
1062
 403 0174 01F4      		brne .L29
1063
 404               		.stabn	68,0,387,.LM46-.LFBB2
1064
 405               	.LM46:
1065
 406 0176 8FE0      		ldi r24,lo8(15)
1066
 407 0178 00D0      		rcall UartInt_txByte
1067
 408               		.stabn	68,0,391,.LM47-.LFBB2
1068
 409               	.LM47:
1069
 410 017a 8091 0000 		lds r24,lineCount
1070
 411 017e 8F5F      		subi r24,lo8(-(1))
1071
 412 0180 8093 0000 		sts lineCount,r24
1072
 413               		.stabn	68,0,394,.LM48-.LFBB2
1073
 414               	.LM48:
1074
 415 0184 8834      		cpi r24,lo8(72)
1075
 416 0186 00F0      		brlo .L31
1076
 417               		.stabn	68,0,398,.LM49-.LFBB2
1077
 418               	.LM49:
1078
 419 0188 1092 0000 		sts lineCount,__zero_reg__
1079
 420               		.stabn	68,0,399,.LM50-.LFBB2
1080
 421               	.LM50:
1081
GAS LISTING /tmp/cc0XjEMJ.s 			page 19
151 kaklik 1082
 
1083
 
484 kaklik 1084
 422 018c 1092 0000 		sts currentState,__zero_reg__
1085
 423               		.stabn	68,0,402,.LM51-.LFBB2
1086
 424               	.LM51:
1087
 425 0190 89B7      		in r24,89-0x20
1088
 426 0192 8B7F      		andi r24,lo8(-5)
1089
 427 0194 89BF      		out 89-0x20,r24
1090
 428               		.stabn	68,0,404,.LM52-.LFBB2
1091
 429               	.LM52:
1092
 430 0196 60E0      		ldi r22,lo8(0)
1093
 431 0198 81E1      		ldi r24,lo8(17)
1094
 432 019a 00D0      		rcall CamConfig_setCamReg
1095
 433               		.stabn	68,0,405,.LM53-.LFBB2
1096
 434               	.LM53:
1097
 435 019c 00D0      		rcall CamConfig_sendFifoCmds
1098
 436 019e 00C0      		rjmp .L72
1099
 437               	.L31:
1100
 438               		.stabn	68,0,410,.LM54-.LFBB2
1101
 439               	.LM54:
1102
 440 01a0 8091 0000 		lds r24,fastEventBitmask
1103
 441 01a4 8260      		ori r24,lo8(2)
1104
 442 01a6 8093 0000 		sts fastEventBitmask,r24
1105
 443 01aa 00C0      		rjmp .L72
1106
 444               	.L27:
1107
 445               		.stabn	68,0,413,.LM55-.LFBB2
1108
 446               	.LM55:
1109
 447 01ac 8130      		cpi r24,lo8(1)
1110
 448 01ae 01F0      		breq .+2
1111
 449 01b0 00C0      		rjmp .L72
1112
 450               	.LBB4:
1113
 451               	.LBB5:
151 kaklik 1114
 606:FrameMgr.c    **** }
1115
 607:FrameMgr.c    **** 
1116
 608:FrameMgr.c    **** /***********************************************************
1117
 609:FrameMgr.c    **** 	Function Name: FrameMgr_findConnectedness
1118
 610:FrameMgr.c    **** 	Function Description: This function is responsible for
1119
 611:FrameMgr.c    **** 	finding the connectedness between two particular run-
1120
 612:FrameMgr.c    **** 	length encoded lines of pixel data.  It updates the
1121
 613:FrameMgr.c    **** 	trackingTable as needed.
1122
 614:FrameMgr.c    **** 	Inputs:  none
1123
 615:FrameMgr.c    **** 	Outputs: none
1124
 616:FrameMgr.c    **** ***********************************************************/	
1125
 617:FrameMgr.c    **** static void FrameMgr_findConnectedness(void)
1126
 618:FrameMgr.c    **** {
1127
 619:FrameMgr.c    **** 	trackedColor_t currColor;
1128
 620:FrameMgr.c    **** 	unsigned char *pCurrLineColorInfo = currentLineBuffer;
1129
 621:FrameMgr.c    **** 	unsigned char *pTrackedObjectData;
1130
 622:FrameMgr.c    **** 	register unsigned char currPixelRunStart=0;
1131
 623:FrameMgr.c    **** 	register unsigned char currPixelRunFinish=0; 
1132
 624:FrameMgr.c    **** 	register unsigned char lastLineXStart=0;
1133
 625:FrameMgr.c    **** 	register unsigned char lastLineXFinish=0;  
1134
 626:FrameMgr.c    **** 	register unsigned char runLength=1;
1135
 627:FrameMgr.c    **** 	unsigned char i;
1136
 628:FrameMgr.c    **** 	bool_t colorConnected;	
1137
 629:FrameMgr.c    **** 	
1138
 630:FrameMgr.c    **** 	do
1139
 631:FrameMgr.c    **** 	{
1140
 632:FrameMgr.c    **** 		/* grab both the current color and the number of pixels
484 kaklik 1141
GAS LISTING /tmp/cc0XjEMJ.s 			page 20
1142
 
1143
 
151 kaklik 1144
 633:FrameMgr.c    **** 		in the run...remember, pixels start at 1, not 0! */
1145
 634:FrameMgr.c    **** 		colorConnected = FALSE;
1146
 635:FrameMgr.c    **** 		currColor = *pCurrLineColorInfo++;
1147
 636:FrameMgr.c    **** 		currPixelRunStart += runLength;
1148
 637:FrameMgr.c    **** 		runLength = *pCurrLineColorInfo++;
1149
 638:FrameMgr.c    **** 		currPixelRunFinish += runLength;
1150
 639:FrameMgr.c    ****       
1151
 640:FrameMgr.c    ****         /* make sure that the run-length is at least as wide as
1152
 641:FrameMgr.c    ****         the minimum horizontal tracking width, and we care about the color */ 
1153
 642:FrameMgr.c    ****         
1154
 643:FrameMgr.c    **** 		if ( (currColor != notTracked) && (runLength > MIN_OBJECT_TRACKING_WIDTH) )
1155
 644:FrameMgr.c    **** 		{			
1156
 645:FrameMgr.c    ****             /* this run contains a color we care about, so 
1157
 646:FrameMgr.c    **** 			either it will begin a new tracked object, or it
1158
 647:FrameMgr.c    **** 			is connected to a currently tracked object...
1159
 648:FrameMgr.c    **** 			compare it with each object in the tracking
1160
 649:FrameMgr.c    **** 			table...we can't just look at the numTrackedObjects because
1161
 650:FrameMgr.c    ****             it is entirely possible that the first couple of objects could
1162
 651:FrameMgr.c    ****             be invalid...
1163
 652:FrameMgr.c    **** 
1164
 653:FrameMgr.c    ****             NOTE: Instead of accessing each element in the trackedObjectTable
1165
 654:FrameMgr.c    ****             through the 'i' index, and then accessing the fields in each structure,
1166
 655:FrameMgr.c    ****             a pointer to each entry is established each time through the loop, followed
1167
 656:FrameMgr.c    ****             by accessing the elements through specified offsets.  GCC seems to be
1168
 657:FrameMgr.c    ****             able to optimize this code much better than simply accessing the elements
1169
 658:FrameMgr.c    ****             of each structure in the array the more normal way...*/
1170
 659:FrameMgr.c    ****             
1171
 660:FrameMgr.c    ****             pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;
1172
 661:FrameMgr.c    **** 			for (i=0; i<MAX_TRACKED_OBJECTS; i++)
1173
 662:FrameMgr.c    **** 			{
1174
 663:FrameMgr.c    **** 				if ( (currColor == *(pTrackedObjectData + COLOR_OFFSET)) && 
484 kaklik 1175
 452               		.stabn	68,0,663,.LM56-.LFBB2
1176
 453               	.LM56:
1177
 454 01b2 B090 0000 		lds r11,trackedLineCount
1178
 455 01b6 EB2C      		mov r14,r11
1179
 456 01b8 FF24      		clr r15
1180
 457 01ba 3701      		movw r6,r14
1181
 458 01bc 0894      		sec
1182
 459 01be 6108      		sbc r6,__zero_reg__
1183
 460 01c0 7108      		sbc r7,__zero_reg__
1184
 461 01c2 0091 0000 		lds r16,numCurrTrackedObjects
1185
 462 01c6 10E0      		ldi r17,lo8(0)
1186
 463 01c8 60E0      		ldi r22,lo8(0)
1187
 464 01ca 71E0      		ldi r23,lo8(1)
1188
 465 01cc 0F2E      		mov __tmp_reg__,r31
1189
 466 01ce F0E0      		ldi r31,lo8(currentLineBuffer)
1190
 467 01d0 2F2E      		mov r2,r31
1191
 468 01d2 F0E0      		ldi r31,hi8(currentLineBuffer)
1192
 469 01d4 3F2E      		mov r3,r31
1193
 470 01d6 F02D      		mov r31,__tmp_reg__
1194
 471               	.L35:
1195
 472               		.stabn	68,0,635,.LM57-.LFBB2
1196
 473               	.LM57:
1197
 474 01d8 D101      		movw r26,r2
1198
 475 01da 3C91      		ld r19,X
1199
 476               		.stabn	68,0,636,.LM58-.LFBB2
1200
 477               	.LM58:
1201
GAS LISTING /tmp/cc0XjEMJ.s 			page 21
1202
 
1203
 
1204
 478 01dc 170F      		add r17,r23
1205
 479               		.stabn	68,0,637,.LM59-.LFBB2
1206
 480               	.LM59:
1207
 481 01de F101      		movw r30,r2
1208
 482 01e0 7181      		ldd r23,Z+1
1209
 483 01e2 82E0      		ldi r24,lo8(2)
1210
 484 01e4 90E0      		ldi r25,hi8(2)
1211
 485 01e6 280E      		add r2,r24
1212
 486 01e8 391E      		adc r3,r25
1213
 487               		.stabn	68,0,638,.LM60-.LFBB2
1214
 488               	.LM60:
1215
 489 01ea 670F      		add r22,r23
1216
 490               		.stabn	68,0,643,.LM61-.LFBB2
1217
 491               	.LM61:
1218
 492 01ec 3323      		tst r19
1219
 493 01ee 01F4      		brne .+2
1220
 494 01f0 00C0      		rjmp .L36
1221
 495 01f2 7430      		cpi r23,lo8(4)
1222
 496 01f4 00F4      		brsh .+2
1223
 497 01f6 00C0      		rjmp .L36
1224
 498 01f8 FA01      		movw r30,r20
1225
 499 01fa 20E0      		ldi r18,lo8(0)
1226
 500               	.L39:
1227
 501               		.stabn	68,0,663,.LM62-.LFBB2
1228
 502               	.LM62:
1229
 503 01fc 8081      		ld r24,Z
1230
 504 01fe 8317      		cp r24,r19
1231
 505 0200 01F4      		brne .L40
1232
 506 0202 8781      		ldd r24,Z+7
1233
 507 0204 8130      		cpi r24,lo8(1)
1234
 508 0206 01F4      		brne .L40
1235
 509 0208 0F2E      		mov __tmp_reg__,r31
1236
 510 020a F6E0      		ldi r31,lo8(6)
1237
 511 020c CF2E      		mov r12,r31
1238
 512 020e DD24      		clr r13
1239
 513 0210 F02D      		mov r31,__tmp_reg__
1240
 514 0212 CE0E      		add r12,r30
1241
 515 0214 DF1E      		adc r13,r31
1242
 516 0216 8681      		ldd r24,Z+6
1243
 517 0218 9927      		clr r25
1244
 518 021a 8615      		cp r24,r6
1245
 519 021c 9705      		cpc r25,r7
1246
 520 021e 01F4      		brne .L40
1247
 521 0220 2F01      		movw r4,r30
1248
 522 0222 0894      		sec
1249
 523 0224 411C      		adc r4,__zero_reg__
1250
 524 0226 511C      		adc r5,__zero_reg__
151 kaklik 1251
 664:FrameMgr.c    ****                      (*(pTrackedObjectData + VALID_OBJECT_OFFSET) == TRUE) &&
1252
 665:FrameMgr.c    ****                      (*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) == trackedLineCount - 1) )
1253
 666:FrameMgr.c    **** 				{
1254
 667:FrameMgr.c    **** 					/* found a color match and the object is valid...check to see if there is
1255
 668:FrameMgr.c    **** 					connectedness */
1256
 669:FrameMgr.c    **** 					lastLineXStart = *(pTrackedObjectData + LAST_LINE_X_START_OFFSET);
484 kaklik 1257
 525               		.stabn	68,0,669,.LM63-.LFBB2
1258
 526               	.LM63:
1259
 527 0228 8181      		ldd r24,Z+1
1260
 528 022a 8824      		clr r8
1261
GAS LISTING /tmp/cc0XjEMJ.s 			page 22
151 kaklik 1262
 
1263
 
484 kaklik 1264
 529 022c 9924      		clr r9
1265
 530 022e 6894      		set
1266
 531 0230 81F8      		bld r8,1
1267
 532 0232 8E0E      		add r8,r30
1268
 533 0234 9F1E      		adc r9,r31
1269
 670:FrameMgr.c    **** 					lastLineXFinish = *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET);
1270
 534               		.stabn	68,0,670,.LM64-.LFBB2
1271
 535               	.LM64:
1272
 536 0236 9281      		ldd r25,Z+2
151 kaklik 1273
 671:FrameMgr.c    **** 					
1274
 672:FrameMgr.c    **** 					/* Check for the 5 following types of line connectedness:
1275
 673:FrameMgr.c    **** 					---------------------
1276
 674:FrameMgr.c    **** 					|                   |
1277
 675:FrameMgr.c    **** 					---------------------
1278
 676:FrameMgr.c    **** 					         -------------------------
1279
 677:FrameMgr.c    **** 							 |                       |
1280
 678:FrameMgr.c    **** 							 -------------------------  */
1281
 679:FrameMgr.c    **** 					if ( (	(currPixelRunStart >= lastLineXStart) &&
484 kaklik 1282
 537               		.stabn	68,0,679,.LM65-.LFBB2
1283
 538               	.LM65:
1284
 539 0238 1817      		cp r17,r24
1285
 540 023a 00F0      		brlo .L44
1286
 541 023c 9117      		cp r25,r17
1287
 542 023e 00F4      		brsh .L46
1288
 543               	.L44:
1289
 544 0240 6817      		cp r22,r24
1290
 545 0242 00F0      		brlo .L47
1291
 546 0244 9617      		cp r25,r22
1292
 547 0246 00F4      		brsh .L46
1293
 548               	.L47:
1294
 549 0248 8117      		cp r24,r17
1295
 550 024a 00F0      		brlo .L40
1296
 551 024c 6917      		cp r22,r25
1297
 552 024e 00F0      		brlo .L40
1298
 553               	.L46:
151 kaklik 1299
 680:FrameMgr.c    **** 							(currPixelRunStart <= lastLineXFinish) )  ||
1300
 681:FrameMgr.c    **** 							
1301
 682:FrameMgr.c    **** 					/*               ---------------------
1302
 683:FrameMgr.c    **** 					                 |                   |
1303
 684:FrameMgr.c    **** 									 ---------------------
1304
 685:FrameMgr.c    **** 						-------------------
1305
 686:FrameMgr.c    **** 						|                 |
1306
 687:FrameMgr.c    **** 						-------------------  
1307
 688:FrameMgr.c    **** 						                   OR
1308
 689:FrameMgr.c    **** 						     ------------------------------
1309
 690:FrameMgr.c    **** 							 |                            |
1310
 691:FrameMgr.c    **** 							 ------------------------------
1311
 692:FrameMgr.c    **** 							              ---------
1312
 693:FrameMgr.c    **** 										  |       |
1313
 694:FrameMgr.c    **** 										  ---------  */
1314
 695:FrameMgr.c    **** 						 (	(currPixelRunFinish >= lastLineXStart) && 
1315
 696:FrameMgr.c    **** 							(currPixelRunFinish <= lastLineXFinish) ) ||
1316
 697:FrameMgr.c    **** 							
1317
 698:FrameMgr.c    **** 							
1318
 699:FrameMgr.c    **** 					/*     -------------------------------
1319
 700:FrameMgr.c    **** 					       |                             |
1320
 701:FrameMgr.c    **** 						   -------------------------------
484 kaklik 1321
GAS LISTING /tmp/cc0XjEMJ.s 			page 23
1322
 
1323
 
151 kaklik 1324
 702:FrameMgr.c    **** 						   -------------------------------
1325
 703:FrameMgr.c    **** 						   |                             |
1326
 704:FrameMgr.c    **** 						   -------------------------------
1327
 705:FrameMgr.c    **** 						                  OR
1328
 706:FrameMgr.c    **** 								     -------------
1329
 707:FrameMgr.c    **** 									 |           |
1330
 708:FrameMgr.c    **** 									 -------------
1331
 709:FrameMgr.c    **** 							-------------------------------
1332
 710:FrameMgr.c    **** 							|                             |
1333
 711:FrameMgr.c    **** 							-------------------------------   */
1334
 712:FrameMgr.c    **** 						 (  (currPixelRunStart <= lastLineXStart) &&
1335
 713:FrameMgr.c    **** 							(currPixelRunFinish >= lastLineXFinish) ) )
1336
 714:FrameMgr.c    **** 					{
1337
 715:FrameMgr.c    **** 						/* THERE IS CONNECTEDNESS...update the lastLineXStart and lastLineXFinish
1338
 716:FrameMgr.c    **** 						data pointed to by pTrackedObjectData */
1339
 717:FrameMgr.c    **** 						*(pTrackedObjectData + LAST_LINE_X_START_OFFSET) = currPixelRunStart;
484 kaklik 1340
 554               		.stabn	68,0,717,.LM66-.LFBB2
1341
 555               	.LM66:
1342
 556 0250 D201      		movw r26,r4
1343
 557 0252 1C93      		st X,r17
151 kaklik 1344
 718:FrameMgr.c    **** 						*(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET) = currPixelRunFinish;
484 kaklik 1345
 558               		.stabn	68,0,718,.LM67-.LFBB2
1346
 559               	.LM67:
1347
 560 0254 D401      		movw r26,r8
1348
 561 0256 6C93      		st X,r22
151 kaklik 1349
 719:FrameMgr.c    **** 						
1350
 720:FrameMgr.c    **** 						/* check if the bounding box needs to be updated */
1351
 721:FrameMgr.c    **** 						if (*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) > currPixelRunStart)
484 kaklik 1352
 562               		.stabn	68,0,721,.LM68-.LFBB2
1353
 563               	.LM68:
1354
 564 0258 8381      		ldd r24,Z+3
1355
 565 025a 1817      		cp r17,r24
1356
 566 025c 00F4      		brsh .L50
151 kaklik 1357
 722:FrameMgr.c    **** 						{
1358
 723:FrameMgr.c    **** 							/* need to update the bounding box for the upper left point to 
1359
 724:FrameMgr.c    **** 							enclose this new left-most point...we never have to update the
1360
 725:FrameMgr.c    **** 							upper left Y point, since each scan line we process moves from
1361
 726:FrameMgr.c    **** 							top to bottom */
1362
 727:FrameMgr.c    **** 							*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) = currPixelRunStart;
484 kaklik 1363
 567               		.stabn	68,0,727,.LM69-.LFBB2
1364
 568               	.LM69:
1365
 569 025e 1383      		std Z+3,r17
1366
 570               	.L50:
151 kaklik 1367
 728:FrameMgr.c    **** 						}
1368
 729:FrameMgr.c    **** 
1369
 730:FrameMgr.c    **** 						if ( *(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) < currPixelRunFinish)
484 kaklik 1370
 571               		.stabn	68,0,730,.LM70-.LFBB2
1371
 572               	.LM70:
1372
 573 0260 8581      		ldd r24,Z+5
1373
 574 0262 8617      		cp r24,r22
1374
 575 0264 00F4      		brsh .L52
151 kaklik 1375
 731:FrameMgr.c    **** 						{
1376
 732:FrameMgr.c    **** 							/* need to update the bounding box for the lower right X point to
1377
 733:FrameMgr.c    **** 							enclose this new right-most point */
1378
 734:FrameMgr.c    **** 							*(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) = currPixelRunFinish;
484 kaklik 1379
 576               		.stabn	68,0,734,.LM71-.LFBB2
1380
 577               	.LM71:
1381
GAS LISTING /tmp/cc0XjEMJ.s 			page 24
1382
 
1383
 
1384
 578 0266 6583      		std Z+5,r22
1385
 579               	.L52:
151 kaklik 1386
 735:FrameMgr.c    **** 						}
1387
 736:FrameMgr.c    **** 						
1388
 737:FrameMgr.c    **** 						/* the lower right 'y' point always gets updated when connectedness is found */
1389
 738:FrameMgr.c    **** 						*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) = trackedLineCount;
484 kaklik 1390
 580               		.stabn	68,0,738,.LM72-.LFBB2
1391
 581               	.LM72:
1392
 582 0268 F601      		movw r30,r12
1393
 583 026a B082      		st Z,r11
1394
 584 026c 00C0      		rjmp .L36
1395
 585               	.L40:
1396
 586               		.stabn	68,0,661,.LM73-.LFBB2
1397
 587               	.LM73:
1398
 588 026e 2F5F      		subi r18,lo8(-(1))
1399
 589 0270 2830      		cpi r18,lo8(8)
1400
 590 0272 01F4      		brne .+2
1401
 591 0274 00C0      		rjmp .L54
151 kaklik 1402
 739:FrameMgr.c    **** 						
1403
 740:FrameMgr.c    **** 						/* set a flag indicating that that color run is part of another
1404
 741:FrameMgr.c    **** 						object and thus doesn't need to be added as a new entry into the
1405
 742:FrameMgr.c    **** 						tracking table */
1406
 743:FrameMgr.c    **** 						colorConnected = TRUE;
1407
 744:FrameMgr.c    **** 						break;
1408
 745:FrameMgr.c    **** 					}
1409
 746:FrameMgr.c    **** 				}
1410
 747:FrameMgr.c    ****                 
1411
 748:FrameMgr.c    ****                 /* go to the next object */
1412
 749:FrameMgr.c    ****                 pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
484 kaklik 1413
 592               		.stabn	68,0,749,.LM74-.LFBB2
1414
 593               	.LM74:
1415
 594 0276 3896      		adiw r30,8
1416
 595 0278 00C0      		rjmp .L39
1417
 596               	.L56:
1418
 597 027a FA01      		movw r30,r20
1419
 598 027c 90E0      		ldi r25,lo8(0)
1420
 599               	.L57:
151 kaklik 1421
 750:FrameMgr.c    **** 			}
1422
 751:FrameMgr.c    **** 			
1423
 752:FrameMgr.c    **** 			if (colorConnected == FALSE)
1424
 753:FrameMgr.c    **** 			{
1425
 754:FrameMgr.c    **** 				/* a new entry needs to be made to the tracking table, since we have
1426
 755:FrameMgr.c    **** 				a run-length with a color, and it isn't connected to anything...but we
1427
 756:FrameMgr.c    **** 				can only do this if there is space left in the trackedObject table */
1428
 757:FrameMgr.c    **** 				if (numCurrTrackedObjects < MAX_TRACKED_OBJECTS)
1429
 758:FrameMgr.c    **** 				{                
1430
 759:FrameMgr.c    ****                     /* space is available...add the object...but first we need to find an
1431
 760:FrameMgr.c    ****                     invalid object in the object tracking table */
1432
 761:FrameMgr.c    ****                     pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;
1433
 762:FrameMgr.c    ****                     for (i=0; i<MAX_TRACKED_OBJECTS; i++)
1434
 763:FrameMgr.c    ****                     {
1435
 764:FrameMgr.c    ****                         if ( *(pTrackedObjectData + VALID_OBJECT_OFFSET) == FALSE)  break;
484 kaklik 1436
 600               		.stabn	68,0,764,.LM75-.LFBB2
1437
 601               	.LM75:
1438
 602 027e 8781      		ldd r24,Z+7
1439
 603 0280 8823      		tst r24
1440
 604 0282 01F0      		breq .L58
1441
GAS LISTING /tmp/cc0XjEMJ.s 			page 25
1442
 
1443
 
151 kaklik 1444
 765:FrameMgr.c    ****                         
1445
 766:FrameMgr.c    ****                         /* if we haven't broken above, then the object must have been valid...
1446
 767:FrameMgr.c    ****                         go ahead and move the pointer to the next object to check it */
1447
 768:FrameMgr.c    ****                         pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
484 kaklik 1448
 605               		.stabn	68,0,768,.LM76-.LFBB2
1449
 606               	.LM76:
1450
 607 0284 3896      		adiw r30,8
1451
 608               		.stabn	68,0,762,.LM77-.LFBB2
1452
 609               	.LM77:
1453
 610 0286 9F5F      		subi r25,lo8(-(1))
1454
 611 0288 9830      		cpi r25,lo8(8)
1455
 612 028a 01F4      		brne .L57
1456
 613               	.L58:
151 kaklik 1457
 769:FrameMgr.c    ****                     }
1458
 770:FrameMgr.c    ****                     
1459
 771:FrameMgr.c    **** 					
1460
 772:FrameMgr.c    **** 					/* now that we have a pointer to the tracked object to be updated, update all
1461
 773:FrameMgr.c    **** 					the fields */
1462
 774:FrameMgr.c    **** 					*(pTrackedObjectData + COLOR_OFFSET)                = currColor;			/* color */
484 kaklik 1463
 614               		.stabn	68,0,774,.LM78-.LFBB2
1464
 615               	.LM78:
1465
 616 028c 3083      		st Z,r19
151 kaklik 1466
 775:FrameMgr.c    **** 					*(pTrackedObjectData + LAST_LINE_X_START_OFFSET)    = currPixelRunStart; 	/* lastLineXStart */
484 kaklik 1467
 617               		.stabn	68,0,775,.LM79-.LFBB2
1468
 618               	.LM79:
1469
 619 028e 1183      		std Z+1,r17
151 kaklik 1470
 776:FrameMgr.c    **** 					*(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET)   = currPixelRunFinish;	/* lastLineXFinish *
484 kaklik 1471
 620               		.stabn	68,0,776,.LM80-.LFBB2
1472
 621               	.LM80:
1473
 622 0290 6283      		std Z+2,r22
151 kaklik 1474
 777:FrameMgr.c    **** 					*(pTrackedObjectData + X_UPPER_LEFT_OFFSET)         = currPixelRunStart;	/* x_upperLeft */
484 kaklik 1475
 623               		.stabn	68,0,777,.LM81-.LFBB2
1476
 624               	.LM81:
1477
 625 0292 1383      		std Z+3,r17
151 kaklik 1478
 778:FrameMgr.c    **** 					*(pTrackedObjectData + Y_UPPER_LEFT_OFFSET)         = trackedLineCount;	/* y_upperLeft */
484 kaklik 1479
 626               		.stabn	68,0,778,.LM82-.LFBB2
1480
 627               	.LM82:
1481
 628 0294 B482      		std Z+4,r11
151 kaklik 1482
 779:FrameMgr.c    **** 					*(pTrackedObjectData + X_LOWER_RIGHT_OFFSET)        = currPixelRunFinish;	/* x_lowerRight */
484 kaklik 1483
 629               		.stabn	68,0,779,.LM83-.LFBB2
1484
 630               	.LM83:
1485
 631 0296 6583      		std Z+5,r22
151 kaklik 1486
 780:FrameMgr.c    **** 					*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET)        = trackedLineCount;	/* y_lowerRight */
484 kaklik 1487
 632               		.stabn	68,0,780,.LM84-.LFBB2
1488
 633               	.LM84:
1489
 634 0298 B682      		std Z+6,r11
151 kaklik 1490
 781:FrameMgr.c    ****                     *(pTrackedObjectData + VALID_OBJECT_OFFSET)         = TRUE;                /* o
484 kaklik 1491
 635               		.stabn	68,0,781,.LM85-.LFBB2
1492
 636               	.LM85:
1493
 637 029a 81E0      		ldi r24,lo8(1)
1494
 638 029c 8783      		std Z+7,r24
151 kaklik 1495
 782:FrameMgr.c    **** 						
1496
 783:FrameMgr.c    **** 					numCurrTrackedObjects++;
484 kaklik 1497
 639               		.stabn	68,0,783,.LM86-.LFBB2
1498
 640               	.LM86:
1499
 641 029e 0F5F      		subi r16,lo8(-(1))
1500
 642               	.L36:
1501
GAS LISTING /tmp/cc0XjEMJ.s 			page 26
1502
 
1503
 
151 kaklik 1504
 784:FrameMgr.c    **** 				}
1505
 785:FrameMgr.c    **** 			}
1506
 786:FrameMgr.c    ****             
1507
 787:FrameMgr.c    ****             /* move the pointer to the beginning of the next tracked object */
1508
 788:FrameMgr.c    ****             pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
1509
 789:FrameMgr.c    **** 		}
1510
 790:FrameMgr.c    **** 	} while(currPixelRunFinish < ACTUAL_NUM_PIXELS_IN_A_LINE);
484 kaklik 1511
 643               		.stabn	68,0,790,.LM87-.LFBB2
1512
 644               	.LM87:
1513
 645 02a0 603B      		cpi r22,lo8(-80)
1514
 646 02a2 00F4      		brsh .+2
1515
 647 02a4 00C0      		rjmp .L35
1516
 648 02a6 0093 0000 		sts numCurrTrackedObjects,r16
1517
 649               	.LBE5:
1518
 650               	.LBE4:
1519
 651               		.stabn	68,0,460,.LM88-.LFBB2
1520
 652               	.LM88:
1521
 653 02aa C701      		movw r24,r14
1522
 654 02ac 8770      		andi r24,lo8(7)
1523
 655 02ae 9070      		andi r25,hi8(7)
1524
 656 02b0 0797      		sbiw r24,7
1525
 657 02b2 01F4      		brne .L61
1526
 658 02b4 60E0      		ldi r22,lo8(0)
1527
 659               	.L63:
1528
 660               		.stabn	68,0,464,.LM89-.LFBB2
1529
 661               	.LM89:
1530
 662 02b6 FA01      		movw r30,r20
1531
 663 02b8 8781      		ldd r24,Z+7
1532
 664 02ba 8130      		cpi r24,lo8(1)
1533
 665 02bc 01F4      		brne .L64
1534
 666               		.stabn	68,0,468,.LM90-.LFBB2
1535
 667               	.LM90:
1536
 668 02be 8681      		ldd r24,Z+6
1537
 669 02c0 282F      		mov r18,r24
1538
 670 02c2 3327      		clr r19
1539
 671 02c4 8481      		ldd r24,Z+4
1540
 672 02c6 D901      		movw r26,r18
1541
 673 02c8 A81B      		sub r26,r24
1542
 674 02ca B109      		sbc r27,__zero_reg__
1543
 675 02cc 1397      		sbiw r26,3
1544
 676 02ce 04F4      		brge .L64
1545
 677               		.stabn	68,0,474,.LM91-.LFBB2
1546
 678               	.LM91:
1547
 679 02d0 C701      		movw r24,r14
1548
 680 02d2 821B      		sub r24,r18
1549
 681 02d4 930B      		sbc r25,r19
1550
 682 02d6 0397      		sbiw r24,3
1551
 683 02d8 04F0      		brlt .L64
1552
 684               		.stabn	68,0,477,.LM92-.LFBB2
1553
 685               	.LM92:
1554
 686 02da 1782      		std Z+7,__zero_reg__
1555
 687               		.stabn	68,0,478,.LM93-.LFBB2
1556
 688               	.LM93:
1557
 689 02dc 0150      		subi r16,lo8(-(-1))
1558
 690               	.L64:
1559
 691               		.stabn	68,0,462,.LM94-.LFBB2
1560
 692               	.LM94:
1561
GAS LISTING /tmp/cc0XjEMJ.s 			page 27
151 kaklik 1562
 
1563
 
484 kaklik 1564
 693 02de 6F5F      		subi r22,lo8(-(1))
1565
 694 02e0 6830      		cpi r22,lo8(8)
1566
 695 02e2 01F0      		breq .L68
1567
 696               		.stabn	68,0,482,.LM95-.LFBB2
1568
 697               	.LM95:
1569
 698 02e4 485F      		subi r20,lo8(-(8))
1570
 699 02e6 5F4F      		sbci r21,hi8(-(8))
1571
 700 02e8 00C0      		rjmp .L63
1572
 701               	.L68:
1573
 702 02ea 0093 0000 		sts numCurrTrackedObjects,r16
1574
 703               	.L61:
1575
 704               		.stabn	68,0,486,.LM96-.LFBB2
1576
 705               	.LM96:
1577
 706 02ee 8B2D      		mov r24,r11
1578
 707 02f0 8F5F      		subi r24,lo8(-(1))
1579
 708 02f2 8093 0000 		sts trackedLineCount,r24
1580
 709               		.stabn	68,0,487,.LM97-.LFBB2
1581
 710               	.LM97:
1582
 711 02f6 8039      		cpi r24,lo8(-112)
1583
 712 02f8 01F4      		brne .L70
1584
 713               		.stabn	68,0,491,.LM98-.LFBB2
1585
 714               	.LM98:
1586
 715 02fa 80E2      		ldi r24,lo8(32)
1587
 716 02fc 00D0      		rcall Exec_writeEventFifo
1588
 717               		.stabn	68,0,493,.LM99-.LFBB2
1589
 718               	.LM99:
1590
 719 02fe 89B7      		in r24,89-0x20
1591
 720 0300 8B7F      		andi r24,lo8(-5)
1592
 721 0302 89BF      		out 89-0x20,r24
1593
 722               		.stabn	68,0,494,.LM100-.LFBB2
1594
 723               	.LM100:
1595
 724 0304 1092 0000 		sts trackedLineCount,__zero_reg__
1596
 725 0308 00C0      		rjmp .L72
1597
 726               	.L70:
1598
 727               		.stabn	68,0,498,.LM101-.LFBB2
1599
 728               	.LM101:
1600
 729 030a 8091 0000 		lds r24,fastEventBitmask
1601
 730 030e 8260      		ori r24,lo8(2)
1602
 731 0310 8093 0000 		sts fastEventBitmask,r24
1603
 732 0314 00C0      		rjmp .L72
1604
 733               	.L54:
1605
 734               	.LBB7:
1606
 735               	.LBB6:
1607
 736               		.stabn	68,0,757,.LM102-.LFBB2
1608
 737               	.LM102:
1609
 738 0316 0830      		cpi r16,lo8(8)
1610
 739 0318 00F4      		brsh .+2
1611
 740 031a 00C0      		rjmp .L56
1612
 741 031c 00C0      		rjmp .L36
1613
 742               	.L72:
1614
 743               	.LBE6:
1615
 744               	.LBE7:
1616
 745               	/* epilogue: frame size=1 */
1617
 746 031e 2196      		adiw r28,1
1618
 747 0320 0FB6      		in __tmp_reg__,__SREG__
1619
 748 0322 F894      		cli
1620
 749 0324 DEBF      		out __SP_H__,r29
1621
GAS LISTING /tmp/cc0XjEMJ.s 			page 28
151 kaklik 1622
 
1623
 
484 kaklik 1624
 750 0326 0FBE      		out __SREG__,__tmp_reg__
1625
 751 0328 CDBF      		out __SP_L__,r28
1626
 752 032a DF91      		pop r29
1627
 753 032c CF91      		pop r28
1628
 754 032e 1F91      		pop r17
1629
 755 0330 0F91      		pop r16
1630
 756 0332 FF90      		pop r15
1631
 757 0334 EF90      		pop r14
1632
 758 0336 DF90      		pop r13
1633
 759 0338 CF90      		pop r12
1634
 760 033a BF90      		pop r11
1635
 761 033c 9F90      		pop r9
1636
 762 033e 8F90      		pop r8
1637
 763 0340 7F90      		pop r7
1638
 764 0342 6F90      		pop r6
1639
 765 0344 5F90      		pop r5
1640
 766 0346 4F90      		pop r4
1641
 767 0348 3F90      		pop r3
1642
 768 034a 2F90      		pop r2
1643
 769 034c 0895      		ret
1644
 770               	/* epilogue end (size=24) */
1645
 771               	/* function FrameMgr_processLine size 337 (288) */
1646
 772               		.size	FrameMgr_processLine, .-FrameMgr_processLine
1647
 773               		.stabs	"i:r(0,11)",64,0,343,22
1648
 774               		.stabs	"dataToSend:(0,23)=B(0,11)",128,0,344,1
1649
 775               		.stabs	"pTrackedObjectData:r(0,22)",64,0,345,20
1650
 776               		.stabn	192,0,0,.LFBB2-.LFBB2
1651
 777               		.stabn	224,0,0,.Lscope2-.LFBB2
1652
 778               	.Lscope2:
1653
 779               		.stabs	"",36,0,0,.Lscope2-.LFBB2
1654
 780               		.stabd	78,0,0
1655
 781               		.stabs	"FrameMgr_init:F(0,15)",36,0,191,FrameMgr_init
1656
 782               	.global	FrameMgr_init
1657
 783               		.type	FrameMgr_init, @function
1658
 784               	FrameMgr_init:
1659
 785               		.stabd	46,0,0
1660
 786               		.stabn	68,0,191,.LM103-.LFBB3
1661
 787               	.LM103:
1662
 788               	.LFBB3:
1663
 789               	/* prologue: frame size=0 */
1664
 790               	/* prologue end (size=0) */
1665
 791               		.stabn	68,0,192,.LM104-.LFBB3
1666
 792               	.LM104:
1667
 793 034e 80E4      		ldi r24,lo8(64)
1668
 794 0350 E0E0      		ldi r30,lo8(trackedObjectTable)
1669
 795 0352 F0E0      		ldi r31,hi8(trackedObjectTable)
1670
 796 0354 1192      		st Z+,__zero_reg__
1671
 797 0356 8A95      	        dec r24
1672
 798 0358 01F4      		brne .-6
1673
 799               	/* epilogue: frame size=0 */
1674
 800 035a 0895      		ret
1675
 801               	/* epilogue end (size=1) */
1676
 802               	/* function FrameMgr_init size 7 (6) */
1677
 803               		.size	FrameMgr_init, .-FrameMgr_init
1678
 804               	.Lscope3:
1679
 805               		.stabs	"",36,0,0,.Lscope3-.LFBB3
1680
 806               		.stabd	78,0,0
1681
GAS LISTING /tmp/cc0XjEMJ.s 			page 29
151 kaklik 1682
 
1683
 
484 kaklik 1684
 807               		.stabs	"FrameMgr_acquireLine:F(0,15)",36,0,287,FrameMgr_acquireLine
1685
 808               	.global	FrameMgr_acquireLine
1686
 809               		.type	FrameMgr_acquireLine, @function
1687
 810               	FrameMgr_acquireLine:
1688
 811               		.stabd	46,0,0
1689
 812               		.stabn	68,0,287,.LM105-.LFBB4
1690
 813               	.LM105:
1691
 814               	.LFBB4:
1692
 815               	/* prologue: frame size=0 */
1693
 816               	/* prologue end (size=0) */
1694
 817               		.stabn	68,0,297,.LM106-.LFBB4
1695
 818               	.LM106:
1696
 819 035c 8091 0000 		lds r24,currentState
1697
 820 0360 8230      		cpi r24,lo8(2)
1698
 821 0362 01F4      		brne .L81
1699
 822               		.stabn	68,0,299,.LM107-.LFBB4
1700
 823               	.LM107:
1701
 824 0364 8091 0000 		lds r24,lineCount
1702
 825 0368 982F      		mov r25,r24
1703
 826 036a 990F      		lsl r25
1704
 827               		.stabn	68,0,305,.LM108-.LFBB4
1705
 828               	.LM108:
1706
 829 036c 80EB      		ldi r24,lo8(-80)
1707
 830 036e E0E0      		ldi r30,lo8(currentLineBuffer)
1708
 831 0370 F0E0      		ldi r31,hi8(currentLineBuffer)
1709
 832 0372 282F      		mov r18,r24
1710
 833 0374 1192      		st Z+,__zero_reg__
1711
 834 0376 2A95      	        dec r18
1712
 835 0378 01F4      		brne .-6
1713
 836               		.stabn	68,0,306,.LM109-.LFBB4
1714
 837               	.LM109:
1715
 838 037a E0E0      		ldi r30,lo8(previousLineBuffer)
1716
 839 037c F0E0      		ldi r31,hi8(previousLineBuffer)
1717
 840 037e 1192      		st Z+,__zero_reg__
1718
 841 0380 8A95      	        dec r24
1719
 842 0382 01F4      		brne .-6
1720
 843               	.L83:
1721
 844               		.stabn	68,0,309,.LM110-.LFBB4
1722
 845               	.LM110:
1723
 846 0384 829B      		sbis 48-0x20,2
1724
 847 0386 00C0      		rjmp .L83
1725
 848               	.L98:
1726
 849               		.stabn	68,0,310,.LM111-.LFBB4
1727
 850               	.LM111:
1728
 851 0388 829B      		sbis 48-0x20,2
1729
 852 038a 00C0      		rjmp .L106
1730
 853 038c 00C0      		rjmp .L98
1731
 854               	.L111:
1732
 855               		.stabn	68,0,316,.LM112-.LFBB4
1733
 856               	.LM112:
1734
 857 038e 849B      		sbis 48-0x20,4
1735
 858 0390 00C0      		rjmp .L111
1736
 859               		.stabn	68,0,317,.LM113-.LFBB4
1737
 860               	.LM113:
1738
 861 0392 9150      		subi r25,lo8(-(-1))
1739
 862               	.L88:
1740
 863               		.stabn	68,0,318,.LM114-.LFBB4
1741
GAS LISTING /tmp/cc0XjEMJ.s 			page 30
151 kaklik 1742
 
1743
 
484 kaklik 1744
 864               	.LM114:
1745
 865 0394 849B      		sbis 48-0x20,4
1746
 866 0396 00C0      		rjmp .L108
1747
 867 0398 00C0      		rjmp .L88
1748
 868               	.L106:
1749
 869               		.stabn	68,0,314,.LM115-.LFBB4
1750
 870               	.LM115:
1751
 871 039a 9923      		tst r25
1752
 872 039c 01F4      		brne .L111
1753
 873 039e 00C0      		rjmp .L90
1754
 874               	.L108:
1755
 875 03a0 9923      		tst r25
1756
 876 03a2 01F4      		brne .L111
1757
 877               	.L90:
1758
 878               		.stabn	68,0,322,.LM116-.LFBB4
1759
 879               	.LM116:
1760
 880 03a4 60E0      		ldi r22,lo8(previousLineBuffer)
1761
 881 03a6 70E0      		ldi r23,hi8(previousLineBuffer)
1762
 882 03a8 80E0      		ldi r24,lo8(currentLineBuffer)
1763
 883 03aa 90E0      		ldi r25,hi8(currentLineBuffer)
1764
 884 03ac 00D0      		rcall CamIntAsm_acquireDumpLine
1765
 885 03ae 0895      		ret
1766
 886               	.L81:
1767
 887               		.stabn	68,0,324,.LM117-.LFBB4
1768
 888               	.LM117:
1769
 889 03b0 8130      		cpi r24,lo8(1)
1770
 890 03b2 01F4      		brne .L94
1771
 891               	.L97:
1772
 892               		.stabn	68,0,326,.LM118-.LFBB4
1773
 893               	.LM118:
1774
 894 03b4 8499      		sbic 48-0x20,4
1775
 895 03b6 00C0      		rjmp .L97
1776
 896               		.stabn	68,0,327,.LM119-.LFBB4
1777
 897               	.LM119:
1778
 898 03b8 60E0      		ldi r22,lo8(colorMap)
1779
 899 03ba 70E0      		ldi r23,hi8(colorMap)
1780
 900 03bc 80E0      		ldi r24,lo8(currentLineBuffer)
1781
 901 03be 90E0      		ldi r25,hi8(currentLineBuffer)
1782
 902 03c0 00D0      		rcall CamIntAsm_acquireTrackingLine
1783
 903               	.L94:
1784
 904 03c2 0895      		ret
1785
 905               	/* epilogue: frame size=0 */
1786
 906               	/* epilogue: noreturn */
1787
 907               	/* epilogue end (size=0) */
1788
 908               	/* function FrameMgr_acquireLine size 52 (52) */
1789
 909               		.size	FrameMgr_acquireLine, .-FrameMgr_acquireLine
1790
 910               		.stabs	"tmpLineCount:r(0,11)",64,0,288,25
1791
 911               		.stabn	192,0,0,.LFBB4-.LFBB4
1792
 912               		.stabn	224,0,0,.Lscope4-.LFBB4
1793
 913               	.Lscope4:
1794
 914               		.stabs	"",36,0,0,.Lscope4-.LFBB4
1795
 915               		.stabd	78,0,0
1796
 916               		.stabs	"FrameMgr_acquireFrame:F(0,15)",36,0,261,FrameMgr_acquireFrame
1797
 917               	.global	FrameMgr_acquireFrame
1798
 918               		.type	FrameMgr_acquireFrame, @function
1799
 919               	FrameMgr_acquireFrame:
1800
 920               		.stabd	46,0,0
1801
GAS LISTING /tmp/cc0XjEMJ.s 			page 31
151 kaklik 1802
 
1803
 
484 kaklik 1804
 921               		.stabn	68,0,261,.LM120-.LFBB5
1805
 922               	.LM120:
1806
 923               	.LFBB5:
1807
 924               	/* prologue: frame size=0 */
1808
 925               	/* prologue end (size=0) */
1809
 926               		.stabn	68,0,262,.LM121-.LFBB5
1810
 927               	.LM121:
1811
 928 03c4 8091 0000 		lds r24,currentState
1812
 929 03c8 8130      		cpi r24,lo8(1)
1813
 930 03ca 01F4      		brne .L117
1814
 931               		.stabn	68,0,264,.LM122-.LFBB5
1815
 932               	.LM122:
1816
 933 03cc 1092 0000 		sts trackedLineCount,__zero_reg__
1817
 934               		.stabn	68,0,265,.LM123-.LFBB5
1818
 935               	.LM123:
1819
 936 03d0 8091 0000 		lds r24,numCurrTrackedObjects
1820
 937 03d4 8093 0000 		sts numPrevTrackedObjects,r24
1821
 938               		.stabn	68,0,266,.LM124-.LFBB5
1822
 939               	.LM124:
1823
 940 03d8 1092 0000 		sts numCurrTrackedObjects,__zero_reg__
1824
 941               		.stabn	68,0,270,.LM125-.LFBB5
1825
 942               	.LM125:
1826
 943 03dc 80E4      		ldi r24,lo8(64)
1827
 944 03de E0E0      		ldi r30,lo8(trackedObjectTable)
1828
 945 03e0 F0E0      		ldi r31,hi8(trackedObjectTable)
1829
 946 03e2 1192      		st Z+,__zero_reg__
1830
 947 03e4 8A95      	        dec r24
1831
 948 03e6 01F4      		brne .-6
1832
 949               	.L115:
1833
 950               		.stabn	68,0,272,.LM126-.LFBB5
1834
 951               	.LM126:
1835
 952 03e8 829B      		sbis 48-0x20,2
1836
 953 03ea 00C0      		rjmp .L115
1837
 954               		.stabn	68,0,273,.LM127-.LFBB5
1838
 955               	.LM127:
1839
 956 03ec 60E0      		ldi r22,lo8(colorMap)
1840
 957 03ee 70E0      		ldi r23,hi8(colorMap)
1841
 958 03f0 80E0      		ldi r24,lo8(currentLineBuffer)
1842
 959 03f2 90E0      		ldi r25,hi8(currentLineBuffer)
1843
 960 03f4 00D0      		rcall CamIntAsm_acquireTrackingLine
1844
 961               	.L117:
1845
 962 03f6 0895      		ret
1846
 963               	/* epilogue: frame size=0 */
1847
 964               	/* epilogue: noreturn */
1848
 965               	/* epilogue end (size=0) */
1849
 966               	/* function FrameMgr_acquireFrame size 26 (26) */
1850
 967               		.size	FrameMgr_acquireFrame, .-FrameMgr_acquireFrame
1851
 968               	.Lscope5:
1852
 969               		.stabs	"",36,0,0,.Lscope5-.LFBB5
1853
 970               		.stabd	78,0,0
1854
 971               		.stabs	"FrameMgr_dispatchEvent:F(0,15)",36,0,205,FrameMgr_dispatchEvent
1855
 972               		.stabs	"event:P(0,11)",64,0,204,24
1856
 973               	.global	FrameMgr_dispatchEvent
1857
 974               		.type	FrameMgr_dispatchEvent, @function
1858
 975               	FrameMgr_dispatchEvent:
1859
 976               		.stabd	46,0,0
1860
 977               		.stabn	68,0,205,.LM128-.LFBB6
1861
GAS LISTING /tmp/cc0XjEMJ.s 			page 32
151 kaklik 1862
 
1863
 
484 kaklik 1864
 978               	.LM128:
1865
 979               	.LFBB6:
1866
 980               	/* prologue: frame size=0 */
1867
 981               	/* prologue end (size=0) */
1868
 982               		.stabn	68,0,206,.LM129-.LFBB6
1869
 983               	.LM129:
1870
 984 03f8 8430      		cpi r24,lo8(4)
1871
 985 03fa 01F0      		breq .L124
1872
 986               		.stabn	68,0,206,.LM130-.LFBB6
1873
 987               	.LM130:
1874
 988 03fc 8530      		cpi r24,lo8(5)
1875
 989 03fe 00F4      		brsh .L128
1876
 990 0400 8130      		cpi r24,lo8(1)
1877
 991 0402 01F0      		breq .L122
1878
 992 0404 8230      		cpi r24,lo8(2)
1879
 993 0406 01F4      		brne .L130
1880
 994 0408 00C0      		rjmp .L123
1881
 995               	.L128:
1882
 996 040a 8038      		cpi r24,lo8(-128)
1883
 997 040c 01F0      		breq .L126
1884
 998 040e 8138      		cpi r24,lo8(-127)
1885
 999 0410 01F0      		breq .L127
1886
 1000 0412 8032      		cpi r24,lo8(32)
1887
 1001 0414 01F4      		brne .L130
1888
 1002 0416 00C0      		rjmp .L125
1889
 1003               	.L123:
1890
 1004               		.stabn	68,0,211,.LM131-.LFBB6
1891
 1005               	.LM131:
1892
 1006 0418 61E0      		ldi r22,lo8(1)
1893
 1007 041a 81E1      		ldi r24,lo8(17)
1894
 1008 041c 00D0      		rcall CamConfig_setCamReg
1895
 1009               		.stabn	68,0,212,.LM132-.LFBB6
1896
 1010               	.LM132:
1897
 1011 041e 00D0      		rcall CamConfig_sendFifoCmds
1898
 1012               		.stabn	68,0,213,.LM133-.LFBB6
1899
 1013               	.LM133:
1900
 1014 0420 88EE      		ldi r24,lo8(1000)
1901
 1015 0422 93E0      		ldi r25,hi8(1000)
1902
 1016 0424 00D0      		rcall Utility_delay
1903
 1017               		.stabn	68,0,214,.LM134-.LFBB6
1904
 1018               	.LM134:
1905
 1019 0426 1092 0000 		sts lineCount,__zero_reg__
1906
 1020               		.stabn	68,0,215,.LM135-.LFBB6
1907
 1021               	.LM135:
1908
 1022 042a 82E0      		ldi r24,lo8(2)
1909
 1023 042c 8093 0000 		sts currentState,r24
1910
 1024               		.stabn	68,0,217,.LM136-.LFBB6
1911
 1025               	.LM136:
1912
 1026 0430 00D0      		rcall FrameMgr_acquireLine
1913
 1027 0432 0895      		ret
1914
 1028               	.L126:
1915
 1029               		.stabn	68,0,221,.LM137-.LFBB6
1916
 1030               	.LM137:
1917
 1031 0434 81E0      		ldi r24,lo8(1)
1918
 1032 0436 8093 0000 		sts currentState,r24
1919
 1033               		.stabn	68,0,222,.LM138-.LFBB6
1920
 1034               	.LM138:
1921
GAS LISTING /tmp/cc0XjEMJ.s 			page 33
151 kaklik 1922
 
1923
 
484 kaklik 1924
 1035 043a 00D0      		rcall FrameMgr_acquireFrame
1925
 1036 043c 0895      		ret
1926
 1037               	.L125:
1927
 1038               		.stabn	68,0,226,.LM139-.LFBB6
1928
 1039               	.LM139:
1929
 1040 043e 00D0      		rcall FrameMgr_processFrame
1930
 1041 0440 0895      		ret
1931
 1042               	.L124:
1932
 1043               		.stabn	68,0,230,.LM140-.LFBB6
1933
 1044               	.LM140:
1934
 1045 0442 00D0      		rcall FrameMgr_acquireFrame
1935
 1046 0444 0895      		ret
1936
 1047               	.L122:
1937
 1048               		.stabn	68,0,234,.LM141-.LFBB6
1938
 1049               	.LM141:
1939
 1050 0446 8091 0000 		lds r24,currentState
1940
 1051 044a 8823      		tst r24
1941
 1052 044c 01F0      		breq .L130
1942
 1053               		.stabn	68,0,240,.LM142-.LFBB6
1943
 1054               	.LM142:
1944
 1055 044e 84E0      		ldi r24,lo8(4)
1945
 1056 0450 00D0      		rcall Exec_writeEventFifo
1946
 1057 0452 0895      		ret
1947
 1058               	.L127:
1948
 1059               		.stabn	68,0,246,.LM143-.LFBB6
1949
 1060               	.LM143:
1950
 1061 0454 1092 0000 		sts currentState,__zero_reg__
1951
 1062               	.L130:
1952
 1063 0458 0895      		ret
1953
 1064               	/* epilogue: frame size=0 */
1954
 1065               	/* epilogue: noreturn */
1955
 1066               	/* epilogue end (size=0) */
1956
 1067               	/* function FrameMgr_dispatchEvent size 49 (49) */
1957
 1068               		.size	FrameMgr_dispatchEvent, .-FrameMgr_dispatchEvent
1958
 1069               	.Lscope6:
1959
 1070               		.stabs	"",36,0,0,.Lscope6-.LFBB6
1960
 1071               		.stabd	78,0,0
1961
 1072               		.data
1962
 1073               		.type	pCurrentTrackedObjectTable, @object
1963
 1074               		.size	pCurrentTrackedObjectTable, 2
1964
 1075               	pCurrentTrackedObjectTable:
1965
 1076 0000 0000      		.word	trackedObjectTable
1966
 1077               		.lcomm numCurrTrackedObjects,1
1967
 1078               		.lcomm currentState,1
1968
 1079               		.lcomm lineCount,1
1969
 1080               		.lcomm trackedLineCount,1
1970
 1081               		.lcomm numPrevTrackedObjects,1
1971
 1082               		.lcomm trackedObjectTable,64
1972
 1083               		.stabs	"trackedObjectTable:S(0,24)=ar(0,25)=r(0,25);0;0177777;;0;7;(0,20)",40,0,162,trackedObjectT
1973
 1084               		.stabs	"pCurrentTrackedObjectTable:S(0,26)=*(0,20)",38,0,163,pCurrentTrackedObjectTable
1974
 1085               		.stabs	"lineCount:S(0,11)",38,0,164,lineCount
1975
 1086               		.stabs	"currentState:S(0,17)",38,0,165,currentState
1976
 1087               		.stabs	"numCurrTrackedObjects:S(0,11)",38,0,166,numCurrTrackedObjects
1977
 1088               		.stabs	"numPrevTrackedObjects:S(0,11)",38,0,167,numPrevTrackedObjects
1978
 1089               		.stabs	"trackedLineCount:S(0,11)",38,0,168,trackedLineCount
1979
 1090               		.text
1980
 1091               		.stabs	"",100,0,0,.Letext0
1981
GAS LISTING /tmp/cc0XjEMJ.s 			page 34
151 kaklik 1982
 
1983
 
484 kaklik 1984
 1092               	.Letext0:
1985
 1093               	/* File "FrameMgr.c": code  559 = 0x022f ( 494), prologues  32, epilogues  33 */
1986
GAS LISTING /tmp/cc0XjEMJ.s 			page 35
151 kaklik 1987
 
1988
 
1989
DEFINED SYMBOLS
1990
                            *ABS*:00000000 FrameMgr.c
484 kaklik 1991
     /tmp/cc0XjEMJ.s:2      *ABS*:0000003f __SREG__
1992
     /tmp/cc0XjEMJ.s:3      *ABS*:0000003e __SP_H__
1993
     /tmp/cc0XjEMJ.s:4      *ABS*:0000003d __SP_L__
1994
     /tmp/cc0XjEMJ.s:5      *ABS*:00000000 __tmp_reg__
1995
     /tmp/cc0XjEMJ.s:6      *ABS*:00000001 __zero_reg__
1996
     /tmp/cc0XjEMJ.s:90     .text:00000000 FrameMgr_processFrame
1997
     /tmp/cc0XjEMJ.s:1075   .data:00000000 pCurrentTrackedObjectTable
151 kaklik 1998
                             .bss:00000000 numCurrTrackedObjects
484 kaklik 1999
     /tmp/cc0XjEMJ.s:270    .text:000000b2 FrameMgr_processLine
2000
     /tmp/cc0XjEMJ.s:1077   .bss:00000001 currentState
2001
     /tmp/cc0XjEMJ.s:1078   .bss:00000002 lineCount
2002
     /tmp/cc0XjEMJ.s:1079   .bss:00000003 trackedLineCount
2003
     /tmp/cc0XjEMJ.s:784    .text:0000034e FrameMgr_init
2004
     /tmp/cc0XjEMJ.s:1081   .bss:00000005 trackedObjectTable
2005
     /tmp/cc0XjEMJ.s:810    .text:0000035c FrameMgr_acquireLine
2006
     /tmp/cc0XjEMJ.s:919    .text:000003c4 FrameMgr_acquireFrame
2007
     /tmp/cc0XjEMJ.s:1080   .bss:00000004 numPrevTrackedObjects
2008
     /tmp/cc0XjEMJ.s:975    .text:000003f8 FrameMgr_dispatchEvent
151 kaklik 2009
 
2010
UNDEFINED SYMBOLS
2011
__do_copy_data
2012
__do_clear_bss
2013
UIMgr_writeTxFifo
2014
Exec_writeEventFifo
2015
UartInt_txByte
2016
currentLineBuffer
2017
previousLineBuffer
2018
CamConfig_setCamReg
2019
CamConfig_sendFifoCmds
2020
fastEventBitmask
2021
CamIntAsm_acquireDumpLine
2022
colorMap
2023
CamIntAsm_acquireTrackingLine
2024
Utility_delay