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.

task_rand.c 855B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "task_rand.h"
  2. #include "hardware_task.h"
  3. #include "data_channel.h"
  4. #include "float_word.h"
  5. #include <stdio.h>
  6. #include <system.h>
  7. #define REG_SEED_OFFSET 0
  8. #define REG_EXP_MIN_OFFSET 1
  9. #define REG_EXP_MAX_OFFSET 2
  10. rand_config RAND_CONFIG = {
  11. .base = { .name = "rand",
  12. .binding = BINDING_SW,
  13. .software = task_rand_run,
  14. .configure = task_rand_configure,
  15. .hardware = HARDWARE_TASK_2_BASE,
  16. .sources = { 0, 0 },
  17. .sink = DATA_CHANNEL_2_BASE,
  18. .cycle_count = 0 },
  19. .seed = 1.3,
  20. .abs_min = 0.125,
  21. .abs_max = 9.0 };
  22. int task_rand_configure( void * data ) {
  23. rand_config * task = ( rand_config * ) data;
  24. uint32_t base = task->base.hardware;
  25. float_word value = { .value = task->seed };
  26. hardware_task_set_config( base, REG_SEED_OFFSET, value.word );
  27. return 0;
  28. }