⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_flag.lst

📁 称植到lpc2124上的UCOS2.85版 是本人初学移植和ARM的成果 可能已有人上传类似的了
💻 LST
📖 第 1 页 / 共 5 页
字号:
   1               		.file	"os_flag.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:
 111               	.global	OSFlagAccept
 113               	OSFlagAccept:
   1:../OSsrc/os_flag.c **** /*
   2:../OSsrc/os_flag.c **** ***************************************************************************************************
   3:../OSsrc/os_flag.c **** *                                                uC/OS-II
   4:../OSsrc/os_flag.c **** *                                          The Real-Time Kernel
   5:../OSsrc/os_flag.c **** *                                         EVENT FLAG  MANAGEMENT
   6:../OSsrc/os_flag.c **** *
   7:../OSsrc/os_flag.c **** *                          (c) Copyright 2001-2007, Jean J. Labrosse, Weston, FL
   8:../OSsrc/os_flag.c **** *                                           All Rights Reserved
   9:../OSsrc/os_flag.c **** *
  10:../OSsrc/os_flag.c **** * File    : OS_FLAG.C
  11:../OSsrc/os_flag.c **** * By      : Jean J. Labrosse
  12:../OSsrc/os_flag.c **** * Version : V2.85
  13:../OSsrc/os_flag.c **** *
  14:../OSsrc/os_flag.c **** * LICENSING TERMS:
  15:../OSsrc/os_flag.c **** * ---------------
  16:../OSsrc/os_flag.c **** *   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful re
  17:../OSsrc/os_flag.c **** * If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly l
  18:../OSsrc/os_flag.c **** * its use in your product. We provide ALL the source code for your convenience and to help you expe
  19:../OSsrc/os_flag.c **** * uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  pa
  20:../OSsrc/os_flag.c **** * licensing fee.
  21:../OSsrc/os_flag.c **** ***************************************************************************************************
  22:../OSsrc/os_flag.c **** */
  23:../OSsrc/os_flag.c **** 
  24:../OSsrc/os_flag.c **** #ifndef  OS_MASTER_FILE
  25:../OSsrc/os_flag.c **** #include <ucos_ii.h>
  26:../OSsrc/os_flag.c **** #endif
  27:../OSsrc/os_flag.c **** 
  28:../OSsrc/os_flag.c **** #if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
  29:../OSsrc/os_flag.c **** /*
  30:../OSsrc/os_flag.c **** ***************************************************************************************************
  31:../OSsrc/os_flag.c **** *                                            LOCAL PROTOTYPES
  32:../OSsrc/os_flag.c **** ***************************************************************************************************
  33:../OSsrc/os_flag.c **** */
  34:../OSsrc/os_flag.c **** 
  35:../OSsrc/os_flag.c **** static  void     OS_FlagBlock(OS_FLAG_GRP *pgrp, OS_FLAG_NODE *pnode, OS_FLAGS flags, INT8U wait_ty
  36:../OSsrc/os_flag.c **** static  BOOLEAN  OS_FlagTaskRdy(OS_FLAG_NODE *pnode, OS_FLAGS flags_rdy);
  37:../OSsrc/os_flag.c **** 
  38:../OSsrc/os_flag.c **** /*$PAGE*/
  39:../OSsrc/os_flag.c **** /*
  40:../OSsrc/os_flag.c **** ***************************************************************************************************
  41:../OSsrc/os_flag.c **** *                              CHECK THE STATUS OF FLAGS IN AN EVENT FLAG GROUP
  42:../OSsrc/os_flag.c **** *
  43:../OSsrc/os_flag.c **** * Description: This function is called to check the status of a combination of bits to be set or cl
  44:../OSsrc/os_flag.c **** *              in an event flag group.  Your application can check for ANY bit to be set/cleared or
  45:../OSsrc/os_flag.c **** *              bits to be set/cleared.
  46:../OSsrc/os_flag.c **** *
  47:../OSsrc/os_flag.c **** *              This call does not block if the desired flags are not present.
  48:../OSsrc/os_flag.c **** *
  49:../OSsrc/os_flag.c **** * Arguments  : pgrp          is a pointer to the desired event flag group.
  50:../OSsrc/os_flag.c **** *
  51:../OSsrc/os_flag.c **** *              flags         Is a bit pattern indicating which bit(s) (i.e. flags) you wish to chec
  52:../OSsrc/os_flag.c **** *                            The bits you want are specified by setting the corresponding bits in
  53:../OSsrc/os_flag.c **** *                            'flags'.  e.g. if your application wants to wait for bits 0 and 1 then
  54:../OSsrc/os_flag.c **** *                            'flags' would contain 0x03.
  55:../OSsrc/os_flag.c **** *
  56:../OSsrc/os_flag.c **** *              wait_type     specifies whether you want ALL bits to be set/cleared or ANY of the bi
  57:../OSsrc/os_flag.c **** *                            to be set/cleared.
  58:../OSsrc/os_flag.c **** *                            You can specify the following argument:
  59:../OSsrc/os_flag.c **** *
  60:../OSsrc/os_flag.c **** *                            OS_FLAG_WAIT_CLR_ALL   You will check ALL bits in 'flags' to be clear 
  61:../OSsrc/os_flag.c **** *                            OS_FLAG_WAIT_CLR_ANY   You will check ANY bit  in 'flags' to be clear 
  62:../OSsrc/os_flag.c **** *                            OS_FLAG_WAIT_SET_ALL   You will check ALL bits in 'flags' to be set   
  63:../OSsrc/os_flag.c **** *                            OS_FLAG_WAIT_SET_ANY   You will check ANY bit  in 'flags' to be set   
  64:../OSsrc/os_flag.c **** *
  65:../OSsrc/os_flag.c **** *                            NOTE: Add OS_FLAG_CONSUME if you want the event flag to be 'consumed' 
  66:../OSsrc/os_flag.c **** *                                  the call.  Example, to wait for any flag in a group AND then cle
  67:../OSsrc/os_flag.c **** *                                  the flags that are present, set 'wait_type' to:
  68:../OSsrc/os_flag.c **** *
  69:../OSsrc/os_flag.c **** *                                  OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME
  70:../OSsrc/os_flag.c **** *
  71:../OSsrc/os_flag.c **** *              perr          is a pointer to an error code and can be:
  72:../OSsrc/os_flag.c **** *                            OS_ERR_NONE               No error
  73:../OSsrc/os_flag.c **** *                            OS_ERR_EVENT_TYPE         You are not pointing to an event flag group
  74:../OSsrc/os_flag.c **** *                            OS_ERR_FLAG_WAIT_TYPE     You didn't specify a proper 'wait_type' argu
  75:../OSsrc/os_flag.c **** *                            OS_ERR_FLAG_INVALID_PGRP  You passed a NULL pointer instead of the eve
  76:../OSsrc/os_flag.c **** *                                                      group handle.
  77:../OSsrc/os_flag.c **** *                            OS_ERR_FLAG_NOT_RDY       The desired flags you are waiting for are no
  78:../OSsrc/os_flag.c **** *                                                      available.
  79:../OSsrc/os_flag.c **** *
  80:../OSsrc/os_flag.c **** * Returns    : The flags in the event flag group that made the task ready or, 0 if a timeout or an 
  81:../OSsrc/os_flag.c **** *              occurred.
  82:../OSsrc/os_flag.c **** *
  83:../OSsrc/os_flag.c **** * Called from: Task or ISR
  84:../OSsrc/os_flag.c **** *
  85:../OSsrc/os_flag.c **** * Note(s)    : 1) IMPORTANT, the behavior of this function has changed from PREVIOUS versions.  The
  86:../OSsrc/os_flag.c **** *                 function NOW returns the flags that were ready INSTEAD of the current state of th
  87:../OSsrc/os_flag.c **** *                 event flags.
  88:../OSsrc/os_flag.c **** ***************************************************************************************************
  89:../OSsrc/os_flag.c **** */
  90:../OSsrc/os_flag.c **** 
  91:../OSsrc/os_flag.c **** #if OS_FLAG_ACCEPT_EN > 0
  92:../OSsrc/os_flag.c **** OS_FLAGS  OSFlagAccept (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT8U *perr)
  93:../OSsrc/os_flag.c **** {
 115               	.LM1:
 116               	/* prologue: frame size=0 */
 117               	/* prologue end (size=0) */
 118 0000 FC01      		movw r30,r24
 119 0002 D901      		movw r26,r18
  94:../OSsrc/os_flag.c ****     OS_FLAGS      flags_rdy;
  95:../OSsrc/os_flag.c ****     INT8U         result;
  96:../OSsrc/os_flag.c ****     BOOLEAN       consume;
  97:../OSsrc/os_flag.c **** #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status regis
  98:../OSsrc/os_flag.c ****     OS_CPU_SR     cpu_sr = 0;
  99:../OSsrc/os_flag.c **** #endif
 100:../OSsrc/os_flag.c **** 
 101:../OSsrc/os_flag.c **** 
 102:../OSsrc/os_flag.c **** 
 103:../OSsrc/os_flag.c **** #if OS_ARG_CHK_EN > 0
 104:../OSsrc/os_flag.c ****     if (perr == (INT8U *)0) {                              /* Validate 'perr'                      
 121               	.LM2:
 122 0004 2115      		cp r18,__zero_reg__
 123 0006 3105      		cpc r19,__zero_reg__
 124 0008 09F4      		brne .+2
 125 000a 6AC0      		rjmp .L1
 105:../OSsrc/os_flag.c ****         return ((OS_FLAGS)0);
 106:../OSsrc/os_flag.c ****     }
 107:../OSsrc/os_flag.c ****     if (pgrp == (OS_FLAG_GRP *)0) {                        /* Validate 'pgrp'                      
 127               	.LM3:
 128 000c 892B      		or r24,r25
 129 000e 21F4      		brne .L3
 108:../OSsrc/os_flag.c ****         *perr = OS_ERR_FLAG_INVALID_PGRP;
 131               	.LM4:
 132 0010 8EE6      		ldi r24,lo8(110)
 133 0012 8C93      		st X,r24
 109:../OSsrc/os_flag.c ****         return ((OS_FLAGS)0);
 135               	.LM5:
 136 0014 9F01      		movw r18,r30
 137 0016 64C0      		rjmp .L1
 138               	.L3:
 110:../OSsrc/os_flag.c ****     }
 111:../OSsrc/os_flag.c **** #endif
 112:../OSsrc/os_flag.c ****     if (pgrp->OSFlagType != OS_EVENT_TYPE_FLAG) {          /* Validate event block type            
 140               	.LM6:
 141 0018 8081      		ld r24,Z
 142 001a 8530      		cpi r24,lo8(5)
 143 001c 29F0      		breq .L4
 113:../OSsrc/os_flag.c ****         *perr = OS_ERR_EVENT_TYPE;
 145               	.LM7:
 146 001e 81E0      		ldi r24,lo8(1)
 147 0020 8C93      		st X,r24
 114:../OSsrc/os_flag.c ****         return ((OS_FLAGS)0);
 149               	.LM8:
 150 0022 20E0      		ldi r18,lo8(0)
 151 0024 30E0      		ldi r19,hi8(0)
 152 0026 5CC0      		rjmp .L1
 153               	.L4:
 115:../OSsrc/os_flag.c ****     }
 116:../OSsrc/os_flag.c ****     result = (INT8U)(wait_type & OS_FLAG_CONSUME);
 155               	.LM9:
 156 0028 842F      		mov r24,r20
 157 002a 8078      		andi r24,lo8(-128)
 117:../OSsrc/os_flag.c ****     if (result != (INT8U)0) {                              /* See if we need to consume the flags  
 159               	.LM10:
 160 002c 19F0      		breq .L5
 118:../OSsrc/os_flag.c ****         wait_type &= ~OS_FLAG_CONSUME;
 162               	.LM11:
 163 002e 4F77      		andi r20,lo8(127)
 119:../OSsrc/os_flag.c ****         consume    = OS_TRUE;
 165               	.LM12:
 166 0030 31E0      		ldi r19,lo8(1)
 167 0032 01C0      		rjmp .L6
 168               	.L5:
 120:../OSsrc/os_flag.c ****     } else {
 121:../OSsrc/os_flag.c ****         consume    = OS_FALSE;
 170               	.LM13:
 171 0034 382F      		mov r19,r24
 172               	.L6:
 122:../OSsrc/os_flag.c ****     }
 123:../OSsrc/os_flag.c **** /*$PAGE*/
 124:../OSsrc/os_flag.c ****     *perr = OS_ERR_NONE;                                   /* Assume NO error until proven otherwis
 174               	.LM14:
 175 0036 1C92      		st X,__zero_reg__
 125:../OSsrc/os_flag.c ****     OS_ENTER_CRITICAL();
 177               	.LM15:
 178               	/* #APP */
 179 0038 F894      		cli
 126:../OSsrc/os_flag.c ****     switch (wait_type) {
 181               	.LM16:
 182               	/* #NOAPP */
 183 003a 5527      		clr r21
 184 003c 4130      		cpi r20,1
 185 003e 5105      		cpc r21,__zero_reg__
 186 0040 09F4      		brne .+2
 187 0042 3BC0      		rjmp .L20
 188 0044 4230      		cpi r20,2
 189 0046 5105      		cpc r21,__zero_reg__
 190 0048 1CF4      		brge .L25
 191 004a 452B      		or r20,r21
 192 004c 39F1      		breq .L16
 193 004e 43C0      		rjmp .L24
 194               	.L25:
 195 0050 4230      		cpi r20,2
 196 0052 5105      		cpc r21,__zero_reg__
 197 0054 21F0      		breq .L8
 198 0056 4330      		cpi r20,3
 199 0058 5105      		cpc r21,__zero_reg__
 200 005a 89F0      		breq .L12
 201 005c 3CC0      		rjmp .L24
 202               	.L8:
 127:../OSsrc/os_flag.c ****         case OS_FLAG_WAIT_SET_ALL:                         /* See if all required flags are set    
 128:../OSsrc/os_flag.c ****              flags_rdy = (OS_FLAGS)(pgrp->OSFlagFlags & flags);     /* Extract only the bits we wan
 204               	.LM17:
 205 005e 9381      		ldd r25,Z+3
 206 0060 292F      		mov r18,r25
 207 0062 2623      		and r18,r22
 129:../OSsrc/os_flag.c ****              if (flags_rdy == flags) {                     /* Must match ALL the bits that we want 
 209               	.LM18:
 210 0064 2617      		cp r18,r22
 211 0066 39F4      		brne .L9
 130:../OSsrc/os_flag.c ****                  if (consume == OS_TRUE) {                 /* See if we need to consume the flags  
 213               	.LM19:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -