mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
Allow the EEPROM driver to consider itself started even if NXFFS fails to mount.
This commit is contained in:
@@ -151,8 +151,6 @@ static ssize_t at24c_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||||||
size_t nblocks, FAR uint8_t *buf);
|
size_t nblocks, FAR uint8_t *buf);
|
||||||
static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||||
size_t nblocks, FAR const uint8_t *buf);
|
size_t nblocks, FAR const uint8_t *buf);
|
||||||
static ssize_t at24c_read(FAR struct mtd_dev_s *dev, off_t offset,
|
|
||||||
size_t nbytes,FAR uint8_t *buffer);
|
|
||||||
static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg);
|
static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -172,7 +170,6 @@ static struct at24c_dev_s g_at24c;
|
|||||||
static int at24c_eraseall(FAR struct at24c_dev_s *priv)
|
static int at24c_eraseall(FAR struct at24c_dev_s *priv)
|
||||||
{
|
{
|
||||||
int startblock = 0;
|
int startblock = 0;
|
||||||
int ret = OK;
|
|
||||||
uint8_t buf[AT24XX_PAGESIZE + 2];
|
uint8_t buf[AT24XX_PAGESIZE + 2];
|
||||||
|
|
||||||
struct i2c_msg_s msgv[1] =
|
struct i2c_msg_s msgv[1] =
|
||||||
|
|||||||
@@ -126,20 +126,21 @@ eeprom_start(void)
|
|||||||
if (mtd == NULL)
|
if (mtd == NULL)
|
||||||
errx(1, "failed to initialize EEPROM driver");
|
errx(1, "failed to initialize EEPROM driver");
|
||||||
|
|
||||||
|
/* driver is started, even if NXFFS fails to mount */
|
||||||
|
started = true;
|
||||||
|
|
||||||
/* start NXFFS */
|
/* start NXFFS */
|
||||||
ret = nxffs_initialize(mtd);
|
ret = nxffs_initialize(mtd);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
err(1, "failed to initialize NXFFS");
|
errx(1, "failed to initialize NXFFS - erase EEPROM to reformat");
|
||||||
|
|
||||||
/* mount the EEPROM */
|
/* mount the EEPROM */
|
||||||
ret = mount(NULL, "/eeprom", "nxffs", 0, NULL);
|
ret = mount(NULL, "/eeprom", "nxffs", 0, NULL);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
err(1, "failed to mount EEPROM");
|
errx(1, "failed to mount /eeprom - erase EEPROM to reformat");
|
||||||
|
|
||||||
started = true;
|
|
||||||
|
|
||||||
errx(0, "mounted EEPROM at /eeprom");
|
errx(0, "mounted EEPROM at /eeprom");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user