44 lines
912 B
Plaintext
44 lines
912 B
Plaintext
(config! {:address 0x8000})
|
|
(const! mmio-base 0x3f000000)
|
|
(label! :boot)
|
|
(move sp :boot)
|
|
|
|
; shut down cores 1-3
|
|
(move-to-coprocessor {:processor 15
|
|
:operations [0 5]
|
|
:source-register (r 5)
|
|
:dest-registers [(c 0) (c 0)]})
|
|
|
|
(and (r 5) (r 5) 3)
|
|
(cmp (r 5) 0)
|
|
(branch {:cond :not-equal} :halt)
|
|
|
|
;; set r3 to gpio base
|
|
(move (r 3) :mmio-base)
|
|
(or (r 3) (r 3) 0x200000)
|
|
|
|
;; set r4 to uart-base
|
|
(or (r 4) (r 4) 0x1000)
|
|
|
|
;; disable uart 0
|
|
(or (r 5) (r 4) 0x30)
|
|
(store (r 5) 0)
|
|
|
|
;;; see https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
|
|
;;; pages 100 and following
|
|
|
|
;; disable pull-up/pull down
|
|
(or (r 5) (r 3) 0x94)
|
|
(store (r 5) 0)
|
|
;; delay for 150 cycles
|
|
(move (r 0) 150)
|
|
(branch-link :delay)
|
|
|
|
(label! end)
|
|
(branch :end)
|
|
|
|
(label! delay)
|
|
(subtract {:flags true} (r 0) 1)
|
|
(branch {:cond :not-equal} #delay)
|
|
(branch-exchange lr)
|