os_mem.lst
来自「在51上运行的小的OS系统」· LST 代码 · 共 500 行 · 第 1/3 页
LST
500 行
C51 COMPILER V8.08 OS_MEM 08/04/2008 21:49:52 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE OS_MEM
OBJECT MODULE PLACED IN OS_MEM.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE uCosii\OS_MEM.C DEBUG OBJECTEXTEND PRINT(.\OS_MEM.lst) OBJECT(OS_MEM.obj)
line level source
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * MEMORY MANAGEMENT
6 *
7 * (c) Copyright 1992-2005, Jean J. Labrosse, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_MEM.C
11 * By : Jean J. Labrosse
12 * Version : V2.80
13 *********************************************************************************************************
14 */
15
16 #ifndef OS_MASTER_FILE
17 #include "..\arm\includes.h"
*** ERROR C141 IN LINE 83 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x00'
*** ERROR C132 IN LINE 83 OF UCOSII\..\ARM\OS_CPU.H: 'OS_TASK_SW': not in formal parameter list
*** ERROR C141 IN LINE 84 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x01'
*** ERROR C132 IN LINE 84 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 84 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 84 OF UCOSII\..\ARM\OS_CPU.H: '_OSStartHighRdy': not in formal parameter list
*** ERROR C141 IN LINE 85 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x02'
*** ERROR C132 IN LINE 85 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 85 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 85 OF UCOSII\..\ARM\OS_CPU.H: 'OS_ENTER_CRITICAL': not in formal parameter list
*** ERROR C141 IN LINE 86 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x03'
*** ERROR C132 IN LINE 86 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 86 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 86 OF UCOSII\..\ARM\OS_CPU.H: 'OS_EXIT_CRITICAL': not in formal parameter list
*** ERROR C141 IN LINE 88 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x40'
*** ERROR C132 IN LINE 88 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 88 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 88 OF UCOSII\..\ARM\OS_CPU.H: '_GetOSFunctionAddr': not in formal parameter list
*** ERROR C141 IN LINE 89 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x41'
*** ERROR C132 IN LINE 89 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 89 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 89 OF UCOSII\..\ARM\OS_CPU.H: '_GetUsrFunctionAddr': not in formal parameter list
*** ERROR C141 IN LINE 90 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x42'
*** ERROR C132 IN LINE 90 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 90 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 90 OF UCOSII\..\ARM\OS_CPU.H: 'OSISRBegin': not in formal parameter list
*** ERROR C141 IN LINE 91 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x43'
*** ERROR C132 IN LINE 91 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 91 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'int'
*** ERROR C132 IN LINE 91 OF UCOSII\..\ARM\OS_CPU.H: 'OSISRNeedSwap': not in formal parameter list
*** ERROR C141 IN LINE 93 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x80'
*** ERROR C132 IN LINE 93 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 93 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 93 OF UCOSII\..\ARM\OS_CPU.H: 'ChangeToSYSMode': not in formal parameter list
*** ERROR C141 IN LINE 94 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x81'
*** ERROR C132 IN LINE 94 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 94 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 94 OF UCOSII\..\ARM\OS_CPU.H: 'ChangeToUSRMode': not in formal parameter list
C51 COMPILER V8.08 OS_MEM 08/04/2008 21:49:52 PAGE 2
*** ERROR C141 IN LINE 95 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x82'
*** ERROR C132 IN LINE 95 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 95 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 95 OF UCOSII\..\ARM\OS_CPU.H: '_TaskIsARM': not in formal parameter list
*** ERROR C141 IN LINE 96 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x83'
*** ERROR C132 IN LINE 96 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 96 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 96 OF UCOSII\..\ARM\OS_CPU.H: '_TaskIsTHUMB': not in formal parameter list
*** ERROR C127 IN LINE 113 OF UCOSII\..\ARM\OS_CPU.H: 'OsEnterSum': invalid storage class
*** ERROR C127 IN LINE 284 OF UCOSII\..\UCOSII\UCOS_II.H: 'OS_EVENT': invalid storage class
*** ERROR C127 IN LINE 301 OF UCOSII\..\UCOSII\UCOS_II.H: 'OS_FLAGS': invalid storage class
*** ERROR C141 IN LINE 312 OF UCOSII\..\UCOSII\UCOS_II.H: syntax error near 'OS_FLAGS'
*** ERROR C127 IN LINE 312 OF UCOSII\..\UCOSII\UCOS_II.H: 'OS_FLAGS': invalid storage class
*** ERROR C141 IN LINE 312 OF UCOSII\..\UCOSII\UCOS_II.H: syntax error near 'OSFlagFlags'
*** ERROR C127 IN LINE 312 OF UCOSII\..\UCOSII\UCOS_II.H: 'OSFlagFlags': invalid storage class
*** ERROR C132 IN LINE 314 OF UCOSII\..\UCOSII\UCOS_II.H: 'OSFlagName': not in formal parameter list
*** ERROR C141 IN LINE 316 OF UCOSII\..\UCOSII\UCOS_II.H: syntax error near '}'
*** ERROR C141 IN LINE 325 OF UCOSII\..\UCOSII\UCOS_II.H: syntax error near 'OS_FLAGS'
*** ERROR C129 IN LINE 325 OF UCOSII\..\UCOSII\UCOS_II.H: missing ';' before 'OSFlagNodeFlags'
18 #endif
19
20 #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
21 /*
22 *********************************************************************************************************
23 * CREATE A MEMORY PARTITION
24 *
25 * Description : Create a fixed-sized memory partition that will be managed by uC/OS-II.
26 *
27 * Arguments : addr is the starting address of the memory partition
28 *
29 * nblks is the number of memory blocks to create from the partition.
30 *
31 * blksize is the size (in bytes) of each block in the memory partition.
32 *
33 * err is a pointer to a variable containing an error message which will be set by
34 * this function to either:
35 *
36 * OS_NO_ERR if the memory partition has been created correctly.
37 * OS_MEM_INVALID_ADDR you are specifying an invalid address for the memory
38 * storage of the partition.
39 * OS_MEM_INVALID_PART no free partitions available
40 * OS_MEM_INVALID_BLKS user specified an invalid number of blocks (must be >= 2)
41 * OS_MEM_INVALID_SIZE user specified an invalid block size
42 * (must be greater than the size of a pointer)
43 * Returns : != (OS_MEM *)0 is the partition was created
44 * == (OS_MEM *)0 if the partition was not created because of invalid arguments or, no
45 * free partition is available.
46 *********************************************************************************************************
47 */
48
49 OS_MEM *OSMemCreate (void *addr, INT32U nblks, INT32U blksize, INT8U *err)
50 {
51 OS_MEM *pmem;
52 INT8U *pblk;
53 void **plink;
54 INT32U i;
55 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr = 0;
#endif
58
59
60
C51 COMPILER V8.08 OS_MEM 08/04/2008 21:49:52 PAGE 3
61 #if OS_ARG_CHK_EN > 0
62 if (err == (INT8U *)0) { /* Validate 'err' */
63 return ((OS_MEM *)0);
64 }
65 if (addr == (void *)0) { /* Must pass a valid address for the memory part.*/
66 *err = OS_MEM_INVALID_ADDR;
67 return ((OS_MEM *)0);
68 }
69 if (nblks < 2) { /* Must have at least 2 blocks per partition */
70 *err = OS_MEM_INVALID_BLKS;
71 return ((OS_MEM *)0);
72 }
73 if (blksize < sizeof(void *)) { /* Must contain space for at least a pointer */
74 *err = OS_MEM_INVALID_SIZE;
75 return ((OS_MEM *)0);
76 }
77 #endif
78 OS_ENTER_CRITICAL();
79 pmem = OSMemFreeList; /* Get next free memory partition */
80 if (OSMemFreeList != (OS_MEM *)0) { /* See if pool of free partitions was empty */
81 OSMemFreeList = (OS_MEM *)OSMemFreeList->OSMemFreeList;
82 }
83 OS_EXIT_CRITICAL();
84 if (pmem == (OS_MEM *)0) { /* See if we have a memory partition */
85 *err = OS_MEM_INVALID_PART;
86 return ((OS_MEM *)0);
87 }
88 plink = (void **)addr; /* Create linked list of free memory blocks */
89 pblk = (INT8U *)((INT32U)addr + blksize);
90 for (i = 0; i < (nblks - 1); i++) {
91 *plink = (void *)pblk; /* Save pointer to NEXT block in CURRENT block */
92 plink = (void **)pblk; /* Position to NEXT block */
93 pblk = (INT8U *)((INT32U)pblk + blksize); /* Point to the FOLLOWING block */
94 }
95 *plink = (void *)0; /* Last memory block points to NULL */
96 pmem->OSMemAddr = addr; /* Store start address of memory partition */
97 pmem->OSMemFreeList = addr; /* Initialize pointer to pool of free blocks */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?