Loesung des Praktikums Systementwurf - Bjarne Hoesch - Bernhard Schoeffel
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 508B

123456789101112131415161718192021
  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* taskConfig = (add_config*) task;
  6. for(uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i) {
  7. float chnl1, chnl2;
  8. data_channel_read(taskConfig->sources[0], (uint32_t*) &chnl1);
  9. data_channel_read(taskConfig->sources[1], (uint32_t*) &chnl2);
  10. float_word result;
  11. result.value = chnl1 + chnl2;
  12. data_channel_write(taskConfig->sink, result.word);
  13. }
  14. return 0;
  15. }