Last active
August 11, 2020 07:03
-
-
Save jonasdn/2507cc5b11588e2b11508f0adfa0e5ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.section .text | |
.equ GPIO_BASE, 0x10012000 # Memory address of FE310-G002 GPIO | |
.equ GPIO_RED, 0x400000 # (00000000010000000000000000000000) | |
.global init_led | |
init_led: | |
li t0, GPIO_BASE # li: load the constant GPIO_BASE into t0 | |
li t1, GPIO_RED # Load the constant GPIO_RED into t1 | |
sw t1, 0x08(t0) # To enable GPIO_RED we write a 32bit word with | |
# the 22bit set to offset 0x08 (output_en) | |
sw t1, 0x40(t0) # We make the GPIO "active high", by writing | |
# to offset 0x40 (out_xor) | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment