📄 executive.lst
字号:
1 .file "Executive.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 Exec_eventFifoHead
73 .global Exec_eventFifoHead
74 .section .bss
77 Exec_eventFifoHead:
78 0000 00 .skip 1,0
79 .global Exec_eventFifoTail
80 .global Exec_eventFifoTail
83 Exec_eventFifoTail:
84 0001 00 .skip 1,0
85 .global fastEventBitmask
86 .global fastEventBitmask
89 fastEventBitmask:
90 0002 00 .skip 1,0
91 .text
93 .global Exec_run
95 Exec_run:
1:Executive.c **** /*
2:Executive.c **** Copyright (C) 2004 John Orlando
3:Executive.c ****
4:Executive.c **** AVRcam: a small real-time image processing engine.
5:Executive.c ****
6:Executive.c **** This program is free software; you can redistribute it and/or
7:Executive.c **** modify it under the terms of the GNU General Public
8:Executive.c **** License as published by the Free Software Foundation; either
9:Executive.c **** version 2 of the License, or (at your option) any later version.
10:Executive.c ****
11:Executive.c **** This program is distributed in the hope that it will be useful,
12:Executive.c **** but WITHOUT ANY WARRANTY; without even the implied warranty of
13:Executive.c **** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14:Executive.c **** General Public License for more details.
15:Executive.c ****
16:Executive.c **** You should have received a copy of the GNU General Public
17:Executive.c **** License along with this program; if not, write to the Free Software
18:Executive.c **** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19:Executive.c ****
20:Executive.c **** For more information on the AVRcam, please contact:
21:Executive.c ****
22:Executive.c **** john@jrobot.net
23:Executive.c ****
24:Executive.c **** or go to www.jrobot.net for more details regarding the system.
25:Executive.c **** */
26:Executive.c **** /***********************************************************
27:Executive.c **** Module Name: Executive.c
28:Executive.c **** Module Date: 04/12/2004
29:Executive.c **** Module Auth: John Orlando
30:Executive.c ****
31:Executive.c **** Description: This file is responsible for implementing a
32:Executive.c **** minimalist event dispatcher. It keeps track of an event
33:Executive.c **** fifo that waits for new events to come in, and dispatches
34:Executive.c **** them to any entities that care about them.
35:Executive.c ****
36:Executive.c **** Revision History:
37:Executive.c **** Date Rel Ver. Notes
38:Executive.c **** 4/10/2004 0.1 Module created
39:Executive.c **** 6/30/2004 1.0 Initial release for Circuit Cellar
40:Executive.c **** contest.
41:Executive.c **** 1/16/2005 1.4 Fixed issue where the interrupts weren't
42:Executive.c **** being turned off when the fastEventBitmask
43:Executive.c **** was being accessed. Also removed redundant
44:Executive.c **** interrupt masking when accessing the
45:Executive.c **** main event fifo. Also fixed issue where
46:Executive.c **** the main event fifo wasn't being checked
47:Executive.c **** for events if an event was pending in
48:Executive.c **** the fast event fifo.
49:Executive.c **** ***********************************************************/
50:Executive.c ****
51:Executive.c **** /* Includes */
52:Executive.c **** #include <stdlib.h>
53:Executive.c **** #include "CommonDefs.h"
54:Executive.c **** #include "Executive.h"
55:Executive.c **** #include "FrameMgr.h"
56:Executive.c **** #include "CamInterface.h"
57:Executive.c **** #include "UIMgr.h"
58:Executive.c **** #include "UartInterface.h"
59:Executive.c **** #include "CamConfig.h"
60:Executive.c **** #include "Utility.h"
61:Executive.c ****
62:Executive.c **** /* Local Variables */
63:Executive.c **** unsigned char Exec_eventFifo[EXEC_EVENT_FIFO_SIZE];
64:Executive.c **** unsigned char Exec_eventFifoHead=0;
65:Executive.c **** unsigned char Exec_eventFifoTail=0;
66:Executive.c ****
67:Executive.c **** /* Local Function Definitions */
68:Executive.c **** static unsigned char Exec_readEventFifo(void);
69:Executive.c ****
70:Executive.c **** /* Local Structures and Typedefs */
71:Executive.c ****
72:Executive.c **** /* Extern Variables */
73:Executive.c **** /* This bitmask holds events that need to be processed as fast as possible */
74:Executive.c **** unsigned char fastEventBitmask = 0x00;
75:Executive.c ****
76:Executive.c **** /* Definitions */
77:Executive.c **** #define IS_DATA_IN_EVENT_FIFO() (!(Exec_eventFifoHead == Exec_eventFifoTail))
78:Executive.c **** /***********************************************************
79:Executive.c **** Function Name: Exec_run
80:Executive.c **** Function Description: This function is responsible for
81:Executive.c **** running the main control loop. The control loop is
82:Executive.c **** based on checking both the fast-event bitmask (for high
83:Executive.c **** priority events) and the event FIFO to determine if an
84:Executive.c **** event needs to be handled. The event is then dispatched
85:Executive.c **** to the appropriate handler.
86:Executive.c **** Inputs: none
87:Executive.c **** Outputs: none
88:Executive.c **** ***********************************************************/
89:Executive.c **** void Exec_run(void)
90:Executive.c **** {
97 .LM1:
98 /* prologue: frame size=0 */
99 0000 CF93 push r28
100 /* prologue end (size=1) */
101 .L18:
91:Executive.c **** unsigned char eventGenerated;
92:Executive.c **** while(1)
93:Executive.c **** {
94:Executive.c **** if (fastEventBitmask)//初值0x00
103 .LM2:
104 0002 8091 0000 lds r24,fastEventBitmask
105 0006 8823 tst r24
106 0008 D1F0 breq .L4
95:Executive.c **** {
96:Executive.c **** /* an event needing fast processing has been received */
97:Executive.c **** /* a received line needs to be processed...this
98:Executive.c **** needs to be processed as quickly as possible */
99:Executive.c **** if (fastEventBitmask & FEV_ACQUIRE_LINE_COMPLETE)//定时器中断,到此
108 .LM3:
109 000a 80FF sbrs r24,0
110 000c 0BC0 rjmp .L5
100:Executive.c **** {
101:Executive.c **** DISABLE_INTS();
112 .LM4:
113 /* #APP */
114 000e F894 cli
102:Executive.c **** fastEventBitmask &= ~FEV_ACQUIRE_LINE_COMPLETE;
116 .LM5:
117 /* #NOAPP */
118 0010 8091 0000 lds r24,fastEventBitmask
119 0014 8E7F andi r24,lo8(-2)
120 0016 8093 0000 sts fastEventBitmask,r24
103:Executive.c **** ENABLE_INTS();
122 .LM6:
123 /* #APP */
124 001a 7894 sei
104:Executive.c **** FrameMgr_processLine();
126 .LM7:
127 /* #NOAPP */
128 001c 0E94 0000 call FrameMgr_processLine
105:Executive.c ****
106:Executive.c **** /* also check if serial data needs to be sent
107:Executive.c **** out through UIMgr */
108:Executive.c **** UIMgr_transmitPendingData();
130 .LM8:
131 0020 0E94 0000 call UIMgr_transmitPendingData
132 .L5:
109:Executive.c ****
110:Executive.c **** /* we can't just call acquire line again here,
111:Executive.c **** since we don't know if we need to acquire another
112:Executive.c **** line or not (it depends on the FrameMgr to figure
113:Executive.c **** this out) */
114:Executive.c **** }
115:Executive.c **** if (fastEventBitmask & FEV_PROCESS_LINE_COMPLETE)
134 .LM9:
135 0024 8091 0000 lds r24,fastEventBitmask
136 0028 81FF sbrs r24,1
137 002a 09C0 rjmp .L4
116:Executive.c **** {
117:Executive.c **** DISABLE_INTS();
139 .LM10:
140 /* #APP */
141 002c F894 cli
118:Executive.c **** fastEventBitmask &= ~FEV_PROCESS_LINE_COMPLETE;
143 .LM11:
144 /* #NOAPP */
145 002e 8091 0000 lds r24,fastEventBitmask
146 0032 8D7F andi r24,lo8(-3)
147 0034 8093 0000 sts fastEventBitmask,r24
119:Executive.c **** ENABLE_INTS();
149 .LM12:
150 /* #APP */
151 0038 7894 sei
120:Executive.c **** FrameMgr_acquireLine();
153 .LM13:
154 /* #NOAPP */
155 003a 0E94 0000 call FrameMgr_acquireLine
156 .L4:
121:Executive.c **** }
122:Executive.c **** }
123:Executive.c ****
124:Executive.c **** if (IS_DATA_IN_EVENT_FIFO() == TRUE)
158 .LM14:
159 003e 9091 0000 lds r25,Exec_eventFifoHead
160 0042 8091 0000 lds r24,Exec_eventFifoTail
161 0046 9817 cp r25,r24
162 0048 E1F2 breq .L18
125:Executive.c **** {
126:Executive.c **** eventGenerated = Exec_readEventFifo();
164 .LM15:
165 004a 0E94 0000 call Exec_readEventFifo
166 004e C82F mov r28,r24
127:Executive.c **** switch(eventGenerated)
168 .LM16:
169 0050 9927 clr r25
170 0052 8230 cpi r24,2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -