blob: 61e12ad432ab2004f4998fd9af6aff6ff29c45b5 [file] [log] [blame]
Harald Welte9469e042020-12-15 23:09:40 +01001/*
2 * ice1usb_proto.h
3 *
4 * Copyright (C) 2020 Harald Welte <laforge@osmocom.org>
5 * SPDX-License-Identifier: MIT
6 *
7 * Header file describing the USB protocol between the icE1usb firmware and the host
8 * software (currently really only osmo-e1d)
9 */
10
11#pragma once
12
13/***********************************************************************
14 * Control Endpoint / Device Requests
15 ***********************************************************************/
16
17/*! returns a bit-mask of optional device capabilities (see enum e1usb_dev_capability) */
18#define ICE1USB_DEV_GET_CAPABILITIES 0x01
19#define ICE1USB_DEV_GET_FW_BUILD 0x02
20
21enum e1usb_dev_capability {
22 /*! Does this board have a GPS-DO */
23 ICE1USB_DEV_CAP_GPSDO,
24};
25
26
27/* Interface Requests */
28
29/*! returns a bit-mask of optional device capabilities (see enum e1usb_intf_capability) */
30#define ICE1USB_INTF_GET_CAPABILITIES 0x01
31#define ICE1USB_INTF_SET_TX_CFG 0x02 /*!< struct ice1usb_tx_config */
32#define ICE1USB_INTF_GET_TX_CFG 0x03 /*!< struct ice1usb_tx_config */
33#define ICE1USB_INTF_SET_RX_CFG 0x04 /*!< struct ice1usb_rx_config */
34#define ICE1USB_INTF_GET_RX_CFG 0x05 /*!< struct ice1usb_rx_config */
35
36//enum e1usb_intf_capability { };
37
38enum ice1usb_tx_mode {
39 ICE1USB_TX_MODE_TRANSP = 0,
40 ICE1USB_TX_MODE_TS0 = 1,
41 ICE1USB_TX_MODE_TS0_CRC4 = 2,
42 ICE1USB_TX_MODE_TS0_CRC4_E = 3,
43};
44
45enum ice1usb_tx_timing {
46 ICE1USB_TX_TIME_SRC_LOCAL = 0,
47 ICE1USB_TX_TIME_SRC_REMOTE = 1,
48};
49
50enum ice1usb_tx_ext_loopback {
51 ICE1USB_TX_EXT_LOOPBACK_OFF = 0,
52 ICE1USB_TX_EXT_LOOPBACK_SAME = 1,
53 ICE1USB_TX_EXT_LOOPBACK_CROSS = 2,
54};
55
56/* ICE1USB_INTF_{GET,SET}_TX_CFG */
57struct ice1usb_tx_config {
58 uint8_t mode; /*!< enum ice1usb_tx_mode */
59 uint8_t timing; /*!< enum ice1usb_tx_timing */
60 uint8_t ext_loopback; /*!< enum ice1usb_tx_ext_loopback */
61 uint8_t alarm; /*!< 1 = transmit alarm; 0 = don't */
62} __attribute__((packed));
63
64
65enum ice1usb_rx_mode {
66 /*! transparent, unaligned bitstream */
67 ICE1USB_RX_MODE_TRANSP = 0,
68 /*! alignment to E1 frame */
69 ICE1USB_RX_MODE_FRAME = 2,
70 /*! alignment to E1 multiframe */
71 ICE1USB_RX_MODE_MULTIFRAME = 3,
72};
73
74/* ICE1USB_INTF_{GET,SET}_RX_CFG */
75struct ice1usb_rx_config {
76 uint8_t mode; /*!< enum ice1usb_rx_mode */
77} __attribute__((packed));