Imported Upstream version 3.2.2
[debian/gnuradio] / usrp2 / host / apps / gen_const.cc
1 #include <stdio.h>
2 #include <stdint.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5
6 int
7 main(int argc, char **argv)
8 {
9   if (argc != 3){
10     fprintf(stderr, "usage: %s i-val q-val\n", argv[0]);
11     return 1;
12   }
13
14   int i_val = strtol(argv[1], 0, 0);
15   int q_val = strtol(argv[2], 0, 0);
16
17   static const int NSAMPLES = 16384;
18
19   uint32_t      sample[NSAMPLES];
20   sample[0] = ((i_val & 0xffff) << 16) | (q_val & 0xffff);
21   for (int i = 1; i < NSAMPLES; i++)
22     sample[i] = sample[0];
23
24   while(1){
25     write(1, sample, sizeof(sample));
26   }
27 }