aboutsummaryrefslogtreecommitdiffstats
path: root/usr/space_light/src/stubs/re_stubs.S
diff options
context:
space:
mode:
authorBernhard Guillon <Bernhard.Guillon@begu.org>2024-12-25 00:34:42 +0100
committerBernhard Guillon <Bernhard.Guillon@begu.org>2024-12-29 19:54:53 +0100
commit1762c56956bafd6fc0636516b494dfa935ff8aec (patch)
tree5b693c0c70400b71c982401fd9693a48991d3c23 /usr/space_light/src/stubs/re_stubs.S
parent40404fb81dfad3f5c5cf567bb053796a9135165e (diff)
downloadwb3s-ble-nebula-galaxy-1762c56956bafd6fc0636516b494dfa935ff8aec.tar.gz
wb3s-ble-nebula-galaxy-1762c56956bafd6fc0636516b494dfa935ff8aec.zip
space_light: first version
TODO: pwm initialization is currently best guess could be wrong active low|high TODO: implement pairing TODO: implement timer TODO: use the button for something TODO: implement a better client
Diffstat (limited to 'usr/space_light/src/stubs/re_stubs.S')
-rw-r--r--usr/space_light/src/stubs/re_stubs.S55
1 files changed, 55 insertions, 0 deletions
diff --git a/usr/space_light/src/stubs/re_stubs.S b/usr/space_light/src/stubs/re_stubs.S
new file mode 100644
index 0000000..774a390
--- /dev/null
+++ b/usr/space_light/src/stubs/re_stubs.S
@@ -0,0 +1,55 @@
+ .thumb
+ .globl rwble_reset
+ .thumb_func
+
+rwble_reset:
+ push {r3, r4, r5, lr}
+ bl portDISABLE_FIQ
+ add r5, r0, #0
+ bl portDISABLE_IRQ
+ movs r2, #128 // 0x80
+ add r4, r0, #0
+ ldr r3, BLE_BASETIMECNT_ADDR
+ lsl r2, r2, #24
+ str r2, [r3, #0]
+2:
+ ldr r2, [r3, #0]
+ cmp r2, #0
+ blt 2b
+ ldr r2, BLE_FINETIMECNT_ADDR
+ ldr r3, BLE_BASETIMECNT_ADDR
+ ldr r3, [r3, #0]
+ ldr r0, [r2, #0]
+ add r0, r0, r3
+ ldr r3, BLE_BDADDRL_ADDR
+ ldr r3, [r3, #0]
+ add r0, r0, r3
+ bl srand
+ bl lld_core_reset
+ movs r0, #1
+ bl lld_init
+ movs r0, #1
+ bl lld_adv_test_init
+ bl llc_reset
+ movs r0, #1
+ bl llm_init
+ bl em_buf_init
+ cmp r5, #0
+ bne 0f
+ bl portENABLE_FIQ
+0:
+ cmp r4, #0
+ bne 1f
+ bl portENABLE_IRQ
+1:
+ pop {r3, r4, r5, pc}
+
+ .balign 4
+
+BLE_BASETIMECNT_ADDR:
+ .word 0x0081001c // BLE_BASETIMECNT_ADDR
+BLE_FINETIMECNT_ADDR:
+ .word 0x00810020 // BLE_FINETIMECNT_ADDR
+BLE_BDADDRL_ADDR:
+ .word 0x00810024 // BLE_BDADDRL_ADDR
+