summaryrefslogtreecommitdiff
path: root/software/first/setup_gpio.S
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2019-07-22 23:04:17 +0200
committerSilvan Jegen <s.jegen@gmail.com>2019-07-22 23:04:17 +0200
commitf5e284223d25ee5beab98de95cd74e3ac72a39a6 (patch)
tree33d6b2b3a0e5fa5b1d0b3094108bac78bd84bda0 /software/first/setup_gpio.S
parent4bc2e5141c68e82f2f6d7c8f71051fe93dd96d18 (diff)
Implement first superblink version
Diffstat (limited to 'software/first/setup_gpio.S')
-rw-r--r--software/first/setup_gpio.S19
1 files changed, 19 insertions, 0 deletions
diff --git a/software/first/setup_gpio.S b/software/first/setup_gpio.S
new file mode 100644
index 0000000..39003b4
--- /dev/null
+++ b/software/first/setup_gpio.S
@@ -0,0 +1,19 @@
+.section .text
+.align 2
+.global setup_GPIO
+.include "memory_map.inc"
+.include "gpio.inc"
+
+setup_GPIO:
+ addi sp, sp, -16 # Allocate stack frame
+ sw ra, 12(sp) # save return address to the stack
+
+ li t0, GPIO_CTRL_ADDR # load base GPIO address
+ li t1, GPIO_RGB_PINS # get RGB offsets
+ sw t1, GPIO_OUTPUT_EN(t0) # enable output on the RGB pins
+ sw t1, GPIO_OUTPUT_XOR(t0) # set the RGB pins to active high
+ sw x0, GPIO_OUTPUT_VAL(t0) # set all pins to 0
+
+ lw ra, 12(sp) # load return address
+ addi sp, sp, 16 # deallocate stack frame
+ ret