32 lines
663 B
C
Raw Normal View History

2023-10-31 07:47:27 +01:00
#include "system/task_crc.h"
#include "system/data_channel.h"
#include "system/float_word.h"
2023-11-28 11:12:37 +01:00
#include <zlib.h> /* c-library for crc32() */
2023-10-31 07:47:27 +01:00
int task_crc_run( void * task ) {
// TODO
2023-11-28 11:12:37 +01:00
crc_config * crc = ( crc_config * ) task;
uint32_t data_channel_base = crc->base.sink;
data_channel_clear( data_channel_base);
float_word crc_res;
float_word crc_input;
for ( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i )
{
2023-11-28 11:18:20 +01:00
data_channel_read(crc->base.sources[0], uint32_t(&crc_input.value));
2023-11-28 11:12:37 +01:00
crc_res.value = crc32(0, (const void*)crc_input.value, sizeof(crc_input.value));
}
data_channel_write( data_channel_base, crc_res.word );
2023-10-31 07:47:27 +01:00
return 0;
}