Subversion Repositories svnkaklik

Rev

Rev 409 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 409 Rev 410
1
;       Module Name: CanInterface.S
1
;       Module Name: CanInterface.S
2
;       Module Date: 04/14/2004
2
;       Module Date: 04/14/2004
3
;       Module Auth: John O.
3
;       Module Auth: John O.
4
;
4
;
5
;       Description: This module provides the low-level interface
5
;       Description: This module provides the low-level interface
6
;       to the OV6620 camera hardware.  It is responsible for
6
;       to the OV6620 camera hardware.  It is responsible for
7
;   	acquiring each pixel block (RG,GB), performing the mapping
7
;   	acquiring each pixel block (RG,GB), performing the mapping
8
;       into an actual color (orange, purple, etc), run-length
8
;       into an actual color (orange, purple, etc), run-length
9
;       encoding the data, and storing the info off to the appropriate
9
;       encoding the data, and storing the info off to the appropriate
10
;       line buffer.  This routine is synchronized with the pixel data
10
;       line buffer.  This routine is synchronized with the pixel data
11
;       so that no polling of the camera data needs to be done (the
11
;       so that no polling of the camera data needs to be done (the
12
;       OV6620 is clocked off of the same crystal source as the mega8,
12
;       OV6620 is clocked off of the same crystal source as the mega8,
13
;       thus providing inherent synchronization between the two).
13
;       thus providing inherent synchronization between the two).
14
 
14
 
15
#include <avr/io.h>
15
#include <avr/io.h>
16
 
16
 
17
#define PCLK_INTERRUPT_ENABLE_MASK  $40
17
#define PCLK_INTERRUPT_ENABLE_MASK  $40
18
#define PCLK_INTERRUPT_DISABLE_MASK $BF
18
#define PCLK_INTERRUPT_DISABLE_MASK $BF
19
 
19
 
20
        .section .text
20
        .section .text
21
 
21
 
22
        .global CamInt_waitForNewFrame
22
        .global CamInt_waitForNewFrame
23
		.global CamInt_acquireLine
23
		.global CamInt_acquireLine
24
		.global SIG_INTERRUPT0
24
		.global SIG_INTERRUPT0
25
		.global SIG_INTERRUPT1
25
		.global SIG_INTERRUPT1
26
		
26
		
27
;*****************************************************************		
27
;*****************************************************************		
28
;   	Function Name: CamInt_waitForNewFrame
28
;   	Function Name: CamInt_waitForNewFrame
29
;       Function Description: This function is responsible for
29
;       Function Description: This function is responsible for
30
;       going to sleep until a new frame begins (indicated by
30
;       going to sleep until a new frame begins (indicated by
31
;    	VSYNC transitioning from high to low.  This will wake
31
;    	VSYNC transitioning from high to low.  This will wake
32
;       the "VSYNC sleep" up and allow it to continue with 
32
;       the "VSYNC sleep" up and allow it to continue with 
33
;       the acquireLine function, where the system waits for
33
;       the acquireLine function, where the system waits for
34
;       a "PCLK sleep" that we use to synchronize with the
34
;       a "PCLK sleep" that we use to synchronize with the
35
;       data.  
35
;       data.  
36
;       Inputs:  none
36
;       Inputs:  none
37
;       Outputs: none
37
;       Outputs: none
38
;       NOTES: This function doesn't really return...it sorta just
38
;       NOTES: This function doesn't really return...it sorta just
39
;       floats into the acquireLine function after the "VSYNC sleep"
39
;       floats into the acquireLine function after the "VSYNC sleep"
40
;       is awoken.
40
;       is awoken.
41
;*****************************************************************
41
;*****************************************************************
42
		
42
		
43
CamInt_waitForNewFrame:
43
CamInt_waitForNewFrame:
44
		sleep     			; sleep mode already set to sleep idle
44
		sleep     			; sleep mode already set to sleep idle
45
 
45
 
46
CamInt_acquireLine:
46
CamInt_acquireLine:
47
		in 	r1,_SFR_IO_ADDR(GICR)  ;enable the PCLK interrupt
47
		in 	r1,_SFR_IO_ADDR(GICR)  ;enable the PCLK interrupt
48
		or 	r1,PCLK_INTERRUPT_ENABLE_MASK
48
		or 	r1,PCLK_INTERRUPT_ENABLE_MASK
49
		out	_SFR_IO_ADDR(GICR),r1
49
		out	_SFR_IO_ADDR(GICR),r1
50
		sleep
50
		sleep
51
		
51
		
52
		in	r1,_SFR_IO_ADDR(GICR)  ;disable the PCLK interrupt
52
		in	r1,_SFR_IO_ADDR(GICR)  ;disable the PCLK interrupt
53
		and	r1,PCLK_INTERRUPT_DISABLE_MASK
53
		and	r1,PCLK_INTERRUPT_DISABLE_MASK
54
		out	_SFR_IO_ADDR(GICR),r1
54
		out	_SFR_IO_ADDR(GICR),r1
55
		
55
		
56
_acquirePixelBlock:		
56
_acquirePixelBlock:		
57
 
57
 
58
 
58
 
59
_exit:
59
_exit:
60
		ret
60
		ret
61
 
61
 
62
 
62
 
63
SIG_INTERRUPT0:
63
SIG_INTERRUPT0:
64
		; This will wake us up when VSYNC transitions low...we just want to return
64
		; This will wake us up when VSYNC transitions low...we just want to return
65
		reti
65
		reti
66
		
66
		
67
SIG_INTERRUPT1:
67
SIG_INTERRUPT1:
68
		; This will wake us up when PCLK transitions low...we just want to return
68
		; This will wake us up when PCLK transitions low...we just want to return
69
		reti
69
		reti
70
 
70
 
71
 
71
 
72
        .global __vector_default                ; Note [10]
72
        .global __vector_default                ; Note [10]
73
__vector_default:
73
__vector_default:
74
        reti
74
        reti
75
 
75
 
76
        .end
76
        .end