📄 os_mbox.lst
字号:
1 .file "os_mbox.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:
108 .global OSMboxAccept
110 OSMboxAccept:
1:../OSsrc/os_mbox.c **** /*
2:../OSsrc/os_mbox.c **** ***************************************************************************************************
3:../OSsrc/os_mbox.c **** * uC/OS-II
4:../OSsrc/os_mbox.c **** * The Real-Time Kernel
5:../OSsrc/os_mbox.c **** * MESSAGE MAILBOX MANAGEMENT
6:../OSsrc/os_mbox.c **** *
7:../OSsrc/os_mbox.c **** * (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
8:../OSsrc/os_mbox.c **** * All Rights Reserved
9:../OSsrc/os_mbox.c **** *
10:../OSsrc/os_mbox.c **** * File : OS_MBOX.C
11:../OSsrc/os_mbox.c **** * By : Jean J. Labrosse
12:../OSsrc/os_mbox.c **** * Version : V2.85
13:../OSsrc/os_mbox.c **** *
14:../OSsrc/os_mbox.c **** * LICENSING TERMS:
15:../OSsrc/os_mbox.c **** * ---------------
16:../OSsrc/os_mbox.c **** * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful re
17:../OSsrc/os_mbox.c **** * If you plan on using uC/OS-II in a commercial product you need to contact Micri祄 to properly l
18:../OSsrc/os_mbox.c **** * its use in your product. We provide ALL the source code for your convenience and to help you expe
19:../OSsrc/os_mbox.c **** * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without pa
20:../OSsrc/os_mbox.c **** * licensing fee.
21:../OSsrc/os_mbox.c **** ***************************************************************************************************
22:../OSsrc/os_mbox.c **** */
23:../OSsrc/os_mbox.c ****
24:../OSsrc/os_mbox.c **** #ifndef OS_MASTER_FILE
25:../OSsrc/os_mbox.c **** #include <ucos_ii.h>
26:../OSsrc/os_mbox.c **** #endif
27:../OSsrc/os_mbox.c ****
28:../OSsrc/os_mbox.c **** #if OS_MBOX_EN > 0
29:../OSsrc/os_mbox.c **** /*
30:../OSsrc/os_mbox.c **** ***************************************************************************************************
31:../OSsrc/os_mbox.c **** * ACCEPT MESSAGE FROM MAILBOX
32:../OSsrc/os_mbox.c **** *
33:../OSsrc/os_mbox.c **** * Description: This function checks the mailbox to see if a message is available. Unlike OSMboxPen
34:../OSsrc/os_mbox.c **** * OSMboxAccept() does not suspend the calling task if a message is not available.
35:../OSsrc/os_mbox.c **** *
36:../OSsrc/os_mbox.c **** * Arguments : pevent is a pointer to the event control block
37:../OSsrc/os_mbox.c **** *
38:../OSsrc/os_mbox.c **** * Returns : != (void *)0 is the message in the mailbox if one is available. The mailbox is cle
39:../OSsrc/os_mbox.c **** * so the next time OSMboxAccept() is called, the mailbox will be empty.
40:../OSsrc/os_mbox.c **** * == (void *)0 if the mailbox is empty or,
41:../OSsrc/os_mbox.c **** * if 'pevent' is a NULL pointer or,
42:../OSsrc/os_mbox.c **** * if you didn't pass the proper event pointer.
43:../OSsrc/os_mbox.c **** ***************************************************************************************************
44:../OSsrc/os_mbox.c **** */
45:../OSsrc/os_mbox.c ****
46:../OSsrc/os_mbox.c **** #if OS_MBOX_ACCEPT_EN > 0
47:../OSsrc/os_mbox.c **** void *OSMboxAccept (OS_EVENT *pevent)
48:../OSsrc/os_mbox.c **** {
112 .LM1:
113 /* prologue: frame size=0 */
114 /* prologue end (size=0) */
115 0000 FC01 movw r30,r24
49:../OSsrc/os_mbox.c **** void *pmsg;
50:../OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status regist
51:../OSsrc/os_mbox.c **** OS_CPU_SR cpu_sr = 0;
52:../OSsrc/os_mbox.c **** #endif
53:../OSsrc/os_mbox.c ****
54:../OSsrc/os_mbox.c ****
55:../OSsrc/os_mbox.c ****
56:../OSsrc/os_mbox.c **** #if OS_ARG_CHK_EN > 0
57:../OSsrc/os_mbox.c **** if (pevent == (OS_EVENT *)0) { /* Validate 'pevent'
117 .LM2:
118 0002 0097 sbiw r24,0
119 0004 09F4 brne .L2
58:../OSsrc/os_mbox.c **** return ((void *)0);
121 .LM3:
122 0006 0895 ret
123 .L2:
59:../OSsrc/os_mbox.c **** }
60:../OSsrc/os_mbox.c **** #endif
61:../OSsrc/os_mbox.c **** if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type
125 .LM4:
126 0008 8081 ld r24,Z
127 000a 8130 cpi r24,lo8(1)
128 000c 19F0 breq .L3
62:../OSsrc/os_mbox.c **** return ((void *)0);
130 .LM5:
131 000e 80E0 ldi r24,lo8(0)
132 0010 90E0 ldi r25,hi8(0)
133 0012 0895 ret
134 .L3:
63:../OSsrc/os_mbox.c **** }
64:../OSsrc/os_mbox.c **** OS_ENTER_CRITICAL();
136 .LM6:
137 /* #APP */
138 0014 F894 cli
65:../OSsrc/os_mbox.c **** pmsg = pevent->OSEventPtr;
140 .LM7:
141 /* #NOAPP */
142 0016 8181 ldd r24,Z+1
143 0018 9281 ldd r25,Z+2
66:../OSsrc/os_mbox.c **** pevent->OSEventPtr = (void *)0; /* Clear the mailbox
145 .LM8:
146 001a 1282 std Z+2,__zero_reg__
147 001c 1182 std Z+1,__zero_reg__
67:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
149 .LM9:
150 /* #APP */
151 001e 7894 sei
68:../OSsrc/os_mbox.c **** return (pmsg); /* Return the message received (or NULL)
69:../OSsrc/os_mbox.c **** }
153 .LM10:
154 /* #NOAPP */
155 0020 0895 ret
156 /* epilogue: frame size=0 */
157 /* epilogue: noreturn */
158 /* epilogue end (size=0) */
159 /* function OSMboxAccept size 19 (19) */
164 .Lscope0:
167 .global OSMboxCreate
169 OSMboxCreate:
70:../OSsrc/os_mbox.c **** #endif
71:../OSsrc/os_mbox.c **** /*$PAGE*/
72:../OSsrc/os_mbox.c **** /*
73:../OSsrc/os_mbox.c **** ***************************************************************************************************
74:../OSsrc/os_mbox.c **** * CREATE A MESSAGE MAILBOX
75:../OSsrc/os_mbox.c **** *
76:../OSsrc/os_mbox.c **** * Description: This function creates a message mailbox if free event control blocks are available.
77:../OSsrc/os_mbox.c **** *
78:../OSsrc/os_mbox.c **** * Arguments : pmsg is a pointer to a message that you wish to deposit in the mailbox. If
79:../OSsrc/os_mbox.c **** * you set this value to the NULL pointer (i.e. (void *)0) then the mailb
80:../OSsrc/os_mbox.c **** * will be considered empty.
81:../OSsrc/os_mbox.c **** *
82:../OSsrc/os_mbox.c **** * Returns : != (OS_EVENT *)0 is a pointer to the event control clock (OS_EVENT) associated with
83:../OSsrc/os_mbox.c **** * created mailbox
84:../OSsrc/os_mbox.c **** * == (OS_EVENT *)0 if no event control blocks were available
85:../OSsrc/os_mbox.c **** ***************************************************************************************************
86:../OSsrc/os_mbox.c **** */
87:../OSsrc/os_mbox.c ****
88:../OSsrc/os_mbox.c **** OS_EVENT *OSMboxCreate (void *pmsg)
89:../OSsrc/os_mbox.c **** {
171 .LM11:
172 /* prologue: frame size=0 */
173 0022 CF93 push r28
174 0024 DF93 push r29
175 /* prologue end (size=2) */
176 0026 9C01 movw r18,r24
90:../OSsrc/os_mbox.c **** OS_EVENT *pevent;
91:../OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register
92:../OSsrc/os_mbox.c **** OS_CPU_SR cpu_sr = 0;
93:../OSsrc/os_mbox.c **** #endif
94:../OSsrc/os_mbox.c ****
95:../OSsrc/os_mbox.c ****
96:../OSsrc/os_mbox.c ****
97:../OSsrc/os_mbox.c **** if (OSIntNesting > 0) { /* See if called from ISR ...
178 .LM12:
179 0028 8091 0000 lds r24,OSIntNesting
180 002c 8823 tst r24
181 002e 19F0 breq .L5
98:../OSsrc/os_mbox.c **** return ((OS_EVENT *)0); /* ... can't CREATE from an ISR
183 .LM13:
184 0030 80E0 ldi r24,lo8(0)
185 0032 90E0 ldi r25,hi8(0)
186 0034 1DC0 rjmp .L4
187 .L5:
99:../OSsrc/os_mbox.c **** }
100:../OSsrc/os_mbox.c **** OS_ENTER_CRITICAL();
189 .LM14:
190 /* #APP */
191 0036 F894 cli
101:../OSsrc/os_mbox.c **** pevent = OSEventFreeList; /* Get next free event control block
193 .LM15:
194 /* #NOAPP */
195 0038 C091 0000 lds r28,OSEventFreeList
196 003c D091 0000 lds r29,(OSEventFreeList)+1
102:../OSsrc/os_mbox.c **** if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty
198 .LM16:
199 0040 2097 sbiw r28,0
200 0042 31F0 breq .L6
103:../OSsrc/os_mbox.c **** OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
202 .LM17:
203 0044 8981 ldd r24,Y+1
204 0046 9A81 ldd r25,Y+2
205 0048 9093 0000 sts (OSEventFreeList)+1,r25
206 004c 8093 0000 sts OSEventFreeList,r24
207 .L6:
104:../OSsrc/os_mbox.c **** }
105:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
209 .LM18:
210 /* #APP */
211 0050 7894 sei
106:../OSsrc/os_mbox.c **** if (pevent != (OS_EVENT *)0) {
213 .LM19:
214 /* #NOAPP */
215 0052 2097 sbiw r28,0
216 0054 61F0 breq .L7
107:../OSsrc/os_mbox.c **** pevent->OSEventType = OS_EVENT_TYPE_MBOX;
218 .LM20:
219 0056 81E0 ldi r24,lo8(1)
220 0058 8883 st Y,r24
108:../OSsrc/os_mbox.c **** pevent->OSEventCnt = 0;
222 .LM21:
223 005a 1C82 std Y+4,__zero_reg__
224 005c 1B82 std Y+3,__zero_reg__
109:../OSsrc/os_mbox.c **** pevent->OSEventPtr = pmsg; /* Deposit message in event control block
226 .LM22:
227 005e 3A83 std Y+2,r19
228 0060 2983 std Y+1,r18
110:../OSsrc/os_mbox.c **** #if OS_EVENT_NAME_SIZE > 1
111:../OSsrc/os_mbox.c **** pevent->OSEventName[0] = '?';
230 .LM23:
231 0062 8FE3 ldi r24,lo8(63)
232 0064 8E87 std Y+14,r24
112:../OSsrc/os_mbox.c **** pevent->OSEventName[1] = OS_ASCII_NUL;
234 .LM24:
235 0066 1F86 std Y+15,__zero_reg__
113:../OSsrc/os_mbox.c **** #endif
114:../OSsrc/os_mbox.c **** OS_EventWaitListInit(pevent);
237 .LM25:
238 0068 CE01 movw r24,r28
239 006a 0E94 0000 call OS_EventWaitListInit
240 .L7:
115:../OSsrc/os_mbox.c **** }
116:../OSsrc/os_mbox.c **** return (pevent); /* Return pointer to event control block
242 .LM26:
243 006e CE01 movw r24,r28
244 .L4:
245 /* epilogue: frame size=0 */
246 0070 DF91 pop r29
247 0072 CF91 pop r28
248 0074 0895 ret
249 /* epilogue end (size=3) */
250 /* function OSMboxCreate size 44 (39) */
255 .Lscope1:
260 .global OSMboxDel
262 OSMboxDel:
117:../OSsrc/os_mbox.c **** }
118:../OSsrc/os_mbox.c **** /*$PAGE*/
119:../OSsrc/os_mbox.c **** /*
120:../OSsrc/os_mbox.c **** ***************************************************************************************************
121:../OSsrc/os_mbox.c **** * DELETE A MAIBOX
122:../OSsrc/os_mbox.c **** *
123:../OSsrc/os_mbox.c **** * Description: This function deletes a mailbox and readies all tasks pending on the mailbox.
124:../OSsrc/os_mbox.c **** *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -