icE1usb fw: Add USB control for the GPSDO function
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: If92aa68d8a49349fa0d6d556eec81bbb80be989c
diff --git a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
index 9ac2136..a249537 100644
--- a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
+++ b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
@@ -17,12 +17,51 @@
/*! returns a bit-mask of optional device capabilities (see enum e1usb_dev_capability) */
#define ICE1USB_DEV_GET_CAPABILITIES 0x01
#define ICE1USB_DEV_GET_FW_BUILD 0x02
+#define ICE1USB_DEV_GET_GPSDO_STATUS 0x10
+#define ICE1USB_DEV_GET_GPSDO_MODE 0x12 /*!< uint8_t */
+#define ICE1USB_DEV_SET_GPSDO_MODE 0x13 /*!< wValue = mode */
+#define ICE1USB_DEV_GET_GPSDO_TUNE 0x14 /*!< data = struct e1usb_gpsdo_tune */
+#define ICE1USB_DEV_SET_GPSDO_TUNE 0x15 /*!< data = struct e1usb_gpsdo_tune */
enum e1usb_dev_capability {
/*! Does this board have a GPS-DO */
ICE1USB_DEV_CAP_GPSDO,
};
+enum ice1usb_gpsdo_mode {
+ ICE1USB_GPSDO_MODE_DISABLED = 0,
+ ICE1USB_GPSDO_MODE_AUTO = 1,
+};
+
+enum ice1usb_gpsdo_antenna_state {
+ ICE1USB_GPSDO_ANT_UNKNOWN = 0,
+ ICE1USB_GPSDO_ANT_OK = 1,
+ ICE1USB_GPSDO_ANT_OPEN = 2,
+ ICE1USB_GPSDO_ANT_SHORT = 3,
+};
+
+enum ice1usb_gpsdo_state {
+ ICE1USB_GPSDO_STATE_DISABLED = 0,
+ ICE1USB_GPSDO_STATE_CALIBRATE = 1,
+ ICE1USB_GPSDO_STATE_HOLD_OVER = 2,
+ ICE1USB_GPSDO_STATE_TUNE_COARSE = 3,
+ ICE1USB_GPSDO_STATE_TUNE_FINE = 4,
+};
+
+struct e1usb_gpsdo_tune {
+ uint16_t coarse;
+ uint16_t fine;
+} __attribute__((packed));
+
+struct e1usb_gpsdo_status {
+ uint8_t state;
+ uint8_t antenna_status; /*!< Antenna status */
+ uint8_t valid_fix; /*!< Valid GPS Fix (0/1) */
+ uint8_t mode; /*!< Current configured operating mode */
+ struct e1usb_gpsdo_tune tune; /*!< Current VCXO tuning values */
+ uint32_t freq_est; /*!< Latest frequency estimate measurement */
+} __attribute__((packed));
+
/* Interface Requests */