/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009,2010 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* ethernet header + transport header + fixed header + maximum number of samples.
* sizeof(u2_eth_samples_t) == 1512
* (payload is 1498 bytes, two bytes shorter than 1500 byte MTU)
+ * (sample numbers are made even to force pairwise alignment in the interleaved case)
*/
-#define U2_MAX_SAMPLES 371
+#define U2_MAX_SAMPLES 370
+#define U2_MIN_SAMPLES 10
typedef struct {
u2_eth_packet_t hdrs;
#define OP_SYNC_TO_PPS_REPLY (OP_SYNC_TO_PPS | OP_REPLY_BIT)
#define OP_PEEK 11
#define OP_PEEK_REPLY (OP_PEEK | OP_REPLY_BIT)
+#define OP_POKE 12
+#define OP_POKE_REPLY (OP_POKE | OP_REPLY_BIT)
+#define OP_SET_TX_LO_OFFSET 13
+#define OP_SET_TX_LO_OFFSET_REPLY (OP_SET_TX_LO_OFFSET | OP_REPLY_BIT)
+#define OP_SET_RX_LO_OFFSET 14
+#define OP_SET_RX_LO_OFFSET_REPLY (OP_SET_RX_LO_OFFSET | OP_REPLY_BIT)
+#define OP_RESET_DB 15
+#define OP_RESET_DB_REPLY (OP_RESET_DB | OP_REPLY_BIT)
+#define OP_SYNC_EVERY_PPS 16
+#define OP_SYNC_EVERY_PPS_REPLY (OP_SYNC_EVERY_PPS | OP_REPLY_BIT)
+#define OP_GPIO_SET_DDR 17
+#define OP_GPIO_SET_DDR_REPLY (OP_GPIO_SET_DDR | OP_REPLY_BIT)
+#define OP_GPIO_SET_SELS 18
+#define OP_GPIO_SET_SELS_REPLY (OP_GPIO_SET_SELS | OP_REPLY_BIT)
+#define OP_GPIO_READ 19
+#define OP_GPIO_READ_REPLY (OP_GPIO_READ | OP_REPLY_BIT)
+#define OP_GPIO_WRITE 20
+#define OP_GPIO_WRITE_REPLY (OP_GPIO_WRITE | OP_REPLY_BIT)
+#define OP_GPIO_STREAM 21
+#define OP_GPIO_STREAM_REPLY (OP_GPIO_STREAM | OP_REPLY_BIT)
+#define OP_RX_ANTENNA 22
+#define OP_RX_ANTENNA_REPLY (OP_RX_ANTENNA | OP_REPLY_BIT)
+#define OP_TX_ANTENNA 23
+#define OP_TX_ANTENNA_REPLY (OP_RX_ANTENNA | OP_REPLY_BIT)
/*
* All subpackets are a multiple of 4 bytes long.
* All subpackets start with an 8-bit opcode, an 8-bit len and an 8-bit rid.
*/
-
+#define MAX_SUBPKT_LEN 252
/*!
* \brief Generic request and reply packet
uint32_t bytes;
} _AL4 op_peek_t;
+/*!
+ * \brief Write to Wishbone memory
+ */
+typedef struct {
+ uint8_t opcode;
+ uint8_t len;
+ uint8_t rid;
+ uint8_t mbz;
+ uint32_t addr;
+ // Words follow here
+} _AL4 op_poke_t;
+
+/*
+ * Common structure for commands with a single frequency param
+ * (e.g., set_*_lo_offset, set_*_bw)
+ */
+typedef struct {
+ uint8_t opcode;
+ uint8_t len;
+ uint8_t rid;
+ uint8_t mbz;
+ uint32_t freq_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20)
+ uint32_t freq_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20)
+} _AL4 op_freq_t;
+
+/*
+ * Structures for commands in GPIO system
+ */
+typedef struct {
+ uint8_t opcode; // OP_GPIO_SET_DDR, OP_GPIO_WRITE, OP_GPIO_STREAM
+ uint8_t len;
+ uint8_t rid;
+ uint8_t bank;
+ uint16_t value;
+ uint16_t mask;
+} _AL4 op_gpio_t;
+
+typedef struct {
+ uint8_t opcode; // OP_GPIO_SET_SELS
+ uint8_t len;
+ uint8_t rid;
+ uint8_t bank;
+ uint8_t sels[16];
+} _AL4 op_gpio_set_sels_t;
+
+typedef struct {
+ uint8_t opcode; // OP_GPIO_READ_REPLY
+ uint8_t len;
+ uint8_t rid;
+ uint8_t ok;
+ uint16_t mbz;
+ uint16_t value;
+} _AL4 op_gpio_read_reply_t;
+
/*
* ================================================================
* union of all of subpacket types
op_config_tx_reply_v2_t op_config_tx_reply_v2;
op_config_mimo_t op_config_mimo;
op_peek_t op_peek;
+ op_poke_t op_poke;
+ op_freq_t op_freq;
+ op_gpio_t op_gpio;
+ op_gpio_set_sels_t op_gpio_set_sels;
+ op_gpio_read_reply_t op_gpio_read_reply;
} u2_subpkt_t;