📄 bbu_mem_tests.s
字号:
; 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_ORLIWDP 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_ORLIW_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, =0x00010001 ; 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 #31 ; Rotate the data left 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_ORLIW_MSG2 ; Let user know data is being read
bl BBU_putstr ; Send string to user
ldr r6, =0x00010001 ; 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 #31 ; Rotate data left 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 the 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 ORLIW memory tests
;
MTS_ORLIW_MSG1 DCB " 0x00000200 - Writing One Rot Left & Invert Data Pattern - Pass ",0
MTS_ORLIW_MSG2 DCB " 0x00000200 - Reading One Rotate Left & Invert Word Data Pattern",0xD,0xA,0
ALIGN 4
ENDFUNC
;
;*********************************************************************************
;
; *******************
; * *
; * bbu_MTS_ORLIDDP * Subroutine
; * *
; *******************
;
; This subroutine performs an "One Rotate Left & Invert DoubleWord 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_ORLIDDP 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_ORLID_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, =0x00000001 ; 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 #31 ; Rotate the data left 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_ORLID_MSG2 ; Let user know data is being read
bl BBU_putstr ; Send string to user
ldr r6, =0x00000001 ; 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 #31 ; Rotate data left 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 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 ORLID memory tests
;
MTS_ORLID_MSG1 DCB " 0x00000400 - Writing One Rot Left & Invert Data Pattern - Pass ",0
MTS_ORLID_MSG2 DCB " 0x00000400 - Reading One Rotate Left & Invert DoubleWord Data Pattern",0xD,0xA,0
ALIGN 4
ENDFUNC
;
;*********************************************************************************
;
; ******************
; * *
; * bbu_MTS_ZRRBDP * Subroutine
; * *
; ******************
;
; This subroutine performs an "Zero Rotate Right 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_ZRRBDP 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_ZRRB_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, #3 ; Make sure bits 1:0 are clear (4 byte increments)
ldr r6, =0x7F7F7F7F ; Load r6 with pattern
;
; Fill memory with the test pattern
;
10 str r6, [r4], #4 ; Store pattern
mov r6, r6, ROR #1 ; Rotate the data right by 1 bit
subs r5, r5, #4 ; Decrement byte count
bne %B10 ; Loop until memory is filled
;
; Read pattern back and check for errors
;
ldr r0, =MTS_ZRRB_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, #3 ; Make sure bits 1:0 are clear (4 byte increments)
11 ldr r8, [r4], #4 ; Fetch the 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 mov r6, r6, ROR #1 ; Rotate data right by 1 bit
subs r5, r5, #4 ; 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,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -