summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2019-03-24 08:55:28 +0000
committerKarl Palsson <karlp@tweak.net.au>2019-03-24 08:55:28 +0000
commit0f23dacaef1fcd52573805a1ace817066a4ede93 (patch)
tree7c957b6bca640542ec29d0a2d405a57d6a9c2bfa
parentd1bb072d2be13506012b589b2d0db8e108ce621e (diff)
downloadledcontrol-0f23dacaef1fcd52573805a1ace817066a4ede93.tar
ledcontrol-0f23dacaef1fcd52573805a1ace817066a4ede93.tar.zst
ledcontrol-0f23dacaef1fcd52573805a1ace817066a4ede93.zip
add missing asm demo files.
that was lame, sorry about that.
-rw-r--r--my-common-code/api-asm.S19
-rw-r--r--my-common-code/api-asm.h7
2 files changed, 26 insertions, 0 deletions
diff --git a/my-common-code/api-asm.S b/my-common-code/api-asm.S
new file mode 100644
index 0000000..93419fd
--- /dev/null
+++ b/my-common-code/api-asm.S
@@ -0,0 +1,19 @@
+/*
+ * Example of a pure assembly file
+ * For most people, this is normally unnecessary, you can use inline
+ * ASM in a C file, if you even need to use ASM at all.
+ * However, if you reallllly like doing this sort of thing, here's how :)
+ */
+
+.syntax unified
+.thumb
+.section .text
+
+#include <libopencm3/stm32/gpio.h>
+
+.global rev_bytes
+.func rev_bytes /* only used for debugger */
+.type rev_bytes, STT_FUNC
+rev_bytes:
+ rev r0, r0
+ bx lr
diff --git a/my-common-code/api-asm.h b/my-common-code/api-asm.h
new file mode 100644
index 0000000..b153620
--- /dev/null
+++ b/my-common-code/api-asm.h
@@ -0,0 +1,7 @@
+#include <stdint.h>
+/**
+ * Reverse bytes in words
+ * @param in word in form abcd
+ * @returns word in form dcba
+ */
+uint32_t rev_bytes(uint32_t in);