Calculate/check USB crc16

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
zoran4afc
Newbie
Posts: 1
Joined: Wed Jul 12, 2017 3:44 pm

Calculate/check USB crc16

Postby zoran4afc » Wed Jul 12, 2017 4:00 pm

Hello,

I am trying to create assembler code to calculate USB crc16.
My problem is that I don't understand how to properly call assembler crc8 instructions in chain.

My try:

ldc r7, 0x8408 // polynomial x16+x12+x5+x0 bit reversed
ldc r3, 0xffff // initial value
ldc r5, 0

crc8 r3, r4, r3, r7 // ???

zhcrc16_loop1:
bf r1, zhcrc16_loop2 // loop

ld8u r3, r0[r5] // take the next byte
add r0, r0, 1 // increment pointer

crc8 r3, r4, r3, r7 // ???

sub r1, r1, 1 // decrement length
bu zhcrc16_loop1 // loop again

zhcrc16_loop2:
ldc r0, 0xffff
and r0, r3, r0 // result crc16 value in r0


Thanks for looking into it.

Return to “Applications”

Who is online

Users browsing this forum: No registered users and 3 guests