aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/heptagon_radio_transmitter/_main.c
blob: 635d660f4dca352c3d6107c67120285c43787a90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* --- Generated the 13/5/2019 at 10:21 --- */
/* --- heptagon compiler, version 1.05.00 (compiled mon. may. 13 10:18:8 CET 2019) --- */
/* --- Command line: /local/STATOR/packages/opam-root/4.07.1/bin/heptc -target c -hepts -s main -target ctrln radiotrans.ept --- */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "_main.h"
#include "../clock.h"
#include "../dm_random.c"

static inline int get_bool(void) {
  return dm_random_uint32() & 1;
}

Radiotrans__main_mem mem;
int main(int argc, char** argv) {
  int step_c;
  int step_max;
  int enter_tx;
  int enter_rx;
  int exit_rx;
  int calibrate;
  int sleep;
  int wake_up;
  int irq_tx_done;
  int irq_on_packet;
  int irq_end_of_packet;
  int irq_end_of_calibration;
  int irq_fifo_threshold;
  int adc_on;
  int adc_off;
  Radiotrans__main_out _res;
  step_c = 0;
  step_max = 1000;
  if ((argc==2)) {
    step_max = atoi(argv[1]);
  };

  clock_prepare();
  clock_start();
  Radiotrans__main_reset(&mem);
  while ((!(step_max)||(step_c<step_max))) {
    step_c = (step_c+1);

    enter_tx = get_bool();
    enter_rx = get_bool();
    exit_rx = get_bool();
    calibrate = get_bool();
    sleep = get_bool();
    wake_up = get_bool();
    irq_tx_done = get_bool();
    irq_on_packet = get_bool();
    irq_end_of_packet = get_bool();
    irq_end_of_calibration = get_bool();
    irq_fifo_threshold = get_bool();
    adc_on = get_bool();
    adc_off = get_bool();
    
    Radiotrans__main_step(enter_tx, enter_rx, exit_rx, calibrate, sleep,
                          wake_up, irq_tx_done, irq_on_packet,
                          irq_end_of_packet, irq_end_of_calibration,
                          irq_fifo_threshold, adc_on, adc_off, &_res, &mem);
#if 0
    printf("%d\n", _res.a_on);
    printf("%d\n", _res.red);
    fflush(stdout);
#endif
  };
  clock_stop();
  print_total_clock();
  return 0;
}