Merge branch 'master' of git://github.com/PX4/Firmware into fault_detection

This commit is contained in:
jgoppert
2013-01-19 13:04:02 -05:00
4 changed files with 266 additions and 209 deletions
+27
View File
@@ -163,6 +163,8 @@ static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
size_t nblocks, FAR const uint8_t *buf);
static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg);
void at24c_test(void);
/************************************************************************************
* Private Data
************************************************************************************/
@@ -218,6 +220,31 @@ static int at24c_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nbloc
return (int)nblocks;
}
/************************************************************************************
* Name: at24c_test
************************************************************************************/
void at24c_test(void)
{
uint8_t buf[CONFIG_AT24XX_MTD_BLOCKSIZE];
unsigned count = 0;
unsigned errors = 0;
for (count = 0; count < 10000; count++) {
ssize_t result = at24c_bread(&g_at24c.mtd, 0, 1, buf);
if (result == ERROR) {
if (errors++ > 2) {
vdbg("too many errors\n");
return;
}
} else if (result != 1) {
vdbg("unexpected %u\n", result);
}
if ((count % 100) == 0)
vdbg("test %u errors %u\n", count, errors);
}
}
/************************************************************************************
* Name: at24c_bread
************************************************************************************/
+13
View File
@@ -73,6 +73,7 @@ static void eeprom_erase(void);
static void eeprom_ioctl(unsigned operation);
static void eeprom_save(const char *name);
static void eeprom_load(const char *name);
static void eeprom_test(void);
static bool attached = false;
static bool started = false;
@@ -93,6 +94,9 @@ int eeprom_main(int argc, char *argv[])
if (!strcmp(argv[1], "erase"))
eeprom_erase();
if (!strcmp(argv[1], "test"))
eeprom_test();
if (0) { /* these actually require a file on the filesystem... */
if (!strcmp(argv[1], "reformat"))
@@ -250,3 +254,12 @@ eeprom_load(const char *name)
exit(0);
}
extern void at24c_test(void);
static void
eeprom_test(void)
{
at24c_test();
exit(0);
}
File diff suppressed because it is too large Load Diff
+38 -8
View File
@@ -348,14 +348,8 @@ CONFIG_CAN_LOOPBACK=n
CONFIG_CAN1_BAUD=700000
CONFIG_CAN2_BAUD=700000
#
# I2C configuration
#
CONFIG_I2C=y
#CONFIG_I2C_POLLED=y
CONFIG_I2C_TRANSFER=y
CONFIG_I2C_TRACE=n
CONFIG_I2C_RESET=y
# XXX remove after integration testing
# Allow 180 us per byte, a wide margin for the 400 KHz clock we're using
# e.g. 9.6 ms for an EEPROM page write, 0.9 ms for a MAG update
CONFIG_STM32_I2CTIMEOUS_PER_BYTE=200
@@ -364,6 +358,42 @@ CONFIG_STM32_I2CTIMEOUS_START_STOP=700
# XXX this is bad and we want it gone
CONFIG_I2C_WRITEREAD=y
#
# I2C configuration
#
CONFIG_I2C=y
CONFIG_I2C_POLLED=y
CONFIG_I2C_TRANSFER=y
CONFIG_I2C_TRACE=n
CONFIG_I2C_RESET=y
# XXX re-enable after integration testing
#
# I2C configuration
#
#CONFIG_I2C=y
#CONFIG_I2C_POLLED=y
#CONFIG_I2C_TRANSFER=y
#CONFIG_I2C_TRACE=n
#CONFIG_I2C_RESET=y
# Dynamic timeout
#CONFIG_STM32_I2C_DYNTIMEO=y
#CONFIG_STM32_I2C_DYNTIMEO_STARTSTOP=500
#CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE=200
# Fixed per-transaction timeout
#CONFIG_STM32_I2CTIMEOSEC=0
#CONFIG_STM32_I2CTIMEOMS=10
#
# General build options
#