Statistics
| Branch: | Tag: | Revision:

root / host / lib / usrp / mboard / usrp2 / fw_common.h @ eb7e709b

History | View | Annotate | Download (3.28 KB)

1
//
2
// Copyright 2010 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17

    
18
#ifndef INCLUDED_USRP2_FW_COMMON_H
19
#define INCLUDED_USRP2_FW_COMMON_H
20

    
21
/*!
22
 * Structs and constants for usrp2 communication.
23
 * This header is shared by the firmware and host code.
24
 * Therefore, this header may only contain valid C code.
25
 */
26
#ifdef __cplusplus
27
extern "C" {
28
#endif
29

    
30
// udp ports for the usrp2 communication
31
// Dynamic and/or private ports: 49152-65535
32
#define USRP2_UDP_CTRL_PORT 49152
33
#define USRP2_UDP_DATA_PORT 49153
34

    
35
typedef enum{
36
    USRP2_CTRL_ID_HUH_WHAT,
37
    //USRP2_CTRL_ID_FOR_SURE, //TODO error condition enums
38
    //USRP2_CTRL_ID_SUX_MAN,
39

    
40
    USRP2_CTRL_ID_GIVE_ME_YOUR_IP_ADDR_BRO,
41
    USRP2_CTRL_ID_THIS_IS_MY_IP_ADDR_DUDE,
42
    USRP2_CTRL_ID_HERE_IS_A_NEW_IP_ADDR_BRO,
43

    
44
    USRP2_CTRL_ID_GIVE_ME_YOUR_MAC_ADDR_BRO,
45
    USRP2_CTRL_ID_THIS_IS_MY_MAC_ADDR_DUDE,
46
    USRP2_CTRL_ID_HERE_IS_A_NEW_MAC_ADDR_BRO,
47

    
48
    USRP2_CTRL_ID_GIVE_ME_YOUR_DBOARD_IDS_BRO,
49
    USRP2_CTRL_ID_THESE_ARE_MY_DBOARD_IDS_DUDE,
50

    
51
    USRP2_CTRL_ID_HERES_A_NEW_CLOCK_CONFIG_BRO,
52
    USRP2_CTRL_ID_GOT_THE_NEW_CLOCK_CONFIG_DUDE,
53

    
54
    USRP2_CTRL_ID_USE_THESE_GPIO_DDR_SETTINGS_BRO,
55
    USRP2_CTRL_ID_GOT_THE_GPIO_DDR_SETTINGS_DUDE,
56

    
57
    USRP2_CTRL_ID_SET_YOUR_GPIO_PIN_OUTS_BRO,
58
    USRP2_CTRL_ID_I_SET_THE_GPIO_PIN_OUTS_DUDE,
59

    
60
    USRP2_CTRL_ID_GIVE_ME_YOUR_GPIO_PIN_VALS_BRO,
61
    USRP2_CTRL_ID_HERE_IS_YOUR_GPIO_PIN_VALS_DUDE,
62

    
63
    USRP2_CTRL_ID_USE_THESE_ATR_SETTINGS_BRO,
64
    USRP2_CTRL_ID_GOT_THE_ATR_SETTINGS_DUDE,
65

    
66
    USRP2_CTRL_ID_PEACE_OUT
67

    
68
} usrp2_ctrl_id_t;
69

    
70
typedef enum{
71
    USRP2_PPS_SOURCE_SMA,
72
    USRP2_PPS_SOURCE_MIMO
73
} usrp2_pps_source_t;
74

    
75
typedef enum{
76
    USRP2_PPS_POLARITY_POS,
77
    USRP2_PPS_POLARITY_NEG
78
} usrp2_pps_polarity_t;
79

    
80
typedef enum{
81
    USRP2_REF_SOURCE_INT,
82
    USRP2_REF_SOURCE_SMA,
83
    USRP2_REF_SOURCE_MIMO
84
} usrp2_ref_source_t;
85

    
86
typedef enum{
87
    USRP2_GPIO_BANK_RX,
88
    USRP2_GPIO_BANK_TX
89
} usrp2_gpio_bank_t;
90

    
91
typedef struct{
92
    uint32_t id;
93
    uint32_t seq;
94
    union{
95
        uint32_t ip_addr;
96
        uint8_t mac_addr[6];
97
        struct {
98
            uint16_t rx_id;
99
            uint16_t tx_id;
100
        } dboard_ids;
101
        struct {
102
            uint8_t pps_source;
103
            uint8_t pps_polarity;
104
            uint8_t ref_source;
105
            uint8_t _pad;
106
        } clock_config;
107
        struct {
108
            uint8_t bank;
109
            uint8_t _pad[3];
110
            uint16_t value;
111
            uint16_t mask;
112
        } gpio_config;
113
        struct {
114
            uint8_t bank;
115
            uint8_t _pad[3];
116
            uint16_t tx_value;
117
            uint16_t rx_value;
118
            uint16_t mask;
119
        } atr_config;
120
    } data;
121
} usrp2_ctrl_data_t;
122

    
123
#ifdef __cplusplus
124
}
125
#endif
126

    
127
#endif /* INCLUDED_USRP2_FW_COMMON_H */