2022-08-30 15:18:31 -05:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
2010-10-28 03:19:37 -05:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2010 by Spencer Oliver *
|
|
|
|
* spen@spen-soft.co.uk *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
parameters:
|
|
|
|
r0 - address in - crc out
|
|
|
|
r1 - char count
|
|
|
|
*/
|
|
|
|
|
|
|
|
.text
|
|
|
|
.syntax unified
|
2012-05-01 03:46:07 -05:00
|
|
|
.cpu cortex-m0
|
2010-10-28 03:19:37 -05:00
|
|
|
.thumb
|
|
|
|
.thumb_func
|
2012-05-01 03:46:07 -05:00
|
|
|
|
2010-10-28 03:19:37 -05:00
|
|
|
.align 2
|
|
|
|
|
|
|
|
_start:
|
2012-05-01 03:46:07 -05:00
|
|
|
main:
|
2010-10-28 03:19:37 -05:00
|
|
|
mov r2, r0
|
2012-05-01 03:46:07 -05:00
|
|
|
movs r0, #0
|
|
|
|
mvns r0, r0
|
|
|
|
ldr r6, CRC32XOR
|
2010-10-28 03:19:37 -05:00
|
|
|
mov r3, r1
|
2012-05-01 03:46:07 -05:00
|
|
|
movs r4, #0
|
2010-10-28 03:19:37 -05:00
|
|
|
b ncomp
|
|
|
|
nbyte:
|
|
|
|
ldrb r1, [r2, r4]
|
2012-05-01 03:46:07 -05:00
|
|
|
lsls r1, r1, #24
|
|
|
|
eors r0, r0, r1
|
|
|
|
movs r5, #0
|
2010-10-28 03:19:37 -05:00
|
|
|
loop:
|
|
|
|
cmp r0, #0
|
2012-05-01 03:46:07 -05:00
|
|
|
bge notset
|
|
|
|
lsls r0, r0, #1
|
|
|
|
eors r0, r0, r6
|
|
|
|
b cont
|
|
|
|
notset:
|
|
|
|
lsls r0, r0, #1
|
|
|
|
cont:
|
|
|
|
adds r5, r5, #1
|
2010-10-28 03:19:37 -05:00
|
|
|
cmp r5, #8
|
|
|
|
bne loop
|
2012-05-01 03:46:07 -05:00
|
|
|
adds r4, r4, #1
|
2010-10-28 03:19:37 -05:00
|
|
|
ncomp:
|
|
|
|
cmp r4, r3
|
|
|
|
bne nbyte
|
|
|
|
bkpt #0
|
|
|
|
|
2012-05-01 03:46:07 -05:00
|
|
|
.align 2
|
|
|
|
|
2010-10-28 03:19:37 -05:00
|
|
|
CRC32XOR: .word 0x04c11db7
|
|
|
|
|
|
|
|
.end
|