mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 14:41:29 +08:00
committed by
Masayuki Ishikawa
parent
9473434587
commit
151cf49562
@@ -121,6 +121,7 @@ static int nsh_sdmmc_initialize(void)
|
||||
ret);
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_bringup.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -76,11 +76,11 @@
|
||||
#include "lpc17_40_symtab.h"
|
||||
#include "lpc17_40_progmem.h"
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration *************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* PORT and SLOT number probably depend on the board configuration */
|
||||
|
||||
@@ -97,9 +97,9 @@
|
||||
# undef CONFIG_NSH_HAVEUSBDEV
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
*****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pnev5180b_bringup
|
||||
@@ -133,7 +133,8 @@ int pnev5180b_bringup(void)
|
||||
ret = nx_mount(NULL, "/bin", "binfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount the BIN filesystem: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount the BIN filesystem: %d\n",
|
||||
ret);
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
@@ -166,7 +167,8 @@ int pnev5180b_bringup(void)
|
||||
ret = lpc17_40_romfs_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: lpc17_40_romfs_initialize() failed: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: lpc17_40_romfs_initialize() failed: %d\n",
|
||||
ret);
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_romfs.c
|
||||
* This file provides contents of an optional ROMFS volume, mounted at boot.
|
||||
*
|
||||
@@ -39,7 +39,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ static int nsh_spifi_initialize(void)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SPFI_NXFFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(CONFIG_SPIFI_DEVNO, mtd);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -96,7 +96,7 @@ static int nsh_spifi_initialize(void)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SPFI_NXFFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(CONFIG_SPIFI_DEVNO, mtd);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -96,7 +96,7 @@ static int nsh_spifi_initialize(void)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SPFI_NXFFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(CONFIG_SPIFI_DEVNO, mtd);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -80,13 +80,13 @@ int sam_at25_automount(int minor)
|
||||
mtd = at25_initialize(spi);
|
||||
if (!mtd)
|
||||
{
|
||||
ferr("ERROR: Failed to bind SPI port %d to the AT25 FLASH driver\n");
|
||||
ferr("ERROR: Failed to bind SPI port %d to AT25 FLASH driver\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SAMA5D3XPLAINED_AT25_FTL)
|
||||
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(AT25_MINOR, mtd);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -95,13 +95,13 @@ int sam_at25_automount(int minor)
|
||||
mtd = at25_initialize(spi);
|
||||
if (!mtd)
|
||||
{
|
||||
ferr("ERROR: Failed to bind SPI port %d to the AT25 FLASH driver\n");
|
||||
ferr("ERROR: Failed to bind SPI port %d to AT25 FLASH driver\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SAMA5D3XPLAINED_AT25_FTL)
|
||||
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(AT25_MINOR, mtd);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -205,7 +205,7 @@ int sam_bringup(void)
|
||||
#ifdef CONFIG_SAMA5D4EK_HSMCI1_MOUNT
|
||||
else
|
||||
{
|
||||
/* REVISIT: A delay seems to be required here or the mount will fail. */
|
||||
/* REVISIT: A delay seems to be required here or the mount will fail */
|
||||
|
||||
/* Mount the volume on HSMCI1 */
|
||||
|
||||
|
||||
@@ -187,7 +187,8 @@ int sam_nand_automount(int minor)
|
||||
mtd = sam_nand_initialize(HSMC_CS3);
|
||||
if (!mtd)
|
||||
{
|
||||
ferr("ERROR: Failed to create the NAND driver on CS%d\n", HSMC_CS3);
|
||||
ferr("ERROR: Failed to create the NAND driver on CS%d\n",
|
||||
HSMC_CS3);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -220,6 +221,7 @@ int sam_nand_automount(int minor)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
/* AT24 Serial EEPROM
|
||||
*
|
||||
* A AT24C512 Serial EEPPROM was used for tested I2C. There are other I2C/TWI
|
||||
* devices on-board, but the serial EEPROM is the simplest test.
|
||||
* A AT24C512 Serial EEPPROM was used for tested I2C. There are other
|
||||
* I2C/TWI devices on-board, but the serial EEPROM is the simplest test.
|
||||
*
|
||||
* There is, however, no AT24 EEPROM on board the SAMA5D3x-EK: The Serial
|
||||
* EEPROM was mounted on an external adaptor board and connected to the
|
||||
@@ -121,7 +121,7 @@ int sam_at24_automount(int minor)
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SAMA5D3xEK_AT24_FTL)
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
finfo("Initialize the FTL layer to create /dev/mtdblock%d\n",
|
||||
AT24_MINOR);
|
||||
@@ -153,6 +153,7 @@ int sam_at24_automount(int minor)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we are initializeed */
|
||||
|
||||
initialized = true;
|
||||
|
||||
@@ -187,7 +187,8 @@ int sam_nand_automount(int minor)
|
||||
mtd = sam_nand_initialize(HSMC_CS3);
|
||||
if (!mtd)
|
||||
{
|
||||
ferr("ERROR: Failed to create the NAND driver on CS%d\n", HSMC_CS3);
|
||||
ferr("ERROR: Failed to create the NAND driver on CS%d\n",
|
||||
HSMC_CS3);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -220,6 +221,7 @@ int sam_nand_automount(int minor)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
|
||||
@@ -173,8 +173,8 @@ int at25_main(int argc, char *argv)
|
||||
fflush(stdout);
|
||||
|
||||
ret = hex2bin(&rawinstream.public, &memoutstream.public,
|
||||
(uint32_t)SAM_ISRAM_VSECTION,
|
||||
(uint32_t)(SAM_ISRAM_VSECTION + CONFIG_SAMA5D4EK_AT25_PROGSIZE),
|
||||
SAM_ISRAM_VSECTION,
|
||||
SAM_ISRAM_VSECTION + CONFIG_SAMA5D4EK_AT25_PROGSIZE,
|
||||
0);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -220,7 +220,7 @@ int sam_bringup(void)
|
||||
#ifdef CONFIG_SAMA5D4EK_HSMCI1_MOUNT
|
||||
else
|
||||
{
|
||||
/* REVISIT: A delay seems to be required here or the mount will fail. */
|
||||
/* REVISIT: A delay seems to be required here or the mount will fail */
|
||||
|
||||
/* Mount the volume on HSMCI1 */
|
||||
|
||||
|
||||
@@ -187,7 +187,8 @@ int sam_nand_automount(int minor)
|
||||
mtd = sam_nand_initialize(HSMC_CS3);
|
||||
if (!mtd)
|
||||
{
|
||||
ferr("ERROR: Failed to create the NAND driver on CS%d\n", HSMC_CS3);
|
||||
ferr("ERROR: Failed to create the NAND driver on CS%d\n",
|
||||
HSMC_CS3);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -220,6 +221,7 @@ int sam_nand_automount(int minor)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
|
||||
@@ -211,7 +211,7 @@ int sam_bringup(void)
|
||||
#ifdef CONFIG_SAME70XPLAINED_HSMCI0_MOUNT
|
||||
else
|
||||
{
|
||||
/* REVISIT: A delay seems to be required here or the mount will fail. */
|
||||
/* REVISIT: A delay seems to be required here or the mount will fail */
|
||||
|
||||
/* Mount the volume on HSMCI0 */
|
||||
|
||||
@@ -239,8 +239,8 @@ int sam_bringup(void)
|
||||
#ifdef HAVE_ROMFS
|
||||
/* Create a ROM disk for the /etc filesystem */
|
||||
|
||||
ret = romdisk_register(CONFIG_SAME70XPLAINED_ROMFS_ROMDISK_MINOR, romfs_img,
|
||||
NSECTORS(romfs_img_len),
|
||||
ret = romdisk_register(CONFIG_SAME70XPLAINED_ROMFS_ROMDISK_MINOR,
|
||||
romfs_img, NSECTORS(romfs_img_len),
|
||||
CONFIG_SAME70XPLAINED_ROMFS_ROMDISK_SECTSIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -280,7 +280,8 @@ int sam_bringup(void)
|
||||
ret = ftl_initialize(PROGMEM_MTD_MINOR, mtd);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize the FTL layer: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize the FTL layer: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -294,7 +295,8 @@ int sam_bringup(void)
|
||||
ret = bchdev_register(blockdev, chardev, false);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: bchdev_register %s failed: %d\n", chardev, ret);
|
||||
syslog(LOG_ERR, "ERROR: bchdev_register %s failed: %d\n",
|
||||
chardev, ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -320,7 +320,7 @@ int sam_bringup(void)
|
||||
#ifdef CONFIG_SAMV71XULT_HSMCI0_MOUNT
|
||||
else
|
||||
{
|
||||
/* REVISIT: A delay seems to be required here or the mount will fail. */
|
||||
/* REVISIT: A delay seems to be required here or the mount will fail */
|
||||
|
||||
/* Mount the volume on HSMCI0 */
|
||||
|
||||
|
||||
@@ -138,7 +138,8 @@ int stm32_bringup(void)
|
||||
ret = stm32_mrf24j40_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_mrf24j40_initialize() failed: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: stm32_mrf24j40_initialize() failed: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -159,7 +160,8 @@ int stm32_bringup(void)
|
||||
ret = stm32_automount_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_automount_initialize() failed: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: stm32_automount_initialize() failed: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Can't support the W25 device if it SPI1 or W25 support is not enabled */
|
||||
|
||||
#define HAVE_W25 1
|
||||
@@ -120,7 +121,7 @@ int stm32_w25initialize(int minor)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_FS_NXFFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(minor, mtd);
|
||||
if (ret < 0)
|
||||
@@ -149,5 +150,6 @@ int stm32_w25initialize(int minor)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Can't support the W25 device if it SPI1 or W25 support is not enabled */
|
||||
|
||||
#define HAVE_W25 1
|
||||
@@ -119,7 +120,7 @@ int stm32_w25initialize(int minor)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_FS_NXFFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(minor, mtd);
|
||||
if (ret < 0)
|
||||
@@ -148,5 +149,6 @@ int stm32_w25initialize(int minor)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y && CONFIG_NSH_ARCHINIT:
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y &&
|
||||
* CONFIG_NSH_ARCHINIT:
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y && CONFIG_NSH_ARCHINIT:
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y &&
|
||||
* CONFIG_NSH_ARCHINIT:
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -234,7 +234,6 @@ int stm32_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
/* Register the LED driver */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32/omnibusf4/src/stm32_romfs_initialize.c
|
||||
* This file provides contents of an optional ROMFS volume, mounted at boot.
|
||||
*
|
||||
@@ -34,7 +34,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Can't support the W25 device if it SPI1 or W25 support is not enabled */
|
||||
|
||||
#define HAVE_W25 1
|
||||
@@ -120,7 +121,7 @@ int stm32_w25initialize(int minor)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_FS_NXFFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(minor, mtd);
|
||||
if (ret < 0)
|
||||
@@ -149,5 +150,6 @@ int stm32_w25initialize(int minor)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -96,8 +96,8 @@
|
||||
#define HAVE_USBHOST 1
|
||||
#define HAVE_RTC_DRIVER 1
|
||||
|
||||
/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
|
||||
* is not enabled.
|
||||
/* Can't support MMC/SD features if mountpoints are disabled or if SDIO
|
||||
* support is not enabled.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO)
|
||||
@@ -287,7 +287,7 @@ int stm32_bringup(void)
|
||||
if (!mtd)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to bind SPI port 0 to the SPI FLASH driver\n");
|
||||
"ERROR: Failed to bind SPI port 0 to SPI FLASH driver\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,6 +296,7 @@ int stm32_bringup(void)
|
||||
|
||||
#ifdef HAVE_MMCSD
|
||||
/* Mount the SDIO-based MMC/SD block driver */
|
||||
|
||||
/* First, get an instance of the SDIO interface */
|
||||
|
||||
sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
|
||||
|
||||
@@ -103,9 +103,10 @@ int stm32_at24_automount(int minor)
|
||||
}
|
||||
|
||||
#if defined(CONFIG_STM32F103MINIMUM_AT24_FTL)
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
finfo("Initialize the FTL layer to create /dev/mtdblock%d\n", AT24_MINOR);
|
||||
finfo("Initialize the FTL layer to create /dev/mtdblock%d\n",
|
||||
AT24_MINOR);
|
||||
ret = ftl_initialize(AT24_MINOR, mtd);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -134,6 +135,7 @@ int stm32_at24_automount(int minor)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
/* Non-standard debug that may be enabled just for testing the watchdog
|
||||
* timer
|
||||
*/
|
||||
@@ -68,6 +69,7 @@
|
||||
#define W25_SPI_PORT 1
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Can't support the W25 device if it SPI1 or W25 support is not enabled */
|
||||
|
||||
#define HAVE_W25 1
|
||||
@@ -131,7 +133,7 @@ int stm32_w25initialize(int minor)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_FS_SMARTFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(minor, mtd);
|
||||
if (ret < 0)
|
||||
@@ -152,122 +154,126 @@ int stm32_w25initialize(int minor)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_STM32F103MINIMUM_FLASH_PART
|
||||
{
|
||||
int partno;
|
||||
int partsize;
|
||||
int partoffset;
|
||||
int partszbytes;
|
||||
int erasesize;
|
||||
const char *partstring = CONFIG_STM32F103MINIMUM_FLASH_PART_LIST;
|
||||
const char *ptr;
|
||||
FAR struct mtd_dev_s *mtd_part;
|
||||
char partref[4];
|
||||
{
|
||||
int partno;
|
||||
int partsize;
|
||||
int partoffset;
|
||||
int partszbytes;
|
||||
int erasesize;
|
||||
const char *partstring = CONFIG_STM32F103MINIMUM_FLASH_PART_LIST;
|
||||
const char *ptr;
|
||||
FAR struct mtd_dev_s *mtd_part;
|
||||
char partref[4];
|
||||
|
||||
/* Now create a partition on the FLASH device */
|
||||
/* Now create a partition on the FLASH device */
|
||||
|
||||
partno = 0;
|
||||
ptr = partstring;
|
||||
partoffset = 0;
|
||||
partno = 0;
|
||||
ptr = partstring;
|
||||
partoffset = 0;
|
||||
|
||||
/* Get the Flash erase size */
|
||||
/* Get the Flash erase size */
|
||||
|
||||
erasesize = geo.erasesize;
|
||||
erasesize = geo.erasesize;
|
||||
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/* Get the partition size */
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/* Get the partition size */
|
||||
|
||||
partsize = atoi(ptr);
|
||||
partszbytes = (partsize << 10); /* partsize is defined in KB */
|
||||
partsize = atoi(ptr);
|
||||
partszbytes = (partsize << 10); /* partsize is defined in KB */
|
||||
|
||||
/* Check if partition size is bigger then erase block */
|
||||
/* Check if partition size is bigger then erase block */
|
||||
|
||||
if (partszbytes < erasesize)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Partition size is lesser than erasesize!\n");
|
||||
return -1;
|
||||
}
|
||||
if (partszbytes < erasesize)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Partition size is lesser than erasesize!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check if partition size is multiple of erase block */
|
||||
/* Check if partition size is multiple of erase block */
|
||||
|
||||
if ( (partszbytes % erasesize) != 0 )
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Partition size is not multiple of erasesize!\n");
|
||||
return -1;
|
||||
}
|
||||
if ((partszbytes % erasesize) != 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Partition size isn't multiple of erasesize!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
mtd_part = mtd_partition(mtd, partoffset, partszbytes/ erasesize);
|
||||
partoffset += partszbytes / erasesize;
|
||||
mtd_part = mtd_partition(mtd, partoffset, partszbytes / erasesize);
|
||||
partoffset += partszbytes / erasesize;
|
||||
|
||||
#ifdef CONFIG_STM32F103MINIMUM_FLASH_CONFIG_PART
|
||||
/* Test if this is the config partition */
|
||||
/* Test if this is the config partition */
|
||||
|
||||
if (CONFIG_STM32F103MINIMUM_FLASH_CONFIG_PART_NUMBER == partno)
|
||||
{
|
||||
/* Register the partition as the config device */
|
||||
if (CONFIG_STM32F103MINIMUM_FLASH_CONFIG_PART_NUMBER == partno)
|
||||
{
|
||||
/* Register the partition as the config device */
|
||||
|
||||
mtdconfig_register(mtd_part);
|
||||
}
|
||||
else
|
||||
mtdconfig_register(mtd_part);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Now initialize a SMART Flash block device and bind it
|
||||
* to the MTD device.
|
||||
*/
|
||||
{
|
||||
/* Now initialize a SMART Flash block device and bind it
|
||||
* to the MTD device.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
|
||||
sprintf(partref, "p%d", partno);
|
||||
smart_initialize(CONFIG_STM32F103MINIMUM_FLASH_MINOR, mtd_part, partref);
|
||||
sprintf(partref, "p%d", partno);
|
||||
smart_initialize(CONFIG_STM32F103MINIMUM_FLASH_MINOR,
|
||||
mtd_part, partref);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the partition name */
|
||||
/* Set the partition name */
|
||||
|
||||
#if defined(CONFIG_MTD_PARTITION_NAMES)
|
||||
if (!mtd_part)
|
||||
{
|
||||
syslog(LOG_ERR, "Error: failed to create partition %s\n", partname);
|
||||
return -1;
|
||||
}
|
||||
if (!mtd_part)
|
||||
{
|
||||
syslog(LOG_ERR, "Error: failed to create partition %s\n",
|
||||
partname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mtd_setpartitionname(mtd_part, partname);
|
||||
mtd_setpartitionname(mtd_part, partname);
|
||||
|
||||
/* Now skip to next name. We don't need to split the string here
|
||||
* because the MTD partition logic will only display names up to
|
||||
* the comma, thus allowing us to use a single static name
|
||||
* in the code.
|
||||
*/
|
||||
/* Now skip to next name. We don't need to split the string here
|
||||
* because the MTD partition logic will only display names up to
|
||||
* the comma, thus allowing us to use a single static name
|
||||
* in the code.
|
||||
*/
|
||||
|
||||
while (*partname != ',' && *partname != '\0')
|
||||
{
|
||||
/* Skip to next ',' */
|
||||
while (*partname != ',' && *partname != '\0')
|
||||
{
|
||||
/* Skip to next ',' */
|
||||
|
||||
partname++;
|
||||
}
|
||||
partname++;
|
||||
}
|
||||
|
||||
if (*partname == ',')
|
||||
{
|
||||
partname++;
|
||||
}
|
||||
if (*partname == ',')
|
||||
{
|
||||
partname++;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update the pointer to point to the next size in the list */
|
||||
/* Update the pointer to point to the next size in the list */
|
||||
|
||||
while ((*ptr >= '0') && (*ptr <= '9'))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
while ((*ptr >= '0') && (*ptr <= '9'))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (*ptr == ',')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
if (*ptr == ',')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
/* Increment the part number */
|
||||
/* Increment the part number */
|
||||
|
||||
partno++;
|
||||
}
|
||||
}
|
||||
partno++;
|
||||
}
|
||||
}
|
||||
#else /* CONFIG_STM32F103MINIMUM_FLASH_PART */
|
||||
|
||||
/* Configure the device with no partition support */
|
||||
|
||||
@@ -74,8 +74,8 @@ int stm32_bringup(void)
|
||||
int ret = OK;
|
||||
|
||||
#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
|
||||
/* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
|
||||
* will monitor for USB connection and disconnection events.
|
||||
/* Initialize USB host operation. stm32_usbhost_initialize() starts
|
||||
* a thread will monitor for USB connection and disconnection events.
|
||||
*/
|
||||
|
||||
ret = stm32_usbhost_initialize();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32/stm32f4discovery/src/stm32_romfs_initialize.c
|
||||
* This file provides contents of an optional ROMFS volume, mounted at boot.
|
||||
*
|
||||
@@ -34,7 +34,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -82,7 +82,8 @@ int stm32_bringup(void)
|
||||
ret = stm32_lpwaninitialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize wireless driver: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize wireless driver: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif /* CONFIG_LPWAN_SX127X */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32f7/nucleo-144/src/stm32_romfs_initialize.c
|
||||
* This file provides contents of an optional ROMFS volume, mounted at boot.
|
||||
*
|
||||
@@ -34,7 +34,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -65,10 +65,10 @@
|
||||
* Name: stm32l4_bringup
|
||||
*
|
||||
* Description:
|
||||
* Called either by board_initialize() if CONFIG_BOARD_LATE_INITIALIZE or by
|
||||
* board_app_initialize if CONFIG_LIB_BOARDCTL is selected. This function
|
||||
* initializes and configures all on-board features appropriate for the
|
||||
* selected configuration.
|
||||
* Called either by board_initialize() if CONFIG_BOARD_LATE_INITIALIZE or
|
||||
* by board_app_initialize if CONFIG_LIB_BOARDCTL is selected. This
|
||||
* function initializes and configures all on-board features appropriate
|
||||
* for the selected configuration.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -104,131 +104,134 @@ int stm32l4_bringup(void)
|
||||
#endif /* CONFIG_USERLED && !CONFIG_ARCH_LEDS */
|
||||
|
||||
#ifdef HAVE_MX25R6435F
|
||||
{
|
||||
/* Create an instance of the STM32L4 QSPI device driver */
|
||||
{
|
||||
/* Create an instance of the STM32L4 QSPI device driver */
|
||||
|
||||
FAR struct qspi_dev_s *g_qspi;
|
||||
FAR struct mtd_dev_s *g_mtd_fs;
|
||||
FAR struct qspi_dev_s *g_qspi;
|
||||
FAR struct mtd_dev_s *g_mtd_fs;
|
||||
|
||||
g_qspi = stm32l4_qspi_initialize(0);
|
||||
if (g_qspi == NULL)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32l4_qspi_initialize failed\n");
|
||||
return -EIO;
|
||||
}
|
||||
g_qspi = stm32l4_qspi_initialize(0);
|
||||
if (g_qspi == NULL)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32l4_qspi_initialize failed\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* Use the QSPI device instance to initialize the
|
||||
* MX25R6435F flash device.
|
||||
*/
|
||||
/* Use the QSPI device instance to initialize the
|
||||
* MX25R6435F flash device.
|
||||
*/
|
||||
|
||||
g_mtd_fs = mx25rxx_initialize(g_qspi, true);
|
||||
if (!g_mtd_fs)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: mx25rxx_initialize failed\n");
|
||||
return -EIO;
|
||||
}
|
||||
g_mtd_fs = mx25rxx_initialize(g_qspi, true);
|
||||
if (!g_mtd_fs)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: mx25rxx_initialize failed\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_B_L475E_IOT01A_MTD_PART
|
||||
{
|
||||
/* Create partitions on external flash memory */
|
||||
{
|
||||
/* Create partitions on external flash memory */
|
||||
|
||||
int partno;
|
||||
int partsize;
|
||||
int partoffset;
|
||||
int partszbytes;
|
||||
int erasesize;
|
||||
FAR struct mtd_geometry_s geo;
|
||||
const char *ptr = CONFIG_B_L475E_IOT01A_MTD_PART_LIST;
|
||||
FAR struct mtd_dev_s *mtd_part;
|
||||
char partref[4];
|
||||
int partno;
|
||||
int partsize;
|
||||
int partoffset;
|
||||
int partszbytes;
|
||||
int erasesize;
|
||||
FAR struct mtd_geometry_s geo;
|
||||
const char *ptr = CONFIG_B_L475E_IOT01A_MTD_PART_LIST;
|
||||
FAR struct mtd_dev_s *mtd_part;
|
||||
char partref[4];
|
||||
|
||||
/* Now create a partition on the FLASH device */
|
||||
/* Now create a partition on the FLASH device */
|
||||
|
||||
partno = 0;
|
||||
partoffset = 0;
|
||||
partno = 0;
|
||||
partoffset = 0;
|
||||
|
||||
/* Query MTD geometry */
|
||||
/* Query MTD geometry */
|
||||
|
||||
ret = MTD_IOCTL(g_mtd_fs, MTDIOC_GEOMETRY,
|
||||
(unsigned long)(uintptr_t)&geo);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: MTDIOC_GEOMETRY failed\n");
|
||||
return ret;
|
||||
}
|
||||
ret = MTD_IOCTL(g_mtd_fs, MTDIOC_GEOMETRY,
|
||||
(unsigned long)(uintptr_t)&geo);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: MTDIOC_GEOMETRY failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get the Flash erase size */
|
||||
/* Get the Flash erase size */
|
||||
|
||||
erasesize = geo.erasesize;
|
||||
erasesize = geo.erasesize;
|
||||
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/* Get the partition size */
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/* Get the partition size */
|
||||
|
||||
partsize = atoi(ptr);
|
||||
if (partsize <= 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Error while processing <%s>\n", ptr);
|
||||
goto process_next_part;
|
||||
}
|
||||
partsize = atoi(ptr);
|
||||
if (partsize <= 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Error while processing <%s>\n", ptr);
|
||||
goto process_next_part;
|
||||
}
|
||||
|
||||
partszbytes = (partsize << 10); /* partsize is defined in KB */
|
||||
partszbytes = (partsize << 10); /* partsize is defined in KB */
|
||||
|
||||
if ((partszbytes < erasesize) || ((partszbytes % erasesize) != 0))
|
||||
{
|
||||
syslog(LOG_ERR, "Invalid partition size: %d bytes\n",
|
||||
partszbytes);
|
||||
partszbytes = (partszbytes+erasesize) & -erasesize;
|
||||
}
|
||||
if (partszbytes < erasesize || (partszbytes % erasesize) != 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Invalid partition size: %d bytes\n",
|
||||
partszbytes);
|
||||
partszbytes = (partszbytes + erasesize) & -erasesize;
|
||||
}
|
||||
|
||||
mtd_part = mtd_partition(g_mtd_fs, partoffset,
|
||||
partszbytes / geo.blocksize);
|
||||
partoffset += partszbytes / geo.blocksize;
|
||||
mtd_part = mtd_partition(g_mtd_fs, partoffset,
|
||||
partszbytes / geo.blocksize);
|
||||
partoffset += partszbytes / geo.blocksize;
|
||||
|
||||
if (!mtd_part)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to create part %d, size=%d\n",
|
||||
partno, partsize);
|
||||
goto process_next_part;
|
||||
}
|
||||
if (!mtd_part)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to create part %d, size=%d\n",
|
||||
partno, partsize);
|
||||
goto process_next_part;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
|
||||
/* Now initialize a SMART Flash block device and bind it to the MTD
|
||||
* device */
|
||||
/* Now initialize a SMART Flash block device and bind it to
|
||||
* the MTD device
|
||||
*/
|
||||
|
||||
sprintf(partref, "p%d", partno);
|
||||
smart_initialize(CONFIG_B_L475E_IOT01A_MTD_FLASH_MINOR,
|
||||
mtd_part, partref);
|
||||
sprintf(partref, "p%d", partno);
|
||||
smart_initialize(CONFIG_B_L475E_IOT01A_MTD_FLASH_MINOR,
|
||||
mtd_part, partref);
|
||||
#endif
|
||||
|
||||
process_next_part:
|
||||
/* Update the pointer to point to the next size in the list */
|
||||
process_next_part:
|
||||
|
||||
while ((*ptr >= '0') && (*ptr <= '9'))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
/* Update the pointer to point to the next size in the list */
|
||||
|
||||
if (*ptr == ',')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
while ((*ptr >= '0') && (*ptr <= '9'))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
/* Increment the part number */
|
||||
if (*ptr == ',')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
partno++;
|
||||
}
|
||||
}
|
||||
/* Increment the part number */
|
||||
|
||||
partno++;
|
||||
}
|
||||
}
|
||||
#else /* CONFIG_B_L475E_IOT01A_MTD_PART */
|
||||
|
||||
#ifdef HAVE_MX25R6435F_SMARTFS
|
||||
/* Configure the device with no partition support */
|
||||
|
||||
smart_initialize(CONFIG_B_L475E_IOT01A_MTD_FLASH_MINOR, g_mtd_fs, NULL);
|
||||
smart_initialize(CONFIG_B_L475E_IOT01A_MTD_FLASH_MINOR,
|
||||
g_mtd_fs, NULL);
|
||||
#endif /* HAVE_MX25R6435F_SMARTFS */
|
||||
|
||||
#endif /* CONFIG_B_L475E_IOT01A_MTD_PART */
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_MX25R6435F */
|
||||
|
||||
#ifdef HAVE_SPSGRF
|
||||
@@ -237,17 +240,19 @@ process_next_part:
|
||||
ret = stm32l4_spirit_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32l4_spirit_initialize() failed: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: stm32l4_spirit_initialize() failed: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TIMER
|
||||
/* Register timer drivers */
|
||||
/* Register timer drivers */
|
||||
|
||||
ret = stm32l4_timer_driver_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to setup TIM1 at /dev/timer0: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: Failed to setup TIM1 at /dev/timer0: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*******************************************************************************
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l4/nucleo-l432kc/src/stm32_at45.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
******************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -51,31 +51,31 @@
|
||||
|
||||
#include "stm32l4_spi.h"
|
||||
|
||||
/*******************************************************************************
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
******************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_STM32L4_SPI1
|
||||
# error "AT45DB driver requires CONFIG_STM32_SPI1 to be enabled"
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Private Definitions
|
||||
******************************************************************************/
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
static const int AT45DB_SPI_PORT = 1; /* AT45DB is connected to SPI1 port */
|
||||
|
||||
/*******************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
******************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: stm32_at45dbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and configure the AT45DB SPI Serial Flash Memory
|
||||
*
|
||||
******************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_at45dbinitialize(int minor)
|
||||
{
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
#endif
|
||||
|
||||
/* Internal reference voltage calibration value locations. Taken from
|
||||
* https://github.com/micropython/micropython/commit/87215a0f0480dd0324a1b9c1d3fc3a5c2806249d
|
||||
* https://github.com/micropython/micropython/commit/87215a0f0480dd0324a1b9c1
|
||||
*
|
||||
* F0 value from DM00115237 Rev 4 p. 19. for STM32F091xB and STM32F091xC
|
||||
*
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
***************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -98,19 +98,19 @@ static void stm32_i2c_register(int bus)
|
||||
|
||||
i2c = stm32l4_i2cbus_initialize(bus);
|
||||
if (i2c == NULL)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = i2c_register(i2c, bus);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n",
|
||||
bus, ret);
|
||||
stm32l4_i2cbus_uninitialize(i2c);
|
||||
syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = i2c_register(i2c, bus);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n",
|
||||
bus, ret);
|
||||
stm32l4_i2cbus_uninitialize(i2c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -292,7 +292,7 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize MMC and register the MMC driver. */
|
||||
/* Initialize MMC and register the MMC driver. */
|
||||
|
||||
#ifdef HAVE_MMCSD_SPI
|
||||
ret = stm32l4_mmcsd_initialize(MMCSD_MINOR);
|
||||
|
||||
@@ -53,19 +53,19 @@
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
***************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_STM32L4_I2C1)
|
||||
struct i2c_master_s* i2c1;
|
||||
struct i2c_master_s *i2c1;
|
||||
#endif
|
||||
#if defined(CONFIG_STM32L4_I2C2)
|
||||
struct i2c_master_s* i2c2;
|
||||
struct i2c_master_s *i2c2;
|
||||
#endif
|
||||
#if defined(CONFIG_STM32L4_I2C3)
|
||||
struct i2c_master_s* i2c3;
|
||||
struct i2c_master_s *i2c3;
|
||||
#endif
|
||||
#if defined(CONFIG_STM32L4_I2C4)
|
||||
struct i2c_master_s* i2c4;
|
||||
struct i2c_master_s *i2c4;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -166,7 +166,8 @@ int board_app_initialize(uintptr_t arg)
|
||||
ret = stm32_spidev_bus_test();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SPI interfaces: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SPI interfaces: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2017-2018 Haltian Ltd. All rights reserved.
|
||||
@@ -61,9 +61,9 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* STM32 chip specific calibration values *******************************************/
|
||||
/* STM32 chip specific calibration values ***********************************/
|
||||
|
||||
/* Voltage used for calibration of internal analog reference voltage (Vrefint) */
|
||||
/* Voltage used for calibration of internal analog reference voltage */
|
||||
|
||||
#if defined(CONFIG_ARCH_CHIP_STM32F7) \
|
||||
|| defined(CONFIG_ARCH_CHIP_STM32F4) \
|
||||
@@ -74,7 +74,7 @@
|
||||
#endif
|
||||
|
||||
/* Internal reference voltage calibration value locations. Taken from
|
||||
* https://github.com/micropython/micropython/commit/87215a0f0480dd0324a1b9c1d3fc3a5c2806249d
|
||||
* https://github.com/micropython/micropython/commit/87215a0f0480dd0324a1b9c1
|
||||
*
|
||||
* F0 value from DM00115237 Rev 4 p. 19. for STM32F091xB and STM32F091xC
|
||||
*
|
||||
@@ -110,7 +110,7 @@
|
||||
# define STM32_TSENSE_TSCAL2 (*(int16_t *)((uint32_t)0x1fff75ca))
|
||||
#endif
|
||||
|
||||
/* Configuration ********************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* These are internal to STM32L4 */
|
||||
|
||||
@@ -146,9 +146,9 @@ static const uint8_t g_chanlist[ADC1_NCHANNELS] =
|
||||
|
||||
static const uint32_t g_pinlist[ADC1_NCHANNELS] =
|
||||
{
|
||||
0xffffffffU,
|
||||
0xffffffffU,
|
||||
0xffffffffU,
|
||||
0xffffffffu,
|
||||
0xffffffffu,
|
||||
0xffffffffu,
|
||||
GPIO_MEASURE_ADC,
|
||||
};
|
||||
|
||||
@@ -164,9 +164,10 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *vext)
|
||||
int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat,
|
||||
uint32_t *vext)
|
||||
{
|
||||
struct adc_msg_s sample[ADC1_NCHANNELS] = { 0 };
|
||||
struct adc_msg_s sample[ADC1_NCHANNELS];
|
||||
FAR struct file filestruct;
|
||||
ssize_t nbytes;
|
||||
int nsamples;
|
||||
@@ -223,7 +224,7 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
|
||||
for (i = 0; i < nsamples ; i++)
|
||||
{
|
||||
ainfo("%d: channel: %d value: %d\n",
|
||||
i+1, sample[i].am_channel, sample[i].am_data);
|
||||
i + 1, sample[i].am_channel, sample[i].am_data);
|
||||
|
||||
/* Add the raw value to entropy pool. */
|
||||
|
||||
@@ -232,9 +233,11 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
|
||||
switch (sample[i].am_channel)
|
||||
{
|
||||
case ADC1_INTERNAL_VREFINT_CHANNEL:
|
||||
/* Calculate corrected Vrefint with factory calibration value. */
|
||||
|
||||
*vrefint = STM32_VREFINT_MVOLTS * STM32_VREFINT_CAL / sample[i].am_data;
|
||||
/* Calculate corrected Vrefint with factory value. */
|
||||
|
||||
*vrefint = STM32_VREFINT_MVOLTS * STM32_VREFINT_CAL /
|
||||
sample[i].am_data;
|
||||
ainfo("VREFINT: %d -> %u mV\n", sample[i].am_data, *vrefint);
|
||||
break;
|
||||
|
||||
@@ -243,8 +246,9 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
|
||||
* so it does not matter much if we use integer type here.
|
||||
*/
|
||||
|
||||
tsense = (110 - 30) * (sample[i].am_data - STM32_TSENSE_TSCAL1)
|
||||
/ (STM32_TSENSE_TSCAL2 - STM32_TSENSE_TSCAL1) + 30;
|
||||
tsense = 30 + (110 - 30) *
|
||||
(sample[i].am_data - STM32_TSENSE_TSCAL1) /
|
||||
(STM32_TSENSE_TSCAL2 - STM32_TSENSE_TSCAL1);
|
||||
ainfo("TSENSE: %d -> %d °C\n", sample[i].am_data, tsense);
|
||||
UNUSED(tsense);
|
||||
break;
|
||||
@@ -260,7 +264,8 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
|
||||
break;
|
||||
|
||||
default:
|
||||
aerr("ERROR: ADC got value from unknown channel %d\n", sample[i].am_channel);
|
||||
aerr("ERROR: ADC got value from unknown channel %d\n",
|
||||
sample[i].am_channel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -283,19 +288,20 @@ int stm32l4_adc_setup(void)
|
||||
if (!initialized)
|
||||
{
|
||||
#ifdef CONFIG_STM32L4_ADC1
|
||||
int ret, i;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
|
||||
for (i = 0; i < ADC1_NCHANNELS; i++)
|
||||
{
|
||||
if (g_pinlist[i] != 0xffffffffU)
|
||||
if (g_pinlist[i] != 0xffffffffu)
|
||||
{
|
||||
stm32l4_configgpio(g_pinlist[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Call stm32l4_adc_initialize() to get an instance of the ADC interface */
|
||||
/* Call stm32l4_adc_initialize() to get an instance of the ADC */
|
||||
|
||||
g_adc = stm32l4_adc_initialize(1, g_chanlist, ADC1_NCHANNELS);
|
||||
if (g_adc == NULL)
|
||||
@@ -313,6 +319,7 @@ int stm32l4_adc_setup(void)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,9 +64,9 @@
|
||||
|
||||
#include "stm32l4r9ai-disco.h"
|
||||
|
||||
/* Conditional logic in stm32l4r9ai-disco.h will determine if certain features
|
||||
* are supported. Tests for these features need to be made after including
|
||||
* stm32l4r9ai-disco.
|
||||
/* Conditional logic in stm32l4r9ai-disco.h will determine if certain
|
||||
* features are supported. Tests for these features need to be made
|
||||
* after includingstm32l4r9ai-disco.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
@@ -80,10 +80,10 @@
|
||||
|
||||
#ifdef CONFIG_I2C
|
||||
# ifdef CONFIG_STM32L4_I2C1
|
||||
static struct i2c_master_s* g_i2c1;
|
||||
static struct i2c_master_s *g_i2c1;
|
||||
# endif
|
||||
# ifdef CONFIG_STM32L4_I2C3
|
||||
static struct i2c_master_s* g_i2c3;
|
||||
static struct i2c_master_s *g_i2c3;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
* Description:
|
||||
* Bring up board features.
|
||||
*
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE=y, then this function will be called from
|
||||
* board_late_initialize().
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE=y, then this function will be called
|
||||
* from board_late_initialize().
|
||||
*
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE is not selected,
|
||||
* but CONFIG_LIB_BOARDCTL=y
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
* Description:
|
||||
* Bring up board features.
|
||||
*
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE=y, then this function will be called from
|
||||
* board_late_initialize().
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE=y, then this function will be called
|
||||
* from board_late_initialize().
|
||||
*
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE is not selected,
|
||||
* but CONFIG_LIB_BOARDCTL=y
|
||||
|
||||
@@ -108,7 +108,8 @@ int lm_bringup(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
mcinfo("Successfully initialized SPI port %d\n", CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
mcinfo("Successfully initialized SPI port %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
|
||||
/* Bind the SPI port to the slot */
|
||||
|
||||
|
||||
@@ -117,9 +117,7 @@ int tm4c_at24_automount(int minor)
|
||||
}
|
||||
|
||||
#if defined(CONFIG_TM4C123G_LAUNCHPAD_AT24_FTL)
|
||||
/* And finally,
|
||||
* use the FTL layer to wrap the MTD driver as a block driver
|
||||
*/
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(AT24_MINOR, mtd);
|
||||
if (ret < 0)
|
||||
@@ -149,6 +147,7 @@ int tm4c_at24_automount(int minor)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Can't support the SST25 device if it SPI2 or SST25 support is not enabled */
|
||||
/* Can't support the SST25 device if it SPI2/SST25 support is not enabled */
|
||||
|
||||
#define HAVE_SST25 1
|
||||
#if !defined(CONFIG_PIC32MX_SPI2) || !defined(CONFIG_MTD_SST25)
|
||||
@@ -139,7 +139,7 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_FS_NXFFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
/* And use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(CONFIG_NSH_MMCSDMINOR, mtd);
|
||||
if (ret < 0)
|
||||
@@ -167,5 +167,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1133,8 +1133,8 @@ static int ili9340_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
|
||||
*
|
||||
* Returned Value:
|
||||
*
|
||||
* On success, this function returns a reference to the LCD driver object for
|
||||
* the specified LCD driver. NULL is returned on any failure.
|
||||
* On success, this function returns a reference to the LCD driver object
|
||||
* for the specified LCD driver. NULL is returned on any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -1181,9 +1181,9 @@ FAR struct lcd_dev_s *ili9340_initialize(
|
||||
*
|
||||
* Description:
|
||||
* This is a non-standard LCD interface. Because of the various rotations,
|
||||
* clearing the display in the normal way by writing a sequences of runs that
|
||||
* covers the entire display can be very slow. Here the display is cleared by
|
||||
* simply setting all GRAM memory to the specified color.
|
||||
* clearing the display in the normal way by writing a sequences of runs
|
||||
* that covers the entire display can be very slow. Here the display is
|
||||
* cleared by simply setting all GRAM memory to the specified color.
|
||||
*
|
||||
* Parameter:
|
||||
* dev - A reference to the lcd driver structure
|
||||
|
||||
@@ -312,7 +312,8 @@ static int grp_foreach(grp_foreach_match_t match, uintptr_t arg,
|
||||
int grp_findby_name(FAR const char *gname, FAR struct group *entry,
|
||||
FAR char *buffer, size_t buflen)
|
||||
{
|
||||
return grp_foreach(grp_match_name, (uintptr_t)gname, entry, buffer, buflen);
|
||||
return grp_foreach(grp_match_name, (uintptr_t)gname,
|
||||
entry, buffer, buflen);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -217,15 +217,17 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count)
|
||||
|
||||
if (nbyteswritten >= 0)
|
||||
{
|
||||
/* Advance the buffer pointer and decrement the number of bytes
|
||||
* remaining in the iobuffer. Typically, nbytesread will now
|
||||
* be zero.
|
||||
/* Advance the buffer pointer and decrement the number of
|
||||
* bytes remaining in the iobuffer. Typically, nbytesread
|
||||
* will now be zero.
|
||||
*/
|
||||
|
||||
wrbuffer += nbyteswritten;
|
||||
nbytesread -= nbyteswritten;
|
||||
|
||||
/* Increment the total number of bytes successfully transferred. */
|
||||
/* Increment the total number of bytes successfully
|
||||
* transferred.
|
||||
*/
|
||||
|
||||
ntransferred += nbyteswritten;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,8 @@ static int pwd_foreach(pwd_foreach_match_t match, uintptr_t arg,
|
||||
int pwd_findby_name(FAR const char *uname, FAR struct passwd *entry,
|
||||
FAR char *buffer, size_t buflen)
|
||||
{
|
||||
return pwd_foreach(pwd_match_name, (uintptr_t)uname, entry, buffer, buflen);
|
||||
return pwd_foreach(pwd_match_name, (uintptr_t)uname,
|
||||
entry, buffer, buflen);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/stdio/lib_libfwrite.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011, 2013-2014, 2017 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -85,18 +86,18 @@ ssize_t lib_fwrite(FAR const void *ptr, size_t count, FAR FILE *stream)
|
||||
/* If there is no I/O buffer, then output data immediately */
|
||||
|
||||
if (stream->fs_bufstart == NULL)
|
||||
{
|
||||
ret = _NX_WRITE(stream->fs_fd, ptr, count);
|
||||
{
|
||||
ret = _NX_WRITE(stream->fs_fd, ptr, count);
|
||||
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
|
||||
if (ret < 0)
|
||||
{
|
||||
_NX_SETERRNO(ret);
|
||||
ret = ERROR;
|
||||
}
|
||||
if (ret < 0)
|
||||
{
|
||||
_NX_SETERRNO(ret);
|
||||
ret = ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
goto errout;
|
||||
}
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Get exclusive access to the stream */
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
|
||||
void perror(FAR const char *s)
|
||||
{
|
||||
|
||||
/* If strerror() is not enabled, then just print the error number */
|
||||
|
||||
#ifdef CONFIG_LIBC_STRERROR
|
||||
|
||||
Reference in New Issue
Block a user