diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 0e169d60d50..f2c89dcbe92 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -3907,21 +3907,8 @@ build -
CONFIG_ARCH_LOWPUTC: architecture supports low-level, boot
- time console output
- CONFIG_NUTTX_KERNEL:
- With most MCUs, NuttX is built as a flat, single executable image
- containing the NuttX RTOS along with all application code.
- The RTOS code and the application run in the same address space and at the same kernel-mode privileges.
- If this option is selected, NuttX will be built separately as a monolithic, kernel-mode module and the applications
- can be added as a separately built, user-mode module.
- In this a system call layer will be built to support the user- to kernel-mode interface to the RTOS.
- CONFIG_MM_REGIONS: If the architecture includes multiple
regions of memory to allocate from, this specifies the
@@ -3939,6 +3926,50 @@ build
can be defined so that those MCUs will also benefit from the
smaller, 16-bit-based allocation overhead.
CONFIG_HEAP2_BASE and CONFIG_HEAP2_SIZE:
+ Some architectures use these settings to specify the size of
+ a second heap region.
+ CONFIG_GRAN:
+ Enable granual allocator support. Allocations will be aligned to the
+ granule size; allocations will be in units of the granule size.
+ Larger granules will give better performance and less overhead but
+ more losses of memory due to alignment and quantization waste.
+ NOTE: The current implementation also restricts the maximum
+ allocation size to 32 granaules. That restriction could be
+ eliminated with some additional coding effort.
+ CONFIG_GRAN_SINGLE:
+ Select if there is only one instance of the granule allocator (i.e.,
+ gran_initialize will be called only once. In this case, (1) there
+ are a few optimizations that can can be done and (2) the GRAN_HANDLE
+ is not needed.
+
+ CONFIG_DEBUG_GRAM:
+ Just like CONFIG_DEBUG_MM, but only generates ouput from the gran
+ allocation logic.
+ CONFIG_ARCH_LOWPUTC: architecture supports low-level, boot
+ time console output
+ CONFIG_NUTTX_KERNEL:
+ With most MCUs, NuttX is built as a flat, single executable image
+ containing the NuttX RTOS along with all application code.
+ The RTOS code and the application run in the same address space and at the same kernel-mode privileges.
+ If this option is selected, NuttX will be built separately as a monolithic, kernel-mode module and the applications
+ can be added as a separately built, user-mode module.
+ In this a system call layer will be built to support the user- to kernel-mode interface to the RTOS.
+ CONFIG_MSEC_PER_TICK: The default system timer is 100Hz
or MSEC_PER_TICK=10. This setting may be defined to inform NuttX
diff --git a/configs/README.txt b/configs/README.txt
index b51b87bece7..b3d0e91f51d 100644
--- a/configs/README.txt
+++ b/configs/README.txt
@@ -270,8 +270,6 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_DEBUG_GRAPHICS - enable NX graphics debug output
(disabled by default)
- CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot
- time console output
CONFIG_MM_REGIONS - If the architecture includes multiple
regions of memory to allocate from, this specifies the
number of memory regions that the memory manager must
@@ -285,6 +283,28 @@ defconfig -- This is a configuration file similar to the Linux
of size less than or equal to 64Kb. In this case, CONFIG_MM_SMALL
can be defined so that those MCUs will also benefit from the
smaller, 16-bit-based allocation overhead.
+ CONFIG_HEAP2_BASE and CONFIG_HEAP2_SIZE
+ Some architectures use these settings to specify the size of
+ a second heap region.
+ CONFIG_GRAN
+ Enable granual allocator support. Allocations will be aligned to the
+ granule size; allocations will be in units of the granule size.
+ Larger granules will give better performance and less overhead but
+ more losses of memory due to alignment and quantization waste.
+ NOTE: The current implementation also restricts the maximum
+ allocation size to 32 granaules. That restriction could be
+ eliminated with some additional coding effort.
+ CONFIG_GRAN_SINGLE
+ Select if there is only one instance of the granule allocator (i.e.,
+ gran_initialize will be called only once. In this case, (1) there
+ are a few optimizations that can can be done and (2) the GRAN_HANDLE
+ is not needed.
+ CONFIG_DEBUG_GRAM
+ Just like CONFIG_DEBUG_MM, but only generates ouput from the gran
+ allocation logic.
+
+ CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot
+ time console output
CONFIG_MSEC_PER_TICK - The default system timer is 100Hz
or MSEC_PER_TICK=10. This setting may be defined to
inform NuttX that the processor hardware is providing
diff --git a/configs/fire-stm32v2/nsh/defconfig b/configs/fire-stm32v2/nsh/defconfig
index ef5fcbf4008..fda34debe31 100644
--- a/configs/fire-stm32v2/nsh/defconfig
+++ b/configs/fire-stm32v2/nsh/defconfig
@@ -481,6 +481,7 @@ CONFIG_FAT_MAXFNAME=32
#
# CONFIG_MM_SMALL is not set
CONFIG_MM_REGIONS=1
+# CONFIG_GRAN is not set
#
# Library Routines
diff --git a/configs/shenzhou/nsh/defconfig b/configs/shenzhou/nsh/defconfig
index 7aa442e12e8..0c18b129f2c 100644
--- a/configs/shenzhou/nsh/defconfig
+++ b/configs/shenzhou/nsh/defconfig
@@ -304,66 +304,22 @@ CONFIG_DEV_NULL=y
# CONFIG_DEV_ZERO is not set
# CONFIG_LOOP is not set
# CONFIG_RAMDISK is not set
-
-#
-# CAN Driver Options
-#
# CONFIG_CAN is not set
-
-#
-# PWM Driver Options
-#
# CONFIG_PWM is not set
-
-#
-# I2C Driver Options
-#
# CONFIG_I2C is not set
-
-#
-# SPI Driver Options
-#
CONFIG_SPI=y
# CONFIG_SPI_OWNBUS is not set
CONFIG_SPI_EXCHANGE=y
CONFIG_SPI_CMDDATA=y
-
-#
-# RTC Driver Options
-#
CONFIG_RTC=y
# CONFIG_RTC_DATETIME is not set
# CONFIG_RTC_HIRES is not set
# CONFIG_RTC_ALARM is not set
-
-#
-# Watchdog Driver Options
-#
# CONFIG_WATCHDOG is not set
-
-#
-# Analog Driver Options
-#
# CONFIG_ANALOG is not set
-
-#
-# Block-to-Character Driver Support
-#
# CONFIG_BCH is not set
-
-#
-# Input device Driver Options
-#
# CONFIG_INPUT is not set
-
-#
-# LCD Driver Options
-#
# CONFIG_LCD is not set
-
-#
-# MMCSD Driver Options
-#
CONFIG_MMCSD=y
CONFIG_MMCSD_NSLOTS=1
# CONFIG_MMCSD_READONLY is not set
@@ -373,42 +329,14 @@ CONFIG_MMCSD_HAVECARDDETECT=y
CONFIG_MMCSD_SPI=y
CONFIG_MMCSD_SPICLOCK=12500000
# CONFIG_MMCSD_SDIO is not set
-
-#
-# I2C Driver Options
-#
# CONFIG_MTD is not set
-
-#
-# Network Device Driver Options
-#
# CONFIG_NETDEVICES is not set
# CONFIG_NET_SLIP is not set
-
-#
-# Pipe Options
-#
# CONFIG_PIPES is not set
-
-#
-# Power Management Options
-#
# CONFIG_PM is not set
# CONFIG_POWER is not set
-
-#
-# Sensor Driver Options
-#
# CONFIG_SENSORS is not set
-
-#
-# Osmocom-bb Sercomm Driver Options
-#
# CONFIG_SERCOMM_CONSOLE is not set
-
-#
-# Serial Driver Options
-#
CONFIG_SERIAL=y
# CONFIG_LOWLEVEL_CONSOLE is not set
# CONFIG_16550_UART is not set
@@ -427,20 +355,8 @@ CONFIG_USART2_BAUD=115200
CONFIG_USART2_BITS=8
CONFIG_USART2_PARITY=0
CONFIG_USART2_2STOP=0
-
-#
-# USB Device Driver Options
-#
# CONFIG_USBDEV is not set
-
-#
-# USB Host Driver Options
-#
# CONFIG_USBHOST is not set
-
-#
-# Wireless Device Driver Options
-#
# CONFIG_WIRELESS is not set
#
@@ -496,6 +412,7 @@ CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FAT_MAXFNAME=32
# CONFIG_FS_FATTIME is not set
+# CONFIG_FAT_DMAMEMORY is not set
# CONFIG_FS_RAMMAP is not set
# CONFIG_NFS is not set
# CONFIG_FS_NXFFS is not set
@@ -511,6 +428,7 @@ CONFIG_FAT_MAXFNAME=32
#
# CONFIG_MM_SMALL is not set
CONFIG_MM_REGIONS=1
+# CONFIG_GRAN is not set
#
# Library Routines
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index eee9ff6f05b..a2f3d587159 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -164,6 +164,15 @@
* Private Types
****************************************************************************/
+/* The state of the interface */
+
+enum enc_state_e
+{
+ ENCSTATE_UNIT = 0, /* The interface is in an unknown state */
+ ENCSTATE_DOWN, /* The interface is down */
+ ENCSTATE_UP /* The interface is up */
+};
+
/* The enc_driver_s encapsulates all state information for a single hardware
* interface
*/
@@ -172,7 +181,7 @@ struct enc_driver_s
{
/* Device control */
- bool bifup; /* true:ifup false:ifdown */
+ uint8_t ifstate; /* Interface state: See ENCSTATE_* */
uint8_t bank; /* Currently selected bank */
uint16_t nextpkt; /* Next packet address */
FAR const struct enc_lower_s *lower; /* Low-level MCU-specific support */
@@ -1656,7 +1665,7 @@ static int enc_ifup(struct uip_driver_s *dev)
* controller
*/
- priv->bifup = true;
+ priv->ifstate = ENCSTATE_UP;
priv->lower->enable(priv->lower);
}
@@ -1686,8 +1695,8 @@ static int enc_ifdown(struct uip_driver_s *dev)
int ret;
nlldbg("Taking down: %d.%d.%d.%d\n",
- dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
- (dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24 );
+ dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
+ (dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24 );
/* Disable the Ethernet interrupt */
@@ -1704,7 +1713,7 @@ static int enc_ifdown(struct uip_driver_s *dev)
ret = enc_reset(priv);
enc_pwrsave(priv);
- priv->bifup = false;
+ priv->ifstate = ENCSTATE_DOWN;
irqrestore(flags);
return ret;
}
@@ -1737,7 +1746,7 @@ static int enc_txavail(struct uip_driver_s *dev)
/* Ignore the notification if the interface is not yet up */
- if (priv->bifup)
+ if (priv->ifstate == ENCSTATE_UP)
{
/* Check if the hardware is ready to send another packet. The driver
* starts a transmission process by setting ECON1.TXRTS. When the packet is
@@ -2131,8 +2140,7 @@ static int enc_reset(FAR struct enc_driver_s *priv)
int enc_initialize(FAR struct spi_dev_s *spi,
FAR const struct enc_lower_s *lower, unsigned int devno)
{
- FAR struct enc_driver_s *priv ;
- int ret;
+ FAR struct enc_driver_s *priv;
DEBUGASSERT(devno < CONFIG_ENC28J60_NINTERFACES);
priv = &g_enc28j60[devno];
@@ -2156,29 +2164,28 @@ int enc_initialize(FAR struct spi_dev_s *spi,
priv->spi = spi; /* Save the SPI instance */
priv->lower = lower; /* Save the low-level MCU interface */
- /* Make sure that the interface is in the down state. NOTE: The MAC
- * address will not be set up until ifup. That gives the app time to set
- * the MAC address before bringing the interface up.
+ /* The interface should be in the down state. However, this function is called
+ * too early in initalization to perform the ENC28J60 reset in enc_ifdown. We
+ * are depending upon the fact that the application level logic will call enc_ifdown
+ * later to reset the ENC28J60. NOTE: The MAC address will not be set up until
+ * enc_ifup() is called. That gives the app time to set the MAC address before
+ * bringing the interface up.
*/
- ret = enc_ifdown(&priv->dev);
- if (ret == OK)
+ priv->ifstate = ENCSTATE_UNIT;
+
+ /* Attach the interrupt to the driver (but don't enable it yet) */
+
+ if (lower->attach(lower, enc_interrupt))
{
- /* Attach the interrupt to the driver (but don't enable it yet) */
+ /* We could not attach the ISR to the interrupt */
- if (lower->attach(lower, enc_interrupt))
- {
- /* We could not attach the ISR to the interrupt */
-
- ret = -EAGAIN;
- }
-
- /* Register the device with the OS so that socket IOCTLs can be performed */
-
- (void)netdev_register(&priv->dev);
+ return -EAGAIN;
}
- return ret;
+ /* Register the device with the OS so that socket IOCTLs can be performed */
+
+ return netdev_register(&priv->dev);
}
/****************************************************************************
diff --git a/include/nuttx/gran.h b/include/nuttx/gran.h
index 2036a29a159..bb08f9b3740 100644
--- a/include/nuttx/gran.h
+++ b/include/nuttx/gran.h
@@ -43,6 +43,11 @@
#include