📄 os_q.lst
字号:
##############################################################################
# #
# IAR MSP430 C-Compiler V1.26A/WIN #
# #
# Time limited license: 29 days left #
# #
# Compile time = 30/Sep/2002 18:04:13 #
# Target option = SP430x31x #
# Memory model = small #
# Source file = c:\software\ucos-ii\source\os_q.c #
# List file = j:\software\ucos-ii\ti-msp430\iar\source\debug\list\os_q.lst#
# Object file = j:\software\ucos-ii\ti-msp430\iar\source\debug\obj\os_q.r43#
# ASM file = j:\software\ucos-ii\ti-msp430\iar\source\debug\list\os_q.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_Q.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_q(16)
\ 0000 RSEG CODE(1)
\ 0000 EXTERN OSEventFreeList
\ 0000 EXTERN OSIntNesting
\ 0000 PUBLIC OSQAccept
\ 0000 PUBLIC OSQCreate
\ 0000 PUBLIC OSQDel
\ 0000 PUBLIC OSQFlush
\ 0000 EXTERN OSQFreeList
\ 0000 PUBLIC OSQPend
\ 0000 PUBLIC OSQPost
\ 0000 PUBLIC OSQPostFront
\ 0000 PUBLIC OSQPostOpt
\ 0000 PUBLIC OSQQuery
\ 0000 EXTERN OSQTbl
\ 0000 EXTERN OSTCBCur
\ 0000 EXTERN OS_EventTO
\ 0000 EXTERN OS_EventTaskRdy
\ 0000 EXTERN OS_EventTaskWait
\ 0000 EXTERN OS_EventWaitListInit
\ 0000 PUBLIC OS_QInit
\ 0000 EXTERN OS_Sched
\ 0000 EXTERN ?CL430_1_26_L08
\ 0000 RSEG CODE
\ 0000 OSQAccept:
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * MESSAGE QUEUE MANAGEMENT
6 *
7 * (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_Q.C
11 * By : Jean J. Labrosse
12 *********************************************************************************************************
13 */
14
15 #ifndef OS_MASTER_FILE
16 #include "includes.h"
17 #endif
18
19 #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
20 /*
21 *********************************************************************************************************
22 * ACCEPT MESSAGE FROM QUEUE
23 *
24 * Description: This function checks the queue to see if a message is available. Unlike OSQPend(),
25 * OSQAccept() 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 queue if one is available. The message is removed
30 * from the so the next time OSQAccept() is called, the queue will contain
31 * one less entry.
32 * == (void *)0 if the queue is empty or,
33 * if 'pevent' is a NULL pointer or,
34 * if you passed an invalid event type
35 *********************************************************************************************************
36 */
37
38 #if OS_Q_ACCEPT_EN > 0
39 void *OSQAccept (OS_EVENT *pevent)
40 {
41 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
42 OS_CPU_SR cpu_sr;
43 #endif
44 void *msg;
45 OS_Q *pq;
46
47
48 #if OS_ARG_CHK_EN > 0
49 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ 0000 0C93 CMP #0,R12
\ 0002 0120 JNE (?0059)
50 return ((void *)0);
51 }
\ 0004 3041 RET
\ 0006 ?0059:
52 if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type */
\ 0006 6D43 MOV.B #2,R13
\ 0008 6D9C CMP.B @R12,R13
\ 000A 0224 JEQ (?0061)
53 return ((void *)0);
\ 000C 0C43 MOV #0,R12
54 }
\ 000E 3041 RET
\ 0010 ?0061:
55 #endif
56 OS_ENTER_CRITICAL();
\ 0010 32C2 DINT
57 pq = (OS_Q *)pevent->OSEventPtr; /* Point at queue control block */
\ 0012 1D4C0400 MOV 4(R12),R13
58 if (pq->OSQEntries > 0) { /* See if any messages in the queue */
\ 0016 8D930C00 CMP #0,12(R13)
\ 001A 0F24 JEQ (?0063)
59 msg = *pq->OSQOut++; /* Yes, extract oldest message from the queue */
\ 001C 1E4D0800 MOV 8(R13),R14
\ 0020 AD530800 ADD #2,8(R13)
\ 0024 2C4E MOV @R14,R12
60 pq->OSQEntries--; /* Update the number of entries in the queue */
\ 0026 BD530C00 ADD #-1,12(R13)
61 if (pq->OSQOut == pq->OSQEnd) { /* Wrap OUT pointer if we are at the end of the queue */
\ 002A 9D9D0800 CMP 8(R13),4(R13)
\ 002E 0400
\ 0030 0520 JNE (?0066)
62 pq->OSQOut = pq->OSQStart;
\ 0032 9D4D0200 MOV 2(R13),8(R13)
\ 0036 0800
63 }
64 } else {
\ 0038 013C JMP (?0066)
\ 003A ?0063:
65 msg = (void *)0; /* Queue is empty */
\ 003A 0C43 MOV #0,R12
\ 003C ?0066:
66 }
67 OS_EXIT_CRITICAL();
\ 003C 32D2 EINT
68 return (msg); /* Return message received (or NULL) */
69 }
\ 003E 3041 RET
\ 0040 OSQCreate:
70 #endif
71 /*$PAGE*/
72 /*
73 *********************************************************************************************************
74 * CREATE A MESSAGE QUEUE
75 *
76 * Description: This function creates a message queue if free event control blocks are available.
77 *
78 * Arguments : start is a pointer to the base address of the message queue storage area. The
79 * storage area MUST be declared as an array of pointers to 'void' as follows
80 *
81 * void *MessageStorage[size]
82 *
83 * size is the number of elements in the storage area
84 *
85 * Returns : != (OS_EVENT *)0 is a pointer to the event control clock (OS_EVENT) associated with the
86 * created queue
87 * == (OS_EVENT *)0 if no event control blocks were available or an error was detected
88 *********************************************************************************************************
89 */
90
91 OS_EVENT *OSQCreate (void **start, INT16U size)
92 {
\ 0040 0A12 PUSH R10
93 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
94 OS_CPU_SR cpu_sr;
95 #endif
96 OS_EVENT *pevent;
97 OS_Q *pq;
98
99
100 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ 0042 C2930000 CMP.B #0,&OSIntNesting
\ 0046 0224 JEQ (?0069)
101 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
\ 0048 0C43 MOV #0,R12
102 }
\ 004A 393C JMP (?0077)
\ 004C ?0069:
103 OS_ENTER_CRITICAL();
\ 004C 32C2 DINT
104 pevent = OSEventFreeList; /* Get next free event control block */
\ 004E 1A420000 MOV &OSEventFreeList,R10
105 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
\ 0052 82930000 CMP #0,&OSEventFreeList
\ 0056 0524 JEQ (?0071)
106 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
\ 0058 1D420000 MOV &OSEventFreeList,R13
\ 005C 924D0400 MOV 4(R13),&OSEventFreeList
\ 0060 0000
\ 0062 ?0071:
107 }
108 OS_EXIT_CRITICAL();
\ 0062 32D2 EINT
109 if (pevent != (OS_EVENT *)0) { /* See if we have an event control block */
\ 0064 0A93 CMP #0,R10
\ 0066 2A24 JEQ (?0076)
110 OS_ENTER_CRITICAL();
\ 0068 32C2 DINT
111 pq = OSQFreeList; /* Get a free queue control block */
\ 006A 1D420000 MOV &OSQFreeList,R13
112 if (pq != (OS_Q *)0) { /* Were we able to get a queue control block ? */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -