📄 os_mbox.lst
字号:
##############################################################################
# #
# IAR MSP430 C-Compiler V1.26A/WIN #
# #
# Time limited license: 29 days left #
# #
# Compile time = 30/Sep/2002 18:04:11 #
# Target option = SP430x31x #
# Memory model = small #
# Source file = c:\software\ucos-ii\source\os_mbox.c #
# List file = j:\software\ucos-ii\ti-msp430\iar\source\debug\list\os_mbox.lst#
# Object file = j:\software\ucos-ii\ti-msp430\iar\source\debug\obj\os_mbox.r43#
# ASM file = j:\software\ucos-ii\ti-msp430\iar\source\debug\list\os_mbox.s43#
# Command line = -OJ:\SOFTWARE\UCOS-II\TI-MSP430\IAR\SOURCE\Debug\Obj\ #
# -e -K -gA -s6 -RCODE -r0 #
# -LJ:\SOFTWARE\UCOS-II\TI-MSP430\IAR\SOURCE\Debug\List\ #
# -q -t8 -x #
# -AJ:\SOFTWARE\UCOS-II\TI-MSP430\IAR\SOURCE\Debug\List\ #
# -X -IC:\PROGRA~1\IARSYS~1\ew23\430\inc\ #
# -I\software\ucos-ii\ti-msp430\iar\source\ #
# -I\software\ucos-ii\source\ #
# C:\SOFTWARE\uCOS-II\SOURCE\OS_MBOX.C #
# #
# Copyright 1996-2002 IAR Systems. All rights reserved. #
##############################################################################
extern INT8U const OSMapTbl[]; /* Priority->Bit Mask lookup table */
-----------------------------------^
"c:\software\ucos-ii\source\ucos_ii.h",481 Warning[27]: Size of "extern" object 'OSMapTbl' is unknown
extern INT8U const OSUnMapTbl[]; /* Priority->Index lookup table */
-------------------------------------^
"c:\software\ucos-ii\source\ucos_ii.h",482 Warning[27]: Size of "extern" object 'OSUnMapTbl' is unknown
\ 0000 NAME os_mbox(16)
\ 0000 RSEG CODE(1)
\ 0000 EXTERN OSEventFreeList
\ 0000 EXTERN OSIntNesting
\ 0000 PUBLIC OSMboxAccept
\ 0000 PUBLIC OSMboxCreate
\ 0000 PUBLIC OSMboxDel
\ 0000 PUBLIC OSMboxPend
\ 0000 PUBLIC OSMboxPost
\ 0000 PUBLIC OSMboxPostOpt
\ 0000 PUBLIC OSMboxQuery
\ 0000 EXTERN OSTCBCur
\ 0000 EXTERN OS_EventTO
\ 0000 EXTERN OS_EventTaskRdy
\ 0000 EXTERN OS_EventTaskWait
\ 0000 EXTERN OS_EventWaitListInit
\ 0000 EXTERN OS_Sched
\ 0000 EXTERN ?CL430_1_26_L08
\ 0000 RSEG CODE
\ 0000 OSMboxAccept:
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * MESSAGE MAILBOX MANAGEMENT
6 *
7 * (c) Copyright 1992-2002, 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 "includes.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
38 void *OSMboxAccept (OS_EVENT *pevent)
39 {
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' */
\ 0000 0C93 CMP #0,R12
\ 0002 0120 JNE (?0057)
48 return ((void *)0);
49 }
\ 0004 3041 RET
\ 0006 ?0057:
50 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ 0006 5D43 MOV.B #1,R13
\ 0008 6D9C CMP.B @R12,R13
\ 000A 0224 JEQ (?0059)
51 return ((void *)0);
\ 000C 0C43 MOV #0,R12
52 }
\ 000E 3041 RET
\ 0010 ?0059:
53 #endif
54 OS_ENTER_CRITICAL();
\ 0010 32C2 DINT
55 msg = pevent->OSEventPtr;
\ 0012 1D4C0400 MOV 4(R12),R13
56 pevent->OSEventPtr = (void *)0; /* Clear the mailbox */
\ 0016 8C430400 MOV #0,4(R12)
57 OS_EXIT_CRITICAL();
\ 001A 32D2 EINT
58 return (msg); /* Return the message received (or NULL) */
\ 001C 0C4D MOV R13,R12
59 }
\ 001E 3041 RET
\ 0020 OSMboxCreate:
60 #endif
61 /*$PAGE*/
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
78 OS_EVENT *OSMboxCreate (void *msg)
79 {
\ 0020 0A12 PUSH R10
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 ... */
\ 0022 C2930000 CMP.B #0,&OSIntNesting
\ 0026 0224 JEQ (?0062)
87 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
\ 0028 0C43 MOV #0,R12
88 }
\ 002A 183C JMP (?0067)
\ 002C ?0062:
89 OS_ENTER_CRITICAL();
\ 002C 32C2 DINT
90 pevent = OSEventFreeList; /* Get next free event control block */
\ 002E 1A420000 MOV &OSEventFreeList,R10
91 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
\ 0032 82930000 CMP #0,&OSEventFreeList
\ 0036 0524 JEQ (?0064)
92 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
\ 0038 1D420000 MOV &OSEventFreeList,R13
\ 003C 924D0400 MOV 4(R13),&OSEventFreeList
\ 0040 0000
\ 0042 ?0064:
93 }
94 OS_EXIT_CRITICAL();
\ 0042 32D2 EINT
95 if (pevent != (OS_EVENT *)0) {
\ 0044 0A93 CMP #0,R10
\ 0046 0924 JEQ (?0066)
96 pevent->OSEventType = OS_EVENT_TYPE_MBOX;
\ 0048 DA430000 MOV.B #1,0(R10)
97 pevent->OSEventCnt = 0;
\ 004C 8A430200 MOV #0,2(R10)
98 pevent->OSEventPtr = msg; /* Deposit message in event control block */
\ 0050 8A4C0400 MOV R12,4(R10)
99 OS_EventWaitListInit(pevent);
\ 0054 0C4A MOV R10,R12
\ 0056 B0120000 CALL #OS_EventWaitListInit
\ 005A ?0066:
100 }
101 return (pevent); /* Return pointer to event control block */
\ 005A 0C4A MOV R10,R12
102 }
\ 005C ?0067:
\ 005C 3A41 POP R10
\ 005E 3041 RET
\ 0060 OSMboxDel:
103 /*$PAGE*/
104 /*
105 *********************************************************************************************************
106 * DELETE A MAIBOX
107 *
108 * Description: This function deletes a mailbox and readies all tasks pending on the mailbox.
109 *
110 * Arguments : pevent is a pointer to the event control block associated with the desired
111 * mailbox.
112 *
113 * opt determines delete options as follows:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -