2
* Copyright 2007 Free Software Foundation, Inc.
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.
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.
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/>.
20
#include <u2_init.h> /* FIXME */
22
#include <usrp2_i2c_addr.h>
28
#define ASSERT_TRUE(x) \
31
printf("ASSERT_TRUE failed on line %d\n", __LINE__); \
36
#define ASSERT_FALSE(x) \
39
printf("ASSERT_FALSE failed on line %d\n", __LINE__); \
54
int not_dev_addr = 0x35; // no device with this address on the i2c bus.
62
// try writing a non-existent device
64
ok = i2c_write(not_dev_addr, buf, 1);
67
// try read from non-existent device
69
ok = i2c_read(not_dev_addr, buf, 1);
75
memset(buf, 0, sizeof(buf));
76
for (i = 0; i < len; i++)
78
ok = eeprom_write(I2C_ADDR_MBOARD, offset, buf, len);
81
// now try to read it back
84
memset(buf, 0, sizeof(buf));
85
ok = eeprom_read(I2C_ADDR_MBOARD, offset, buf, len);
89
for (i = 0; i < len; i++){
91
printf("buf[%d] = %d, should be %d\n", i, buf[i], i);
97
output_regs->leds = 0x3;
101
output_regs->leds = 0x0;