diff options
Diffstat (limited to 'software/first/setup_gpio.S')
-rw-r--r-- | software/first/setup_gpio.S | 19 |
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 |