Subversion Repositories svnkaklik

Rev

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

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