os_mbox.lst
来自「atmega单片机用的ucos系统 占用内存适中 是atmega单片机合适的操作」· LST 代码 · 共 1,285 行 · 第 1/5 页
LST
1,285 行
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:
85 .global OSMboxAccept
87 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-2003, 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.76
13:OSsrc/os_mbox.c **** ***************************************************************************************************
14:OSsrc/os_mbox.c **** */
15:OSsrc/os_mbox.c ****
16:OSsrc/os_mbox.c **** #ifndef OS_MASTER_FILE
17:OSsrc/os_mbox.c **** #include "ucos_ii.h"
18:OSsrc/os_mbox.c **** #endif
19:OSsrc/os_mbox.c ****
20:OSsrc/os_mbox.c **** #if OS_MBOX_EN > 0
21:OSsrc/os_mbox.c **** /*
22:OSsrc/os_mbox.c **** ***************************************************************************************************
23:OSsrc/os_mbox.c **** * ACCEPT MESSAGE FROM MAILBOX
24:OSsrc/os_mbox.c **** *
25:OSsrc/os_mbox.c **** * Description: This function checks the mailbox to see if a message is available. Unlike OSMboxPen
26:OSsrc/os_mbox.c **** * OSMboxAccept() does not suspend the calling task if a message is not available.
27:OSsrc/os_mbox.c **** *
28:OSsrc/os_mbox.c **** * Arguments : pevent is a pointer to the event control block
29:OSsrc/os_mbox.c **** *
30:OSsrc/os_mbox.c **** * Returns : != (void *)0 is the message in the mailbox if one is available. The mailbox is cle
31:OSsrc/os_mbox.c **** * so the next time OSMboxAccept() is called, the mailbox will be empty.
32:OSsrc/os_mbox.c **** * == (void *)0 if the mailbox is empty or,
33:OSsrc/os_mbox.c **** * if 'pevent' is a NULL pointer or,
34:OSsrc/os_mbox.c **** * if you didn't pass the proper event pointer.
35:OSsrc/os_mbox.c **** ***************************************************************************************************
36:OSsrc/os_mbox.c **** */
37:OSsrc/os_mbox.c ****
38:OSsrc/os_mbox.c **** #if OS_MBOX_ACCEPT_EN > 0
39:OSsrc/os_mbox.c **** void *OSMboxAccept (OS_EVENT *pevent)
40:OSsrc/os_mbox.c **** {
89 .LM1:
90 /* prologue: frame size=0 */
91 /* prologue end (size=0) */
92 0000 FC01 movw r30,r24
41:OSsrc/os_mbox.c **** void *msg;
42:OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status regist
43:OSsrc/os_mbox.c **** OS_CPU_SR cpu_sr;
44:OSsrc/os_mbox.c ****
45:OSsrc/os_mbox.c ****
46:OSsrc/os_mbox.c ****
47:OSsrc/os_mbox.c **** cpu_sr = 0; /* Prevent compiler warning
48:OSsrc/os_mbox.c **** #endif
49:OSsrc/os_mbox.c **** #if OS_ARG_CHK_EN > 0
50:OSsrc/os_mbox.c **** if (pevent == (OS_EVENT *)0) { /* Validate 'pevent'
94 .LM2:
95 0002 0097 sbiw r24,0
96 0004 09F4 brne .L2
51:OSsrc/os_mbox.c **** return ((void *)0);
98 .LM3:
99 0006 0895 ret
100 .L2:
52:OSsrc/os_mbox.c **** }
53:OSsrc/os_mbox.c **** #endif
54:OSsrc/os_mbox.c **** if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type
102 .LM4:
103 0008 8081 ld r24,Z
104 000a 8130 cpi r24,lo8(1)
105 000c 19F0 breq .L3
55:OSsrc/os_mbox.c **** return ((void *)0);
107 .LM5:
108 000e 80E0 ldi r24,lo8(0)
109 0010 90E0 ldi r25,hi8(0)
110 0012 0895 ret
111 .L3:
56:OSsrc/os_mbox.c **** }
57:OSsrc/os_mbox.c **** OS_ENTER_CRITICAL();
113 .LM6:
114 /* #APP */
115 0014 0FB6 in __tmp_reg__,__SREG__
116 0016 F894 cli
117 0018 0F92 push __tmp_reg__
58:OSsrc/os_mbox.c **** msg = pevent->OSEventPtr;
119 .LM7:
120 /* #NOAPP */
121 001a 8481 ldd r24,Z+4
122 001c 9581 ldd r25,Z+5
59:OSsrc/os_mbox.c **** pevent->OSEventPtr = (void *)0; /* Clear the mailbox
124 .LM8:
125 001e 1482 std Z+4,__zero_reg__
126 0020 1582 std Z+5,__zero_reg__
60:OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
128 .LM9:
129 /* #APP */
130 0022 0F90 pop __tmp_reg__
131 0024 0FBE out __SREG__,__tmp_reg__
61:OSsrc/os_mbox.c **** return (msg); /* Return the message received (or NULL)
62:OSsrc/os_mbox.c **** }
133 .LM10:
134 /* #NOAPP */
135 0026 0895 ret
136 /* epilogue: frame size=0 */
137 0028 0895 ret
138 /* epilogue end (size=1) */
139 /* function OSMboxAccept size 26 (25) */
144 .Lscope0:
147 .global OSMboxCreate
149 OSMboxCreate:
63:OSsrc/os_mbox.c **** #endif
64:OSsrc/os_mbox.c **** /*$PAGE*/
65:OSsrc/os_mbox.c **** /*
66:OSsrc/os_mbox.c **** ***************************************************************************************************
67:OSsrc/os_mbox.c **** * CREATE A MESSAGE MAILBOX
68:OSsrc/os_mbox.c **** *
69:OSsrc/os_mbox.c **** * Description: This function creates a message mailbox if free event control blocks are available.
70:OSsrc/os_mbox.c **** *
71:OSsrc/os_mbox.c **** * Arguments : msg is a pointer to a message that you wish to deposit in the mailbox. If
72:OSsrc/os_mbox.c **** * you set this value to the NULL pointer (i.e. (void *)0) then the mailb
73:OSsrc/os_mbox.c **** * will be considered empty.
74:OSsrc/os_mbox.c **** *
75:OSsrc/os_mbox.c **** * Returns : != (OS_EVENT *)0 is a pointer to the event control clock (OS_EVENT) associated with
76:OSsrc/os_mbox.c **** * created mailbox
77:OSsrc/os_mbox.c **** * == (OS_EVENT *)0 if no event control blocks were available
78:OSsrc/os_mbox.c **** ***************************************************************************************************
79:OSsrc/os_mbox.c **** */
80:OSsrc/os_mbox.c ****
81:OSsrc/os_mbox.c **** OS_EVENT *OSMboxCreate (void *msg)
82:OSsrc/os_mbox.c **** {
151 .LM11:
152 /* prologue: frame size=0 */
153 002a CF93 push r28
154 002c DF93 push r29
155 /* prologue end (size=2) */
156 002e 9C01 movw r18,r24
83:OSsrc/os_mbox.c **** OS_EVENT *pevent;
84:OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register
85:OSsrc/os_mbox.c **** OS_CPU_SR cpu_sr;
86:OSsrc/os_mbox.c ****
87:OSsrc/os_mbox.c ****
88:OSsrc/os_mbox.c ****
89:OSsrc/os_mbox.c **** cpu_sr = 0; /* Prevent compiler warning
90:OSsrc/os_mbox.c **** #endif
91:OSsrc/os_mbox.c **** if (OSIntNesting > 0) { /* See if called from ISR ...
158 .LM12:
159 0030 8091 0000 lds r24,OSIntNesting
160 0034 8823 tst r24
161 0036 19F0 breq .L5
92:OSsrc/os_mbox.c **** return ((OS_EVENT *)0); /* ... can't CREATE from an ISR
163 .LM13:
164 0038 80E0 ldi r24,lo8(0)
165 003a 90E0 ldi r25,hi8(0)
166 003c 20C0 rjmp .L4
167 .L5:
93:OSsrc/os_mbox.c **** }
94:OSsrc/os_mbox.c **** OS_ENTER_CRITICAL();
169 .LM14:
170 /* #APP */
171 003e 0FB6 in __tmp_reg__,__SREG__
172 0040 F894 cli
173 0042 0F92 push __tmp_reg__
95:OSsrc/os_mbox.c **** pevent = OSEventFreeList; /* Get next free event control block
175 .LM15:
176 /* #NOAPP */
177 0044 C091 0000 lds r28,OSEventFreeList
178 0048 D091 0000 lds r29,(OSEventFreeList)+1
96:OSsrc/os_mbox.c **** if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty
180 .LM16:
181 004c 2097 sbiw r28,0
182 004e 31F0 breq .L6
97:OSsrc/os_mbox.c **** OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
184 .LM17:
185 0050 8C81 ldd r24,Y+4
186 0052 9D81 ldd r25,Y+5
187 0054 9093 0000 sts (OSEventFreeList)+1,r25
188 0058 8093 0000 sts OSEventFreeList,r24
189 .L6:
98:OSsrc/os_mbox.c **** }
99:OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
191 .LM18:
192 /* #APP */
193 005c 0F90 pop __tmp_reg__
194 005e 0FBE out __SREG__,__tmp_reg__
100:OSsrc/os_mbox.c **** if (pevent != (OS_EVENT *)0) {
196 .LM19:
197 /* #NOAPP */
198 0060 2097 sbiw r28,0
199 0062 61F0 breq .L7
101:OSsrc/os_mbox.c **** pevent->OSEventType = OS_EVENT_TYPE_MBOX;
201 .LM20:
202 0064 81E0 ldi r24,lo8(1)
203 0066 8883 st Y,r24
102:OSsrc/os_mbox.c **** pevent->OSEventCnt = 0;
205 .LM21:
206 0068 1A82 std Y+2,__zero_reg__
207 006a 1B82 std Y+3,__zero_reg__
103:OSsrc/os_mbox.c **** pevent->OSEventPtr = msg; /* Deposit message in event control block
209 .LM22:
210 006c 2C83 std Y+4,r18
211 006e 3D83 std Y+5,r19
104:OSsrc/os_mbox.c **** #if OS_EVENT_NAME_SIZE > 1
105:OSsrc/os_mbox.c **** pevent->OSEventName[0] = '?';
213 .LM23:
214 0070 8FE3 ldi r24,lo8(63)
215 0072 8E87 std Y+14,r24
106:OSsrc/os_mbox.c **** pevent->OSEventName[1] = OS_ASCII_NUL;
217 .LM24:
218 0074 1F86 std Y+15,__zero_reg__
107:OSsrc/os_mbox.c **** #endif
108:OSsrc/os_mbox.c **** OS_EventWaitListInit(pevent);
220 .LM25:
221 0076 CE01 movw r24,r28
222 0078 0E94 0000 call OS_EventWaitListInit
223 .L7:
109:OSsrc/os_mbox.c **** }
110:OSsrc/os_mbox.c **** return (pevent); /* Return pointer to event control block
225 .LM26:
226 007c CE01 movw r24,r28
227 .L4:
228 /* epilogue: frame size=0 */
229 007e DF91 pop r29
230 0080 CF91 pop r28
231 0082 0895 ret
232 /* epilogue end (size=3) */
233 /* function OSMboxCreate size 50 (45) */
238 .Lscope1:
243 .global OSMboxDel
245 OSMboxDel:
111:OSsrc/os_mbox.c **** }
112:OSsrc/os_mbox.c **** /*$PAGE*/
113:OSsrc/os_mbox.c **** /*
114:OSsrc/os_mbox.c **** ***************************************************************************************************
115:OSsrc/os_mbox.c **** * DELETE A MAIBOX
116:OSsrc/os_mbox.c **** *
117:OSsrc/os_mbox.c **** * Description: This function deletes a mailbox and readies all tasks pending on the mailbox.
118:OSsrc/os_mbox.c **** *
119:OSsrc/os_mbox.c **** * Arguments : pevent is a pointer to the event control block associated with the desired
120:OSsrc/os_mbox.c **** * mailbox.
121:OSsrc/os_mbox.c **** *
122:OSsrc/os_mbox.c **** * opt determines delete options as follows:
123:OSsrc/os_mbox.c **** * opt == OS_DEL_NO_PEND Delete the mailbox ONLY if no task pending
124:OSsrc/os_mbox.c **** * opt == OS_DEL_ALWAYS Deletes the mailbox even if tasks are waiting.
125:OSsrc/os_mbox.c **** * In this case, all the tasks pending will be re
126:OSsrc/os_mbox.c **** *
127:OSsrc/os_mbox.c **** * err is a pointer to an error code that can contain one of the following va
128:OSsrc/os_mbox.c **** * OS_NO_ERR The call was successful and the mailbox was de
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?