📄 avrcam.lss
字号:
/* just return the current tail from the tx fifo */
dataByte = Exec_eventFifo[Exec_eventFifoTail];
1de: 20 91 0f 01 lds r18, 0x010F
1e2: 87 ee ldi r24, 0xE7 ; 231
1e4: 93 e0 ldi r25, 0x03 ; 3
1e6: fc 01 movw r30, r24
1e8: e2 0f add r30, r18
1ea: f1 1d adc r31, r1
1ec: 90 81 ld r25, Z
tmpTail = (Exec_eventFifoTail+1) & (EXEC_EVENT_FIFO_MASK);
1ee: 82 2f mov r24, r18
1f0: 8f 5f subi r24, 0xFF ; 255
1f2: 87 70 andi r24, 0x07 ; 7
Exec_eventFifoTail = tmpTail;
1f4: 80 93 0f 01 sts 0x010F, r24
ENABLE_INTS();
1f8: 78 94 sei
return(dataByte);
}
1fa: 89 2f mov r24, r25
1fc: 99 27 eor r25, r25
1fe: 08 95 ret
00000200 <Exec_writeEventFifo>:
/***********************************************************
Function Name: Exec_writeEventFifo
Function Description: This function is responsible for
writing a single event to the event fifo and
updating the appropriate pointers.
Inputs: data - the byte to write to the Fifo
Outputs: none
***********************************************************/
void Exec_writeEventFifo(unsigned char event)
{
200: 38 2f mov r19, r24
unsigned char tmpHead;
DISABLE_INTS();
202: f8 94 cli
Exec_eventFifo[Exec_eventFifoHead] = event;
204: 20 91 0e 01 lds r18, 0x010E
208: 87 ee ldi r24, 0xE7 ; 231
20a: 93 e0 ldi r25, 0x03 ; 3
20c: fc 01 movw r30, r24
20e: e2 0f add r30, r18
210: f1 1d adc r31, r1
212: 30 83 st Z, r19
/* now move the head up */
tmpHead = (Exec_eventFifoHead + 1) & (EXEC_EVENT_FIFO_MASK);
214: 82 2f mov r24, r18
216: 8f 5f subi r24, 0xFF ; 255
218: 87 70 andi r24, 0x07 ; 7
Exec_eventFifoHead = tmpHead;
21a: 80 93 0e 01 sts 0x010E, r24
ENABLE_INTS();
21e: 78 94 sei
220: 08 95 ret
00000222 <FrameMgr_init>:
Inputs: none
Outputs: none
***********************************************************/
void FrameMgr_init(void)
{
222: 08 95 ret
00000224 <FrameMgr_dispatchEvent>:
}
/***********************************************************
Function Name: FrameMgr_dispatchEvent
Function Description: This function is responsible for
taking an incoming event and performing the needed
actions with it as pertains to the FrameMgr.
Inputs: event - the generated event
Outputs: none
***********************************************************/
void FrameMgr_dispatchEvent(unsigned char event)
{
switch(event)
224: 82 30 cpi r24, 0x02 ; 2
226: 89 f4 brne .+34 ; 0x24a
{
case EV_DUMP_FRAME:
/* try re-initializing the camera before we start dumping */
CamConfig_setCamReg(0x11,0x01); /* reduce the frame rate for dumping*/
228: 61 e0 ldi r22, 0x01 ; 1
22a: 81 e1 ldi r24, 0x11 ; 17
22c: 0e 94 9b 05 call 0xb36
CamConfig_sendFifoCmds();
230: 0e 94 a1 05 call 0xb42
Utility_delay(1000); /* allow the new frame rate to settle */
234: 88 ee ldi r24, 0xE8 ; 232
236: 93 e0 ldi r25, 0x03 ; 3
238: 0e 94 fe 05 call 0xbfc
lineCount = 0;
23c: 10 92 11 01 sts 0x0111, r1
currentState = ST_FrameMgr_DumpingFrame;
240: 81 e0 ldi r24, 0x01 ; 1
242: 80 93 12 01 sts 0x0112, r24
//CamIntAsm_waitForNewDumpFrame(currentLineBuffer,previousLineBuffer);
FrameMgr_acquireLine();
246: 0e 94 27 01 call 0x24e
24a: 08 95 ret
24c: 08 95 ret
0000024e <FrameMgr_acquireLine>:
break;
case EV_PROCESS_FRAME_COMPLETE://second here
//FrameMgr_acquireFrame();
break;
case EV_SERIAL_DATA_RECEIVED:////////////////first reach here
//if (currentState != ST_FrameMgr_idle)
//{
/* we need to go back to processing line data, since
serial data reception interrupted us....just trash the
frame and act like the frame has been processed, which
will kick off the system to wait for the next line */
//PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);//Exec_writeEventFifo(event)
//}
break;
}
}
/***********************************************************
Function Name: FrameMgr_acquireLine
Function Description: This function is responsible for
acquiring a line of data from the camera interface.
The acquisition of this line depends on the current
state of the FrameMgr.
Inputs: none
Outputs: none
***********************************************************/
void FrameMgr_acquireLine(void)
{
//unsigned char tmpLineCount;
int tmpLineCount;
/* clearing out the buffers takes too long...we should
just overwrite the data here without a problem when
we start acquiring...at no point do we check for
a 0x00 value in the current or previous lineBuffers,
so it was a bit excessive :-) */
/* check which state we are in and proceed as needed */
if (currentState == ST_FrameMgr_DumpingFrame)
24e: 80 91 12 01 lds r24, 0x0112
252: 81 30 cpi r24, 0x01 ; 1
254: a9 f5 brne .+106 ; 0x2c0
{
tmpLineCount = lineCount*2;
256: 80 91 11 01 lds r24, 0x0111
25a: 28 2f mov r18, r24
25c: 33 27 eor r19, r19
25e: 22 0f add r18, r18
260: 33 1f adc r19, r19
/* clearing out the line data in dump mode is ok, and actually
is needed, since it is possible for the first dump line in
a frame to come back with the last line captured of the
last capture session...*/
memset(currentLineBuffer,0x00,LENGTH_OF_LINE_BUFFER);
262: 80 e4 ldi r24, 0x40 ; 64
264: 91 e0 ldi r25, 0x01 ; 1
266: e7 ea ldi r30, 0xA7 ; 167
268: f2 e0 ldi r31, 0x02 ; 2
26a: ac 01 movw r20, r24
26c: 11 92 st Z+, r1
26e: 41 50 subi r20, 0x01 ; 1
270: 50 40 sbci r21, 0x00 ; 0
272: e1 f7 brne .-8 ; 0x26c
memset(previousLineBuffer,0x00,LENGTH_OF_LINE_BUFFER);
274: e7 e6 ldi r30, 0x67 ; 103
276: f1 e0 ldi r31, 0x01 ; 1
278: 11 92 st Z+, r1
27a: 01 97 sbiw r24, 0x01 ; 1
27c: e9 f7 brne .-6 ; 0x278
27e: 41 e0 ldi r20, 0x01 ; 1
280: 50 e0 ldi r21, 0x00 ; 0
/* wait for another VSYNC so we know which frame to use
to start looking for a line to receive */
WAIT_FOR_VSYNC_HIGH();
282: 80 b3 in r24, 0x10 ; 16
284: 99 27 eor r25, r25
286: 96 95 lsr r25
288: 87 95 ror r24
28a: 96 95 lsr r25
28c: 87 95 ror r24
28e: 81 70 andi r24, 0x01 ; 1
290: 90 70 andi r25, 0x00 ; 0
292: 84 17 cp r24, r20
294: 95 07 cpc r25, r21
296: a9 f7 brne .-22 ; 0x282
WAIT_FOR_VSYNC_LOW();
298: 82 99 sbic 0x10, 2 ; 16
29a: fe cf rjmp .-4 ; 0x298
/* look at lineCount to determine how many HREFs we should
wait before we start sampling */
while(tmpLineCount != 0)
{
WAIT_FOR_HREF_HIGH();
tmpLineCount--;
WAIT_FOR_HREF_LOW();
29c: 21 15 cp r18, r1
29e: 31 05 cpc r19, r1
2a0: 49 f0 breq .+18 ; 0x2b4
2a2: 87 9b sbis 0x10, 7 ; 16
2a4: fe cf rjmp .-4 ; 0x2a2
2a6: 21 50 subi r18, 0x01 ; 1
2a8: 30 40 sbci r19, 0x00 ; 0
2aa: 87 99 sbic 0x10, 7 ; 16
2ac: fe cf rjmp .-4 ; 0x2aa
2ae: 21 15 cp r18, r1
2b0: 31 05 cpc r19, r1
2b2: b9 f7 brne .-18 ; 0x2a2
}
/* we should now be ready to sample our line...*/
CamIntAsm_acquireDumpLine(currentLineBuffer,previousLineBuffer);
2b4: 67 e6 ldi r22, 0x67 ; 103
2b6: 71 e0 ldi r23, 0x01 ; 1
2b8: 87 ea ldi r24, 0xA7 ; 167
2ba: 92 e0 ldi r25, 0x02 ; 2
2bc: 0e 94 6d 06 call 0xcda
2c0: 08 95 ret
2c2: 08 95 ret
000002c4 <FrameMgr_processLine>:
}
}
/***********************************************************
Function Name: FrameMgr_processLine
Function Description: This function is responsible for
parsing the received image line and performing either
connected region mapping (if in the Tracking state) or
sending out the raw sampled data (if in the Dumping
state).
Inputs: none
Outputs: none
***********************************************************/
void FrameMgr_processLine(void)
{
2c4: bf 92 push r11
2c6: cf 92 push r12
2c8: df 92 push r13
2ca: ef 92 push r14
2cc: ff 92 push r15
2ce: 0f 93 push r16
2d0: 1f 93 push r17
2d2: cf 93 push r28
2d4: df 93 push r29
2d6: cd b7 in r28, 0x3d ; 61
2d8: de b7 in r29, 0x3e ; 62
2da: 21 97 sbiw r28, 0x01 ; 1
2dc: 0f b6 in r0, 0x3f ; 63
2de: f8 94 cli
2e0: de bf out 0x3e, r29 ; 62
2e2: 0f be out 0x3f, r0 ; 63
2e4: cd bf out 0x3d, r28 ; 61
//unsigned char i;
int i;
volatile unsigned char dataToSend;
if (currentState == ST_FrameMgr_DumpingFrame)
2e6: 80 91 12 01 lds r24, 0x0112
2ea: 81 30 cpi r24, 0x01 ; 1
2ec: 09 f0 breq .+2 ; 0x2f0
2ee: 71 c0 rjmp .+226 ; 0x3d2
{
/* we want to sit in a tight loop and send the acquired data
sitting in current and previous line buffers out the serial
port...it is sent out the serial port immediately instead
of going into the UIMgr tx fifo because we can't do anything
until its sent out anyway...may as well just get it out now */
/* currentLineBuffer is getting "g" previousLineBuffer is getting "b-r" */
UartInt_txByte(0x0B); /* send the header byte */
2f0: 8b e0 ldi r24, 0x0B ; 11
2f2: 0e 94 09 04 call 0x812
UartInt_txByte(lineCount); /* send the line count */
2f6: 80 91 11 01 lds r24, 0x0111
2fa: 0e 94 09 04 call 0x812
for (i=0; i<NUM_PIXELS_IN_A_DUMP_LINE; i+=2)////176
2fe: cc 24 eor r12, r12
300: dd 24 eor r13, r13
302: 0f 2e mov r0, r31
304: f0 ef ldi r31, 0xF0 ; 240
306: bf 2e mov r11, r31
308: f0 2d mov r31, r0
{
/* when a dump line is sampled, the upper byte can potentially
have garbage in it...we don't have time to mask it off as we're
sampling, so it is done here before we send it out...we also
combine the samples together so we really are sending up a
sample for line N as well as line N+1 */
dataToSend = previousLineBuffer[i];
30a: 0f 2e mov r0, r31
30c: f7 e6 ldi r31, 0x67 ; 103
30e: ef 2e mov r14, r31
310: f1 e0 ldi r31, 0x01 ; 1
312: ff 2e mov r15, r31
314: f0 2d mov r31, r0
316: ec 0c add r14, r12
318: fd 1c adc r15, r13
31a: f7 01 movw r30, r14
31c: 80 81 ld r24, Z
31e: 89 83 std Y+1, r24 ; 0x01
dataToSend &= 0xF0;
320: 89 81 ldd r24, Y+1 ; 0x01
322: 8b 21 and r24, r11
324: 89 83 std Y+1, r24 ; 0x01
dataToSend >>= 4;
326: 89 81 ldd r24, Y+1 ; 0x01
328: 82 95 swap r24
32a: 8f 70 andi r24, 0x0F ; 15
32c: 89 83 std Y+1, r24 ; 0x01
dataToSend |= (currentLineBuffer[i] & 0xF0);
32e: 86 01 movw r16, r12
330: 09 55 subi r16, 0x59 ; 89
332: 1d 4f sbci r17, 0xFD ; 253
334: f8 01 movw r30, r16
336: 80 81 ld r24, Z
338: 98 2f mov r25, r24
33a: 9b 21 and r25, r11
33c: 89 81 ldd r24, Y+1 ; 0x01
33e: 89 2b or r24, r25
340: 89 83 std Y+1, r24 ; 0x01
/* dataToSend should be packed now */
UartInt_txByte(dataToSend);
342: 89 81 ldd r24, Y+1 ; 0x01
344: 0e 94 09 04 call 0x812
/* flip the colors around since we are doing all G on Y and BR on UV */
dataToSend = currentLineBuffer[i+1];
348: f8 01 movw r30, r16
34a: 81 81 ldd r24, Z+1 ; 0x01
34c: 89 83 std Y+1, r24 ; 0x01
dataToSend &= 0xF0;
34e: 89 81 ldd r24, Y+1 ; 0x01
350: 8b 21 and r24, r11
352: 89 83 std Y+1, r24 ; 0x01
dataToSend >>= 4;
354: 89 81 ldd r24, Y+1 ; 0x01
356: 82 95 swap r24
358: 8f 70 andi r24, 0x0F ; 15
35a: 89 83 std Y+1, r24 ; 0x01
dataToSend |= (previousLineBuffer[i+1] & 0xF0);
35c: f7 01 movw r30, r14
35e: 81 81 ldd r24, Z+1 ; 0x01
360: 98 2f mov r25, r24
362: 9b 21 and r25, r11
364: 89 81 ldd r24, Y+1 ; 0x01
366: 89 2b or r24, r25
368: 89 83 std Y+1, r24 ; 0x01
/* dataToSend should be packed now */
UartInt_txByte(dataToSend);
36a: 89 81 ldd r24, Y+1 ; 0x01
36c: 0e 94 09 04 call 0x812
370: 82 e0 ldi r24, 0x02 ; 2
372: 90 e0 ldi r25, 0x00 ; 0
374: c8 0e add r12, r24
376: d9 1e adc r13, r25
378: 90 e4 ldi r25, 0x40 ; 64
37a: c9 16 cp r12, r25
37c: 91 e0 ldi r25, 0x01 ; 1
37e: d9 06 cpc r13, r25
380: 24 f2 brlt .-120 ; 0x30a
}
UartInt_txByte(0x0F); /* send line end */
382: 8f e0 ldi r24, 0x0F ; 15
384: 0e 94 09 04 call 0x812
/* once all the data is sent, increment out line count by 2 since
we really get 2 lines worth of pixels on each pass */
/* Update...increment only by 1, but only send 72 double-lines */
lineCount++;
388: 80 91 11 01 lds r24, 0x0111
38c: 8f 5f subi r24, 0xFF ; 255
38e: 80 93 11 01 sts 0x0111, r24
if(lineCount%61==0)
392: 6d e3 ldi r22, 0x3D ; 61
394: 0e 94 cb 06 call 0xd96
398: 99 23 and r25, r25
39a: 21 f4 brne .+8 ; 0x3a4
{
Utility_delay(500);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -