From 4e5429b2839115235c7be778fe334479b833f128 Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Wed, 24 Mar 2010 11:33:02 -0400 Subject: Start renaming stuff in line with product name USRP Embedded. --- host/apps/omap_debug/usrp-e-ctl.c | 52 +++++++++++++++++++ host/apps/omap_debug/usrp-e-ram.c | 25 ++++++++++ host/apps/omap_debug/usrp-e-read.c | 18 +++++++ host/apps/omap_debug/usrp-e-rw.c | 97 ++++++++++++++++++++++++++++++++++++ host/apps/omap_debug/usrp-e-spi.c | 40 +++++++++++++++ host/apps/omap_debug/usrp-e-write.c | 21 ++++++++ host/apps/omap_debug/usrp1-e-ctl.c | 52 ------------------- host/apps/omap_debug/usrp1-e-ram.c | 25 ---------- host/apps/omap_debug/usrp1-e-read.c | 18 ------- host/apps/omap_debug/usrp1-e-rw.c | 97 ------------------------------------ host/apps/omap_debug/usrp1-e-spi.c | 40 --------------- host/apps/omap_debug/usrp1-e-write.c | 21 -------- 12 files changed, 253 insertions(+), 253 deletions(-) create mode 100644 host/apps/omap_debug/usrp-e-ctl.c create mode 100644 host/apps/omap_debug/usrp-e-ram.c create mode 100644 host/apps/omap_debug/usrp-e-read.c create mode 100644 host/apps/omap_debug/usrp-e-rw.c create mode 100644 host/apps/omap_debug/usrp-e-spi.c create mode 100644 host/apps/omap_debug/usrp-e-write.c delete mode 100644 host/apps/omap_debug/usrp1-e-ctl.c delete mode 100644 host/apps/omap_debug/usrp1-e-ram.c delete mode 100644 host/apps/omap_debug/usrp1-e-read.c delete mode 100644 host/apps/omap_debug/usrp1-e-rw.c delete mode 100644 host/apps/omap_debug/usrp1-e-spi.c delete mode 100644 host/apps/omap_debug/usrp1-e-write.c (limited to 'host/apps/omap_debug') diff --git a/host/apps/omap_debug/usrp-e-ctl.c b/host/apps/omap_debug/usrp-e-ctl.c new file mode 100644 index 000000000..045e7ce19 --- /dev/null +++ b/host/apps/omap_debug/usrp-e-ctl.c @@ -0,0 +1,52 @@ +#include +#include +#include +#include +#include + +#include "usrp1_e.h" + +// Usage: usrp1_e_ctl w|r offset number_of_values val1 val2 .... + +int main(int argc, char *argv[]) +{ + int fp, i, cnt, ret; + struct usrp1_e_ctl *ctl_data; + + if (argc < 4) { + printf("Usage: usrp1_e_ctl w|r offset number_of_values val1 val2 ....\n"); + exit(-1); + } + + cnt = atoi(argv[3]); + + ctl_data = malloc(sizeof(struct usrp1_e_ctl) + cnt*2); + + ctl_data->offset = atoi(argv[2]); + ctl_data->count = cnt; + + printf("Sizeof usrp1_e_ctl struct = %d\n", sizeof(struct usrp1_e_ctl)); + + fp = open("/dev/usrp1_e0", O_RDWR); + printf("fp = %d\n", fp); + + if (*argv[1] == 'w') { + for (i=0; ibuf[i] = atoi(argv[4+i]); + + ret = ioctl(fp, USRP1_E_WRITE_CTL, ctl_data); + printf("Return value from write ioctl = %d\n", ret); + } + + if (*argv[1] == 'r') { + ret = ioctl(fp, USRP1_E_READ_CTL, ctl_data); + printf("Return value from write ioctl = %d\n", ret); + + for (i=0; icount; i++) { + if (!(i%8)) + printf("\nData at %4d :", i); + printf(" %5d", ctl_data->buf[i]); + } + printf("\n"); + } +} diff --git a/host/apps/omap_debug/usrp-e-ram.c b/host/apps/omap_debug/usrp-e-ram.c new file mode 100644 index 000000000..d548f7ccd --- /dev/null +++ b/host/apps/omap_debug/usrp-e-ram.c @@ -0,0 +1,25 @@ +#include +#include +#include + +int main(int rgc, char *argv[]) +{ + int fp, i, cnt; + unsigned short buf[1024]; + unsigned short buf_rb[1024]; + + fp = open("/dev/usrp1_e0", O_RDWR); + printf("fp = %d\n", fp); + + for (i=0; i<1024; i++) + buf[i] = i*256; + write(fp, buf, 2048); + read(fp, buf_rb, 2048); + + printf("Read back %hX %hX\n", buf_rb[0], buf_rb[1]); + + for (i=0; i<1024; i++) { + if (buf[i] != buf_rb[i]) + printf("Read - %hX, expected - %hX\n", buf_rb[i], buf[i]); + } +} diff --git a/host/apps/omap_debug/usrp-e-read.c b/host/apps/omap_debug/usrp-e-read.c new file mode 100644 index 000000000..c28f018d5 --- /dev/null +++ b/host/apps/omap_debug/usrp-e-read.c @@ -0,0 +1,18 @@ +#include +#include +#include + +int main(int rgc, char *argv[]) +{ + int fp, cnt; + short buf[1024]; + + fp = open("/dev/usrp1_e0", O_RDONLY); + printf("fp = %d\n", fp); + + do { + cnt = read(fp, buf, 2048); +// printf("Bytes read - %d\n", cnt); + } while(1); + printf("Data - %hX\n", buf[0]); +} diff --git a/host/apps/omap_debug/usrp-e-rw.c b/host/apps/omap_debug/usrp-e-rw.c new file mode 100644 index 000000000..cd7fbe4dd --- /dev/null +++ b/host/apps/omap_debug/usrp-e-rw.c @@ -0,0 +1,97 @@ +#include +#include +#include +#include +#include + +struct pkt { + int checksum; + int seq_num; + short data[1020]; +}; + +static int fp; + +static int calc_checksum(struct pkt *p) +{ + int i, sum; + + i = 0; + sum = 0; + + for (i=0; i<1020; i++) + sum += p->data[i]; + + sum += p->seq_num; + + return sum; +} + +static void *read_thread(void *threadid) +{ + int cnt, prev_seq_num; + struct pkt rx_data; + + printf("Greetings from the reading thread!\n"); + + prev_seq_num = 0; + + while (1) { + cnt = read(fp, &rx_data, 2048); + + if (rx_data.seq_num != prev_seq_num + 1) + printf("Sequence number fail, current = %d, previous = %d\n", + rx_data.seq_num, prev_seq_num); + prev_seq_num = rx_data.seq_num; + + if (calc_checksum(&rx_data) != rx_data.checksum) + printf("Checksum fail packet = %d, expected = %d\n", + calc_checksum(&rx_data), rx_data.checksum); + } + +} + +static void *write_thread(void *threadid) +{ + int seq_number, i, cnt; + struct pkt tx_data; + + printf("Greetings from the write thread!\n"); + + for (i=0; i<1020; i++) + tx_data.data[i] = random() >> 16; + + + seq_number = 1; + + while (1) { + tx_data.seq_num = seq_number++; + tx_data.checksum = calc_checksum(&tx_data); + cnt = write(fp, &tx_data, 2048); + } +} + + +int main(int argc, char *argv[]) +{ + int ret; + pthread_t tx, rx; + long int t; + + fp = open("/dev/usrp1_e0", O_RDWR); + printf("fp = %d\n", fp); + + if (pthread_create(&rx, NULL, read_thread, (void *) t)) { + printf("Failed to create rx thread\n"); + exit(-1); + } + + if (pthread_create(&tx, NULL, write_thread, (void *) t)) { + printf("Failed to create tx thread\n"); + exit(-1); + } + + sleep(10000); + + printf("Done sleeping\n"); +} diff --git a/host/apps/omap_debug/usrp-e-spi.c b/host/apps/omap_debug/usrp-e-spi.c new file mode 100644 index 000000000..a79d74b18 --- /dev/null +++ b/host/apps/omap_debug/usrp-e-spi.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include + +#include "usrp1_e.h" + +// Usage: usrp1_e_spi w|rb slave data + +int main(int argc, char *argv[]) +{ + int fp, slave, data, ret; + struct usrp_e_spi spi_dat; + + if (argc < 4) { + printf("Usage: usrp1_e_spi w|rb slave data\n"); + exit(-1); + } + + slave = atoi(argv[2]); + data = atoi(argv[3]); + + fp = open("/dev/usrp1_e0", O_RDWR); + printf("fp = %d\n", fp); + + spi_dat.slave = slave; + spi_dat.data = data; + spi_dat.length = 2; + spi_dat.flags = 0; + + if (*argv[1] == 'r') { + spi_dat.readback = 1; + ret = ioctl(fp, USRP_E_SPI, &spi_dat); + printf("Data returned = %d\n", ret); + } else { + spi_dat.readback = 0; + ioctl(fp, USRP_E_SPI, &spi_dat); + } +} diff --git a/host/apps/omap_debug/usrp-e-write.c b/host/apps/omap_debug/usrp-e-write.c new file mode 100644 index 000000000..903c0071f --- /dev/null +++ b/host/apps/omap_debug/usrp-e-write.c @@ -0,0 +1,21 @@ +#include +#include +#include + +int main(int rgc, char *argv[]) +{ + int fp, i, cnt; + short buf[1024]; + + fp = open("/dev/usrp1_e0", O_WRONLY); + printf("fp = %d\n", fp); + + for (i=0; i<1024; i++) { + buf[i] = i; + } + +// do { + cnt = write(fp, buf, 2048); + printf("Bytes written - %d\n", cnt); +// } while (1); +} diff --git a/host/apps/omap_debug/usrp1-e-ctl.c b/host/apps/omap_debug/usrp1-e-ctl.c deleted file mode 100644 index 045e7ce19..000000000 --- a/host/apps/omap_debug/usrp1-e-ctl.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include - -#include "usrp1_e.h" - -// Usage: usrp1_e_ctl w|r offset number_of_values val1 val2 .... - -int main(int argc, char *argv[]) -{ - int fp, i, cnt, ret; - struct usrp1_e_ctl *ctl_data; - - if (argc < 4) { - printf("Usage: usrp1_e_ctl w|r offset number_of_values val1 val2 ....\n"); - exit(-1); - } - - cnt = atoi(argv[3]); - - ctl_data = malloc(sizeof(struct usrp1_e_ctl) + cnt*2); - - ctl_data->offset = atoi(argv[2]); - ctl_data->count = cnt; - - printf("Sizeof usrp1_e_ctl struct = %d\n", sizeof(struct usrp1_e_ctl)); - - fp = open("/dev/usrp1_e0", O_RDWR); - printf("fp = %d\n", fp); - - if (*argv[1] == 'w') { - for (i=0; ibuf[i] = atoi(argv[4+i]); - - ret = ioctl(fp, USRP1_E_WRITE_CTL, ctl_data); - printf("Return value from write ioctl = %d\n", ret); - } - - if (*argv[1] == 'r') { - ret = ioctl(fp, USRP1_E_READ_CTL, ctl_data); - printf("Return value from write ioctl = %d\n", ret); - - for (i=0; icount; i++) { - if (!(i%8)) - printf("\nData at %4d :", i); - printf(" %5d", ctl_data->buf[i]); - } - printf("\n"); - } -} diff --git a/host/apps/omap_debug/usrp1-e-ram.c b/host/apps/omap_debug/usrp1-e-ram.c deleted file mode 100644 index d548f7ccd..000000000 --- a/host/apps/omap_debug/usrp1-e-ram.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include - -int main(int rgc, char *argv[]) -{ - int fp, i, cnt; - unsigned short buf[1024]; - unsigned short buf_rb[1024]; - - fp = open("/dev/usrp1_e0", O_RDWR); - printf("fp = %d\n", fp); - - for (i=0; i<1024; i++) - buf[i] = i*256; - write(fp, buf, 2048); - read(fp, buf_rb, 2048); - - printf("Read back %hX %hX\n", buf_rb[0], buf_rb[1]); - - for (i=0; i<1024; i++) { - if (buf[i] != buf_rb[i]) - printf("Read - %hX, expected - %hX\n", buf_rb[i], buf[i]); - } -} diff --git a/host/apps/omap_debug/usrp1-e-read.c b/host/apps/omap_debug/usrp1-e-read.c deleted file mode 100644 index c28f018d5..000000000 --- a/host/apps/omap_debug/usrp1-e-read.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include - -int main(int rgc, char *argv[]) -{ - int fp, cnt; - short buf[1024]; - - fp = open("/dev/usrp1_e0", O_RDONLY); - printf("fp = %d\n", fp); - - do { - cnt = read(fp, buf, 2048); -// printf("Bytes read - %d\n", cnt); - } while(1); - printf("Data - %hX\n", buf[0]); -} diff --git a/host/apps/omap_debug/usrp1-e-rw.c b/host/apps/omap_debug/usrp1-e-rw.c deleted file mode 100644 index cd7fbe4dd..000000000 --- a/host/apps/omap_debug/usrp1-e-rw.c +++ /dev/null @@ -1,97 +0,0 @@ -#include -#include -#include -#include -#include - -struct pkt { - int checksum; - int seq_num; - short data[1020]; -}; - -static int fp; - -static int calc_checksum(struct pkt *p) -{ - int i, sum; - - i = 0; - sum = 0; - - for (i=0; i<1020; i++) - sum += p->data[i]; - - sum += p->seq_num; - - return sum; -} - -static void *read_thread(void *threadid) -{ - int cnt, prev_seq_num; - struct pkt rx_data; - - printf("Greetings from the reading thread!\n"); - - prev_seq_num = 0; - - while (1) { - cnt = read(fp, &rx_data, 2048); - - if (rx_data.seq_num != prev_seq_num + 1) - printf("Sequence number fail, current = %d, previous = %d\n", - rx_data.seq_num, prev_seq_num); - prev_seq_num = rx_data.seq_num; - - if (calc_checksum(&rx_data) != rx_data.checksum) - printf("Checksum fail packet = %d, expected = %d\n", - calc_checksum(&rx_data), rx_data.checksum); - } - -} - -static void *write_thread(void *threadid) -{ - int seq_number, i, cnt; - struct pkt tx_data; - - printf("Greetings from the write thread!\n"); - - for (i=0; i<1020; i++) - tx_data.data[i] = random() >> 16; - - - seq_number = 1; - - while (1) { - tx_data.seq_num = seq_number++; - tx_data.checksum = calc_checksum(&tx_data); - cnt = write(fp, &tx_data, 2048); - } -} - - -int main(int argc, char *argv[]) -{ - int ret; - pthread_t tx, rx; - long int t; - - fp = open("/dev/usrp1_e0", O_RDWR); - printf("fp = %d\n", fp); - - if (pthread_create(&rx, NULL, read_thread, (void *) t)) { - printf("Failed to create rx thread\n"); - exit(-1); - } - - if (pthread_create(&tx, NULL, write_thread, (void *) t)) { - printf("Failed to create tx thread\n"); - exit(-1); - } - - sleep(10000); - - printf("Done sleeping\n"); -} diff --git a/host/apps/omap_debug/usrp1-e-spi.c b/host/apps/omap_debug/usrp1-e-spi.c deleted file mode 100644 index a79d74b18..000000000 --- a/host/apps/omap_debug/usrp1-e-spi.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include -#include -#include - -#include "usrp1_e.h" - -// Usage: usrp1_e_spi w|rb slave data - -int main(int argc, char *argv[]) -{ - int fp, slave, data, ret; - struct usrp_e_spi spi_dat; - - if (argc < 4) { - printf("Usage: usrp1_e_spi w|rb slave data\n"); - exit(-1); - } - - slave = atoi(argv[2]); - data = atoi(argv[3]); - - fp = open("/dev/usrp1_e0", O_RDWR); - printf("fp = %d\n", fp); - - spi_dat.slave = slave; - spi_dat.data = data; - spi_dat.length = 2; - spi_dat.flags = 0; - - if (*argv[1] == 'r') { - spi_dat.readback = 1; - ret = ioctl(fp, USRP_E_SPI, &spi_dat); - printf("Data returned = %d\n", ret); - } else { - spi_dat.readback = 0; - ioctl(fp, USRP_E_SPI, &spi_dat); - } -} diff --git a/host/apps/omap_debug/usrp1-e-write.c b/host/apps/omap_debug/usrp1-e-write.c deleted file mode 100644 index 903c0071f..000000000 --- a/host/apps/omap_debug/usrp1-e-write.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -int main(int rgc, char *argv[]) -{ - int fp, i, cnt; - short buf[1024]; - - fp = open("/dev/usrp1_e0", O_WRONLY); - printf("fp = %d\n", fp); - - for (i=0; i<1024; i++) { - buf[i] = i; - } - -// do { - cnt = write(fp, buf, 2048); - printf("Bytes written - %d\n", cnt); -// } while (1); -} -- cgit v1.2.3