"It works for me"
--- /home/ldoolitt/cvs/usrp/host/apps/test_usrp_standard_rx.cc 2005-09-08 08:34:57.000000000 -0700 +++ test_usrp_standard_rx.cc 2005-09-09 09:23:35.000000000 -0700 @@ -38,7 +38,7 @@ char *prog_name; -static bool test_input (usrp_standard_rx *urx, bool forever_p, FILE *fp); +static bool test_input (usrp_standard_rx *urx, int max_bytes, FILE *fp); static void set_progname (char *path) @@ -55,6 +55,7 @@ { fprintf (stderr, "usage: %s [-f] [-v] [-l] [-c] [-D <decim>] [-F freq] [-o output_file]\n", prog_name); fprintf (stderr, " [-f] loop forever\n"); + fprintf (stderr, " [-M] how many Megabytes to transfer (default 128)\n"); fprintf (stderr, " [-v] verbose\n"); fprintf (stderr, " [-l] digital loopback in FPGA\n"); fprintf (stderr, " [-c] counting in FPGA\n"); @@ -72,9 +73,9 @@ main (int argc, char **argv) { bool verbose_p = false; - bool forever_p = false; bool loopback_p = false; bool counting_p = false; + int max_bytes = 128 * (1L << 20); int ch; char *output_filename = 0; int which_board = 0; @@ -83,10 +84,10 @@ set_progname (argv[0]); - while ((ch = getopt (argc, argv, "fvlco:D:F:")) != EOF){ + while ((ch = getopt (argc, argv, "fvlco:D:F:M:")) != EOF){ switch (ch){ case 'f': - forever_p = true; + max_bytes = 0; break; case 'v': @@ -113,6 +114,11 @@ center_freq = strtod (optarg, 0); break; + case 'M': + max_bytes = strtol (optarg, 0, 0) * (1L << 20); + if (max_bytes < 0) max_bytes = 0; + break; + default: usage (); } @@ -143,7 +149,7 @@ urx->start(); // start data xfers - test_input (urx, forever_p, fp); + test_input (urx, max_bytes, fp); if (fp) fclose (fp); @@ -155,15 +161,13 @@ static bool -test_input (usrp_standard_rx *urx, bool forever_p, FILE *fp) +test_input (usrp_standard_rx *urx, int max_bytes, FILE *fp) { int fd = -1; static const int BUFSIZE = urx->block_size(); static const int N = BUFSIZE/sizeof (short); short buf[N]; int nbytes = 0; - // int max_bytes = 512 * (1L << 20); - int max_bytes = 128 * (1L << 20); double start_wall_time = get_elapsed_time (); double start_cpu_time = get_cpu_usage (); @@ -174,9 +178,9 @@ bool overrun; int noverruns = 0; - for (nbytes = 0; forever_p || nbytes < max_bytes; nbytes += BUFSIZE){ + for (nbytes = 0; max_bytes == 0 || nbytes < max_bytes; nbytes += BUFSIZE){ - int ret = urx->read (buf, sizeof (buf), &overrun); + unsigned int ret = urx->read (buf, sizeof (buf), &overrun); if (ret != sizeof (buf)){ fprintf (stderr, "test_input: error, ret = %d\n", ret); }
signature.asc
Description: Digital signature
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio