From 69302fa6497bfb5b5908682bba4e0d5bf7ad4c92 Mon Sep 17 00:00:00 2001 From: badenbergra78621 Date: Sat, 2 Dec 2023 23:50:26 +0100 Subject: [PATCH] crc.c Korrekturen --- software/signal_processing/crc.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/software/signal_processing/crc.c b/software/signal_processing/crc.c index 9152f38..8830ddd 100644 --- a/software/signal_processing/crc.c +++ b/software/signal_processing/crc.c @@ -1,7 +1,27 @@ #include "system/task_crc.h" #include "system/data_channel.h" #include "system/float_word.h" -#include /* c-library for crc32() */ +//#include /* c-library for crc32() */ +#include /* for "size_t" */ + + +uint32_t crc32(const char *s,size_t n) { + uint32_t crc=0xFFFFFFFF; + for(size_t i=0;i>=1; + if(b) crc=crc^0xEDB88320; + ch>>=1; + } + } + return ~crc; +} + + + int task_crc_run( void * task ) { @@ -16,9 +36,9 @@ int task_crc_run( void * task ) { for ( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i ) { - data_channel_read(crc->base.sources[0], uint32_t(&crc_input.value)); + data_channel_read(crc->base.sources[0], (uint32_t*)&crc_input.value); - crc_res.value = crc32(0, (const void*)crc_input.value, sizeof(crc_input.value)); + crc_res.word = crc32((const void *)&crc_input, sizeof(crc_input)); }