drivers/mtd/at24xx.c: Appease nxstyle
This commit is contained in:
parent
aa294546f4
commit
99f545f5c3
@ -197,13 +197,13 @@ static struct at24c_dev_s g_at24c;
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/************************************************************************************
|
||||||
* Name: at24c_i2c_write
|
* Name: at24c_i2c_write
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Write to the I2C device.
|
* Write to the I2C device.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
static int at24c_i2c_write(FAR struct at24c_dev_s *priv, uint16_t at24addr,
|
static int at24c_i2c_write(FAR struct at24c_dev_s *priv, uint16_t at24addr,
|
||||||
FAR const uint8_t *buffer, int buflen)
|
FAR const uint8_t *buffer, int buflen)
|
||||||
@ -223,13 +223,13 @@ static int at24c_i2c_write(FAR struct at24c_dev_s *priv, uint16_t at24addr,
|
|||||||
return I2C_TRANSFER(priv->dev, &msg, 1);
|
return I2C_TRANSFER(priv->dev, &msg, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/************************************************************************************
|
||||||
* Name: at24c_i2c_read
|
* Name: at24c_i2c_read
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Read from the I2C device.
|
* Read from the I2C device.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
static int at24c_i2c_read(FAR struct at24c_dev_s *priv, uint16_t at24addr,
|
static int at24c_i2c_read(FAR struct at24c_dev_s *priv, uint16_t at24addr,
|
||||||
FAR uint8_t *buffer, int buflen)
|
FAR uint8_t *buffer, int buflen)
|
||||||
@ -319,17 +319,20 @@ static ssize_t at24c_read_internal(FAR struct at24c_dev_s *priv, off_t offset,
|
|||||||
finfo("offset: %lu nbytes: %lu address: %02x\n",
|
finfo("offset: %lu nbytes: %lu address: %02x\n",
|
||||||
(unsigned long)offset, (unsigned long)nbytes, address);
|
(unsigned long)offset, (unsigned long)nbytes, address);
|
||||||
|
|
||||||
/* "Random Read: A Random Read requires a dummy byte write sequence to load in the
|
/* "Random Read: A Random Read requires a dummy byte write sequence to
|
||||||
* data word address. Once the device address word and data word address are clocked
|
* load in the data word address. Once the device address word and data
|
||||||
* in and acknowledged by the EEPROM, the microcontroller must generate another
|
* word address are clocked in and acknowledged by the EEPROM, the
|
||||||
* Start condition. The microcontroller now initiates a current address read
|
* microcontroller must generate another Start condition. The
|
||||||
* by sending a device address with the read/write select bit high. The EEPROM
|
* microcontroller now initiates a current address read by sending a
|
||||||
* acknowledges the device address and serially clocks out the data word. To end the
|
* device address with the read/write select bit high. The EEPROM
|
||||||
* random read sequence, the microcontroller does not respond with a zero but does
|
* acknowledges the device address and serially clocks out the data word.
|
||||||
* generate a Stop condition in the subsequent clock cycle."
|
* To end the random read sequence, the microcontroller does not respond
|
||||||
|
* with a zero but does generate a Stop condition in the subsequent clock
|
||||||
|
* cycle."
|
||||||
*
|
*
|
||||||
* A repeated START after the address is suggested, however, this simple driver
|
* A repeated START after the address is suggested, however, this simple
|
||||||
* just performs the write as a sepate transfer with an additional, unnecessary STOP.
|
* driver just performs the write as a sepate transfer with an additional,
|
||||||
|
* unnecessary STOP.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if AT24XX_ADDRSIZE == 2
|
#if AT24XX_ADDRSIZE == 2
|
||||||
@ -411,9 +414,9 @@ static ssize_t at24c_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_AT24XX_MTD_BLOCKSIZE > AT24XX_PAGESIZE
|
#if CONFIG_AT24XX_MTD_BLOCKSIZE > AT24XX_PAGESIZE
|
||||||
return nblocks / (CONFIG_AT24XX_MTD_BLOCKSIZE / AT24XX_PAGESIZE);
|
return nblocks / (CONFIG_AT24XX_MTD_BLOCKSIZE / AT24XX_PAGESIZE);
|
||||||
#else
|
#else
|
||||||
return nblocks;
|
return nblocks;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +427,8 @@ static ssize_t at24c_bread(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,
|
static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||||
|
size_t nblocks,
|
||||||
FAR const uint8_t *buffer)
|
FAR const uint8_t *buffer)
|
||||||
{
|
{
|
||||||
FAR struct at24c_dev_s *priv = (FAR struct at24c_dev_s *)dev;
|
FAR struct at24c_dev_s *priv = (FAR struct at24c_dev_s *)dev;
|
||||||
@ -553,7 +557,8 @@ static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
case MTDIOC_GEOMETRY:
|
case MTDIOC_GEOMETRY:
|
||||||
{
|
{
|
||||||
FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)((uintptr_t)arg);
|
FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)
|
||||||
|
((uintptr_t)arg);
|
||||||
if (geo)
|
if (geo)
|
||||||
{
|
{
|
||||||
/* Populate the geometry structure with information need to know
|
/* Populate the geometry structure with information need to know
|
||||||
@ -580,7 +585,8 @@ static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
|||||||
#if CONFIG_AT24XX_MTD_BLOCKSIZE > AT24XX_PAGESIZE
|
#if CONFIG_AT24XX_MTD_BLOCKSIZE > AT24XX_PAGESIZE
|
||||||
geo->blocksize = CONFIG_AT24XX_MTD_BLOCKSIZE;
|
geo->blocksize = CONFIG_AT24XX_MTD_BLOCKSIZE;
|
||||||
geo->erasesize = CONFIG_AT24XX_MTD_BLOCKSIZE;
|
geo->erasesize = CONFIG_AT24XX_MTD_BLOCKSIZE;
|
||||||
geo->neraseblocks = (CONFIG_AT24XX_SIZE * 1024 / 8) / CONFIG_AT24XX_MTD_BLOCKSIZE;
|
geo->neraseblocks = (CONFIG_AT24XX_SIZE * 1024 / 8) /
|
||||||
|
CONFIG_AT24XX_MTD_BLOCKSIZE;
|
||||||
#else
|
#else
|
||||||
geo->blocksize = priv->pagesize;
|
geo->blocksize = priv->pagesize;
|
||||||
geo->erasesize = priv->pagesize;
|
geo->erasesize = priv->pagesize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user