os_mem.lst

来自「atmega单片机用的ucos系统 占用内存适中 是atmega单片机合适的操作」· LST 代码 · 共 1,065 行 · 第 1/4 页

LST
1,065
字号
 275               	/* function OSMemCreate size 118 (97) */
 283               	.Lscope0:
 287               	.global	OSMemGet
 289               	OSMemGet:
 101:OSsrc/os_mem.c **** }
 102:OSsrc/os_mem.c **** /*$PAGE*/
 103:OSsrc/os_mem.c **** /*
 104:OSsrc/os_mem.c **** ***************************************************************************************************
 105:OSsrc/os_mem.c **** *                                          GET A MEMORY BLOCK
 106:OSsrc/os_mem.c **** *
 107:OSsrc/os_mem.c **** * Description : Get a memory block from a partition
 108:OSsrc/os_mem.c **** *
 109:OSsrc/os_mem.c **** * Arguments   : pmem    is a pointer to the memory partition control block
 110:OSsrc/os_mem.c **** *
 111:OSsrc/os_mem.c **** *               err     is a pointer to a variable containing an error message which will be set by
 112:OSsrc/os_mem.c **** *                       function to either:
 113:OSsrc/os_mem.c **** *
 114:OSsrc/os_mem.c **** *                       OS_NO_ERR           if the memory partition has been created correctly.
 115:OSsrc/os_mem.c **** *                       OS_MEM_NO_FREE_BLKS if there are no more free memory blocks to allocate to 
 116:OSsrc/os_mem.c **** *                       OS_MEM_INVALID_PMEM if you passed a NULL pointer for 'pmem'
 117:OSsrc/os_mem.c **** *
 118:OSsrc/os_mem.c **** * Returns     : A pointer to a memory block if no error is detected
 119:OSsrc/os_mem.c **** *               A pointer to NULL if an error is detected
 120:OSsrc/os_mem.c **** ***************************************************************************************************
 121:OSsrc/os_mem.c **** */
 122:OSsrc/os_mem.c **** 
 123:OSsrc/os_mem.c **** void  *OSMemGet (OS_MEM *pmem, INT8U *err)
 124:OSsrc/os_mem.c **** {
 291               	.LM31:
 292               	/* prologue: frame size=0 */
 293 00dc CF93      		push r28
 294 00de DF93      		push r29
 295               	/* prologue end (size=2) */
 296 00e0 DC01      		movw r26,r24
 297 00e2 EB01      		movw r28,r22
 125:OSsrc/os_mem.c ****     void      *pblk;
 126:OSsrc/os_mem.c **** #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register  
 127:OSsrc/os_mem.c ****     OS_CPU_SR  cpu_sr;
 128:OSsrc/os_mem.c **** 
 129:OSsrc/os_mem.c **** 
 130:OSsrc/os_mem.c **** 
 131:OSsrc/os_mem.c ****     cpu_sr = 0;                                       /* Prevent compiler warning                  
 132:OSsrc/os_mem.c **** #endif    
 133:OSsrc/os_mem.c **** #if OS_ARG_CHK_EN > 0
 134:OSsrc/os_mem.c ****     if (pmem == (OS_MEM *)0) {                        /* Must point to a valid memory partition    
 299               	.LM32:
 300 00e4 0097      		sbiw r24,0
 301 00e6 21F4      		brne .L17
 135:OSsrc/os_mem.c ****         *err = OS_MEM_INVALID_PMEM;
 303               	.LM33:
 304 00e8 84E7      		ldi r24,lo8(116)
 305 00ea 8883      		st Y,r24
 136:OSsrc/os_mem.c ****         return ((OS_MEM *)0);
 307               	.LM34:
 308 00ec CD01      		movw r24,r26
 309 00ee 28C0      		rjmp .L16
 310               	.L17:
 137:OSsrc/os_mem.c ****     }
 138:OSsrc/os_mem.c **** #endif
 139:OSsrc/os_mem.c ****     OS_ENTER_CRITICAL();
 312               	.LM35:
 313               	/* #APP */
 314 00f0 0FB6      		in __tmp_reg__,__SREG__
 315 00f2 F894      		cli
 316 00f4 0F92      		push __tmp_reg__
 140:OSsrc/os_mem.c ****     if (pmem->OSMemNFree > 0) {                       /* See if there are any free memory blocks   
 318               	.LM36:
 319               	/* #NOAPP */
 320 00f6 FC01      		movw r30,r24
 321 00f8 2485      		ldd r18,Z+12
 322 00fa 3585      		ldd r19,Z+13
 323 00fc 4685      		ldd r20,Z+14
 324 00fe 5785      		ldd r21,Z+15
 325 0100 2115      		cp r18,__zero_reg__
 326 0102 3105      		cpc r19,__zero_reg__
 327 0104 4105      		cpc r20,__zero_reg__
 328 0106 5105      		cpc r21,__zero_reg__
 329 0108 A9F0      		breq .L18
 141:OSsrc/os_mem.c ****         pblk                = pmem->OSMemFreeList;    /* Yes, point to next free memory block      
 331               	.LM37:
 332 010a 6281      		ldd r22,Z+2
 333 010c 7381      		ldd r23,Z+3
 142:OSsrc/os_mem.c ****         pmem->OSMemFreeList = *(void **)pblk;         /*      Adjust pointer to new free list      
 335               	.LM38:
 336 010e FB01      		movw r30,r22
 337 0110 8081      		ld r24,Z
 338 0112 9181      		ldd r25,Z+1
 339 0114 FD01      		movw r30,r26
 340 0116 8283      		std Z+2,r24
 341 0118 9383      		std Z+3,r25
 143:OSsrc/os_mem.c ****         pmem->OSMemNFree--;                           /*      One less memory block in this partiti
 343               	.LM39:
 344 011a 2150      		subi r18,lo8(-(-1))
 345 011c 3040      		sbci r19,hi8(-(-1))
 346 011e 4040      		sbci r20,hlo8(-(-1))
 347 0120 5040      		sbci r21,hhi8(-(-1))
 348 0122 2487      		std Z+12,r18
 349 0124 3587      		std Z+13,r19
 350 0126 4687      		std Z+14,r20
 351 0128 5787      		std Z+15,r21
 144:OSsrc/os_mem.c ****         OS_EXIT_CRITICAL();
 353               	.LM40:
 354               	/* #APP */
 355 012a 0F90      		pop __tmp_reg__
 356 012c 0FBE      		out __SREG__,__tmp_reg__
 145:OSsrc/os_mem.c ****         *err = OS_NO_ERR;                             /*      No error                             
 358               	.LM41:
 359               	/* #NOAPP */
 360 012e 1882      		st Y,__zero_reg__
 146:OSsrc/os_mem.c ****         return (pblk);                                /*      Return memory block to caller        
 362               	.LM42:
 363 0130 CB01      		movw r24,r22
 364 0132 06C0      		rjmp .L16
 365               	.L18:
 147:OSsrc/os_mem.c ****     }
 148:OSsrc/os_mem.c ****     OS_EXIT_CRITICAL();
 367               	.LM43:
 368               	/* #APP */
 369 0134 0F90      		pop __tmp_reg__
 370 0136 0FBE      		out __SREG__,__tmp_reg__
 149:OSsrc/os_mem.c ****     *err = OS_MEM_NO_FREE_BLKS;                       /* No,  Notify caller of empty memory partiti
 372               	.LM44:
 373               	/* #NOAPP */
 374 0138 81E7      		ldi r24,lo8(113)
 375 013a 8883      		st Y,r24
 150:OSsrc/os_mem.c ****     return ((void *)0);                               /*      Return NULL pointer to caller        
 377               	.LM45:
 378 013c 80E0      		ldi r24,lo8(0)
 379 013e 90E0      		ldi r25,hi8(0)
 380               	.L16:
 381               	/* epilogue: frame size=0 */
 382 0140 DF91      		pop r29
 383 0142 CF91      		pop r28
 384 0144 0895      		ret
 385               	/* epilogue end (size=3) */
 386               	/* function OSMemGet size 60 (55) */
 391               	.Lscope1:
 396               	.global	OSMemNameGet
 398               	OSMemNameGet:
 151:OSsrc/os_mem.c **** }
 152:OSsrc/os_mem.c **** /*$PAGE*/
 153:OSsrc/os_mem.c **** /*
 154:OSsrc/os_mem.c **** ***************************************************************************************************
 155:OSsrc/os_mem.c **** *                                   GET THE NAME OF A MEMORY PARTITION
 156:OSsrc/os_mem.c **** *
 157:OSsrc/os_mem.c **** * Description: This function is used to obtain the name assigned to a memory partition.
 158:OSsrc/os_mem.c **** *
 159:OSsrc/os_mem.c **** * Arguments  : pmem      is a pointer to the memory partition
 160:OSsrc/os_mem.c **** *
 161:OSsrc/os_mem.c **** *              pname     is a pointer to an ASCII string that will receive the name of the memory p
 162:OSsrc/os_mem.c **** *
 163:OSsrc/os_mem.c **** *              err       is a pointer to an error code that can contain one of the following values
 164:OSsrc/os_mem.c **** *
 165:OSsrc/os_mem.c **** *                        OS_NO_ERR                  if the name was copied to 'pname'
 166:OSsrc/os_mem.c **** *                        OS_MEM_INVALID_PMEM        if you passed a NULL pointer for 'pmem'
 167:OSsrc/os_mem.c **** *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
 168:OSsrc/os_mem.c **** *
 169:OSsrc/os_mem.c **** * Returns    : The length of the string or 0 if 'pmem' is a NULL pointer.
 170:OSsrc/os_mem.c **** ***************************************************************************************************
 171:OSsrc/os_mem.c **** */
 172:OSsrc/os_mem.c **** 
 173:OSsrc/os_mem.c **** #if OS_MEM_NAME_SIZE > 1
 174:OSsrc/os_mem.c **** INT8U  OSMemNameGet (OS_MEM *pmem, char *pname, INT8U *err)
 175:OSsrc/os_mem.c **** {
 400               	.LM46:
 401               	/* prologue: frame size=0 */
 402 0146 CF93      		push r28
 403 0148 DF93      		push r29
 404               	/* prologue end (size=2) */
 405 014a 9B01      		movw r18,r22
 406 014c EA01      		movw r28,r20
 176:OSsrc/os_mem.c ****     INT8U      len;
 177:OSsrc/os_mem.c **** #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register       
 178:OSsrc/os_mem.c ****     OS_CPU_SR  cpu_sr;
 179:OSsrc/os_mem.c **** 
 180:OSsrc/os_mem.c **** 
 181:OSsrc/os_mem.c **** 
 182:OSsrc/os_mem.c ****     cpu_sr = 0;                                  /* Prevent compiler warning                       
 183:OSsrc/os_mem.c **** #endif    
 184:OSsrc/os_mem.c ****     OS_ENTER_CRITICAL();
 408               	.LM47:
 409               	/* #APP */
 410 014e 0FB6      		in __tmp_reg__,__SREG__
 411 0150 F894      		cli
 412 0152 0F92      		push __tmp_reg__
 185:OSsrc/os_mem.c **** #if OS_ARG_CHK_EN > 0
 186:OSsrc/os_mem.c ****     if (pmem == (OS_MEM *)0) {                   /* Is 'pmem' a NULL pointer?                      
 414               	.LM48:
 415               	/* #NOAPP */
 416 0154 0097      		sbiw r24,0
 417 0156 21F4      		brne .L20
 187:OSsrc/os_mem.c ****         OS_EXIT_CRITICAL();                      /* Yes                                            
 419               	.LM49:
 420               	/* #APP */
 421 0158 0F90      		pop __tmp_reg__
 422 015a 0FBE      		out __SREG__,__tmp_reg__
 188:OSsrc/os_mem.c ****         *err = OS_MEM_INVALID_PMEM;
 424               	.LM50:
 425               	/* #NOAPP */
 426 015c 84E7      		ldi r24,lo8(116)
 427 015e 05C0      		rjmp .L22
 428               	.L20:
 189:OSsrc/os_mem.c ****         return (0);
 190:OSsrc/os_mem.c ****     }
 191:OSsrc/os_mem.c ****     if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?                     
 430               	.LM51:
 431 0160 672B      		or r22,r23
 432 0162 39F4      		brne .L21
 192:OSsrc/os_mem.c ****         OS_EXIT_CRITICAL();                      /* Yes                                            
 434               	.LM52:
 435               	/* #APP */
 436 0164 0F90      		pop __tmp_reg__
 437 0166 0FBE      		out __SREG__,__tmp_reg__
 193:OSsrc/os_mem.c ****         *err = OS_ERR_PNAME_NULL;
 439               	.LM53:
 440               	/* #NOAPP */
 441 0168 8FE0      		ldi r24,lo8(15)
 442               	.L22:
 443 016a 8883      		st Y,r24
 194:OSsrc/os_mem.c ****         return (0);
 445               	.LM54:
 446 016c 80E0      		ldi r24,lo8(0)
 447 016e 90E0      		ldi r25,hi8(0)
 448 0170 09C0      		rjmp .L19
 449               	.L21:
 195:OSsrc/os_mem.c ****     }
 196:OSsrc/os_mem.c **** #endif
 197:OSsrc/os_mem.c ****     len  = OS_StrCopy(pname, pmem->OSMemName);   /* Copy name from OS_MEM                          
 451               	.LM55:
 452 0172 4096      		adiw r24,16
 453 0174 BC01      		movw r22,r24
 454 0176 C901      		movw r24,r18
 455 0178 0E94 0000 		call OS_StrCopy
 198:OSsrc/os_mem.c ****     OS_EXIT_CRITICAL();
 457               	.LM56:
 458               	/* #APP */
 459 017c 0F90      		pop __tmp_reg__
 460 017e 0FBE      		out __SREG__,__tmp_reg__
 199:OSsrc/os_mem.c ****     *err = OS_NO_ERR;
 462               	.LM57:
 463               	/* #NOAPP */
 464 0180 1882      		st Y,__zero_reg__
 200:OSsrc/os_mem.c ****     return (len);
 466               	.LM58:
 467 0182 9927      		clr r25
 468               	.L19:
 469               	/* epilogue: frame size=0 */
 470 0184 DF91      		pop r29
 471 0186 CF91      		pop r28
 472 0188 0895      		ret
 473               	/* epilogue end (size=3) */
 474               	/* function OSMemNameGet size 43 (38) */
 479               	.Lscope2:
 484               	.global	OSMemNameSet
 486               	OSMemNameSet:
 201:OSsrc/os_mem.c **** }
 202:OSsrc/os_mem.c **** #endif
 203:OSsrc/os_mem.c **** 
 204:OSsrc/os_mem.c **** /*$PAGE*/
 205:OSsrc/os_mem.c **** /*
 206:OSsrc/os_mem.c **** ***************************************************************************************************
 207:OSsrc/os_mem.c **** *                                 ASSIGN A NAME TO A MEMORY PARTITION
 208:OSsrc/os_mem.c **** *
 209:OSsrc/os_mem.c **** * Description: This function assigns a name to a memory partition.
 210:OSsrc/os_mem.c **** *
 211:OSsrc/os_mem.c **** * Arguments  : pmem      is a pointer to the memory partition
 212:OSsrc/os_mem.c **** *

⌨️ 快捷键说明

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