platform.mac
来自「这是arm10上面的linux环境下的串口通信源程序,方便学习和调试」· MAC 代码 · 共 116 行
MAC
116 行
;------------------------------------------------------------------------
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 + =
减小字号Ctrl + -
显示快捷键?