📄 bbu_mem_tests.s
字号:
; ****************
; * *
; * bbu_MTS_MEDP * Subroutine
; * *
; ****************
;
; This subroutine performs an "Miller Effect Data Pattern" test on the selected memory
;
; PARAMETER PASSING & REGISTER USE:
;
; R0 = used for calls to UART subroutines
; r1 - r8 = available for general use
; r9 = Starting address of memory test (DO NOT MODIFY!)
; r10 = Number of bytes to be tested (DO NOT MODIFY!)
; r11-r12 = available for general use
; r13 = Stack pointer (sp) - DO NOT MODIFY
; r14 = Link register (lr) - DO NOT MODIFY
;
bbu_MTS_MEDP FUNCTION
stmfd sp!, {r0-r12, lr} ; Save r0-r12 and link register on the stack
ldr r5, =BBU_SMTD_CLC ; Address of current loop counter
mov r6, #1 ; This is pass #1
str r6, [r5] ; Save this value
5 ldr r0, =MTS_MEDP_MSG1 ; Identify test to be run
bl BBU_putstr ; Send string to user
mov r0, r6 ; Get pass number
mov r1, #0 ; Supress leading zeros
bl BBU_UDecToAscii ; Send to user
bl BBU_crlf ; Output a <CR><LF>
mov r4, r9 ; Set up starting address in r4
mov r5, r10 ; Put byte count into r5
bic r5, r5, #7 ; Make sure bits 2:0 are clear (8 byte increments)
ldr r6, =0x55555555 ; Load r6 with pattern #1
ldr r7, =0xAAAAAAAA ; Load r7 with pattern #2
;
; Fill memory with the test pattern
;
10 str r6, [r4], #4 ; Store first pattern
str r7, [r4], #4 ; Store second pattern
subs r5, r5, #8 ; Decrement byte count
bne %B10 ; Loop until memory is filled
;
; Read pattern back and check for errors
;
ldr r0, =MTS_MEDP_MSG2 ; Let user know data is being read
bl BBU_putstr ; Send string to user
mov r4, r9 ; Set up starting address in r4
mov r5, r10 ; Put byte count into r5
bic r5, r5, #7 ; Make sure bits 2:0 are clear (8 byte increments)
11 ldr r8, [r4], #4 ; Fetch the first value
cmp r8, r6 ; Does the data match?
beq %F12 ; YES - do next test
;
; No match on 1st value - inform user
;
mov r0, r6 ; copy expected data to r0
mov r1, r4 ; Get address of failed location
mov r2, r8 ; Move actual data to r2
bl BBU_MTSP_error ; Print message
12 ldr r8, [r4], #4 ; Fetch the second value
cmp r8, r7 ; Does the data match?
beq %F13 ; YES - continue
;
; No match on 2nd value - inform user
;
mov r0, r7 ; copy expected data to r0
mov r1, r4 ; Get address of failed location
mov r2, r8 ; Move actual data to r2
bl BBU_MTSP_error ; Print message
13 subs r5, r5, #8 ; decrement byte count
bne %B11 ; Loop until done
;
; Increment current loop counter and exit if equal to max loop count
;
ldr r5, =BBU_SMTD_CLC ; Address of current loop counter
ldr r6, [r5] ; Fetch this value
ldr r7, =BBU_SMTD_LOOP ; Address of ending loop count
ldr r8, [r7] ; Fetch this value
cmp r6, r8 ; Are the loop counts equal?
bne %F14 ; No - skip over return
ldmfd sp!, {r0-r12, pc} ; return to caller
14 add r6, r6, #1 ; Increment current loop count ...
str r6, [r5] ; ... and save this value
b %B5 ; Run test again
;
; Text Messages for MEDP memory tests
;
MTS_MEDP_MSG1 DCB " 0x00000010 - Writing Miller Effect Data Pattern - Pass ",0
MTS_MEDP_MSG2 DCB " 0x00000010 - Reading Miller Effect Data Pattern",0xD,0xA,0
ALIGN 4
ENDFUNC
;
;*********************************************************************************
;
; *******************
; * *
; * bbu_MTS_ZRRIBDP * Subroutine
; * *
; *******************
;
; This subroutine performs an "Zero Rotate Right & Invert Byte Data Pattern" memory test
;
; PARAMETER PASSING & REGISTER USE:
;
; R0 = used for calls to UART subroutines
; r1 - r8 = available for general use
; r9 = Starting address of memory test (DO NOT MODIFY!)
; r10 = Number of bytes to be tested (DO NOT MODIFY!)
; r11-r12 = available for general use
; r13 = Stack pointer (sp) - DO NOT MODIFY
; r14 = Link register (lr) - DO NOT MODIFY
;
bbu_MTS_ZRRIBDP FUNCTION
stmfd sp!, {r0-r12, lr} ; Save r0-r12 and link register on the stack
ldr r5, =BBU_SMTD_CLC ; Address of current loop counter
mov r6, #1 ; This is pass #1
str r6, [r5] ; Save this value
mov r12, lr ; Copy the link register into r12
5 ldr r0, =MTS_ZRRIB_MSG1 ; Identify test to be run
bl BBU_putstr ; Send string to user
mov r0, r6 ; Get pass number
mov r1, #0 ; Supress leading zeros
bl BBU_UDecToAscii ; Send to user
bl BBU_crlf ; Output a <CR><LF>
mov r4, r9 ; Set up starting address in r4
mov r5, r10 ; Put byte count into r5
bic r5, r5, #7 ; Make sure bits 2:0 are clear (8 byte increments)
ldr r6, =0x7F7F7F7F ; Load r6 with pattern
;
; Fill memory with the test pattern
;
10 str r6, [r4], #4 ; Store first pattern
mvn r6, r6 ; Invert the data
str r6, [r4], #4 ; Store inverted pattern
mvn r6, r6 ; Invert the data (back to original data)
mov r6, r6, ROR #1 ; Rotate the data right by 1 bit
subs r5, r5, #8 ; Decrement byte count
bne %B10 ; Loop until memory is filled
;
; Read pattern back and check for errors
;
ldr r0, =MTS_ZRRIB_MSG2 ; Let user know data is being read
bl BBU_putstr ; Send string to user
ldr r6, =0x7F7F7F7F ; Load r6 with pattern
mov r4, r9 ; Set up starting address in r4
mov r5, r10 ; Put byte count into r5
bic r5, r5, #7 ; Make sure bits 2:0 are clear (8 byte increments)
11 ldr r8, [r4], #4 ; Fetch the first value
cmp r8, r6 ; Does the data match?
beq %F12 ; YES - do next test
;
; No match on 1st value - inform user
;
mov r0, r6 ; copy expected data to r0
mov r1, r4 ; Get address of failed location
mov r2, r8 ; Move actual data to r2
bl BBU_MTSP_error ; Print message
12 ldr r8, [r4], #4 ; Fetch the second value
mvn r6, r6 ; invert the compare data
cmp r8, r6 ; Does the data match?
beq %F13 ; YES - continue
;
; No match on inverted value - inform user
;
mov r0, r6 ; copy expected data to r0
mov r1, r4 ; Get address of failed location
mov r2, r8 ; Move actual data to r2
bl BBU_MTSP_error ; Print message
13 mvn r6, r6 ; Invert the data (back to original data)
mov r6, r6, ROR #1 ; Rotate data right by 1 bit
subs r5, r5, #8 ; decrement byte count
bne %B11 ; Loop until done
;
; Increment current loop counter and exit if equal to max loop count
;
ldr r5, =BBU_SMTD_CLC ; Address of current loop counter
ldr r6, [r5] ; Fetch this value
ldr r7, =BBU_SMTD_LOOP ; Address of ending loop count
ldr r8, [r7] ; Fetch this value
cmp r6, r8 ; Are the loop counts equal?
bne %F14 ; No - Skip over return
ldmfd sp!, {r0-r12, pc} ; return to caller
14 add r6, r6, #1 ; NO! - Increment current loop count ...
str r6, [r5] ; ... and save this value
b %B5 ; Run test again
;
; Text Messages for ZRRIB memory tests
;
MTS_ZRRIB_MSG1 DCB " 0x00000020 - Writing Zero Rot Right & Inv Data Pattern - Pass ",0
MTS_ZRRIB_MSG2 DCB " 0x00000020 - Reading Zero Rotate Right & Invert Byte Data Pattern",0xD,0xA,0
ALIGN 4
ENDFUNC
;
;*********************************************************************************
;
; *******************
; * *
; * bbu_MTS_ZRRIWDP * Subroutine
; * *
; *******************
;
; This subroutine performs an "Zero Rotate Right & Invert Word Data Pattern" memory test
;
; PARAMETER PASSING & REGISTER USE:
;
; R0 = used for calls to UART subroutines
; r1 - r8 = available for general use
; r9 = Starting address of memory test (DO NOT MODIFY!)
; r10 = Number of bytes to be tested (DO NOT MODIFY!)
; r11-r12 = available for general use
; r13 = Stack pointer (sp) - DO NOT MODIFY
; r14 = Link register (lr) - DO NOT MODIFY
;
bbu_MTS_ZRRIWDP FUNCTION
stmfd sp!, {r0-r12, lr} ; Save r0-r12 and link register on the stack
ldr r5, =BBU_SMTD_CLC ; Address of current loop counter
mov r6, #1 ; This is pass #1
str r6, [r5] ; Save this value
5 ldr r0, =MTS_ZRRIW_MSG1 ; Identify test to be run
bl BBU_putstr ; Send string to user
mov r0, r6 ; Get pass number
mov r1, #0 ; Supress leading zeros
bl BBU_UDecToAscii ; Send to user
bl BBU_crlf ; Output a <CR><LF>
mov r4, r9 ; Set up starting address in r4
mov r5, r10 ; Put byte count into r5
bic r5, r5, #7 ; Make sure bits 2:0 are clear (8 byte increments)
ldr r6, =0x7FFF7FFF ; Load r6 with pattern
;
; Fill memory with the test pattern
;
10 str r6, [r4], #4 ; Store first pattern
mvn r6, r6 ; Invert the data
str r6, [r4], #4 ; Store inverted pattern
mvn r6, r6 ; Invert the data (back to original data)
mov r6, r6, ROR #1 ; Rotate the data right by 1 bit
subs r5, r5, #8 ; Decrement byte count
bne %B10 ; Loop until memory is filled
;
; Read pattern back and check for errors
;
ldr r0, =MTS_ZRRIW_MSG2 ; Let user know data is being read
bl BBU_putstr ; Send string to user
ldr r6, =0x7FFF7FFF ; Load r6 with pattern
mov r4, r9 ; Set up starting address in r4
mov r5, r10 ; Put byte count into r5
bic r5, r5, #7 ; Make sure bits 2:0 are clear (8 byte increments)
11 ldr r8, [r4], #4 ; Fetch the first value
cmp r8, r6 ; Does the data match?
beq %F12 ; YES - do next test
;
; No match on 1st value - inform user
;
mov r0, r6 ; copy expected data to r0
mov r1, r4 ; Get address of failed location
mov r2, r8 ; Move actual data to r2
bl BBU_MTSP_error ; Print message
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -