📄 os_mbox.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.40A/W32 EVALUATION 21/Jul/2006 17:17:41 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# Time limited license: 22 days left #
# #
# Cpu mode = interwork #
# Endian = little #
# Stack alignment = 4 #
# Source file = E:\Project\ucos-ii\counter\uCOS-II\os_mbox.c #
# Command line = E:\Project\ucos-ii\counter\uCOS-II\os_mbox.c -lCN #
# E:\Project\ucos-ii\counter\Debug\List\ -lA #
# E:\Project\ucos-ii\counter\Debug\List\ -o #
# E:\Project\ucos-ii\counter\Debug\Obj\ -s9 --no_cse #
# --no_unroll --no_inline --no_code_motion --no_tbaa #
# --no_clustering --no_scheduling --debug --cpu_mode #
# thumb --endian little --cpu ARM7TDMI-S #
# --stack_align 4 --interwork -e --fpu None #
# --dlib_config "E:\Program Files\IAR #
# Systems\Embedded Workbench 4.0 #
# Evaluation\ARM\LIB\dl4tptinl8n.h" -I #
# E:\Project\ucos-ii\counter\ -I #
# E:\Project\ucos-ii\counter\App\ -I #
# E:\Project\ucos-ii\counter\BSP\ -I #
# E:\Project\ucos-ii\counter\ARM\ -I #
# E:\Project\ucos-ii\counter\uCOS-II\ -I "E:\Program #
# Files\IAR Systems\Embedded Workbench 4.0 #
# Evaluation\ARM\INC\" #
# List file = E:\Project\ucos-ii\counter\Debug\List\os_mbox.lst #
# Object file = E:\Project\ucos-ii\counter\Debug\Obj\os_mbox.r79 #
# #
# #
##############################################################################
E:\Project\ucos-ii\counter\uCOS-II\os_mbox.c
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * MESSAGE MAILBOX MANAGEMENT
6 *
7 * (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_MBOX.C
11 * By : Jean J. Labrosse
12 *********************************************************************************************************
13 */
14
15 #ifndef OS_MASTER_FILE
16 #include <ucos_ii.h>
17 #endif
18
19 #if OS_MBOX_EN > 0
20 /*
21 *********************************************************************************************************
22 * ACCEPT MESSAGE FROM MAILBOX
23 *
24 * Description: This function checks the mailbox to see if a message is available. Unlike OSMboxPend(),
25 * OSMboxAccept() does not suspend the calling task if a message is not available.
26 *
27 * Arguments : pevent is a pointer to the event control block
28 *
29 * Returns : != (void *)0 is the message in the mailbox if one is available. The mailbox is cleared
30 * so the next time OSMboxAccept() is called, the mailbox will be empty.
31 * == (void *)0 if the mailbox is empty or,
32 * if 'pevent' is a NULL pointer or,
33 * if you didn't pass the proper event pointer.
34 *********************************************************************************************************
35 */
36
37 #if OS_MBOX_ACCEPT_EN > 0
\ In segment CODE, align 4, keep-with-next
38 void *OSMboxAccept (OS_EVENT *pevent)
39 {
\ OSMboxAccept:
\ 00000000 30B5 PUSH {R4,R5,LR}
\ 00000002 0400 MOVS R4,R0
40 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
41 OS_CPU_SR cpu_sr;
42 #endif
43 void *msg;
44
45
46 #if OS_ARG_CHK_EN > 0
47 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ 00000004 01D1 BNE ??OSMboxAccept_0
48 return ((void *)0);
\ ??OSMboxAccept_1:
\ 00000006 0020 MOVS R0,#+0
\ 00000008 0AE0 B ??OSMboxAccept_2
49 }
50 #endif
51 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ ??OSMboxAccept_0:
\ 0000000A 2078 LDRB R0,[R4, #+0]
\ 0000000C 0128 CMP R0,#+1
\ 0000000E FAD1 BNE ??OSMboxAccept_1
52 return ((void *)0);
53 }
54 OS_ENTER_CRITICAL();
\ ??OSMboxAccept_3:
\ 00000010 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
55 msg = pevent->OSEventPtr;
\ 00000014 6568 LDR R5,[R4, #+4]
56 pevent->OSEventPtr = (void *)0; /* Clear the mailbox */
\ 00000016 0021 MOVS R1,#+0
\ 00000018 6160 STR R1,[R4, #+4]
57 OS_EXIT_CRITICAL();
\ 0000001A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
58 return (msg); /* Return the message received (or NULL) */
\ 0000001E 2800 MOVS R0,R5
\ ??OSMboxAccept_2:
\ 00000020 30BC POP {R4,R5}
\ 00000022 02BC POP {R1}
\ 00000024 0847 BX R1 ;; return
59 }
60 #endif
61
62 /*
63 *********************************************************************************************************
64 * CREATE A MESSAGE MAILBOX
65 *
66 * Description: This function creates a message mailbox if free event control blocks are available.
67 *
68 * Arguments : msg is a pointer to a message that you wish to deposit in the mailbox. If
69 * you set this value to the NULL pointer (i.e. (void *)0) then the mailbox
70 * will be considered empty.
71 *
72 * Returns : != (OS_EVENT *)0 is a pointer to the event control clock (OS_EVENT) associated with the
73 * created mailbox
74 * == (OS_EVENT *)0 if no event control blocks were available
75 *********************************************************************************************************
76 */
77
\ In segment CODE, align 4, keep-with-next
78 OS_EVENT *OSMboxCreate (void *msg)
79 {
\ OSMboxCreate:
\ 00000000 30B5 PUSH {R4,R5,LR}
\ 00000002 0400 MOVS R4,R0
80 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
81 OS_CPU_SR cpu_sr;
82 #endif
83 OS_EVENT *pevent;
84
85
86 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ 00000004 .... LDR R0,??DataTable7 ;; OSIntNesting
\ 00000006 0078 LDRB R0,[R0, #+0]
\ 00000008 0028 CMP R0,#+0
\ 0000000A 01D0 BEQ ??OSMboxCreate_0
87 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
\ 0000000C 0020 MOVS R0,#+0
\ 0000000E 18E0 B ??OSMboxCreate_1
88 }
89 OS_ENTER_CRITICAL();
\ ??OSMboxCreate_0:
\ 00000010 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
90 pevent = OSEventFreeList; /* Get next free event control block */
\ 00000014 .... LDR R1,??DataTable6 ;; OSEventFreeList
\ 00000016 0D68 LDR R5,[R1, #+0]
91 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
\ 00000018 002D CMP R5,#+0
\ 0000001A 01D0 BEQ ??OSMboxCreate_2
92 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
\ 0000001C 6A68 LDR R2,[R5, #+4]
\ 0000001E 0A60 STR R2,[R1, #+0]
93 }
94 OS_EXIT_CRITICAL();
\ ??OSMboxCreate_2:
\ 00000020 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
95 if (pevent != (OS_EVENT *)0) {
\ 00000024 002D CMP R5,#+0
\ 00000026 0BD0 BEQ ??OSMboxCreate_3
96 pevent->OSEventType = OS_EVENT_TYPE_MBOX;
\ 00000028 0120 MOVS R0,#+1
\ 0000002A 2870 STRB R0,[R5, #+0]
97 pevent->OSEventCnt = 0;
\ 0000002C 0020 MOVS R0,#+0
\ 0000002E 6880 STRH R0,[R5, #+2]
98 pevent->OSEventPtr = msg; /* Deposit message in event control block */
\ 00000030 6C60 STR R4,[R5, #+4]
99 #if OS_EVENT_NAME_SIZE > 1
100 pevent->OSEventName[0] = '?';
\ 00000032 3F20 MOVS R0,#+63
\ 00000034 2874 STRB R0,[R5, #+16]
101 pevent->OSEventName[1] = OS_ASCII_NUL;
\ 00000036 0020 MOVS R0,#+0
\ 00000038 6874 STRB R0,[R5, #+17]
102 #endif
103 OS_EventWaitListInit(pevent);
\ 0000003A 2800 MOVS R0,R5
\ 0000003C ........ _BLF OS_EventWaitListInit,??OS_EventWaitListInit??rT
104 }
105 return (pevent); /* Return pointer to event control block */
\ ??OSMboxCreate_3:
\ 00000040 2800 MOVS R0,R5
\ ??OSMboxCreate_1:
\ 00000042 30BC POP {R4,R5}
\ 00000044 02BC POP {R1}
\ 00000046 0847 BX R1 ;; return
106 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -