Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
ae356001cf
commit
b5f429c88b
@ -1,4 +1,4 @@
|
|||||||
/****************************************************************************
|
/***************************************************************************
|
||||||
* drivers/mtd/gd25.c
|
* drivers/mtd/gd25.c
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
@ -41,9 +41,9 @@
|
|||||||
#include <nuttx/spi/spi.h>
|
#include <nuttx/spi/spi.h>
|
||||||
#include <nuttx/mtd/mtd.h>
|
#include <nuttx/mtd/mtd.h>
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Configuration
|
* Configuration
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_GD25_SPIMODE
|
#ifndef CONFIG_GD25_SPIMODE
|
||||||
# define CONFIG_GD25_SPIMODE SPIDEV_MODE0
|
# define CONFIG_GD25_SPIMODE SPIDEV_MODE0
|
||||||
@ -53,12 +53,11 @@
|
|||||||
# define CONFIG_GD25_SPIFREQUENCY 20000000
|
# define CONFIG_GD25_SPIFREQUENCY 20000000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* GD25 Instructions
|
* GD25 Instructions
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* Command Value Description */
|
/* Command Value Description */
|
||||||
/* */
|
|
||||||
|
|
||||||
#define GD25_WREN 0x06 /* Write enable */
|
#define GD25_WREN 0x06 /* Write enable */
|
||||||
#define GD25_WRDI 0x04 /* Write Disable */
|
#define GD25_WRDI 0x04 /* Write Disable */
|
||||||
@ -78,9 +77,9 @@
|
|||||||
#define GD25_JEDEC_ID 0x9f /* JEDEC ID read */
|
#define GD25_JEDEC_ID 0x9f /* JEDEC ID read */
|
||||||
#define GD25_4BEN 0xb7 /* Enable 4-byte Mode */
|
#define GD25_4BEN 0xb7 /* Enable 4-byte Mode */
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* GD25 Registers
|
* GD25 Registers
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* JEDEC Read ID register values */
|
/* JEDEC Read ID register values */
|
||||||
|
|
||||||
@ -111,11 +110,11 @@
|
|||||||
|
|
||||||
#define GD25_DUMMY 0x00
|
#define GD25_DUMMY 0x00
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Chip Geometries
|
* Chip Geometries
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* All members of the family support uniform 4K-byte sectors and 256 byte pages */
|
/* All members of the family support uniform 4KB sectors and 256B pages */
|
||||||
|
|
||||||
#define GD25_SECTOR_SHIFT 12 /* Sector size 1 << 12 = 4Kb */
|
#define GD25_SECTOR_SHIFT 12 /* Sector size 1 << 12 = 4Kb */
|
||||||
#define GD25_SECTOR_SIZE (1 << 12) /* Sector size 1 << 12 = 4Kb */
|
#define GD25_SECTOR_SIZE (1 << 12) /* Sector size 1 << 12 = 4Kb */
|
||||||
@ -124,13 +123,13 @@
|
|||||||
|
|
||||||
#define GD25_ERASED_STATE 0xff /* State of FLASH when erased */
|
#define GD25_ERASED_STATE 0xff /* State of FLASH when erased */
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* This type represents the state of the MTD device. The struct mtd_dev_s must
|
/* This type represents the state of the MTD device. The struct mtd_dev_s
|
||||||
* appear at the beginning of the definition so that you can freely cast
|
* must appear at the beginning of the definition so that you can freely
|
||||||
* between pointers to struct mtd_dev_s and struct gd25_dev_s.
|
* cast between pointers to struct mtd_dev_s and struct gd25_dev_s.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct gd25_dev_s
|
struct gd25_dev_s
|
||||||
@ -143,9 +142,9 @@ struct gd25_dev_s
|
|||||||
bool addr_4byte; /* True: Use Four-byte address */
|
bool addr_4byte; /* True: Use Four-byte address */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* Helpers */
|
/* Helpers */
|
||||||
|
|
||||||
@ -190,13 +189,13 @@ static ssize_t gd25_write(FAR struct mtd_dev_s *dev, off_t offset,
|
|||||||
size_t nbytes, FAR const uint8_t *buffer);
|
size_t nbytes, FAR const uint8_t *buffer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_purdid
|
* Name: gd25_purdid
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline void gd25_purdid(FAR struct gd25_dev_s *priv)
|
static inline void gd25_purdid(FAR struct gd25_dev_s *priv)
|
||||||
{
|
{
|
||||||
@ -206,9 +205,9 @@ static inline void gd25_purdid(FAR struct gd25_dev_s *priv)
|
|||||||
up_udelay(20);
|
up_udelay(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_pd
|
* Name: gd25_pd
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline void gd25_pd(FAR struct gd25_dev_s *priv)
|
static inline void gd25_pd(FAR struct gd25_dev_s *priv)
|
||||||
{
|
{
|
||||||
@ -217,9 +216,9 @@ static inline void gd25_pd(FAR struct gd25_dev_s *priv)
|
|||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_lock
|
* Name: gd25_lock
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static void gd25_lock(FAR struct spi_dev_s *spi)
|
static void gd25_lock(FAR struct spi_dev_s *spi)
|
||||||
{
|
{
|
||||||
@ -231,18 +230,18 @@ static void gd25_lock(FAR struct spi_dev_s *spi)
|
|||||||
SPI_SETFREQUENCY(spi, CONFIG_GD25_SPIFREQUENCY);
|
SPI_SETFREQUENCY(spi, CONFIG_GD25_SPIFREQUENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_unlock
|
* Name: gd25_unlock
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline void gd25_unlock(FAR struct spi_dev_s *spi)
|
static inline void gd25_unlock(FAR struct spi_dev_s *spi)
|
||||||
{
|
{
|
||||||
SPI_LOCK(spi, false);
|
SPI_LOCK(spi, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_readid
|
* Name: gd25_readid
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline int gd25_readid(FAR struct gd25_dev_s *priv)
|
static inline int gd25_readid(FAR struct gd25_dev_s *priv)
|
||||||
{
|
{
|
||||||
@ -341,9 +340,9 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_unprotect
|
* Name: gd25_unprotect
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_GD25_READONLY
|
#ifndef CONFIG_GD25_READONLY
|
||||||
static void gd25_unprotect(FAR struct gd25_dev_s *priv)
|
static void gd25_unprotect(FAR struct gd25_dev_s *priv)
|
||||||
@ -381,9 +380,9 @@ static void gd25_unprotect(FAR struct gd25_dev_s *priv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_waitwritecomplete
|
* Name: gd25_waitwritecomplete
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static uint8_t gd25_waitwritecomplete(FAR struct gd25_dev_s *priv)
|
static uint8_t gd25_waitwritecomplete(FAR struct gd25_dev_s *priv)
|
||||||
{
|
{
|
||||||
@ -404,9 +403,9 @@ static uint8_t gd25_waitwritecomplete(FAR struct gd25_dev_s *priv)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_rdsr
|
* Name: gd25_rdsr
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline uint8_t gd25_rdsr(FAR struct gd25_dev_s *priv, uint32_t id)
|
static inline uint8_t gd25_rdsr(FAR struct gd25_dev_s *priv, uint32_t id)
|
||||||
{
|
{
|
||||||
@ -424,9 +423,9 @@ static inline uint8_t gd25_rdsr(FAR struct gd25_dev_s *priv, uint32_t id)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_4ben
|
* Name: gd25_4ben
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline void gd25_4ben(FAR struct gd25_dev_s *priv)
|
static inline void gd25_4ben(FAR struct gd25_dev_s *priv)
|
||||||
{
|
{
|
||||||
@ -435,9 +434,9 @@ static inline void gd25_4ben(FAR struct gd25_dev_s *priv)
|
|||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_wren
|
* Name: gd25_wren
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline void gd25_wren(FAR struct gd25_dev_s *priv)
|
static inline void gd25_wren(FAR struct gd25_dev_s *priv)
|
||||||
{
|
{
|
||||||
@ -446,9 +445,9 @@ static inline void gd25_wren(FAR struct gd25_dev_s *priv)
|
|||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_wrdi
|
* Name: gd25_wrdi
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline void gd25_wrdi(FAR struct gd25_dev_s *priv)
|
static inline void gd25_wrdi(FAR struct gd25_dev_s *priv)
|
||||||
{
|
{
|
||||||
@ -457,9 +456,9 @@ static inline void gd25_wrdi(FAR struct gd25_dev_s *priv)
|
|||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_is_erased
|
* Name: gd25_is_erased
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static bool gd25_is_erased(FAR struct gd25_dev_s *priv, off_t address,
|
static bool gd25_is_erased(FAR struct gd25_dev_s *priv, off_t address,
|
||||||
off_t size)
|
off_t size)
|
||||||
@ -499,9 +498,9 @@ static bool gd25_is_erased(FAR struct gd25_dev_s *priv, off_t address,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_sectorerase
|
* Name: gd25_sectorerase
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static void gd25_sectorerase(FAR struct gd25_dev_s *priv, off_t sector)
|
static void gd25_sectorerase(FAR struct gd25_dev_s *priv, off_t sector)
|
||||||
{
|
{
|
||||||
@ -549,9 +548,9 @@ static void gd25_sectorerase(FAR struct gd25_dev_s *priv, off_t sector)
|
|||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_chiperase
|
* Name: gd25_chiperase
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline int gd25_chiperase(FAR struct gd25_dev_s *priv)
|
static inline int gd25_chiperase(FAR struct gd25_dev_s *priv)
|
||||||
{
|
{
|
||||||
@ -574,9 +573,9 @@ static inline int gd25_chiperase(FAR struct gd25_dev_s *priv)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_byteread
|
* Name: gd25_byteread
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static void gd25_byteread(FAR struct gd25_dev_s *priv, FAR uint8_t *buffer,
|
static void gd25_byteread(FAR struct gd25_dev_s *priv, FAR uint8_t *buffer,
|
||||||
off_t address, size_t nbytes)
|
off_t address, size_t nbytes)
|
||||||
@ -627,9 +626,9 @@ static void gd25_byteread(FAR struct gd25_dev_s *priv, FAR uint8_t *buffer,
|
|||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(priv->spi_devid), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_pagewrite
|
* Name: gd25_pagewrite
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_GD25_READONLY
|
#ifndef CONFIG_GD25_READONLY
|
||||||
static void gd25_pagewrite(FAR struct gd25_dev_s *priv,
|
static void gd25_pagewrite(FAR struct gd25_dev_s *priv,
|
||||||
@ -682,9 +681,9 @@ static void gd25_pagewrite(FAR struct gd25_dev_s *priv,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_bytewrite
|
* Name: gd25_bytewrite
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_MTD_BYTE_WRITE) && !defined(CONFIG_GD25_READONLY)
|
#if defined(CONFIG_MTD_BYTE_WRITE) && !defined(CONFIG_GD25_READONLY)
|
||||||
static inline void gd25_bytewrite(FAR struct gd25_dev_s *priv,
|
static inline void gd25_bytewrite(FAR struct gd25_dev_s *priv,
|
||||||
@ -732,9 +731,9 @@ static inline void gd25_bytewrite(FAR struct gd25_dev_s *priv,
|
|||||||
}
|
}
|
||||||
#endif /* defined(CONFIG_MTD_BYTE_WRITE) && !defined(CONFIG_GD25_READONLY) */
|
#endif /* defined(CONFIG_MTD_BYTE_WRITE) && !defined(CONFIG_GD25_READONLY) */
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_erase
|
* Name: gd25_erase
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static int gd25_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
static int gd25_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||||
size_t nblocks)
|
size_t nblocks)
|
||||||
@ -766,9 +765,9 @@ static int gd25_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_bread
|
* Name: gd25_bread
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static ssize_t gd25_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
static ssize_t gd25_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||||
size_t nblocks, FAR uint8_t *buffer)
|
size_t nblocks, FAR uint8_t *buffer)
|
||||||
@ -787,9 +786,9 @@ static ssize_t gd25_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_bwrite
|
* Name: gd25_bwrite
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static ssize_t gd25_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
static ssize_t gd25_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||||
size_t nblocks, FAR const uint8_t *buffer)
|
size_t nblocks, FAR const uint8_t *buffer)
|
||||||
@ -814,9 +813,9 @@ static ssize_t gd25_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_read
|
* Name: gd25_read
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static ssize_t gd25_read(FAR struct mtd_dev_s *dev, off_t offset,
|
static ssize_t gd25_read(FAR struct mtd_dev_s *dev, off_t offset,
|
||||||
size_t nbytes, FAR uint8_t *buffer)
|
size_t nbytes, FAR uint8_t *buffer)
|
||||||
@ -837,9 +836,9 @@ static ssize_t gd25_read(FAR struct mtd_dev_s *dev, off_t offset,
|
|||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_write
|
* Name: gd25_write
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_BYTE_WRITE
|
#ifdef CONFIG_MTD_BYTE_WRITE
|
||||||
static ssize_t gd25_write(FAR struct mtd_dev_s *dev, off_t offset,
|
static ssize_t gd25_write(FAR struct mtd_dev_s *dev, off_t offset,
|
||||||
@ -915,9 +914,9 @@ static ssize_t gd25_write(FAR struct mtd_dev_s *dev, off_t offset,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_ioctl
|
* Name: gd25_ioctl
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static int gd25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
static int gd25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
@ -967,19 +966,19 @@ static int gd25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/**************************************************************************
|
/***************************************************************************
|
||||||
* Name: gd25_initialize
|
* Name: gd25_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Create an initialize MTD device instance. MTD devices are not registered
|
* Create an initialize MTD device instance. MTD devices aren't registered
|
||||||
* in the file system, but are created as instances that can be bound to
|
* in the file system, but are created as instances that can be bound to
|
||||||
* other functions (such as a block or character driver front end).
|
* other functions (such as a block or character driver front end).
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
FAR struct mtd_dev_s *gd25_initialize(FAR struct spi_dev_s *spi,
|
FAR struct mtd_dev_s *gd25_initialize(FAR struct spi_dev_s *spi,
|
||||||
uint32_t spi_devid)
|
uint32_t spi_devid)
|
||||||
|
@ -40,8 +40,9 @@
|
|||||||
|
|
||||||
#define BANK_SELECT 14
|
#define BANK_SELECT 14
|
||||||
|
|
||||||
/* Transmit Control Register */
|
/* Transmit Control Register
|
||||||
/* BANK 0 */
|
* BANK 0
|
||||||
|
*/
|
||||||
|
|
||||||
#define TCR_REG 0x0000
|
#define TCR_REG 0x0000
|
||||||
#define TCR_ENABLE 0x0001 /* When 1 we can transmit */
|
#define TCR_ENABLE 0x0001 /* When 1 we can transmit */
|
||||||
@ -61,8 +62,9 @@
|
|||||||
|
|
||||||
#define TCR_DEFAULT (TCR_ENABLE | TCR_PAD_EN)
|
#define TCR_DEFAULT (TCR_ENABLE | TCR_PAD_EN)
|
||||||
|
|
||||||
/* EPH Status Register */
|
/* EPH Status Register
|
||||||
/* BANK 0 */
|
* BANK 0
|
||||||
|
*/
|
||||||
|
|
||||||
#define EPH_STATUS_REG 0x0002
|
#define EPH_STATUS_REG 0x0002
|
||||||
#define ES_TX_SUC 0x0001 /* Last TX was successful */
|
#define ES_TX_SUC 0x0001 /* Last TX was successful */
|
||||||
@ -81,8 +83,9 @@
|
|||||||
#define ES_TXUNRN 0x8000 /* Tx Underrun */
|
#define ES_TXUNRN 0x8000 /* Tx Underrun */
|
||||||
#define ES_ERRORS (ES_TXUNRN | ES_LOSTCARR | ES_LATCOL | ES_SQET | ES_16COL)
|
#define ES_ERRORS (ES_TXUNRN | ES_LOSTCARR | ES_LATCOL | ES_SQET | ES_16COL)
|
||||||
|
|
||||||
/* Receive Control Register */
|
/* Receive Control Register
|
||||||
/* BANK 0 */
|
* BANK 0
|
||||||
|
*/
|
||||||
|
|
||||||
#define RCR_REG 0x0004
|
#define RCR_REG 0x0004
|
||||||
#define RCR_RX_ABORT 0x0001 /* Set if a rx frame was aborted */
|
#define RCR_RX_ABORT 0x0001 /* Set if a rx frame was aborted */
|
||||||
@ -103,19 +106,22 @@
|
|||||||
#endif
|
#endif
|
||||||
#define RCR_CLEAR 0x0 /* set it to a base state */
|
#define RCR_CLEAR 0x0 /* set it to a base state */
|
||||||
|
|
||||||
/* Counter Register */
|
/* Counter Register
|
||||||
/* BANK 0 */
|
* BANK 0
|
||||||
|
*/
|
||||||
|
|
||||||
#define COUNTER_REG 0x0006
|
#define COUNTER_REG 0x0006
|
||||||
|
|
||||||
/* Memory Information Register */
|
/* Memory Information Register
|
||||||
/* BANK 0 */
|
* BANK 0
|
||||||
|
*/
|
||||||
|
|
||||||
#define MIR_REG 0x0008
|
#define MIR_REG 0x0008
|
||||||
#define MIR_FREE_MASK 0xff00
|
#define MIR_FREE_MASK 0xff00
|
||||||
|
|
||||||
/* Receive/Phy Control Register */
|
/* Receive/Phy Control Register
|
||||||
/* BANK 0 */
|
* BANK 0
|
||||||
|
*/
|
||||||
|
|
||||||
#define RPC_REG 0x000a
|
#define RPC_REG 0x000a
|
||||||
#define RPC_SPEED 0x2000 /* When 1 PHY is in 100Mbps mode. */
|
#define RPC_SPEED 0x2000 /* When 1 PHY is in 100Mbps mode. */
|
||||||
@ -137,13 +143,15 @@
|
|||||||
|
|
||||||
/* Bank 0 0x000c is reserved */
|
/* Bank 0 0x000c is reserved */
|
||||||
|
|
||||||
/* Bank Select Register */
|
/* Bank Select Register
|
||||||
/* All Banks */
|
* All Banks
|
||||||
|
*/
|
||||||
|
|
||||||
#define BSR_REG 0x000e
|
#define BSR_REG 0x000e
|
||||||
|
|
||||||
/* Configuration Reg */
|
/* Configuration Reg
|
||||||
/* BANK 1 */
|
* BANK 1
|
||||||
|
*/
|
||||||
|
|
||||||
#define CONFIG_REG 0x0100
|
#define CONFIG_REG 0x0100
|
||||||
#define CONFIG_EXT_PHY 0x0200 /* 1=external MII, 0=internal Phy */
|
#define CONFIG_EXT_PHY 0x0200 /* 1=external MII, 0=internal Phy */
|
||||||
@ -156,25 +164,29 @@
|
|||||||
#define CONFIG_DEFAULT (CONFIG_EPH_POWER_EN)
|
#define CONFIG_DEFAULT (CONFIG_EPH_POWER_EN)
|
||||||
#define CONFIG_CLEAR 0
|
#define CONFIG_CLEAR 0
|
||||||
|
|
||||||
/* Base Address Register */
|
/* Base Address Register
|
||||||
/* BANK 1 */
|
* BANK 1
|
||||||
|
*/
|
||||||
|
|
||||||
#define BASE_REG 0x0102
|
#define BASE_REG 0x0102
|
||||||
|
|
||||||
/* Individual Address Registers */
|
/* Individual Address Registers
|
||||||
/* BANK 1 */
|
* BANK 1
|
||||||
|
*/
|
||||||
|
|
||||||
#define ADDR0_REG 0x0104
|
#define ADDR0_REG 0x0104
|
||||||
#define ADDR1_REG 0x0106
|
#define ADDR1_REG 0x0106
|
||||||
#define ADDR2_REG 0x0108
|
#define ADDR2_REG 0x0108
|
||||||
|
|
||||||
/* General Purpose Register */
|
/* General Purpose Register
|
||||||
/* BANK 1 */
|
* BANK 1
|
||||||
|
*/
|
||||||
|
|
||||||
#define GP_REG 0x010a
|
#define GP_REG 0x010a
|
||||||
|
|
||||||
/* Control Register */
|
/* Control Register
|
||||||
/* BANK 1 */
|
* BANK 1
|
||||||
|
*/
|
||||||
|
|
||||||
#define CTL_REG 0x010c
|
#define CTL_REG 0x010c
|
||||||
#define CTL_RCV_BAD 0x4000 /* When 1 bad CRC packets are received */
|
#define CTL_RCV_BAD 0x4000 /* When 1 bad CRC packets are received */
|
||||||
@ -189,8 +201,9 @@
|
|||||||
#define CTL_DEFAULT (CTL_AUTO_RELEASE)
|
#define CTL_DEFAULT (CTL_AUTO_RELEASE)
|
||||||
#define CTL_CLEAR 0
|
#define CTL_CLEAR 0
|
||||||
|
|
||||||
/* MMU Command Register */
|
/* MMU Command Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define MMU_CMD_REG 0x0200
|
#define MMU_CMD_REG 0x0200
|
||||||
#define MC_BUSY 1 /* When 1 the last release has not completed */
|
#define MC_BUSY 1 /* When 1 the last release has not completed */
|
||||||
@ -203,33 +216,38 @@
|
|||||||
#define MC_ENQUEUE (6<<5) /* Enqueue the packet for transmit */
|
#define MC_ENQUEUE (6<<5) /* Enqueue the packet for transmit */
|
||||||
#define MC_RSTTXFIFO (7<<5) /* Reset the TX FIFOs */
|
#define MC_RSTTXFIFO (7<<5) /* Reset the TX FIFOs */
|
||||||
|
|
||||||
/* Packet Number Register */
|
/* Packet Number Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define PN_REG 0x0202
|
#define PN_REG 0x0202
|
||||||
|
|
||||||
/* Allocation Result Register */
|
/* Allocation Result Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define AR_REG 0x0203
|
#define AR_REG 0x0203
|
||||||
#define AR_FAILED 0x80 /* Allocation Failed */
|
#define AR_FAILED 0x80 /* Allocation Failed */
|
||||||
|
|
||||||
/* TX FIFO Ports Register */
|
/* TX FIFO Ports Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define TXFIFO_REG 0x0204
|
#define TXFIFO_REG 0x0204
|
||||||
#define TXFIFO_TEMPTY 0x80 /* TX FIFO Empty */
|
#define TXFIFO_TEMPTY 0x80 /* TX FIFO Empty */
|
||||||
|
|
||||||
/* RX FIFO Ports Register */
|
/* RX FIFO Ports Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define RXFIFO_REG 0x0205
|
#define RXFIFO_REG 0x0205
|
||||||
#define RXFIFO_REMPTY 0x80 /* RX FIFO Empty */
|
#define RXFIFO_REMPTY 0x80 /* RX FIFO Empty */
|
||||||
|
|
||||||
#define FIFO_REG 0x0204
|
#define FIFO_REG 0x0204
|
||||||
|
|
||||||
/* Pointer Register */
|
/* Pointer Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define PTR_REG 0x0206
|
#define PTR_REG 0x0206
|
||||||
#define PTR_RCV 0x8000 /* 1=Receive area, 0=Transmit area */
|
#define PTR_RCV 0x8000 /* 1=Receive area, 0=Transmit area */
|
||||||
@ -237,18 +255,21 @@
|
|||||||
#define PTR_READ 0x2000 /* When 1 the operation is a read */
|
#define PTR_READ 0x2000 /* When 1 the operation is a read */
|
||||||
#define PTR_NOTEMPTY 0x0800 /* When 1 _do not_ write fifo DATA REG */
|
#define PTR_NOTEMPTY 0x0800 /* When 1 _do not_ write fifo DATA REG */
|
||||||
|
|
||||||
/* Data Register */
|
/* Data Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define DATA_REG 0x0208
|
#define DATA_REG 0x0208
|
||||||
|
|
||||||
/* Interrupt Status/Acknowledge Register */
|
/* Interrupt Status/Acknowledge Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define INT_REG 0x020c
|
#define INT_REG 0x020c
|
||||||
|
|
||||||
/* Interrupt Mask Register */
|
/* Interrupt Mask Register
|
||||||
/* BANK 2 */
|
* BANK 2
|
||||||
|
*/
|
||||||
|
|
||||||
#define IM_REG 0x020d
|
#define IM_REG 0x020d
|
||||||
#define IM_MDINT 0x80 /* PHY MI Register 18 Interrupt */
|
#define IM_MDINT 0x80 /* PHY MI Register 18 Interrupt */
|
||||||
@ -260,16 +281,18 @@
|
|||||||
#define IM_TX_INT 0x02 /* Transmit Interrupt */
|
#define IM_TX_INT 0x02 /* Transmit Interrupt */
|
||||||
#define IM_RCV_INT 0x01 /* Receive Interrupt */
|
#define IM_RCV_INT 0x01 /* Receive Interrupt */
|
||||||
|
|
||||||
/* Multicast Table Registers */
|
/* Multicast Table Registers
|
||||||
/* BANK 3 */
|
* BANK 3
|
||||||
|
*/
|
||||||
|
|
||||||
#define MCAST_REG1 0x0300
|
#define MCAST_REG1 0x0300
|
||||||
#define MCAST_REG2 0x0302
|
#define MCAST_REG2 0x0302
|
||||||
#define MCAST_REG3 0x0304
|
#define MCAST_REG3 0x0304
|
||||||
#define MCAST_REG4 0x0306
|
#define MCAST_REG4 0x0306
|
||||||
|
|
||||||
/* Management Interface Register (MII) */
|
/* Management Interface Register (MII)
|
||||||
/* BANK 3 */
|
* BANK 3
|
||||||
|
*/
|
||||||
|
|
||||||
#define MII_REG 0x0308
|
#define MII_REG 0x0308
|
||||||
#define MII_MSK_CRS100 0x4000 /* Disables CRS100 detection during tx half dup */
|
#define MII_MSK_CRS100 0x4000 /* Disables CRS100 detection during tx half dup */
|
||||||
@ -278,22 +301,25 @@
|
|||||||
#define MII_MDI 0x0002 /* MII Input, pin MDI */
|
#define MII_MDI 0x0002 /* MII Input, pin MDI */
|
||||||
#define MII_MDO 0x0001 /* MII Output, pin MDO */
|
#define MII_MDO 0x0001 /* MII Output, pin MDO */
|
||||||
|
|
||||||
/* Revision Register */
|
/* Revision Register
|
||||||
/* BANK 3 */
|
* BANK 3
|
||||||
/* ( hi: chip id low: rev # ) */
|
* ( hi: chip id low: rev # )
|
||||||
|
*/
|
||||||
|
|
||||||
#define REV_REG 0x030a
|
#define REV_REG 0x030a
|
||||||
|
|
||||||
/* Early RCV Register */
|
/* Early RCV Register
|
||||||
/* BANK 3 */
|
* BANK 3
|
||||||
/* this is NOT on SMC9192 */
|
* this is NOT on SMC9192
|
||||||
|
*/
|
||||||
|
|
||||||
#define ERCV_REG 0x030c
|
#define ERCV_REG 0x030c
|
||||||
#define ERCV_RCV_DISCRD 0x0080 /* When 1 discards a packet being received */
|
#define ERCV_RCV_DISCRD 0x0080 /* When 1 discards a packet being received */
|
||||||
#define ERCV_THRESHOLD 0x001f /* ERCV Threshold Mask */
|
#define ERCV_THRESHOLD 0x001f /* ERCV Threshold Mask */
|
||||||
|
|
||||||
/* External Register */
|
/* External Register
|
||||||
/* BANK 7 */
|
* BANK 7
|
||||||
|
*/
|
||||||
|
|
||||||
#define EXT_REG 0x0700
|
#define EXT_REG 0x0700
|
||||||
|
|
||||||
@ -305,8 +331,9 @@
|
|||||||
#define CHIP_91100FD 8
|
#define CHIP_91100FD 8
|
||||||
#define CHIP_91111FD 9
|
#define CHIP_91111FD 9
|
||||||
|
|
||||||
/* Transmit status bits */
|
/* Transmit status bits
|
||||||
/* Same as ES_xxx */
|
* Same as ES_xxx
|
||||||
|
*/
|
||||||
|
|
||||||
/* Transmit control bits */
|
/* Transmit control bits */
|
||||||
|
|
||||||
|
@ -90,7 +90,8 @@ static int uart_rpmsg_setup(FAR struct uart_dev_s *dev);
|
|||||||
static void uart_rpmsg_shutdown(FAR struct uart_dev_s *dev);
|
static void uart_rpmsg_shutdown(FAR struct uart_dev_s *dev);
|
||||||
static int uart_rpmsg_attach(FAR struct uart_dev_s *dev);
|
static int uart_rpmsg_attach(FAR struct uart_dev_s *dev);
|
||||||
static void uart_rpmsg_detach(FAR struct uart_dev_s *dev);
|
static void uart_rpmsg_detach(FAR struct uart_dev_s *dev);
|
||||||
static int uart_rpmsg_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
|
static int uart_rpmsg_ioctl(FAR struct file *filep,
|
||||||
|
int cmd, unsigned long arg);
|
||||||
static void uart_rpmsg_rxint(FAR struct uart_dev_s *dev, bool enable);
|
static void uart_rpmsg_rxint(FAR struct uart_dev_s *dev, bool enable);
|
||||||
static bool uart_rpmsg_rxflowcontrol(FAR struct uart_dev_s *dev,
|
static bool uart_rpmsg_rxflowcontrol(FAR struct uart_dev_s *dev,
|
||||||
unsigned int nbuffered, bool upper);
|
unsigned int nbuffered, bool upper);
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#define SYSLOG_RPMSG_RESUME 3
|
#define SYSLOG_RPMSG_RESUME 3
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
begin_packed_struct struct syslog_rpmsg_header_s
|
begin_packed_struct struct syslog_rpmsg_header_s
|
||||||
|
@ -146,8 +146,9 @@ static void syslog_rpmsg_ns_unbind(FAR struct rpmsg_endpoint *ept)
|
|||||||
kmm_free(priv);
|
kmm_free(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int syslog_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept, FAR void *data,
|
static int syslog_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept,
|
||||||
size_t len, uint32_t src, FAR void *priv_)
|
FAR void *data, size_t len,
|
||||||
|
uint32_t src, FAR void *priv_)
|
||||||
{
|
{
|
||||||
FAR struct syslog_rpmsg_server_s *priv = priv_;
|
FAR struct syslog_rpmsg_server_s *priv = priv_;
|
||||||
FAR struct syslog_rpmsg_header_s *header = data;
|
FAR struct syslog_rpmsg_header_s *header = data;
|
||||||
@ -168,7 +169,8 @@ static int syslog_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept, FAR void *data,
|
|||||||
|
|
||||||
if (priv->nextpos)
|
if (priv->nextpos)
|
||||||
{
|
{
|
||||||
syslog_rpmsg_write(priv->tmpbuf, priv->nextpos, msg->data, printed);
|
syslog_rpmsg_write(priv->tmpbuf, priv->nextpos,
|
||||||
|
msg->data, printed);
|
||||||
priv->nextpos = 0;
|
priv->nextpos = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -331,8 +331,8 @@ int up_alarm_cancel(FAR struct timespec *ts)
|
|||||||
* Provided by platform-specific code and called from the RTOS base code.
|
* Provided by platform-specific code and called from the RTOS base code.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* ts - The time in the future at the alarm is expected to occur. When
|
* ts - The time in the future at the alarm is expected to occur. When the
|
||||||
* the alarm occurs the timer logic will call nxsched_alarm_expiration().
|
* alarm occurs the timer logic will call nxsched_alarm_expiration().
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
@ -60,15 +60,15 @@ void up_rtc_set_lowerhalf(FAR struct rtc_lowerhalf_s *lower)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_rtc_time
|
* Name: up_rtc_time
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get the current time in seconds. This is similar to the standard time()
|
* Get the current time in seconds. This is similar to the standard time()
|
||||||
* function. This interface is only required if the low-resolution RTC/counter
|
* function. This interface is only required if the low-resolution RTC/
|
||||||
* hardware implementation selected. It is only used by the RTOS during
|
* counter hardware implementation selected. It is only used by the RTOS
|
||||||
* initialization to set up the system time when CONFIG_RTC is set but neither
|
* during initialization to set up the system time when CONFIG_RTC is set
|
||||||
* CONFIG_RTC_HIRES nor CONFIG_RTC_DATETIME are set.
|
* but neither CONFIG_RTC_HIRES nor CONFIG_RTC_DATETIME are set.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
@ -76,7 +76,7 @@ void up_rtc_set_lowerhalf(FAR struct rtc_lowerhalf_s *lower)
|
|||||||
* Returned Value:
|
* Returned Value:
|
||||||
* The current time in seconds.
|
* The current time in seconds.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_RTC_HIRES
|
#ifndef CONFIG_RTC_HIRES
|
||||||
time_t up_rtc_time(void)
|
time_t up_rtc_time(void)
|
||||||
@ -97,13 +97,13 @@ time_t up_rtc_time(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_rtc_gettime
|
* Name: up_rtc_gettime
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get the current time from the high resolution RTC clock/counter. This interface
|
* Get the current time from the high resolution RTC clock/counter. This
|
||||||
* is only supported by the high-resolution RTC/counter hardware implementation.
|
* interface is only supported by the high-resolution RTC/counter hardware
|
||||||
* It is used to replace the system timer.
|
* implementation. It is used to replace the system timer.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* tp - The location to return the high resolution time value.
|
* tp - The location to return the high resolution time value.
|
||||||
@ -111,7 +111,7 @@ time_t up_rtc_time(void)
|
|||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure.
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_RTC_HIRES
|
#ifdef CONFIG_RTC_HIRES
|
||||||
int up_rtc_gettime(FAR struct timespec *tp)
|
int up_rtc_gettime(FAR struct timespec *tp)
|
||||||
@ -134,20 +134,20 @@ int up_rtc_gettime(FAR struct timespec *tp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_rtc_getdatetime
|
* Name: up_rtc_getdatetime
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get the current date and time from the date/time RTC. This interface
|
* Get the current date and time from the date/time RTC. This interface
|
||||||
* is only supported by the date/time RTC hardware implementation.
|
* is only supported by the date/time RTC hardware implementation.
|
||||||
* It is used to replace the system timer. It is only used by the RTOS during
|
* It is used to replace the system timer. It is only used by the RTOS
|
||||||
* initialization to set up the system time when CONFIG_RTC and CONFIG_RTC_DATETIME
|
* during initialization to set up the system time when CONFIG_RTC and
|
||||||
* are selected (and CONFIG_RTC_HIRES is not).
|
* CONFIG_RTC_DATETIME are selected (and CONFIG_RTC_HIRES is not).
|
||||||
*
|
*
|
||||||
* NOTE: Some date/time RTC hardware is capability of sub-second accuracy. That
|
* NOTE: Some date/time RTC hardware is capability of sub-second accuracy.
|
||||||
* sub-second accuracy is lost in this interface. However, since the system time
|
* That sub-second accuracy is lost in this interface. However, since the
|
||||||
* is reinitialized on each power-up/reset, there will be no timing inaccuracy in
|
* system time is reinitialized on each power-up/reset, there will be no
|
||||||
* the long run.
|
* timing inaccuracy in the long run.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* tp - The location to return the high resolution time value.
|
* tp - The location to return the high resolution time value.
|
||||||
@ -155,7 +155,7 @@ int up_rtc_gettime(FAR struct timespec *tp)
|
|||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure.
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_RTC_DATETIME
|
#ifdef CONFIG_RTC_DATETIME
|
||||||
int up_rtc_getdatetime(FAR struct tm *tp)
|
int up_rtc_getdatetime(FAR struct tm *tp)
|
||||||
@ -177,20 +177,20 @@ int up_rtc_getdatetime(FAR struct tm *tp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_rtc_getdatetime_with_subseconds
|
* Name: up_rtc_getdatetime_with_subseconds
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get the current date and time from the date/time RTC. This interface
|
* Get the current date and time from the date/time RTC. This interface
|
||||||
* is only supported by the date/time RTC hardware implementation.
|
* is only supported by the date/time RTC hardware implementation.
|
||||||
* It is used to replace the system timer. It is only used by the RTOS during
|
* It is used to replace the system timer. It is only used by the RTOS
|
||||||
* initialization to set up the system time when CONFIG_RTC and CONFIG_RTC_DATETIME
|
* during initialization to set up the system time when CONFIG_RTC and
|
||||||
* are selected (and CONFIG_RTC_HIRES is not).
|
* CONFIG_RTC_DATETIME are selected (and CONFIG_RTC_HIRES is not).
|
||||||
*
|
*
|
||||||
* NOTE: This interface exposes sub-second accuracy capability of RTC hardware.
|
* NOTE: This interface exposes sub-second accuracy capability of RTC
|
||||||
* This interface allow maintaining timing accuracy when system time needs constant
|
* hardware. This interface allow maintaining timing accuracy when system
|
||||||
* resynchronization with RTC, for example on MCU with low-power state that
|
* time needs constant resynchronization with RTC, for example on MCU with
|
||||||
* stop system timer.
|
* low-power state that stop system timer.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* tp - The location to return the high resolution time value.
|
* tp - The location to return the high resolution time value.
|
||||||
@ -199,7 +199,7 @@ int up_rtc_getdatetime(FAR struct tm *tp)
|
|||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno on failure
|
* Zero (OK) on success; a negated errno on failure
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_RTC_DATETIME) && defined(CONFIG_ARCH_HAVE_RTC_SUBSECONDS)
|
#if defined(CONFIG_RTC_DATETIME) && defined(CONFIG_ARCH_HAVE_RTC_SUBSECONDS)
|
||||||
int up_rtc_getdatetime_with_subseconds(FAR struct tm *tp, FAR long *nsec)
|
int up_rtc_getdatetime_with_subseconds(FAR struct tm *tp, FAR long *nsec)
|
||||||
@ -222,12 +222,12 @@ int up_rtc_getdatetime_with_subseconds(FAR struct tm *tp, FAR long *nsec)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_rtc_settime
|
* Name: up_rtc_settime
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the RTC to the provided time. All RTC implementations must be able to
|
* Set the RTC to the provided time. All RTC implementations must be able
|
||||||
* set their time based on a standard timespec.
|
* to set their time based on a standard timespec.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* tp - the time to use
|
* tp - the time to use
|
||||||
@ -235,7 +235,7 @@ int up_rtc_getdatetime_with_subseconds(FAR struct tm *tp, FAR long *nsec)
|
|||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure.
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int up_rtc_settime(FAR const struct timespec *tp)
|
int up_rtc_settime(FAR const struct timespec *tp)
|
||||||
{
|
{
|
||||||
|
@ -416,7 +416,7 @@ int up_timer_start(FAR const struct timespec *ts)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/********************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_critmon_*
|
* Name: up_critmon_*
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@ -433,7 +433,7 @@ int up_timer_start(FAR const struct timespec *ts)
|
|||||||
*
|
*
|
||||||
* The second interface simple converts an elapsed time into well known
|
* The second interface simple converts an elapsed time into well known
|
||||||
* units.
|
* units.
|
||||||
********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_CRITMONITOR
|
#ifdef CONFIG_SCHED_CRITMONITOR
|
||||||
uint32_t up_critmon_gettime(void)
|
uint32_t up_critmon_gettime(void)
|
||||||
|
@ -45,7 +45,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -132,7 +132,7 @@ void up_invalidate_icache_all(void);
|
|||||||
# define up_invalidate_icache_all()
|
# define up_invalidate_icache_all()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_enable_dcache
|
* Name: up_enable_dcache
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
|
@ -96,8 +96,8 @@ int up_relocateadd(FAR const Elf_Rela *rel,
|
|||||||
* size - The exception index section size.
|
* size - The exception index section size.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) if the initialization was successful. Otherwise, a negated errno
|
* Zero (OK) if the initialization was successful. Otherwise, a negated
|
||||||
* value indicating the cause of the failure.
|
* errno value indicating the cause of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ extern "C"
|
|||||||
|
|
||||||
struct partition_s
|
struct partition_s
|
||||||
{
|
{
|
||||||
char name[NAME_MAX+1];
|
char name[NAME_MAX + 1];
|
||||||
size_t index;
|
size_t index;
|
||||||
size_t firstblock;
|
size_t firstblock;
|
||||||
size_t nblocks;
|
size_t nblocks;
|
||||||
|
@ -269,7 +269,8 @@ static inline void list_delete(struct list_node *item)
|
|||||||
item->prev = item->next = 0;
|
item->prev = item->next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline FAR struct list_node *list_remove_head(FAR struct list_node *list)
|
static inline FAR struct list_node *
|
||||||
|
list_remove_head(FAR struct list_node *list)
|
||||||
{
|
{
|
||||||
if (list->next != list)
|
if (list->next != list)
|
||||||
{
|
{
|
||||||
@ -283,7 +284,8 @@ static inline FAR struct list_node *list_remove_head(FAR struct list_node *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline FAR struct list_node *list_remove_tail(FAR struct list_node *list)
|
static inline FAR struct list_node *
|
||||||
|
list_remove_tail(FAR struct list_node *list)
|
||||||
{
|
{
|
||||||
if (list->prev != list)
|
if (list->prev != list)
|
||||||
{
|
{
|
||||||
@ -297,7 +299,8 @@ static inline FAR struct list_node *list_remove_tail(FAR struct list_node *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline FAR struct list_node *list_peek_head(FAR struct list_node *list)
|
static inline FAR struct list_node *
|
||||||
|
list_peek_head(FAR struct list_node *list)
|
||||||
{
|
{
|
||||||
if (list->next != list)
|
if (list->next != list)
|
||||||
{
|
{
|
||||||
@ -309,7 +312,8 @@ static inline FAR struct list_node *list_peek_head(FAR struct list_node *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline FAR struct list_node *list_peek_tail(FAR struct list_node *list)
|
static inline FAR struct list_node *
|
||||||
|
list_peek_tail(FAR struct list_node *list)
|
||||||
{
|
{
|
||||||
if (list->prev != list)
|
if (list->prev != list)
|
||||||
{
|
{
|
||||||
@ -334,8 +338,8 @@ static inline FAR struct list_node *list_prev(FAR struct list_node *list,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline FAR struct list_node *list_prev_wrap(FAR struct list_node *list,
|
static inline FAR struct list_node *
|
||||||
FAR struct list_node *item)
|
list_prev_wrap(FAR struct list_node *list, FAR struct list_node *item)
|
||||||
{
|
{
|
||||||
if (item->prev != list)
|
if (item->prev != list)
|
||||||
{
|
{
|
||||||
@ -364,8 +368,8 @@ static inline FAR struct list_node *list_next(FAR struct list_node *list,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline FAR struct list_node *list_next_wrap(FAR struct list_node *list,
|
static inline FAR struct list_node *
|
||||||
FAR struct list_node *item)
|
list_next_wrap(FAR struct list_node *list, FAR struct list_node *item)
|
||||||
{
|
{
|
||||||
if (item->next != list)
|
if (item->next != list)
|
||||||
{
|
{
|
||||||
@ -399,4 +403,4 @@ static inline size_t list_length(FAR struct list_node *list)
|
|||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*__INCLUDE_NUTTX_LIST_H */
|
#endif /* __INCLUDE_NUTTX_LIST_H */
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#ifndef __INCLUDE_NUTTX_NET_LAN91C111_H
|
#ifndef __INCLUDE_NUTTX_NET_LAN91C111_H
|
||||||
#define __INCLUDE_NUTTX_NET_LAN91C111_H
|
#define __INCLUDE_NUTTX_NET_LAN91C111_H
|
||||||
|
|
||||||
/****************************************************************************'
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/****************************************************************************'
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -68,4 +68,4 @@ void rpmsg_unregister_callback(FAR void *priv,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_RPTUN */
|
#endif /* CONFIG_RPTUN */
|
||||||
#endif /*__INCLUDE_NUTTX_RPTUN_OPENAMP_H */
|
#endif /* __INCLUDE_NUTTX_RPTUN_OPENAMP_H */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/timers/arch_rtc.h
|
* include/nuttx/timers/arch_rtc.h
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __INCLUDE_NUTTX_TIMERS_ARCH_RTC_H
|
#ifndef __INCLUDE_NUTTX_TIMERS_ARCH_RTC_H
|
||||||
#define __INCLUDE_NUTTX_TIMERS_ARCH_RTC_H
|
#define __INCLUDE_NUTTX_TIMERS_ARCH_RTC_H
|
||||||
|
@ -53,7 +53,8 @@ int pthread_attr_getstack(FAR pthread_attr_t *attr,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
linfo("attr=0x%p stackaddr=0x%p stacksize=0x%p\n", attr, stackaddr, stacksize);
|
linfo("attr=0x%p stackaddr=0x%p stacksize=0x%p\n",
|
||||||
|
attr, stackaddr, stacksize);
|
||||||
|
|
||||||
if (!attr || !stackaddr || !stacksize)
|
if (!attr || !stackaddr || !stacksize)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,8 @@ int pthread_attr_setstack(FAR pthread_attr_t *attr,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
linfo("attr=0x%p stackaddr=0x%p stacksize=%ld\n", attr, stackaddr, stacksize);
|
linfo("attr=0x%p stackaddr=0x%p stacksize=%ld\n",
|
||||||
|
attr, stackaddr, stacksize);
|
||||||
|
|
||||||
if (!attr || !stackaddr || stacksize < PTHREAD_STACK_MIN)
|
if (!attr || !stackaddr || stacksize < PTHREAD_STACK_MIN)
|
||||||
{
|
{
|
||||||
|
@ -121,12 +121,12 @@ icmpv6_linkipaddr_8(FAR const void *mac_, net_ipv6addr_t ipaddr)
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Generate the device link scope ipv6 address as below:
|
* Generate the device link scope ipv6 address as below:
|
||||||
* 128 112 96 80 64 48 32 16
|
* 128 112 96 80 64 48 32 16
|
||||||
* ---- ---- ---- ---- ---- ---- ---- ----
|
* ---- ---- ---- ---- ---- ---- ---- ----
|
||||||
* fe80 0000 0000 0000 0000 00ff fe00 xx00 1-byte short address IEEE 48-bit MAC
|
* fe80 0000 0000 0000 0000 00ff fe00 xx00 1B short address IEEE 48b MAC
|
||||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
|
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2B short address IEEE 48b MAC
|
||||||
* fe80 0000 0000 0000 xxxx xxff fexx xxxx 6-byte normal address IEEE 48-bit MAC
|
* fe80 0000 0000 0000 xxxx xxff fexx xxxx 6B normal address IEEE 48b MAC
|
||||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
|
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8B extended address IEEE EUI-64
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* dev - The device driver structure containing the link layer address
|
* dev - The device driver structure containing the link layer address
|
||||||
|
@ -99,7 +99,8 @@ int ipv4_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||||||
#ifdef NET_TCP_HAVE_STACK
|
#ifdef NET_TCP_HAVE_STACK
|
||||||
case SOCK_STREAM:
|
case SOCK_STREAM:
|
||||||
{
|
{
|
||||||
FAR struct tcp_conn_s *tcp_conn = (FAR struct tcp_conn_s *)psock->s_conn;
|
FAR struct tcp_conn_s *tcp_conn =
|
||||||
|
(FAR struct tcp_conn_s *)psock->s_conn;
|
||||||
|
|
||||||
outaddr->sin_port = tcp_conn->rport; /* Already in network byte order */
|
outaddr->sin_port = tcp_conn->rport; /* Already in network byte order */
|
||||||
ripaddr = tcp_conn->u.ipv4.raddr;
|
ripaddr = tcp_conn->u.ipv4.raddr;
|
||||||
@ -110,7 +111,8 @@ int ipv4_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||||||
#ifdef NET_UDP_HAVE_STACK
|
#ifdef NET_UDP_HAVE_STACK
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
{
|
{
|
||||||
FAR struct udp_conn_s *udp_conn = (FAR struct udp_conn_s *)psock->s_conn;
|
FAR struct udp_conn_s *udp_conn =
|
||||||
|
(FAR struct udp_conn_s *)psock->s_conn;
|
||||||
|
|
||||||
outaddr->sin_port = udp_conn->rport; /* Already in network byte order */
|
outaddr->sin_port = udp_conn->rport; /* Already in network byte order */
|
||||||
ripaddr = udp_conn->u.ipv4.raddr;
|
ripaddr = udp_conn->u.ipv4.raddr;
|
||||||
|
@ -98,7 +98,8 @@ int ipv6_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||||||
#ifdef NET_TCP_HAVE_STACK
|
#ifdef NET_TCP_HAVE_STACK
|
||||||
case SOCK_STREAM:
|
case SOCK_STREAM:
|
||||||
{
|
{
|
||||||
FAR struct tcp_conn_s *tcp_conn = (FAR struct tcp_conn_s *)psock->s_conn;
|
FAR struct tcp_conn_s *tcp_conn =
|
||||||
|
(FAR struct tcp_conn_s *)psock->s_conn;
|
||||||
|
|
||||||
outaddr->sin6_port = tcp_conn->lport; /* Already in network byte order */
|
outaddr->sin6_port = tcp_conn->lport; /* Already in network byte order */
|
||||||
ripaddr = &tcp_conn->u.ipv6.raddr;
|
ripaddr = &tcp_conn->u.ipv6.raddr;
|
||||||
@ -109,7 +110,8 @@ int ipv6_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||||||
#ifdef NET_UDP_HAVE_STACK
|
#ifdef NET_UDP_HAVE_STACK
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
{
|
{
|
||||||
FAR struct udp_conn_s *udp_conn = (FAR struct udp_conn_s *)psock->s_conn;
|
FAR struct udp_conn_s *udp_conn =
|
||||||
|
(FAR struct udp_conn_s *)psock->s_conn;
|
||||||
|
|
||||||
outaddr->sin6_port = udp_conn->lport; /* Already in network byte order */
|
outaddr->sin6_port = udp_conn->lport; /* Already in network byte order */
|
||||||
ripaddr = &udp_conn->u.ipv6.raddr;
|
ripaddr = &udp_conn->u.ipv6.raddr;
|
||||||
|
@ -199,7 +199,8 @@ static int do_accept_request(FAR struct usrsock_conn_s *conn,
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
* psock Reference to the listening socket structure
|
* psock Reference to the listening socket structure
|
||||||
* addr Receives the address of the connecting client
|
* addr Receives the address of the connecting client
|
||||||
* addrlen Input: allocated size of 'addr', Return: returned size of 'addr'
|
* addrlen Input: allocated size of 'addr',
|
||||||
|
* Return: returned size of 'addr'
|
||||||
* newsock Location to return the accepted socket information.
|
* newsock Location to return the accepted socket information.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
|
@ -172,7 +172,7 @@ int usrsock_getpeername(FAR struct socket *psock,
|
|||||||
{
|
{
|
||||||
/* Invalid state or closed by daemon. */
|
/* Invalid state or closed by daemon. */
|
||||||
|
|
||||||
ninfo("usockid=%d; usrsock_getpeername() with uninitialized usrsock.\n",
|
ninfo("usockid=%d; usrsock_getpeername() with uninitialized usrsock\n",
|
||||||
conn->usockid);
|
conn->usockid);
|
||||||
|
|
||||||
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
|
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
|
||||||
|
@ -137,7 +137,7 @@ static int do_ioctl_request(FAR struct usrsock_conn_s *conn, int cmd,
|
|||||||
* Name: usrsock_ioctl
|
* Name: usrsock_ioctl
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The usrsock_ioctl() function performs network device specific operations.
|
* This function performs network device specific operations.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* psock A pointer to a NuttX-specific, internal socket structure
|
* psock A pointer to a NuttX-specific, internal socket structure
|
||||||
|
@ -76,9 +76,9 @@
|
|||||||
* to indicate the error.
|
* to indicate the error.
|
||||||
*
|
*
|
||||||
* EINVAL - The which argument does not correspond to an predefined ID.
|
* EINVAL - The which argument does not correspond to an predefined ID.
|
||||||
* EINVAL - A value structure specified a microsecond value less than zero or
|
* EINVAL - A value structure specified a microsecond value less than zero
|
||||||
* greater than or equal to 1000 million, and the it_value member of that
|
* or greater than or equal to 1000 million, and the it_value member of
|
||||||
* structure did not specify zero seconds and nanoseconds.
|
* that structure did not specify zero seconds and nanoseconds.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user