📄 os_mbox.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION 12/Dec/2008 17:14:25 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Stack alignment = 4 #
# Source file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
# \Source\os_mbox.c #
# Command line = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
# \Source\os_mbox.c -lCN E:\IAR_2478\IAR_2478\26uCOS\S #
# rc\uCOS\RAM_Debug\List\ -o #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\ #
# -z2 --no_cse --no_unroll --no_inline #
# --no_code_motion --no_tbaa --no_clustering #
# --no_scheduling --debug --cpu_mode arm --endian #
# little --cpu ARM7TDMI-S --stack_align 4 -e --fpu #
# None --dlib_config "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0 #
# Evaluation\arm\LIB\dl4tpannl8n.h" -I #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\include\ -I #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\ucos-ii\include #
# \ -I "C:\Program Files\IAR Systems\Embedded #
# Workbench 4.0 Evaluation\arm\INC\" #
# List file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\List\ #
# os_mbox.lst #
# Object file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
# s_mbox.r79 #
# #
# #
##############################################################################
E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II\Source\os_mbox.c
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * MESSAGE MAILBOX MANAGEMENT
6 *
7 * (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_MBOX.C
11 * By : Jean J. Labrosse
12 * Version : V2.84
13 *
14 * LICENSING TERMS:
15 * ---------------
16 * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
17 * If you plan on using uC/OS-II in a commercial product you need to contact Micri祄 to properly license
18 * its use in your product. We provide ALL the source code for your convenience and to help you experience
19 * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a
20 * licensing fee.
21 *********************************************************************************************************
22 */
23
24 #ifndef OS_MASTER_FILE
25 #include <ucos_ii.h>
26 #endif
27
28 #if OS_MBOX_EN > 0
29 /*
30 *********************************************************************************************************
31 * ACCEPT MESSAGE FROM MAILBOX
32 *
33 * Description: This function checks the mailbox to see if a message is available. Unlike OSMboxPend(),
34 * OSMboxAccept() does not suspend the calling task if a message is not available.
35 *
36 * Arguments : pevent is a pointer to the event control block
37 *
38 * Returns : != (void *)0 is the message in the mailbox if one is available. The mailbox is cleared
39 * so the next time OSMboxAccept() is called, the mailbox will be empty.
40 * == (void *)0 if the mailbox is empty or,
41 * if 'pevent' is a NULL pointer or,
42 * if you didn't pass the proper event pointer.
43 *********************************************************************************************************
44 */
45
46 #if OS_MBOX_ACCEPT_EN > 0
\ In segment CODE, align 4, keep-with-next
47 void *OSMboxAccept (OS_EVENT *pevent)
48 {
\ OSMboxAccept:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 0040B0E1 MOVS R4,R0
49 void *msg;
50 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
51 OS_CPU_SR cpu_sr = 0;
\ 00000008 0000A0E3 MOV R0,#+0
\ 0000000C 0060B0E1 MOVS R6,R0
52 #endif
53
54
55
56 #if OS_ARG_CHK_EN > 0
57 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ 00000010 000054E3 CMP R4,#+0
\ 00000014 0100001A BNE ??OSMboxAccept_0
58 return ((void *)0);
\ 00000018 0000A0E3 MOV R0,#+0
\ 0000001C 0D0000EA B ??OSMboxAccept_1
59 }
60 #endif
61 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ ??OSMboxAccept_0:
\ 00000020 0000D4E5 LDRB R0,[R4, #+0]
\ 00000024 010050E3 CMP R0,#+1
\ 00000028 0100000A BEQ ??OSMboxAccept_2
62 return ((void *)0);
\ 0000002C 0000A0E3 MOV R0,#+0
\ 00000030 080000EA B ??OSMboxAccept_1
63 }
64 OS_ENTER_CRITICAL();
\ ??OSMboxAccept_2:
\ 00000034 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 00000038 0060B0E1 MOVS R6,R0
65 msg = pevent->OSEventPtr;
\ 0000003C 040094E5 LDR R0,[R4, #+4]
\ 00000040 0050B0E1 MOVS R5,R0
66 pevent->OSEventPtr = (void *)0; /* Clear the mailbox */
\ 00000044 0000A0E3 MOV R0,#+0
\ 00000048 040084E5 STR R0,[R4, #+4]
67 OS_EXIT_CRITICAL();
\ 0000004C 0600B0E1 MOVS R0,R6
\ 00000050 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
68 return (msg); /* Return the message received (or NULL) */
\ 00000054 0500B0E1 MOVS R0,R5
\ ??OSMboxAccept_1:
\ 00000058 7080BDE8 POP {R4-R6,PC} ;; return
69 }
70 #endif
71 /*$PAGE*/
72 /*
73 *********************************************************************************************************
74 * CREATE A MESSAGE MAILBOX
75 *
76 * Description: This function creates a message mailbox if free event control blocks are available.
77 *
78 * Arguments : msg is a pointer to a message that you wish to deposit in the mailbox. If
79 * you set this value to the NULL pointer (i.e. (void *)0) then the mailbox
80 * will be considered empty.
81 *
82 * Returns : != (OS_EVENT *)0 is a pointer to the event control clock (OS_EVENT) associated with the
83 * created mailbox
84 * == (OS_EVENT *)0 if no event control blocks were available
85 *********************************************************************************************************
86 */
87
\ In segment CODE, align 4, keep-with-next
88 OS_EVENT *OSMboxCreate (void *msg)
89 {
\ OSMboxCreate:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 0040B0E1 MOVS R4,R0
90 OS_EVENT *pevent;
91 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
92 OS_CPU_SR cpu_sr = 0;
\ 00000008 0000A0E3 MOV R0,#+0
\ 0000000C 0060B0E1 MOVS R6,R0
93 #endif
94
95
96
97 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ 00000010 ........ LDR R0,??DataTable10 ;; OSIntNesting
\ 00000014 0000D0E5 LDRB R0,[R0, #+0]
\ 00000018 010050E3 CMP R0,#+1
\ 0000001C 0100003A BCC ??OSMboxCreate_0
98 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
\ 00000020 0000A0E3 MOV R0,#+0
\ 00000024 1D0000EA B ??OSMboxCreate_1
99 }
100 OS_ENTER_CRITICAL();
\ ??OSMboxCreate_0:
\ 00000028 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 0000002C 0060B0E1 MOVS R6,R0
101 pevent = OSEventFreeList; /* Get next free event control block */
\ 00000030 ........ LDR R0,??DataTable9 ;; OSEventFreeList
\ 00000034 000090E5 LDR R0,[R0, #+0]
\ 00000038 0050B0E1 MOVS R5,R0
102 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
\ 0000003C ........ LDR R0,??DataTable9 ;; OSEventFreeList
\ 00000040 000090E5 LDR R0,[R0, #+0]
\ 00000044 000050E3 CMP R0,#+0
\ 00000048 0400000A BEQ ??OSMboxCreate_2
103 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
\ 0000004C ........ LDR R0,??DataTable9 ;; OSEventFreeList
\ 00000050 ........ LDR R1,??DataTable9 ;; OSEventFreeList
\ 00000054 001091E5 LDR R1,[R1, #+0]
\ 00000058 041091E5 LDR R1,[R1, #+4]
\ 0000005C 001080E5 STR R1,[R0, #+0]
104 }
105 OS_EXIT_CRITICAL();
\ ??OSMboxCreate_2:
\ 00000060 0600B0E1 MOVS R0,R6
\ 00000064 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
106 if (pevent != (OS_EVENT *)0) {
\ 00000068 000055E3 CMP R5,#+0
\ 0000006C 0A00000A BEQ ??OSMboxCreate_3
107 pevent->OSEventType = OS_EVENT_TYPE_MBOX;
\ 00000070 0100A0E3 MOV R0,#+1
\ 00000074 0000C5E5 STRB R0,[R5, #+0]
108 pevent->OSEventCnt = 0;
\ 00000078 0000A0E3 MOV R0,#+0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -