📄 comtest.lst
字号:
136 /*-----------------------------------------------------------*/
137
\ In segment CODE, align 4, keep-with-next
138 void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned portLONG ulBaudRate, unsigned portBASE_TYPE uxLED )
139 {
\ vAltStartComTestTasks:
\ 00000000 10B5 PUSH {R4,LR}
\ 00000002 041C MOV R4,R0
\ 00000004 081C MOV R0,R1
140 /* Initialise the com port then spawn the Rx and Tx tasks. */
141 uxBaseLED = uxLED;
\ 00000006 .... LDR R1,??DataTable5 ;; ??uxBaseLED
\ 00000008 0A60 STR R2,[R1, #+0]
142 xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
\ 0000000A 1821 MOV R1,#+0x18
\ 0000000C ........ _BLF xSerialPortInitMinimal,xSerialPortInitMinimal??rT
143
144 /* The Tx task is spawned with a lower priority than the Rx task. */
145 xTaskCreate( vComTxTask, ( const signed portCHAR * const ) "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
\ 00000010 0020 MOV R0,#+0
\ 00000012 01B4 PUSH {R0}
\ 00000014 601E SUB R0,R4,#+0x1
\ 00000016 01B4 PUSH {R0}
\ 00000018 0023 MOV R3,#+0
\ 0000001A 6422 MOV R2,#+0x64
\ 0000001C 0849 LDR R1,??vAltStartComTestTasks_0 ;; `?<Constant "COMTx">`
\ 0000001E 0948 LDR R0,??vAltStartComTestTasks_0+0x4 ;; ??vComTxTask
\ 00000020 ........ _BLF xTaskCreate,xTaskCreate??rT
146 xTaskCreate( vComRxTask, ( const signed portCHAR * const ) "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
\ 00000024 0020 MOV R0,#+0
\ 00000026 01B4 PUSH {R0}
\ 00000028 10B4 PUSH {R4}
\ 0000002A 0023 MOV R3,#+0
\ 0000002C 6422 MOV R2,#+0x64
\ 0000002E 0649 LDR R1,??vAltStartComTestTasks_0+0x8 ;; `?<Constant "COMRx">`
\ 00000030 0648 LDR R0,??vAltStartComTestTasks_0+0xC ;; ??vComRxTask
\ 00000032 ........ _BLF xTaskCreate,xTaskCreate??rT
147 }
\ 00000036 04B0 ADD SP,#+0x10
\ 00000038 10BC POP {R4}
\ 0000003A 01BC POP {R0}
\ 0000003C 0047 BX R0 ;; return
\ 0000003E C046 NOP
\ ??vAltStartComTestTasks_0:
\ 00000040 ........ DC32 `?<Constant "COMTx">`
\ 00000044 ........ DC32 ??vComTxTask
\ 00000048 ........ DC32 `?<Constant "COMRx">`
\ 0000004C ........ DC32 ??vComRxTask
148 /*-----------------------------------------------------------*/
149
\ In segment CODE, align 4, keep-with-next
150 static portTASK_FUNCTION( vComTxTask, pvParameters )
151 {
\ ??vComTxTask:
\ 00000000 D0B5 PUSH {R4,R6,R7,LR}
152 signed portCHAR cByteToSend;
153 portTickType xTimeToWait;
154
155 /* Just to stop compiler warnings. */
156 ( void ) pvParameters;
\ 00000002 .... LDR R4,??DataTable5 ;; ??uxBaseLED
\ 00000004 .... LDR R7,??DataTable3 ;; ??xPort
157
158 for( ;; )
159 {
160 /* Simply transmit a sequence of characters from comFIRST_BYTE to
161 comLAST_BYTE. */
162 for( cByteToSend = comFIRST_BYTE; cByteToSend <= comLAST_BYTE; cByteToSend++ )
\ ??vComTxTask_1:
\ 00000006 4126 MOV R6,#+0x41
163 {
164 if( xSerialPutChar( xPort, cByteToSend, comNO_BLOCK ) == pdPASS )
\ ??vComTxTask_2:
\ 00000008 0022 MOV R2,#+0
\ 0000000A 3106 LSL R1,R6,#+0x18
\ 0000000C 0916 ASR R1,R1,#+0x18
\ 0000000E 3868 LDR R0,[R7, #+0]
\ 00000010 ........ _BLF xSerialPutChar,xSerialPutChar??rT
\ 00000014 0128 CMP R0,#+0x1
\ 00000016 02D1 BNE ??vComTxTask_3
165 {
166 vParTestToggleLED( uxBaseLED + comTX_LED_OFFSET );
\ 00000018 2068 LDR R0,[R4, #+0]
\ 0000001A ........ _BLF vParTestToggleLED,vParTestToggleLED??rT
167 }
168 }
\ ??vComTxTask_3:
\ 0000001E 761C ADD R6,R6,#+0x1
\ 00000020 592E CMP R6,#+0x59
\ 00000022 F1DB BLT ??vComTxTask_2
169
170 /* Turn the LED off while we are not doing anything. */
171 vParTestSetLED( uxBaseLED + comTX_LED_OFFSET, pdFALSE );
\ 00000024 0021 MOV R1,#+0
\ 00000026 2068 LDR R0,[R4, #+0]
\ 00000028 ........ _BLF vParTestSetLED,vParTestSetLED??rT
172
173 /* We have posted all the characters in the string - wait before
174 re-sending. Wait a pseudo-random time as this will provide a better
175 test. */
176 xTimeToWait = xTaskGetTickCount() + comOFFSET_TIME;
\ 0000002C ........ _BLF xTaskGetTickCount,xTaskGetTickCount??rT
\ 00000030 C01C ADD R0,R0,#+0x3
177
178 /* Make sure we don't wait too long... */
179 xTimeToWait %= comTX_MAX_BLOCK_TIME;
\ 00000032 9621 MOV R1,#+0x96
\ 00000034 ........ _BLF ??divu32_t,??rT??divu32_t
180
181 /* ...but we do want to wait. */
182 if( xTimeToWait < comTX_MIN_BLOCK_TIME )
\ 00000038 3228 CMP R0,#+0x32
\ 0000003A 00D2 BCS ??vComTxTask_4
183 {
184 xTimeToWait = comTX_MIN_BLOCK_TIME;
\ 0000003C 3220 MOV R0,#+0x32
185 }
186
187 vTaskDelay( xTimeToWait );
\ ??vComTxTask_4:
\ 0000003E ........ _BLF vTaskDelay,vTaskDelay??rT
\ 00000042 E0E7 B ??vComTxTask_1
188 }
189 } /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */
190 /*-----------------------------------------------------------*/
191
\ In segment CODE, align 4, keep-with-next
192 static portTASK_FUNCTION( vComRxTask, pvParameters )
193 {
\ ??vComRxTask:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 82B0 SUB SP,#+0x8
\ 00000004 0020 MOV R0,#+0
\ 00000006 0190 STR R0,[SP, #+0x4]
194 signed portCHAR cExpectedByte, cByteRxed;
195 portBASE_TYPE xResyncRequired = pdFALSE, xErrorOccurred = pdFALSE;
\ 00000008 0024 MOV R4,#+0
\ 0000000A 1B4D LDR R5,??vComRxTask_1 ;; 0xffff
\ 0000000C .... LDR R6,??DataTable3 ;; ??xPort
\ 0000000E 0BE0 B ??vComRxTask_2
196
197 /* Just to stop compiler warnings. */
198 ( void ) pvParameters;
199
200 for( ;; )
201 {
202 /* We expect to receive the characters from comFIRST_BYTE to
203 comLAST_BYTE in an incrementing order. Loop to receive each byte. */
204 for( cExpectedByte = comFIRST_BYTE; cExpectedByte <= comLAST_BYTE; cExpectedByte++ )
205 {
206 /* Block on the queue that contains received bytes until a byte is
207 available. */
208 if( xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME ) )
209 {
210 /* Was this the byte we were expecting? If so, toggle the LED,
211 otherwise we are out on sync and should break out of the loop
212 until the expected character sequence is about to restart. */
213 if( cByteRxed == cExpectedByte )
214 {
215 vParTestToggleLED( uxBaseLED + comRX_LED_OFFSET );
216 }
217 else
218 {
219 xResyncRequired = pdTRUE;
220 break; /*lint !e960 Non-switch break allowed. */
221 }
222 }
223 }
224
225 /* Turn the LED off while we are not doing anything. */
226 vParTestSetLED( uxBaseLED + comRX_LED_OFFSET, pdFALSE );
227
228 /* Did we break out of the loop because the characters were received in
229 an unexpected order? If so wait here until the character sequence is
230 about to restart. */
231 if( xResyncRequired == pdTRUE )
232 {
233 while( cByteRxed != comLAST_BYTE )
234 {
235 /* Block until the next char is available. */
236 xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME );
\ ??vComRxTask_3:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -