aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Balister <philip@opensdr.com>2010-05-28 11:26:40 +0000
committerPhilip Balister <philip@opensdr.com>2010-06-13 19:24:15 +0000
commit8869208ea8d8dfdd5fe86adc1637b93c4b390c0c (patch)
treea4346650facae73a1ad3755e609e4c31c44273df
parent71783634c4394e739bbc13a9bb3df7d6ab75c147 (diff)
downloaduhd-8869208ea8d8dfdd5fe86adc1637b93c4b390c0c.tar.gz
uhd-8869208ea8d8dfdd5fe86adc1637b93c4b390c0c.tar.bz2
uhd-8869208ea8d8dfdd5fe86adc1637b93c4b390c0c.zip
Update usrp_e.h file. Change programs to use struct element status instead of flags.
-rw-r--r--host/apps/omap_debug/usrp-e-crc-rw.c15
-rw-r--r--host/apps/omap_debug/usrp-e-lb-test.c2
-rw-r--r--host/apps/omap_debug/usrp-e-loopback.c6
-rw-r--r--host/apps/omap_debug/usrp-e-rw-random.c4
-rw-r--r--host/apps/omap_debug/usrp-e-timed.c6
-rw-r--r--host/apps/omap_debug/usrp_e.h16
6 files changed, 29 insertions, 20 deletions
diff --git a/host/apps/omap_debug/usrp-e-crc-rw.c b/host/apps/omap_debug/usrp-e-crc-rw.c
index 8883366ae..c3ae45cc1 100644
--- a/host/apps/omap_debug/usrp-e-crc-rw.c
+++ b/host/apps/omap_debug/usrp-e-crc-rw.c
@@ -81,13 +81,20 @@ static void *read_thread(void *threadid)
}
#endif
- if (rx_data->flags & RB_OVERRUN)
+ if (rx_data->status & RB_OVERRUN)
printf("O");
-
+
+ printf("rx_data->len = %d\n", rx_data->len);
+
+
crc = 0xFFFFFFFF;
- for (i = 0; i < rx_data->len - 4; i++) {
+ for (i = 0; i < rx_data->len - 4; i+=2) {
+ crc = ((crc >> 8) & 0x00FFFFFF) ^
+ crc_tab[(crc ^ rx_data->buf[i+1]) & 0xFF];
+printf("idx = %d, data = %X, crc = %X\n", i, rx_data->buf[i+1],crc);
crc = ((crc >> 8) & 0x00FFFFFF) ^
crc_tab[(crc ^ rx_data->buf[i]) & 0xFF];
+printf("idx = %d, data = %X, crc = %X\n", i, rx_data->buf[i],crc);
}
p = &rx_data->buf[rx_data->len - 4];
@@ -96,7 +103,7 @@ static void *read_thread(void *threadid)
#if 1
printf("rx_data->len = %d\n", rx_data->len);
- printf("rx_data->flags = %d\n", rx_data->flags);
+ printf("rx_data->status = %d\n", rx_data->status);
for (i = 0; i < rx_data->len; i++)
printf("idx = %d, data = %X\n", i, rx_data->buf[i]);
printf("calc crc = %lX, rx crc = %X\n", crc, rx_crc);
diff --git a/host/apps/omap_debug/usrp-e-lb-test.c b/host/apps/omap_debug/usrp-e-lb-test.c
index 675de8622..68848064e 100644
--- a/host/apps/omap_debug/usrp-e-lb-test.c
+++ b/host/apps/omap_debug/usrp-e-lb-test.c
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
tx_data = malloc(2048);
rx_data = malloc(2048);
- tx_data->flags = 0;
+ tx_data->status = 0;
tx_data->len = sizeof(struct usrp_transfer_frame) + packet_data_length;
while (1) {
diff --git a/host/apps/omap_debug/usrp-e-loopback.c b/host/apps/omap_debug/usrp-e-loopback.c
index 177394947..535ce1025 100644
--- a/host/apps/omap_debug/usrp-e-loopback.c
+++ b/host/apps/omap_debug/usrp-e-loopback.c
@@ -63,7 +63,7 @@ static void *read_thread(void *threadid)
if (cnt < 0)
printf("Error returned from read: %d\n", cnt);
-// printf("Packet received, flags = %X, len = %d\n", rx_data->flags, rx_data->len);
+// printf("Packet received, status = %X, len = %d\n", rx_data->status, rx_data->len);
// printf("p->seq_num = %d\n", p->seq_num);
@@ -119,7 +119,7 @@ static void *write_thread(void *threadid)
// p->data[i] = random() >> 16;
p->data[i] = i;
- tx_data->flags = 0xdeadbeef;
+ tx_data->status = 0xdeadbeef;
tx_data->len = 8 + packet_data_length * 2;
printf("tx_data->len = %d\n", tx_data->len);
@@ -127,7 +127,7 @@ static void *write_thread(void *threadid)
seq_number = 1;
while (1) {
-// printf("tx flags = %X, len = %d\n", tx_data->flags, tx_data->len);
+// printf("tx status = %X, len = %d\n", tx_data->status, tx_data->len);
p->seq_num = seq_number++;
p->checksum = calc_checksum(p);
cnt = write(fp, tx_data, 2048);
diff --git a/host/apps/omap_debug/usrp-e-rw-random.c b/host/apps/omap_debug/usrp-e-rw-random.c
index 43f1571cb..5960b8fbd 100644
--- a/host/apps/omap_debug/usrp-e-rw-random.c
+++ b/host/apps/omap_debug/usrp-e-rw-random.c
@@ -65,7 +65,7 @@ static void *read_thread(void *threadid)
while (1) {
cnt = read(fp, rx_data, 2048);
-// printf("Packet received, flags = %X, len = %d\n", rx_data->flags, rx_data->len);
+// printf("Packet received, status = %X, len = %d\n", rx_data->status, rx_data->len);
// printf("p->seq_num = %d\n", p->seq_num);
if (p->seq_num != prev_seq_num + 1)
@@ -102,7 +102,7 @@ static void *write_thread(void *threadid)
// p->data[i] = random() >> 16;
p->data[i] = i;
- tx_data->flags = 0xdeadbeef;
+ tx_data->status = 0xdeadbeef;
tx_data->len = 8 + packet_data_length * 2;
printf("tx_data->len = %d\n", tx_data->len);
diff --git a/host/apps/omap_debug/usrp-e-timed.c b/host/apps/omap_debug/usrp-e-timed.c
index c71651741..3cb33ce2d 100644
--- a/host/apps/omap_debug/usrp-e-timed.c
+++ b/host/apps/omap_debug/usrp-e-timed.c
@@ -75,7 +75,7 @@ static void *read_thread(void *threadid)
}
#endif
- if (rx_data->flags & RB_OVERRUN)
+ if (rx_data->status & RB_OVERRUN)
printf("O");
bytes_transfered += rx_data->len;
@@ -118,7 +118,7 @@ static void *write_thread(void *threadid)
// p->data[i] = random() >> 16;
p->data[i] = i;
- tx_data->flags = 0;
+ tx_data->status = 0;
tx_data->len = 8 + packet_data_length * 2;
printf("tx_data->len = %d\n", tx_data->len);
@@ -146,7 +146,7 @@ static void *write_thread(void *threadid)
}
#endif
-// printf("tx flags = %X, len = %d\n", tx_data->flags, tx_data->len);
+// printf("tx status = %X, len = %d\n", tx_data->status, tx_data->len);
p->seq_num = seq_number++;
p->checksum = calc_checksum(p);
cnt = write(fp, tx_data, 2048);
diff --git a/host/apps/omap_debug/usrp_e.h b/host/apps/omap_debug/usrp_e.h
index fd74e6e9e..b098ad114 100644
--- a/host/apps/omap_debug/usrp_e.h
+++ b/host/apps/omap_debug/usrp_e.h
@@ -28,14 +28,14 @@ struct usrp_e_ctl32 {
__u32 buf[10];
};
-// SPI interface
+/* SPI interface */
#define UE_SPI_TXONLY 0
#define UE_SPI_TXRX 1
-// Defines for spi ctrl register
-#define UE_SPI_CTRL_TXNEG (1<<10)
-#define UE_SPI_CTRL_RXNEG (1<<9)
+/* Defines for spi ctrl register */
+#define UE_SPI_CTRL_TXNEG (1 << 10)
+#define UE_SPI_CTRL_RXNEG (1 << 9)
#define UE_SPI_PUSH_RISE 0
#define UE_SPI_PUSH_FALL UE_SPI_CTRL_TXNEG
@@ -65,20 +65,22 @@ struct usrp_e_i2c {
#define USRP_E_I2C_READ _IOWR(USRP_E_IOC_MAGIC, 0x25, struct usrp_e_i2c)
#define USRP_E_I2C_WRITE _IOW(USRP_E_IOC_MAGIC, 0x26, struct usrp_e_i2c)
-// Data transfer frame definition
+/* Data transfer frame definition */
struct usrp_transfer_frame {
- __u32 flags;
+ __u32 status;
__u32 len;
__u8 buf[];
};
-// Flag defines
+/* Flag defines */
#define RB_USER (1 << 0)
#define RB_KERNEL (1 << 1)
#define RB_OVERRUN (1 << 2)
+#define RB_DMA_ACTIVE (1 << 3)
struct ring_buffer_entry {
+ unsigned int flags;
unsigned long dma_addr;
struct usrp_transfer_frame *frame_addr;
};