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.

add.c 630B

12345678910111213141516171819202122232425
  1. #include "system/task_add.h"
  2. #include "system/data_channel.h"
  3. #include "system/float_word.h"
  4. int task_add_run( void * task ) {
  5. add_config * addiere = ( add_config * ) task;
  6. uint32_t data_channel_base = addiere->sink;
  7. data_channel_clear( data_channel_base );
  8. for ( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i )
  9. {
  10. float_word res;
  11. float_word sin_val;
  12. float_word cos_val;
  13. data_channel_read(addiere->sources[0], &sin_val.value);
  14. data_channel_read(addiere->sources[1], &cos_val.value);
  15. res.value = sin_val.value + cos_val.value;
  16. data_channel_write( data_channel_base, res.word );
  17. }
  18. return 0;
  19. }