3 * Copyright 2009 Free Software Foundation, Inc.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "usrp2_i2c_addr.h"
33 int read_dboard_eeprom(int i2c_addr);
36 #define USRP_DBID_DBS_RX 0x0002
37 #define USRP_DBID_DBS_RX_WITH_CLOCK_MOD 0x000d
39 const char dbs_rx_rev2_eeprom[] = {
40 0xdb, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18
46 #define LED_VALS (LED_A | LED_B | LED_C | LED_D)
47 #define LED_MASK (LED_A | LED_B | LED_C | LED_D)
54 puts("\nburn_dbsrx_eeprom\n");
56 hal_set_leds(0, ~0); // all off
58 int i2c_addr = I2C_ADDR_RX_A;
59 int dbid = read_dboard_eeprom(i2c_addr);
65 msg = "No RX daughterboard found";
69 msg = "Invalid RX EEPROM contents";
72 case USRP_DBID_DBS_RX_WITH_CLOCK_MOD:
73 msg = "RX Daughterboard already reports being a DBS RX w/ CLOCK_MOD";
76 case USRP_DBID_DBS_RX:
77 // Says it's a DBS_RX, attempt to burn the EEPROM
78 ok = eeprom_write(i2c_addr, 0,
79 dbs_rx_rev2_eeprom, sizeof(dbs_rx_rev2_eeprom));
81 msg = "Successfully programmed db as DBS RX Rev 2.1";
85 msg = "Failed to write daugherboard eeprom";
90 msg = "Daughterboard is not a DBS RX; ignored";
96 hal_set_leds(LED_VALS, LED_MASK);
103 hal_toggle_leds(LED_VALS);