diff options
Diffstat (limited to 'misc/crc.s')
-rw-r--r-- | misc/crc.s | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/misc/crc.s b/misc/crc.s new file mode 100644 index 0000000..03c0ce2 --- /dev/null +++ b/misc/crc.s @@ -0,0 +1,24 @@ +.syntax unified +.cpu cortex-m0plus +.thumb + +.type CRC32, %function +.global CRC32 + +// R0 = input addr +// R1 = length +CRC32: LDR R5, =0x04C11DB7 + LDR R4, =0xFFFFFFFF +10: LDR R2, [R0] + REV R2, R2; + EORS R4, R2 + MOVS R3, 32 +20: LSLS R4, 1 + BCC 30f + EORS R4, R5 +30: SUBS R3, 1 + BNE 20b + ADDS R0, 4 + SUBS R1, 1 + BNE 10b + BX LR |