📄 platform.mac
字号:
;------------------------------------------------------------------------
INCLUDE platform.inc
INCLUDE regMemory.inc
;------------------------------------------------------------------------
; This macro performs initialization on the platform registers
MACRO
initPlatform $w1, $w2
; memory controller base address
ldr $w2, =MEMREGS_PHYSICAL_BASE
; initialization value for access to fpga
ldr $w1, =MSC1_INIT
; setup access to the fpga
str $w1, [$w2, #MSC1_OFFSET]
; read back the new msc1 value
ldr $w1, [$w2, #MSC1_OFFSET]
; platform registers (fpga) base address
ldr $w2, =PLATREGS_PHYSICAL_BASE
; clear PCR
mov $w1, #0
str $w1, [$w2, #OFFSET_REG_PCR]
; clear BCR
mov $w1, #0
str $w1, [$w2, #OFFSET_REG_BCR]
; clear BIPR
mov $w1, #0xff
str $w1, [$w2, #OFFSET_REG_BIPR]
mov $w1, #0xff00
str $w1, [$w2, #OFFSET_REG_BIPR]
; clear BIMR
mov $w1, #0
str $w1, [$w2, #OFFSET_REG_BIMR]
MEND
MACRO
onCPLD_LED0 $w1, $w2
ldr $w2, =PLATREGS_PHYSICAL_BASE
; read current BCR settings
ldr $w1, [$w2, #OFFSET_REG_BCR]
; set the red led bit
orr $w1, $w1, #REG_BCR_RED_LED
; write the new settings
str $w1, [$w2, #OFFSET_REG_BCR]
MEND
MACRO
onCPLD_LED1 $w1, $w2
ldr $w2, =PLATREGS_PHYSICAL_BASE
; read current BCR settings
ldr $w1, [$w2, #OFFSET_REG_BCR]
; set the red led bit
orr $w1, $w1, #REG_BCR_GREEN_LED
; write the new settings
str $w1, [$w2, #OFFSET_REG_BCR]
MEND
MACRO
offCPLD_LED0 $w1, $w2
ldr $w2, =PLATREGS_PHYSICAL_BASE
; read current BCR settings
ldr $w1, [$w2, #OFFSET_REG_BCR]
; set the red led bit
bic $w1, $w1, #REG_BCR_RED_LED
; write the new settings
str $w1, [$w2, #OFFSET_REG_BCR]
MEND
MACRO
offCPLD_LED1 $w1, $w2
ldr $w2, =PLATREGS_PHYSICAL_BASE
; read current BCR settings
ldr $w1, [$w2, #OFFSET_REG_BCR]
; set the red led bit
bic $w1, $w1, #REG_BCR_GREEN_LED
; write the new settings
str $w1, [$w2, #OFFSET_REG_BCR]
MEND
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -