📄 caminterfaceasm.lst
字号:
331 ; NOTES: This function doesn't really return...it sorta just
332 ; floats into the acquireDumpLine function after the "VSYNC sleep"
333 ; is awoken.
334 ;*****************************************************************
335 CamIntAsm_waitForNewDumpFrame:
336:CamInterfaceAsm.S **** sbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
337:CamInterfaceAsm.S **** cbi _SFR_IO_ADDR(PORTD),PD6
338:CamInterfaceAsm.S **** sleep
339
340 ;*****************************************************************
341 ; REMEMBER...everything from here on out is critically timed to be
342 ; synchronized with the flow of pixel data from the camera...
343 ;*****************************************************************
344
345 CamIntAsm_acquireDumpLine:
346:CamInterfaceAsm.S **** brts _cleanUp
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 16
347 ;sbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
348 ;cbi _SFR_IO_ADDR(PORTD),PD6
349
350:CamInterfaceAsm.S **** mov XH,currLineBuffHigh ; Load the pointer to the current line
351:CamInterfaceAsm.S **** mov XL,currLineBuffLow ; buffer into the X pointer regs
352
353:CamInterfaceAsm.S **** mov YH,prevLineBuffHigh ; Load the pointer to the previous line
354:CamInterfaceAsm.S **** mov YL,prevLineBuffLow ; buffer into the Y pointer regs
355
356:CamInterfaceAsm.S **** ldi tmp1,PIXEL_RUN_START_INITIAL ; set up the TCNT1 to overflow (and
357:CamInterfaceAsm.S **** ldi tmp2,0xFF ; interrupts) after 176 pixels
358:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCNT1H),tmp2
359:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCNT1L),tmp1
360
361:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(TCCR1B) ; Enable the PCLK line to actually
362:CamInterfaceAsm.S **** ori tmp1, 0x07 ; feed Timer1
363:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCCR1B),tmp1
364:CamInterfaceAsm.S **** nop
365
366:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(TIMSK) ; enable TIMER1 to start counting
367:CamInterfaceAsm.S **** ori tmp1, ENABLE_PCLK_TIMER1_OVERFLOW_BITMASK ; external PCLK pulses and interrupt on
368:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TIMSK),tmp1 ; overflow
369
370:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(GICR) ; enable the HREF interrupt...remember, we
371 ; only use this interrupt to synchronize
372 ; the beginning of the line
373:CamInterfaceAsm.S **** ori tmp1, HREF_INTERRUPT_ENABLE_MASK
374:CamInterfaceAsm.S **** out _SFR_IO_ADDR(GICR), tmp1
375
376 ;*******************************************************************************************
377 ; Dump Frame handler
378 ;*******************************************************************************************
379
380 _dumpFrame:
381:CamInterfaceAsm.S **** sbi _SFR_IO_ADDR(PORTD),PD6
382:CamInterfaceAsm.S **** sleep ; ...And we wait...
383
384:CamInterfaceAsm.S **** cbi _SFR_IO_ADDR(PORTD),PD6
385:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(GICR) ; disable the HREF interrupt
386:CamInterfaceAsm.S **** andi tmp1, HREF_INTERRUPT_DISABLE_MASK ; so we don't get interrupted
387:CamInterfaceAsm.S **** out _SFR_IO_ADDR(GICR), tmp1 ; while dumping the line
388
389:CamInterfaceAsm.S **** nop ; Remember...if we ever remove the "cbi" instruction above,
390 ; we need to add two more NOPs to cover this
391
392 ; Ok...the following loop needs to run in 8 clock cycles, so we can get every
393 ; pixel in the line...this shouldn't be a problem, since the PCLK timing was
394 ; reduced by a factor of 2 whenever we go to dump a line (this is to give us
395 ; enough time to do the sampling and storing of the pixel data). In addition,
396 ; it is assumed that we will have to do some minor processing on the data right
397 ; before we send it out, like mask off the top 4-bits of each, and then pack both
398 ; low nibbles into a single byte for transmission...we just don't have time to
399 ; do that here (only 8 instruction cycles :-) )
400 _sampleDumpPixel:
401:CamInterfaceAsm.S **** in tmp1,G_PORT ; sample the G value (1)
402:CamInterfaceAsm.S **** in tmp2,RB_PORT ; sample the R/B value (1)
403:CamInterfaceAsm.S **** st X+,tmp1 ; store to the currLineBuff and inc ptrs(2)
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 17
404:CamInterfaceAsm.S **** st Y+,tmp2 ; store to the prevLineBuff and inc ptrs(2)
405:CamInterfaceAsm.S **** brtc _sampleDumpPixel ; loop back unless flag is set (2...if not set)
406 ; ___________
407 ; 8 cycles normally
408
409 ; if we make it here, it means the T flag is set, and we must have been interrupted
410 ; so we need to exit (what if we were interrupted for serial? should we disable it?)
411:CamInterfaceAsm.S **** rjmp _cleanUpDumpLine
412
413 ;***********************************************************
414 ; Function Name: <interrupt handler for External Interrupt0>
415 ; Function Description: This function is responsible
416 ; for handling a rising edge on the Ext Interrupt 0. This
417 ; routine simply returns, since we just want to wake up
418 ; whenever the VSYNC transitions (meaning the start of a new
419 ; frame).
420 ; Inputs: none
421 ; Outputs: none
422 ;***********************************************************
423 SIG_INTERRUPT0:
424 ; This will wake us up when VSYNC transitions high...we just want to return
425:CamInterfaceAsm.S **** reti
426
427 ;***********************************************************
428 ; Function Name: <interrupt handler for External Interrupt1>
429 ; Function Description: This function is responsible
430 ; for handling a falling edge on the Ext Interrupt 1. This
431 ; routine simply returns, since we just want to wake up
432 ; whenever the HREF transitions (meaning the pixels
433 ; are starting after VSYNC transitioned, and we need to
434 ; start acquiring the pixel blocks
435 ; Inputs: none
436 ; Outputs: none
437 ;***********************************************************
438 SIG_INTERRUPT1:
439 ; This will wake us up when HREF transitions high...we just want to return
440:CamInterfaceAsm.S **** reti
441
442 ;***********************************************************
443 ; Function Name: <interrupt handler for Timer0 overflow>
444 ; Function Description: This function is responsible
445 ; for handling the Timer0 overflow (hooked up to indicate
446 ; when we have reached the number of HREFs required in a
447 ; single frame). We set the T flag in the SREG to
448 ; indicate to the _acquirePixelBlock routine that it needs
449 ; to exit, and then set the appropriate action to take in
450 ; the eventList of the Executive module.
451 ; Inputs: none
452 ; Outputs: none
453 ; Note: Originally, the HREF pulses were also going to
454 ; be counted by a hardware counter, but it didn't end up
455 ; being necessary
456 ;***********************************************************
457 ;SIG_OVERFLOW0:
458 ; set ; set the T bit in SREG
459 ; lds tmp1,eventBitmask
460 ; ori tmp1,EV_ACQUIRE_FRAME_COMPLETE
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 18
461 ; sts eventBitmask,tmp1
462 ; reti
463
464 ;***********************************************************
465 ; Function Name: <interrupt handler for Timer1 overflow>
466 ; Function Description: This function is responsible
467 ; for handling the Timer1 overflow (hooked up to indicate
468 ; when we have reached the end of a line of pixel data,
469 ; since PCLK is hooked up to overflow TCNT1 after 176
470 ; pixels). This routine generates an acquire line complete
471 ; event in the fastEventBitmask, which is streamlined for
472 ; efficiency reasons.
473 ;***********************************************************
474 SIG_OVERFLOW1:
475:CamInterfaceAsm.S **** lds tmp1,fastEventBitmask ; set a flag indicating
476:CamInterfaceAsm.S **** ori tmp1,FEV_ACQUIRE_LINE_COMPLETE ; a line is complete
477:CamInterfaceAsm.S **** sts fastEventBitmask,tmp1
478:CamInterfaceAsm.S **** set ; set the T bit in SREG
479 ;sbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
480 ;cbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
481
482:CamInterfaceAsm.S **** reti
483
484 ; This is the default handler for all interrupts that don't
485 ; have handler routines specified for them.
486 .global __vector_default
487 __vector_default:
488:CamInterfaceAsm.S **** reti
489
490 .end
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 19
DEFINED SYMBOLS
*ABS*:00000000 CamInterfaceAsm.S
*ABS*:00000000 Events.h
*ABS*:00000000 CamInterfaceAsm.S
*ABS*:00000000 C:/WinAVR/avr/include/avr/io.h
*ABS*:00000000 C:/WinAVR/avr/include/avr/iom8.h
*ABS*:00000000 C:/WinAVR/avr/include/avr/io.h
*ABS*:00000000 C:/WinAVR/avr/include/avr/sfr_defs.h
*ABS*:00000000 C:/WinAVR/avr/include/avr/io.h
*ABS*:00000000 CamInterfaceAsm.S
*ABS*:00000000 <command line>
*ABS*:00000000 <built-in>
*ABS*:00000000 CamInterfaceAsm.S
*ABS*:00000010 pixelCount
*ABS*:00000011 pixelRunStart
*ABS*:00000012 lastColor
*ABS*:00000013 tmp1
*ABS*:00000014 tmp2
*ABS*:00000013 color
*ABS*:00000014 greenData
*ABS*:00000015 blueData
*ABS*:00000016 colorMapLow
*ABS*:00000017 colorMapHigh
*ABS*:00000016 prevLineBuffLow
*ABS*:00000017 prevLineBuffHigh
*ABS*:00000018 currLineBuffLow
*ABS*:00000019 currLineBuffHigh
CamInterfaceAsm.S:169 .text:00000000 CamIntAsm_waitForNewTrackingFrame
CamInterfaceAsm.S:335 .text:0000008e CamIntAsm_waitForNewDumpFrame
CamInterfaceAsm.S:345 .text:00000094 CamIntAsm_acquireDumpLine
CamInterfaceAsm.S:179 .text:00000006 CamIntAsm_acquireTrackingLine
CamInterfaceAsm.S:423 .text:000000d4 __vector_1
CamInterfaceAsm.S:438 .text:000000d6 __vector_2
CamInterfaceAsm.S:474 .text:000000d8 __vector_8
CamInterfaceAsm.S:305 .text:00000080 _cleanUp
CamInterfaceAsm.S:223 .text:00000034 _trackFrame
CamInterfaceAsm.S:240 .text:00000044 _acquirePixelBlock
CamInterfaceAsm.S:281 .text:00000074 _cleanUpTrackingLine
CamInterfaceAsm.S:292 .text:00000080 _cleanUpDumpLine
CamInterfaceAsm.S:316 .text:0000008c _exit
CamInterfaceAsm.S:380 .text:000000ba _dumpFrame
CamInterfaceAsm.S:400 .text:000000c8 _sampleDumpPixel
CamInterfaceAsm.S:487 .text:000000e6 __vector_default
UNDEFINED SYMBOLS
__vector_9
fastEventBitmask
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -