Studentenversion des ESY6/A Praktikums "signal_processing".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

crc.c 653B

12345678910111213141516171819202122232425262728293031
  1. #include "system/task_crc.h"
  2. #include "system/data_channel.h"
  3. #include "system/float_word.h"
  4. #include <zlib.h> /* c-library for crc32() */
  5. int task_crc_run( void * task ) {
  6. // TODO
  7. crc_config * crc = ( crc_config * ) task;
  8. uint32_t data_channel_base = crc->base.sink;
  9. data_channel_clear( data_channel_base);
  10. float_word crc_res;
  11. float_word crc_input;
  12. for ( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i )
  13. {
  14. data_channel_read(crc->base.sources[0], &crc_input.value);
  15. crc_res.value = crc32(0, (const void*)crc_input.value, sizeof(crc_input.value));
  16. }
  17. data_channel_write( data_channel_base, crc_res.word );
  18. return 0;
  19. }