📄 os_core.lst
字号:
\ In segment DATA_Z, align 4, align-sorted
\ INT32U __data OSTmrTime
\ OSTmrTime:
\ 00000000 DS8 4
\ In segment DATA_Z, align 4, align-sorted
\ struct os_event *__data OSTmrSem
\ OSTmrSem:
\ 00000000 DS8 4
\ In segment DATA_Z, align 4, align-sorted
\ struct os_event *__data OSTmrSemSignal
\ OSTmrSemSignal:
\ 00000000 DS8 4
\ In segment DATA_Z, align 4, align-sorted
\ OS_TMR __data OSTmrTbl[16]
\ OSTmrTbl:
\ 00000000 DS8 832
\ In segment DATA_Z, align 4, align-sorted
\ struct os_tmr *__data OSTmrFreeList
\ OSTmrFreeList:
\ 00000000 DS8 4
\ In segment DATA_Z, align 4, align-sorted
\ OS_STK __data OSTmrTaskStk[128]
\ OSTmrTaskStk:
\ 00000000 DS8 512
\ In segment DATA_Z, align 4, align-sorted
\ OS_TMR_WHEEL __data OSTmrWheelTbl[8]
\ OSTmrWheelTbl:
\ 00000000 DS8 64
27 #endif
28
29 /*
30 *********************************************************************************************************
31 * PRIORITY RESOLUTION TABLE
32 *
33 * Note: Index into table is bit pattern to resolve highest priority
34 * Indexed value corresponds to highest priority bit position (i.e. 0..7)
35 *********************************************************************************************************
36 */
37
\ In segment DATA_C, align 4, align-sorted
38 INT8U const OSUnMapTbl[256] = {
\ OSUnMapTbl:
\ 00000000 000001000200 DC8 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1
\ 010003000100
\ 020001000400
\ 0100020001
\ 00000017 000300010002 DC8 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0
\ 000100050001
\ 000200010003
\ 0001000200
\ 0000002E 010004000100 DC8 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2
\ 020001000300
\ 010002000100
\ 0600010002
\ 00000045 000100030001 DC8 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0
\ 000200010004
\ 000100020001
\ 0003000100
\ 0000005C 020001000500 DC8 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1
\ 010002000100
\ 030001000200
\ 0100040001
\ 00000073 000200010003 DC8 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0
\ 000100020001
\ 000700010002
\ 0001000300
\ 0000008A 010002000100 DC8 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5
\ 040001000200
\ 010003000100
\ 0200010005
\ 000000A1 000100020001 DC8 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0
\ 000300010002
\ 000100040001
\ 0002000100
\ 000000B8 030001000200 DC8 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1
\ 010006000100
\ 020001000300
\ 0100020001
\ 000000CF 000400010002 DC8 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0
\ 000100030001
\ 000200010005
\ 0001000200
\ 000000E6 010003000100 DC8 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2
\ 020001000400
\ 010002000100
\ 0300010002
\ 000000FD 000100 DC8 0, 1, 0
39 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x00 to 0x0F */
40 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x10 to 0x1F */
41 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x20 to 0x2F */
42 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x30 to 0x3F */
43 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x40 to 0x4F */
44 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x50 to 0x5F */
45 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x60 to 0x6F */
46 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x70 to 0x7F */
47 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x80 to 0x8F */
48 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x90 to 0x9F */
49 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xA0 to 0xAF */
50 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xB0 to 0xBF */
51 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xC0 to 0xCF */
52 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xD0 to 0xDF */
53 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xE0 to 0xEF */
54 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 /* 0xF0 to 0xFF */
55 };
56
57 /*$PAGE*/
58 /*
59 *********************************************************************************************************
60 * FUNCTION PROTOTYPES
61 *********************************************************************************************************
62 */
63
64 static void OS_InitEventList(void);
65
66 static void OS_InitMisc(void);
67
68 static void OS_InitRdyList(void);
69
70 static void OS_InitTaskIdle(void);
71
72 #if OS_TASK_STAT_EN > 0
73 static void OS_InitTaskStat(void);
74 #endif
75
76 static void OS_InitTCBList(void);
77
78 static void OS_SchedNew(void);
79
80 /*$PAGE*/
81 /*
82 *********************************************************************************************************
83 * GET THE NAME OF A SEMAPHORE, MUTEX, MAILBOX or QUEUE
84 *
85 * Description: This function is used to obtain the name assigned to a semaphore, mutex, mailbox or queue.
86 *
87 * Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
88 * a mutex, a mailbox or a queue. Where this function is concerned, the actual
89 * type is irrelevant.
90 *
91 * pname is a pointer to an ASCII string that will receive the name of the semaphore,
92 * mutex, mailbox or queue. The string must be able to hold at least
93 * OS_EVENT_NAME_SIZE characters.
94 *
95 * err is a pointer to an error code that can contain one of the following values:
96 *
97 * OS_ERR_NONE if the name was copied to 'pname'
98 * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
99 * control block type.
100 * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
101 * OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
102 *
103 * Returns : The length of the string or 0 if the 'pevent' is a NULL pointer.
104 *********************************************************************************************************
105 */
106
107 #if OS_EVENT_EN && (OS_EVENT_NAME_SIZE > 1)
\ In segment CODE, align 4, keep-with-next
108 INT8U OSEventNameGet (OS_EVENT *pevent, INT8U *pname, INT8U *err)
109 {
\ OSEventNameGet:
\ 00000000 F0412DE9 PUSH {R4-R8,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
\ 0000000C 0260B0E1 MOVS R6,R2
110 INT8U len;
111 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
112 OS_CPU_SR cpu_sr = 0;
\ 00000010 0000A0E3 MOV R0,#+0
\ 00000014 0080B0E1 MOVS R8,R0
113 #endif
114
115
116
117 #if OS_ARG_CHK_EN > 0
118 if (err == (INT8U *)0) { /* Validate 'err' */
\ 00000018 000056E3 CMP R6,#+0
\ 0000001C 0100001A BNE ??OSEventNameGet_1
119 return (0);
\ 00000020 0000A0E3 MOV R0,#+0
\ 00000024 220000EA B ??OSEventNameGet_2
120 }
121 if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
\ ??OSEventNameGet_1:
\ 00000028 000054E3 CMP R4,#+0
\ 0000002C 0300001A BNE ??OSEventNameGet_3
122 *err = OS_ERR_PEVENT_NULL;
\ 00000030 0400A0E3 MOV R0,#+4
\ 00000034 0000C6E5 STRB R0,[R6, #+0]
123 return (0);
\ 00000038 0000A0E3 MOV R0,#+0
\ 0000003C 1C0000EA B ??OSEventNameGet_2
124 }
125 if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
\ ??OSEventNameGet_3:
\ 00000040 000055E3 CMP R5,#+0
\ 00000044 0300001A BNE ??OSEventNameGet_4
126 *err = OS_ERR_PNAME_NULL;
\ 00000048 0C00A0E3 MOV R0,#+12
\ 0000004C 0000C6E5 STRB R0,[R6, #+0]
127 return (0);
\ 00000050 0000A0E3 MOV R0,#+0
\ 00000054 160000EA B ??OSEventNameGet_2
128 }
129 #endif
130 switch (pevent->OSEventType) {
\ ??OSEventNameGet_4:
\ 00000058 0000D4E5 LDRB R0,[R4, #+0]
\ 0000005C 010040E2 SUB R0,R0,#+1
\ 00000060 030050E3 CMP R0,#+3
\ 00000064 0F00008A BHI ??OSEventNameGet_5
\ 00000068 011F8FE2 ADR R1,??OSEventNameGet_0
\ 0000006C 0010D1E7 LDRB R1,[R1, R0]
\ 00000070 01F18FE0 ADD PC,PC,R1, LSL #+2
\ ??OSEventNameGet_0:
\ 00000074 00000000 DC8 +0,+0,+0,+0
131 case OS_EVENT_TYPE_SEM:
132 case OS_EVENT_TYPE_MUTEX:
133 case OS_EVENT_TYPE_MBOX:
134 case OS_EVENT_TYPE_Q:
135 break;
136
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -