⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 caminterface.lst

📁 mg128+Ov7620实现图象采集
💻 LST
字号:
   1               		.file	"CamInterface.c"
   2               		.arch atmega128
   3               	__SREG__ = 0x3f
   4               	__SP_H__ = 0x3e
   5               	__SP_L__ = 0x3d
   6               	__tmp_reg__ = 0
   7               	__zero_reg__ = 1
   8               		.global __do_copy_data
   9               		.global __do_clear_bss
  11               		.text
  12               	.Ltext0:
  72               	.global	CamInt_init
  74               	CamInt_init:
   1:CamInterface.c **** /***********************************************************
   2:CamInterface.c **** 	Module Name: CamInterface.c
   3:CamInterface.c **** 	Module Date: 04/12/2004
   4:CamInterface.c **** 	Module Auth: John Orlando
   5:CamInterface.c **** 	
   6:CamInterface.c **** 	Description: This file is responsible for providing an
   7:CamInterface.c **** 	interface to the OV6620 camera hardware.  This includes
   8:CamInterface.c **** 	an interface to CamInterface.S for certain low-level,
   9:CamInterface.c **** 	optimized camera access routines.
  10:CamInterface.c ****     
  11:CamInterface.c ****     Revision History:
  12:CamInterface.c ****     Date        Rel Ver.    Notes
  13:CamInterface.c ****     4/10/2004      0.1     Module created
  14:CamInterface.c ****     6/30/2004      1.0     Initial release for Circuit Cellar
  15:CamInterface.c ****                            contest.
  16:CamInterface.c ****     11/15/2004     1.2     ifdef'd out the resetCam routine, since
  17:CamInterface.c ****                            resetting the cam now causes the OV6620's
  18:CamInterface.c ****                            clock to not be output (we have to start
  19:CamInterface.c ****                            it up after each reset with the external
  20:CamInterface.c ****                            tiny12 processor).
  21:CamInterface.c ****     1/16/2005      1.4     Ensure that the TCCR1B register is set so
  22:CamInterface.c ****                            nothing is clocking timer1 at startup.                             
  23:CamInterface.c **** ***********************************************************/
  24:CamInterface.c **** 
  25:CamInterface.c **** /*	Includes */
  26:CamInterface.c **** #include <avr/interrupt.h>
  27:CamInterface.c **** #include <avr/signal.h>
  28:CamInterface.c **** #include <avr/sleep.h>
  29:CamInterface.c **** #include <avr/eeprom.h>
  30:CamInterface.c **** #include <stdlib.h>
  31:CamInterface.c **** #include <string.h>
  32:CamInterface.c **** #include "CommonDefs.h"
  33:CamInterface.c **** #include "CamInterface.h"
  34:CamInterface.c **** #include "Utility.h"
  35:CamInterface.c **** #include "UIMgr.h"
  36:CamInterface.c **** #include "Executive.h"
  37:CamInterface.c **** #include "UartInterface.h"
  38:CamInterface.c **** 
  39:CamInterface.c **** 
  40:CamInterface.c **** 
  41:CamInterface.c **** #define CAM_G_BUS          	PINC
  42:CamInterface.c **** #define CAM_G_BUS_DIR      	DDRC
  43:CamInterface.c **** #define CAM_RB_BUS          PINA
  44:CamInterface.c **** #define CAM_RB_BUS_DIR 		DDRA
  45:CamInterface.c **** 
  46:CamInterface.c **** #define CAM_CONTROL_PORT     PORTD
  47:CamInterface.c **** #define CAM_CONTROL_PORT_DIR DDRD
  48:CamInterface.c **** 
  49:CamInterface.c **** 
  50:CamInterface.c **** 
  51:CamInterface.c **** /*  Extern Variables */
  52:CamInterface.c **** /* These two buffers hold the current and previous lines
  53:CamInterface.c **** of pixel data.  They are sized to the worst case scenario,
  54:CamInterface.c **** where the color changes between every pixel (unrealistic).
  55:CamInterface.c **** The format of each buffer is for all the even bytes to hold
  56:CamInterface.c **** the run-length, and the odd bytes to hold the color data. */
  57:CamInterface.c **** 
  58:CamInterface.c **** /* In addition, if we are in frameDump mode, we use these buffers
  59:CamInterface.c **** to store the acquired line data...we are actually grabbing ALL of the
  60:CamInterface.c **** pixels in a line (176) instead of the 88 we get normally during tracking.
  61:CamInterface.c **** But since we have enough to hold 88-RLE blocks, we already have the 176
  62:CamInterface.c **** allocated for this... */
  63:CamInterface.c **** unsigned char currentLineBuffer[LENGTH_OF_LINE_BUFFER];
  64:CamInterface.c **** unsigned char previousLineBuffer[LENGTH_OF_LINE_BUFFER];/*176*/
  65:CamInterface.c **** 
  66:CamInterface.c **** /*  Extern Functions */
  67:CamInterface.c **** /* These functions are located in assembly files, and thus
  68:CamInterface.c **** must be externed here so they can be referenced in the source below. */
  69:CamInterface.c **** extern void CamIntAsm_waitForNewDumpFrame(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);
  70:CamInterface.c **** extern void CamIntAsm_acquireDumpLine(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);
  71:CamInterface.c **** 
  72:CamInterface.c **** /***********************************************************
  73:CamInterface.c **** 	Function Name: CamInt_init
  74:CamInterface.c **** 	Function Description: This function is responsible
  75:CamInterface.c **** 	for initializing the camera interface.  This includes
  76:CamInterface.c **** 	setting up the i/o ports that are used to read the
  77:CamInterface.c **** 	camera busses, as well as resetting the camera.
  78:CamInterface.c **** 	Inputs:  none
  79:CamInterface.c **** 	Outputs: none
  80:CamInterface.c **** ***********************************************************/	
  81:CamInterface.c **** void CamInt_init(void)
  82:CamInterface.c **** {
  76               	.LM1:
  77               	/* prologue: frame size=0 */
  78               	/* prologue end (size=0) */
  83:CamInterface.c **** 
  84:CamInterface.c **** 	CAM_CONTROL_PORT_DIR &= 0xFB;   /* make sure bit2 is clear (input) VSYNC interrupt*/
  80               	.LM2:
  81 0000 8A98      		cbi 49-0x20,2
  85:CamInterface.c **** 	//CAM_CONTROL_PORT &= 0x7F;   /* set reset line low */
  86:CamInterface.c **** 	CAM_G_BUS_DIR &= 0x00;  /* 8-bit G bus all inputs      PortC*/
  83               	.LM3:
  84 0002 84B3      		in r24,52-0x20
  85 0004 14BA      		out 52-0x20,__zero_reg__
  87:CamInterface.c ****     DDRB |= 0x0A;  /* disable the pull-up on PB1 and PB3 */
  87               	.LM4:
  88 0006 87B3      		in r24,55-0x20
  89 0008 8A60      		ori r24,lo8(10)
  90 000a 87BB      		out 55-0x20,r24
  88:CamInterface.c **** 	CAM_RB_BUS_DIR &= 0x00;  /* 8-bit RB bus all inputs    PortA*/
  92               	.LM5:
  93 000c 8AB3      		in r24,58-0x20
  94 000e 1ABA      		out 58-0x20,__zero_reg__
  89:CamInterface.c **** 	
  90:CamInterface.c ****     /* ensure that timer1 is disabled to start...eventually, when PCLK needs
  91:CamInterface.c ****     to feed timer1 through the external counter, it will be enabled on an
  92:CamInterface.c ****     "as needed" basis...*/
  93:CamInterface.c **** 	TCCR1B &= ~( (1<<CS12)|(1<<CS11)|(1<<CS10) );
  96               	.LM6:
  97 0010 8EB5      		in r24,78-0x20
  98 0012 887F      		andi r24,lo8(-8)
  99 0014 8EBD      		out 78-0x20,r24
  94:CamInterface.c **** 	
  95:CamInterface.c **** 	/* we'll turn on the interrupt after we assign the initial TCNT value */
  96:CamInterface.c **** 	
  97:CamInterface.c **** 	/* set up External Interrupt1 to interrupt us on rising edges (HREF)...
  98:CamInterface.c **** 	this is needed to indicate when the first pixel of each line is about to start, so
  99:CamInterface.c **** 	we can synch up with it...this interrupt will be disabled once HREF goes high */
 100:CamInterface.c **** 	
 101:CamInterface.c **** 	EICRA |= (1<<ISC31) | (1<<ISC30);  /* rising edge interrupt *///EICRA
 101               	.LM7:
 102 0016 8091 6A00 		lds r24,106
 103 001a 806C      		ori r24,lo8(-64)
 104 001c 8093 6A00 		sts 106,r24
 102:CamInterface.c **** 	/* the interrupt will be enabled when we are ready to detect the rising edge of
 103:CamInterface.c **** 	HREF...its now primed and ready to go */
 104:CamInterface.c **** 	
 105:CamInterface.c **** 	/* set up External Interrupt0 to interrupt us on rising edges (VSYNC) */
 106:CamInterface.c **** 	EICRA |= (1<<ISC21) | (1<<ISC20);	/* rising edge interrupt */ 
 106               	.LM8:
 107 0020 8091 6A00 		lds r24,106
 108 0024 8063      		ori r24,lo8(48)
 109 0026 8093 6A00 		sts 106,r24
 107:CamInterface.c **** 	EIMSK |= (1<<INT2);    /* VSYNC interrupt request enabled */
 111               	.LM9:
 112 002a 89B7      		in r24,89-0x20
 113 002c 8460      		ori r24,lo8(4)
 114 002e 89BF      		out 89-0x20,r24
 108:CamInterface.c **** 	
 109:CamInterface.c **** 	/* set up TimerO to count and be clocked from an external pulse source
 110:CamInterface.c **** 	(HREF) on falling edges...eventually, we need to enable the interrupt
 111:CamInterface.c **** 	for this!  FIX THIS */
 112:CamInterface.c **** 	TCCR2 = (1<<CS02)|(1<<CS01)|(0<<CS00);
 116               	.LM10:
 117 0030 86E0      		ldi r24,lo8(6)
 118 0032 85BD      		out 69-0x20,r24
 113:CamInterface.c **** 	
 114:CamInterface.c **** 	/* setting up the PCLK counter with Timer1 will be done right after
 115:CamInterface.c **** 	we start receiving pixels in each line...we sacrifice the first pixel
 116:CamInterface.c **** 	in each line, but we'll account for it...*/
 117:CamInterface.c **** 	
 118:CamInterface.c **** 	/* set up the mega8 so that its sleep mode puts it in an IDLE sleep
 119:CamInterface.c **** 	mode, where it can wake up as fast as possible */
 120:CamInterface.c **** 	set_sleep_mode(SLEEP_MODE_IDLE);
 120               	.LM11:
 121 0034 85B7      		in r24,85-0x20
 122 0036 837E      		andi r24,lo8(-29)
 123 0038 85BF      		out 85-0x20,r24
 121:CamInterface.c **** 	/* umm....we need to actually enable the sleep mode...*/
 122:CamInterface.c **** 	MCUCR |= (1<<SE);
 125               	.LM12:
 126 003a 85B7      		in r24,85-0x20
 127 003c 8062      		ori r24,lo8(32)
 128 003e 85BF      		out 85-0x20,r24
 129               	/* epilogue: frame size=0 */
 130 0040 0895      		ret
 131               	/* epilogue end (size=1) */
 132               	/* function CamInt_init size 33 (32) */
 134               	.Lscope0:
 136               	.global	CamInt_resetCam
 138               	CamInt_resetCam:
 123:CamInterface.c **** 	
 124:CamInterface.c **** 	
 125:CamInterface.c **** 
 126:CamInterface.c **** 
 127:CamInterface.c **** }
 128:CamInterface.c **** 
 129:CamInterface.c **** /***********************************************************
 130:CamInterface.c **** 	Function Name: CamInt_resetCam
 131:CamInterface.c **** 	Function Description: This function is responsible
 132:CamInterface.c **** 	for resetting the camera.  This is accomplished by
 133:CamInterface.c **** 	toggling the reset line on the OV6620 for ~100 mS.
 134:CamInterface.c **** 	Inputs:  none
 135:CamInterface.c **** 	Outputs: none
 136:CamInterface.c ****     IMPORTANT NOTE: This function has effectively been removed
 137:CamInterface.c ****     since resetting the camera now causes the camera to not
 138:CamInterface.c ****     output the clock signal.  Thus, if we reset the cam, the
 139:CamInterface.c ****     AVR has no clock, and thus doesn't run...
 140:CamInterface.c **** ***********************************************************/	
 141:CamInterface.c **** void CamInt_resetCam(void)
 142:CamInterface.c **** {
 140               	.LM13:
 141               	/* prologue: frame size=0 */
 142               	/* prologue end (size=0) */
 143               	/* epilogue: frame size=0 */
 144 0042 0895      		ret
 145               	/* epilogue end (size=1) */
 146               	/* function CamInt_resetCam size 1 (0) */
 148               	.Lscope1:
 149               		.comm currentLineBuffer,320,1
 150               		.comm previousLineBuffer,320,1
 153               		.text
 155               	Letext:
 156               	/* File "CamInterface.c": code   34 = 0x0022 (  32), prologues   0, epilogues   2 */
DEFINED SYMBOLS
                            *ABS*:00000000 CamInterface.c
                            *ABS*:0000003f __SREG__
                            *ABS*:0000003e __SP_H__
                            *ABS*:0000003d __SP_L__
                            *ABS*:00000000 __tmp_reg__
                            *ABS*:00000001 __zero_reg__
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccgBaaaa.s:74     .text:00000000 CamInt_init
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccgBaaaa.s:138    .text:00000042 CamInt_resetCam
                            *COM*:00000140 currentLineBuffer
                            *COM*:00000140 previousLineBuffer
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccgBaaaa.s:155    .text:00000044 Letext

UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -