mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Merged nuttx/nuttx into master
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
NuttX TODO List (Last updated January 7, 2017)
|
||||
NuttX TODO List (Last updated January 10, 2017)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
||||
@@ -31,8 +31,8 @@ nuttx/:
|
||||
|
||||
apps/ and other Add-Ons:
|
||||
|
||||
(3) Network Utilities (apps/netutils/)
|
||||
(2) NuttShell (NSH) (apps/nshlib)
|
||||
(2) Network Utilities (apps/netutils/)
|
||||
(1) NuttShell (NSH) (apps/nshlib)
|
||||
(1) System libraries apps/system (apps/system)
|
||||
(1) Pascal add-on (pcode/)
|
||||
(4) Other Applications & Tests (apps/examples/)
|
||||
@@ -414,7 +414,7 @@ o Memory Management (mm/)
|
||||
|
||||
So in this case, NuttX work just link Linux or or *nix systems:
|
||||
All memory allocated by processes or threads in processes will
|
||||
be recovered when the process exists.
|
||||
be recovered when the process exits.
|
||||
|
||||
But not for the flat memory build. In that case, the issues
|
||||
above do apply. There is no safe way to recover the memory in
|
||||
@@ -427,7 +427,9 @@ o Memory Management (mm/)
|
||||
it is inherently unsafe, I would never incorporate anything
|
||||
like that into NuttX.
|
||||
|
||||
Status: Open. No changes are planned.
|
||||
Status: Open. No changes are planned. NOTE: This applies to the FLAT
|
||||
and PROTECTED builds only. There is no such leaking of memory
|
||||
in the KERNEL build mode.
|
||||
Priority: Medium/Low, a good feature to prevent memory leaks but would
|
||||
have negative impact on memory usage and code size.
|
||||
|
||||
@@ -1503,7 +1505,7 @@ o Libraries (libc/, libm/)
|
||||
at the OS interface: I would like to see more primitive OS
|
||||
system calls with more higher level logic in the C library.
|
||||
|
||||
One awkard thing is the incompatibility of KERNEL vs FLAT
|
||||
One awkward thing is the incompatibility of KERNEL vs FLAT
|
||||
builds: In the kernel build, it would be nice to move many
|
||||
of the thread-specific data items out of the TCB and into
|
||||
the process address environment where they belong. It is
|
||||
@@ -1754,13 +1756,15 @@ o Graphics Subsystem (graphics/)
|
||||
interactions are via a thin layer in libnx/. The OS
|
||||
interface is only via messages sent and received using POSIX
|
||||
message queues. So this is good code and respects all of the
|
||||
POSIX interfacing rules.
|
||||
POSIX interfacing rules. Hence, it works well in all build
|
||||
modes (FLAT, PROTECTED, and KERNEL builds).
|
||||
|
||||
But without CONFIG_NX_MULTIUSER, the single user applications
|
||||
violate all of the rules and call internal NX functions
|
||||
violate all of the rules and calls internal NX functions
|
||||
directly. This includes all calls to internal OSfunctions
|
||||
with names like, nx_open, up_fbinitialize, board_lcd_*, and
|
||||
others
|
||||
others. This is a violation of interfacing standard in all
|
||||
cases and can only be made to work in the FLAT build mode.
|
||||
|
||||
The single user mode does have some desirable properties: It
|
||||
is lighter weight and so more suitable for very resource limited
|
||||
@@ -1768,7 +1772,7 @@ o Graphics Subsystem (graphics/)
|
||||
solution is to eliminate the single user mode and provide only
|
||||
the multi-user mode with the message queue interface.
|
||||
Status: Open
|
||||
Priority: Low, not a serious issue but worth noting. Single user
|
||||
Priority: Low-Medium, not a serious issue but worth noting. Single user
|
||||
mode is a blemish on the OS and not compatible with the RTOS
|
||||
roadmap. But neither is there any critical necessity to
|
||||
remove the offending code immediately. Be aware: If you use
|
||||
@@ -1804,21 +1808,6 @@ o Build system
|
||||
Priority: Low, since I am not aware of anyone using the Windows Native build.
|
||||
But, of course, very high if you want to use it.
|
||||
|
||||
Title: REMOVE SINGLE USER MODE
|
||||
Description: The graphics sub-system can operate in either a single-user mode or
|
||||
in a multi-user mode. In the multiple-user mode, a kernel thread
|
||||
is used to support a graphics server. Multiple applications may then
|
||||
communicate with the server using a message queue. This users only
|
||||
standard POSIX interfaces and works in all build modes (FLAT,
|
||||
PROTECTED, and KERNEL builds).
|
||||
|
||||
The single-user mode, on the hand, uses inappropriate calls directly
|
||||
into the OS. This violates the POSIX interface and must, eventually,
|
||||
be eliminated. These inappropriate calls can only be supported in
|
||||
the FLAT build mode.
|
||||
Status: Open
|
||||
Priority: Medium-High
|
||||
|
||||
o Other drivers (drivers/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -2011,13 +2000,6 @@ o Network Utilities (apps/netutils/)
|
||||
Status: Open
|
||||
Priority: Medium
|
||||
|
||||
Title: THTTPD WARNINGS
|
||||
Description: If the network is enabled, but THTTPD is not configured, it spews out lots
|
||||
of pointless warnings. This is kind of annoying and unprofessional; needs to
|
||||
be fixed someday.
|
||||
Status: Open. An annoyance, but not a real problem.
|
||||
Priority: Low
|
||||
|
||||
Title: NETWORK MONITOR NOT GENERALLY AVAILABLE
|
||||
Description: The NSH network management logic has general applicability
|
||||
but is currently useful only because it is embedded in the NSH
|
||||
@@ -2037,11 +2019,6 @@ o NuttShell (NSH) (apps/nshlib)
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
Title: ARPPING COMMAND
|
||||
Description: Add an arping command
|
||||
Status: Open
|
||||
Priority: Low (enhancement)
|
||||
|
||||
o System libraries apps/system (apps/system)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
+846
-805
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 201-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 201-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -41,10 +41,11 @@
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "task/task.h"
|
||||
@@ -141,14 +142,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next task is
|
||||
* started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
#ifdef CONFIG_SMP
|
||||
(void)spin_trylock(&g_cpu_irqlock);
|
||||
#endif
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -120,6 +120,12 @@ config ARCH_CHIP_MK60X256VMD100
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
|
||||
config ARCH_CHIP_MK60FN1M0VLQ12
|
||||
bool "MK60FN1M0VLQ12"
|
||||
select ARCH_FAMILY_K60
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
|
||||
config ARCH_CHIP_MK64FN1M0VLL12
|
||||
bool "MK64FN1M0VLL12"
|
||||
select ARCH_FAMILY_K64
|
||||
|
||||
@@ -55,10 +55,10 @@
|
||||
* configuration (with no suffix) that maps to the correct alternative.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ARCH_CHIP_MK60N256VLQ100) || defined(CONFIG_ARCH_CHIP_MK60X256VLQ100) || \
|
||||
#if defined(CONFIG_ARCH_CHIP_MK60N256VLQ100) || defined(CONFIG_ARCH_CHIP_MK60X256VLQ100) || \
|
||||
defined(CONFIG_ARCH_CHIP_MK60N512VLQ100) || defined(CONFIG_ARCH_CHIP_MK60N256VMD100) || \
|
||||
defined(CONFIG_ARCH_CHIP_MK60X256VMD100) || defined(CONFIG_ARCH_CHIP_MK60N512VMD100) || \
|
||||
defined(CONFIG_ARCH_CHIP_MK60N512VLL100)
|
||||
defined(CONFIG_ARCH_CHIP_MK60N512VLL100) || defined(CONFIG_ARCH_CHIP_MK60FN1M0VLQ12)
|
||||
|
||||
#define PIN_TSI0_CH1 (PIN_ANALOG | PIN_PORTA | PIN0)
|
||||
#define PIN_UART0_CTS_1 (PIN_ALT2 | PIN_PORTA | PIN0)
|
||||
|
||||
@@ -151,7 +151,11 @@
|
||||
|
||||
#define MCG_C6_VDIV_SHIFT (0) /* Bits 0-4: VCO Divider */
|
||||
#define MCG_C6_VDIV_MASK (31 << MCG_C6_VDIV_SHIFT)
|
||||
#ifdef KINETIS_NEW_MCG
|
||||
# define MCG_C6_VDIV(n) ((uint32_t)((n)-16) << MCG_C6_VDIV_SHIFT) /* n=16..47 */
|
||||
#else
|
||||
# define MCG_C6_VDIV(n) ((uint32_t)((n)-24) << MCG_C6_VDIV_SHIFT) /* n=24..55 */
|
||||
#endif
|
||||
#define MCG_C6_CME (1 << 5) /* Bit 5: Clock Monitor Enable */
|
||||
#define MCG_C6_PLLS (1 << 6) /* Bit 6: PLL Select */
|
||||
#define MCG_C6_LOLIE (1 << 7) /* Bit 7: Loss of Lock Interrrupt Enable */
|
||||
|
||||
@@ -152,7 +152,7 @@ void kinetis_pllconfig(void)
|
||||
*/
|
||||
|
||||
#ifdef BOARD_FRDIV
|
||||
putreg8(BOARD_FRDIV | MCG_C1_CLKS_EXTREF, KINETIS_MCG_C1);
|
||||
putreg8((BOARD_FRDIV << MCG_C1_FRDIV_SHIFT) | MCG_C1_CLKS_EXTREF, KINETIS_MCG_C1);
|
||||
#else
|
||||
putreg8(MCG_C1_FRDIV_DIV256 | MCG_C1_CLKS_EXTREF, KINETIS_MCG_C1);
|
||||
#endif
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
#undef HAVE_UART_DEVICE
|
||||
#if defined(CONFIG_KINETIS_UART0) || defined(CONFIG_KINETIS_UART1) || \
|
||||
defined(CONFIG_KINETIS_UART2) || defined(CONFIG_KINETIS_UART3) || \
|
||||
defined(CONFIG_KINETIS_UART5)
|
||||
defined(CONFIG_KINETIS_UART4) || defined(CONFIG_KINETIS_UART5)
|
||||
# define HAVE_UART_DEVICE 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -875,7 +875,7 @@ static int up_interrupts(int irq, void *context)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_KINETIS_UART5
|
||||
if (g_uart5priv.irq == irqs)
|
||||
if (g_uart5priv.irqs == irq)
|
||||
{
|
||||
dev = &g_uart5port;
|
||||
}
|
||||
|
||||
@@ -231,12 +231,14 @@ ssize_t up_progmem_erasepage(size_t page)
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* Get flash ready and begin erasing single page */
|
||||
|
||||
#if !defined(CONFIG_STM32_STM32F40XX)
|
||||
if (!(getreg32(STM32_RCC_CR) & RCC_CR_HSION))
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get flash ready and begin erasing single page */
|
||||
|
||||
stm32_flash_unlock();
|
||||
|
||||
@@ -318,12 +320,14 @@ ssize_t up_progmem_write(size_t addr, const void *buf, size_t count)
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* Get flash ready and begin flashing */
|
||||
|
||||
#if !defined(CONFIG_STM32_STM32F40XX)
|
||||
if (!(getreg32(STM32_RCC_CR) & RCC_CR_HSION))
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get flash ready and begin flashing */
|
||||
|
||||
stm32_flash_unlock();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/stm32/stm32_serial.c
|
||||
*
|
||||
* Copyright (C) 2009-2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009-2014, 2016, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -70,6 +70,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Some sanity checks *******************************************************/
|
||||
/* DMA configuration */
|
||||
|
||||
@@ -208,7 +209,7 @@
|
||||
# error "Unknown STM32 DMA"
|
||||
# endif
|
||||
|
||||
/* DMA control words */
|
||||
/* DMA control word */
|
||||
|
||||
# if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
|
||||
# define SERIAL_DMA_CONTROL_WORD \
|
||||
@@ -220,16 +221,6 @@
|
||||
CONFIG_USART_DMAPRIO | \
|
||||
DMA_SCR_PBURST_SINGLE | \
|
||||
DMA_SCR_MBURST_SINGLE)
|
||||
# ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
# define SERIAL_DMA_IFLOW_CONTROL_WORD \
|
||||
(DMA_SCR_DIR_P2M | \
|
||||
DMA_SCR_MINC | \
|
||||
DMA_SCR_PSIZE_8BITS | \
|
||||
DMA_SCR_MSIZE_8BITS | \
|
||||
CONFIG_USART_DMAPRIO | \
|
||||
DMA_SCR_PBURST_SINGLE | \
|
||||
DMA_SCR_MBURST_SINGLE)
|
||||
# endif
|
||||
# else
|
||||
# define SERIAL_DMA_CONTROL_WORD \
|
||||
(DMA_CCR_CIRC | \
|
||||
@@ -237,13 +228,6 @@
|
||||
DMA_CCR_PSIZE_8BITS | \
|
||||
DMA_CCR_MSIZE_8BITS | \
|
||||
CONFIG_USART_DMAPRIO)
|
||||
# ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
# define SERIAL_DMA_IFLOW_CONTROL_WORD \
|
||||
(DMA_CCR_MINC | \
|
||||
DMA_CCR_PSIZE_8BITS | \
|
||||
DMA_CCR_MSIZE_8BITS | \
|
||||
CONFIG_USART_DMAPRIO)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@@ -1608,28 +1592,13 @@ static int up_dma_setup(struct uart_dev_s *dev)
|
||||
|
||||
priv->rxdma = stm32_dmachannel(priv->rxdma_channel);
|
||||
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
if (priv->iflow)
|
||||
{
|
||||
/* Configure for non-circular DMA reception into the RX FIFO */
|
||||
/* Configure for circular DMA reception into the RX fifo */
|
||||
|
||||
stm32_dmasetup(priv->rxdma,
|
||||
priv->usartbase + STM32_USART_RDR_OFFSET,
|
||||
(uint32_t)priv->rxfifo,
|
||||
RXDMA_BUFFER_SIZE,
|
||||
SERIAL_DMA_IFLOW_CONTROL_WORD);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Configure for circular DMA reception into the RX FIFO */
|
||||
|
||||
stm32_dmasetup(priv->rxdma,
|
||||
priv->usartbase + STM32_USART_RDR_OFFSET,
|
||||
(uint32_t)priv->rxfifo,
|
||||
RXDMA_BUFFER_SIZE,
|
||||
SERIAL_DMA_CONTROL_WORD);
|
||||
}
|
||||
stm32_dmasetup(priv->rxdma,
|
||||
priv->usartbase + STM32_USART_RDR_OFFSET,
|
||||
(uint32_t)priv->rxfifo,
|
||||
RXDMA_BUFFER_SIZE,
|
||||
SERIAL_DMA_CONTROL_WORD);
|
||||
|
||||
/* Reset our DMA shadow pointer to match the address just
|
||||
* programmed above.
|
||||
@@ -1643,26 +1612,12 @@ static int up_dma_setup(struct uart_dev_s *dev)
|
||||
regval |= USART_CR3_DMAR;
|
||||
up_serialout(priv, STM32_USART_CR3_OFFSET, regval);
|
||||
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
if (priv->iflow)
|
||||
{
|
||||
/* Start the DMA channel, and arrange for callbacks at the full point
|
||||
* in the FIFO. After buffer gets full, hardware flow-control kicks
|
||||
* in and DMA transfer is stopped.
|
||||
*/
|
||||
/* Start the DMA channel, and arrange for callbacks at the half and
|
||||
* full points in the FIFO. This ensures that we have half a FIFO
|
||||
* worth of time to claim bytes before they are overwritten.
|
||||
*/
|
||||
|
||||
stm32_dmastart(priv->rxdma, up_dma_rxcallback, (void *)priv, false);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Start the DMA channel, and arrange for callbacks at the half and
|
||||
* full points in the FIFO. This ensures that we have half a FIFO
|
||||
* worth of time to claim bytes before they are overwritten.
|
||||
*/
|
||||
|
||||
stm32_dmastart(priv->rxdma, up_dma_rxcallback, (void *)priv, true);
|
||||
}
|
||||
stm32_dmastart(priv->rxdma, up_dma_rxcallback, (void *)priv, true);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -2316,9 +2271,9 @@ static bool up_rxflowcontrol(struct uart_dev_s *dev,
|
||||
unsigned int nbuffered, bool upper)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
uint16_t ie;
|
||||
|
||||
#if defined(CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS) && \
|
||||
defined(CONFIG_STM32_FLOWCONTROL_BROKEN)
|
||||
#if defined(CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS) && defined(CONFIG_STM32_FLOWCONTROL_BROKEN)
|
||||
if (priv->iflow && (priv->rts_gpio != 0))
|
||||
{
|
||||
/* Assert/de-assert nRTS set it high resume/stop sending */
|
||||
@@ -2346,7 +2301,9 @@ static bool up_rxflowcontrol(struct uart_dev_s *dev,
|
||||
* enable Rx interrupts.
|
||||
*/
|
||||
|
||||
uart_disablerxint(dev);
|
||||
ie = priv->ie;
|
||||
ie &= ~USART_CR1_RXNEIE;
|
||||
up_restoreusartint(priv, ie);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2359,7 +2316,7 @@ static bool up_rxflowcontrol(struct uart_dev_s *dev,
|
||||
* received.
|
||||
*/
|
||||
|
||||
uart_enablerxint(dev);
|
||||
up_rxint(dev, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2391,18 +2348,7 @@ static int up_dma_receive(struct uart_dev_s *dev, unsigned int *status)
|
||||
priv->rxdmanext++;
|
||||
if (priv->rxdmanext == RXDMA_BUFFER_SIZE)
|
||||
{
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
if (priv->iflow)
|
||||
{
|
||||
/* RX DMA buffer full. RX paused, RTS line pulled up to prevent
|
||||
* more input data from other end.
|
||||
*/
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
priv->rxdmanext = 0;
|
||||
}
|
||||
priv->rxdmanext = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2410,40 +2356,6 @@ static int up_dma_receive(struct uart_dev_s *dev, unsigned int *status)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma_reenable
|
||||
*
|
||||
* Description:
|
||||
* Call to re-enable RX DMA.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(SERIAL_HAVE_DMA) && defined(CONFIG_SERIAL_IFLOWCONTROL)
|
||||
static void up_dma_reenable(struct up_dev_s *priv)
|
||||
{
|
||||
/* Configure for non-circular DMA reception into the RX fifo */
|
||||
|
||||
stm32_dmasetup(priv->rxdma,
|
||||
priv->usartbase + STM32_USART_RDR_OFFSET,
|
||||
(uint32_t)priv->rxfifo,
|
||||
RXDMA_BUFFER_SIZE,
|
||||
SERIAL_DMA_IFLOW_CONTROL_WORD);
|
||||
|
||||
/* Reset our DMA shadow pointer to match the address just
|
||||
* programmed above.
|
||||
*/
|
||||
|
||||
priv->rxdmanext = 0;
|
||||
|
||||
/* Start the DMA channel, and arrange for callbacks at the full point in
|
||||
* the FIFO. After buffer gets full, hardware flow-control kicks in and
|
||||
* DMA transfer is stopped.
|
||||
*/
|
||||
|
||||
stm32_dmastart(priv->rxdma, up_dma_rxcallback, (void *)priv, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma_rxint
|
||||
*
|
||||
@@ -2466,15 +2378,6 @@ static void up_dma_rxint(struct uart_dev_s *dev, bool enable)
|
||||
*/
|
||||
|
||||
priv->rxenable = enable;
|
||||
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
if (priv->iflow && priv->rxenable && (priv->rxdmanext == RXDMA_BUFFER_SIZE))
|
||||
{
|
||||
/* Re-enable RX DMA. */
|
||||
|
||||
up_dma_reenable(priv);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2510,14 +2413,10 @@ static bool up_dma_rxavailable(struct uart_dev_s *dev)
|
||||
static void up_send(struct uart_dev_s *dev, int ch)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
|
||||
#ifdef HAVE_RS485
|
||||
if (priv->rs485_dir_gpio != 0)
|
||||
{
|
||||
stm32_gpiowrite(priv->rs485_dir_gpio, priv->rs485_dir_polarity);
|
||||
}
|
||||
stm32_gpiowrite(priv->rs485_dir_gpio, priv->rs485_dir_polarity);
|
||||
#endif
|
||||
|
||||
up_serialout(priv, STM32_USART_TDR_OFFSET, (uint32_t)ch);
|
||||
}
|
||||
|
||||
@@ -2683,16 +2582,6 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
|
||||
if (priv->rxenable && up_dma_rxavailable(&priv->dev))
|
||||
{
|
||||
uart_recvchars(&priv->dev);
|
||||
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
if (priv->iflow && priv->rxenable &&
|
||||
(priv->rxdmanext == RXDMA_BUFFER_SIZE))
|
||||
{
|
||||
/* Re-enable RX DMA. */
|
||||
|
||||
up_dma_reenable(priv);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2791,6 +2680,7 @@ static void up_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
* return non-zero values when reverting back to higher power
|
||||
* consumption modes!
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
@@ -95,10 +95,10 @@ static inline void rcc_reset(void)
|
||||
|
||||
putreg32(0x00000000, STM32_RCC_CFGR);
|
||||
|
||||
/* Reset HSION, HSEON, CSSON and PLLON bits */
|
||||
/* Reset HSEON, CSSON and PLLON bits */
|
||||
|
||||
regval = getreg32(STM32_RCC_CR);
|
||||
regval &= ~(RCC_CR_HSION | RCC_CR_HSEON | RCC_CR_CSSON | RCC_CR_PLLON);
|
||||
regval &= ~(RCC_CR_HSEON | RCC_CR_CSSON | RCC_CR_PLLON);
|
||||
putreg32(regval, STM32_RCC_CR);
|
||||
|
||||
/* Reset PLLCFGR register to reset default */
|
||||
@@ -619,11 +619,6 @@ static void stm32_stdclockconfig(void)
|
||||
volatile int32_t timeout;
|
||||
|
||||
#ifdef STM32_BOARD_USEHSI
|
||||
/* Enable Internal High-Speed Clock (HSI) */
|
||||
|
||||
regval = getreg32(STM32_RCC_CR);
|
||||
regval |= RCC_CR_HSION; /* Enable HSI */
|
||||
putreg32(regval, STM32_RCC_CR);
|
||||
|
||||
/* Wait until the HSI is ready (or until a timeout elapsed) */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 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
|
||||
@@ -41,10 +41,11 @@
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "task/task.h"
|
||||
@@ -140,11 +141,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next
|
||||
* task is started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 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
|
||||
@@ -41,10 +41,11 @@
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "task/task.h"
|
||||
@@ -140,11 +141,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s* tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next
|
||||
* task is started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/mips/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 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
|
||||
@@ -43,10 +43,11 @@
|
||||
#include <syscall.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "task/task.h"
|
||||
@@ -142,11 +143,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next
|
||||
* task is started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/****************************************************************************
|
||||
* arch/misoc/src/lm32/lm32_exit.c
|
||||
*
|
||||
* Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Ramtin Amin <keytwo@gmail.com>
|
||||
* Ramtin Amin <keytwo@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -42,8 +42,9 @@
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
@@ -139,11 +140,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next
|
||||
* task is started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/renesas/src/=common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 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
|
||||
@@ -43,9 +43,9 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "task/task.h"
|
||||
@@ -141,11 +141,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s* tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next
|
||||
* task is started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/risc-v/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 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
|
||||
@@ -43,10 +43,11 @@
|
||||
#include <syscall.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "task/task.h"
|
||||
@@ -142,11 +143,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next
|
||||
* task is started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013-2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013-2014, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -41,10 +41,11 @@
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "task/task.h"
|
||||
@@ -140,11 +141,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s* tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next
|
||||
* task is started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/common/xtensa_exit.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,10 +43,11 @@
|
||||
#include <syscall.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "task/task.h"
|
||||
@@ -142,11 +143,11 @@ void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
|
||||
/* Disable interrupts. They will be restored when the next task is
|
||||
* started.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/z16/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2013, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,9 +43,9 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "chip/chip.h"
|
||||
@@ -141,11 +141,11 @@ void _exit(int status)
|
||||
{
|
||||
FAR struct tcb_s* tcb;
|
||||
|
||||
/* Disable interrupts. Interrupts will remain disabled until
|
||||
* the new task is resumed below.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 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
|
||||
@@ -44,9 +44,9 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
#include <nuttx/fs/fs.h>
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
|
||||
#include "chip/chip.h"
|
||||
@@ -143,11 +143,11 @@ void _exit(int status)
|
||||
{
|
||||
FAR struct tcb_s* tcb;
|
||||
|
||||
/* Disable interrupts. Interrupts will remain disabled until
|
||||
* the new task is resumed below.
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
*/
|
||||
|
||||
(void)up_irq_save();
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
|
||||
@@ -1476,6 +1476,7 @@ static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv,
|
||||
{
|
||||
offset = startblock << priv->blockshift;
|
||||
}
|
||||
|
||||
finfo("nbytes=%d byte offset=%d\n", nbytes, offset);
|
||||
|
||||
/* Select the block size for the card */
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ mqd_t mq_open(FAR const char *mq_name, int oflags, ...)
|
||||
|
||||
/* Make sure that a non-NULL name is supplied */
|
||||
|
||||
if (mq_name == NULL || *mq_name == '/0')
|
||||
if (mq_name == NULL || *mq_name == '\0')
|
||||
{
|
||||
errcode = EINVAL;
|
||||
goto errout;
|
||||
|
||||
+1
-1
@@ -732,7 +732,7 @@ config SCHED_INSTRUMENTATION_CSECTION
|
||||
|
||||
void sched_note_csection(FAR struct tcb_s *tcb, bool state);
|
||||
|
||||
config SCHED_INSTRUMENTATION_SPINLOCK
|
||||
config SCHED_INSTRUMENTATION_SPINLOCKS
|
||||
bool "Spinlock monitor hooks"
|
||||
default n
|
||||
---help---
|
||||
|
||||
+5
-1
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/irq/irq.h
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008, 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
|
||||
@@ -72,6 +72,10 @@ extern volatile spinlock_t g_cpu_irqlock SP_SECTION;
|
||||
|
||||
extern volatile spinlock_t g_cpu_irqsetlock SP_SECTION;
|
||||
extern volatile cpu_set_t g_cpu_irqset SP_SECTION;
|
||||
|
||||
/* Handles nested calls to enter_critical section from interrupt handlers */
|
||||
|
||||
extern volatile uint8_t g_cpu_nestcount[CONFIG_SMP_NCPUS];
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
+18
-13
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/irq/irq_csection.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -66,16 +66,10 @@ volatile spinlock_t g_cpu_irqlock SP_SECTION = SP_UNLOCKED;
|
||||
|
||||
volatile spinlock_t g_cpu_irqsetlock SP_SECTION;
|
||||
volatile cpu_set_t g_cpu_irqset SP_SECTION;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Handles nested calls to enter_critical section from interrupt handlers */
|
||||
|
||||
static uint8_t g_cpu_nestcount[CONFIG_SMP_NCPUS];
|
||||
volatile uint8_t g_cpu_nestcount[CONFIG_SMP_NCPUS];
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -303,6 +297,13 @@ try_again:
|
||||
/* In any event, the nesting count is now one */
|
||||
|
||||
g_cpu_nestcount[cpu] = 1;
|
||||
|
||||
/* Also set the CPU bit so that other CPUs will be aware that this
|
||||
* CPU holds the critical section.
|
||||
*/
|
||||
|
||||
spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
|
||||
&g_cpu_irqlock);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -455,18 +456,22 @@ void leave_critical_section(irqstate_t flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No, not nested. Release the spinlock. */
|
||||
/* No, not nested. Restore the g_cpu_irqset for this CPU
|
||||
* and release the spinlock (if necessary).
|
||||
*/
|
||||
|
||||
DEBUGASSERT(spin_islocked(&g_cpu_irqlock) &&
|
||||
g_cpu_nestcount[cpu] == 1);
|
||||
|
||||
spin_lock(&g_cpu_irqsetlock); /* Protects g_cpu_irqset */
|
||||
if (g_cpu_irqset == 0)
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
DEBUGASSERT(rtcb != NULL);
|
||||
|
||||
if (rtcb->irqcount <= 0)
|
||||
{
|
||||
spin_unlock(&g_cpu_irqlock);
|
||||
spin_clrbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
|
||||
&g_cpu_irqlock);
|
||||
}
|
||||
|
||||
spin_unlock(&g_cpu_irqsetlock);
|
||||
g_cpu_nestcount[cpu] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/sched/sched_addreadytorun.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -322,13 +322,40 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
|
||||
|
||||
if (btcb->irqcount > 0)
|
||||
{
|
||||
/* Yes... make sure that scheduling logic on other CPUs knows
|
||||
* that we hold the IRQ lock.
|
||||
*/
|
||||
|
||||
spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
|
||||
&g_cpu_irqlock);
|
||||
}
|
||||
|
||||
/* No.. This CPU will be relinquishing the lock. But this works
|
||||
* differently if we are performing a context switch from an
|
||||
* interrupt handler and the interrupt handler has established
|
||||
* a critical section. We can detect this case when
|
||||
* g_cpu_nestcount[me] > 0.
|
||||
*/
|
||||
|
||||
else if (g_cpu_nestcount[me] <= 0)
|
||||
{
|
||||
/* Release our hold on the IRQ lock. */
|
||||
|
||||
spin_clrbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
|
||||
&g_cpu_irqlock);
|
||||
}
|
||||
|
||||
/* Sanity check. g_cpu_netcount should be greater than zero
|
||||
* only while we are within the critical section and within
|
||||
* an interrupt handler. If we are not in an interrupt handler
|
||||
* then there is a problem; perhaps some logic previously
|
||||
* called enter_critical_section() with no matching call to
|
||||
* leave_critical_section(), leaving the non-zero count.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
spin_clrbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
|
||||
&g_cpu_irqlock);
|
||||
DEBUGASSERT(up_interrupt_context());
|
||||
}
|
||||
|
||||
/* If the following task is not locked to this CPU, then it must
|
||||
|
||||
@@ -82,6 +82,12 @@ struct note_startalloc_s
|
||||
# define SIZEOF_NOTE_START(n) (sizeof(struct note_start_s))
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void note_add(FAR const uint8_t *note, uint8_t notelen);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@@ -558,21 +564,21 @@ void sched_note_csection(FAR struct tcb_s *tcb, bool enter)
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS
|
||||
void sched_note_spinlock(FAR struct tcb_s *tcb, FAR volatile void *spinlock)
|
||||
{
|
||||
note_spincommon(tcb, spinlock, NOTE_SPINLOCK_LOCK)
|
||||
note_spincommon(tcb, spinlock, NOTE_SPINLOCK_LOCK);
|
||||
}
|
||||
|
||||
void sched_note_spinlocked(FAR struct tcb_s *tcb, FAR volatile void *spinlock);
|
||||
void sched_note_spinlocked(FAR struct tcb_s *tcb, FAR volatile void *spinlock)
|
||||
{
|
||||
note_spincommon(tcb, spinlock, NOTE_SPINLOCK_LOCKED)
|
||||
note_spincommon(tcb, spinlock, NOTE_SPINLOCK_LOCKED);
|
||||
}
|
||||
|
||||
void sched_note_spinunlock(FAR struct tcb_s *tcb, FAR volatile void *spinlock);
|
||||
void sched_note_spinunlock(FAR struct tcb_s *tcb, FAR volatile void *spinlock)
|
||||
{
|
||||
note_spincommon(tcb, spinlock, NOTE_SPINLOCK_UNLOCK)
|
||||
note_spincommon(tcb, spinlock, NOTE_SPINLOCK_UNLOCK);
|
||||
}
|
||||
void sched_note_spinabort(FAR struct tcb_s *tcb, FAR volatile void *spinlock);
|
||||
void sched_note_spinabort(FAR struct tcb_s *tcb, FAR volatile void *spinlock)
|
||||
{
|
||||
note_spincommon(tcb, spinlock, NOTE_SPINLOCK_ABORT)
|
||||
note_spincommon(tcb, spinlock, NOTE_SPINLOCK_ABORT);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/sched_removereadytorun.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2012, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -260,23 +260,46 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb)
|
||||
&g_cpu_schedlock);
|
||||
}
|
||||
|
||||
/* Interrupts may be disabled after the switch. If irqcount is greater
|
||||
* than zero, then this task/this CPU holds the IRQ lock
|
||||
/* Adjust global IRQ controls. If irqcount is greater than zero,
|
||||
* then this task/this CPU holds the IRQ lock
|
||||
*/
|
||||
|
||||
if (nxttcb->irqcount > 0)
|
||||
{
|
||||
/* Yes... make sure that scheduling logic knows about this */
|
||||
/* Yes... make sure that scheduling logic on other CPUs knows
|
||||
* that we hold the IRQ lock.
|
||||
*/
|
||||
|
||||
spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
|
||||
&g_cpu_irqlock);
|
||||
}
|
||||
else
|
||||
|
||||
/* No.. This CPU will be relinquishing the lock. But this works
|
||||
* differently if we are performing a context switch from an
|
||||
* interrupt handler and the interrupt handler has established
|
||||
* a critical section. We can detect this case when
|
||||
* g_cpu_nestcount[me] > 0.
|
||||
*/
|
||||
|
||||
else if (g_cpu_nestcount[me] <= 0)
|
||||
{
|
||||
/* No.. we may need to release our hold on the irq state. */
|
||||
/* Release our hold on the IRQ lock. */
|
||||
|
||||
spin_clrbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
|
||||
&g_cpu_irqlock);
|
||||
&g_cpu_irqlock);
|
||||
}
|
||||
|
||||
/* Sanity check. g_cpu_netcount should be greater than zero
|
||||
* only while we are within the critical section and within
|
||||
* an interrupt handler. If we are not in an interrupt handler
|
||||
* then there is a problem; perhaps some logic previously
|
||||
* called enter_critical_section() with no matching call to
|
||||
* leave_critical_section(), leaving the non-zero count.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
DEBUGASSERT(up_interrupt_context());
|
||||
}
|
||||
|
||||
nxttcb->task_state = TSTATE_TASK_RUNNING;
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "irq/irq.h"
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user