mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Merged nuttx/nuttx into master
This commit is contained in:
@@ -11665,4 +11665,13 @@
|
||||
complete, but untested and so not ready for primetime (2016-04-18).
|
||||
* configs/samv71-xult/vnc: Add a configuration that will be used to
|
||||
verify VNC (also untested) (2016-04-18).
|
||||
* drivers/ioexpander: Fix an error in the PCA9555 driver: Under certain
|
||||
error conditions, interrupts were not being re-enabled. Sebastien
|
||||
Lorquet (2016-04-20).
|
||||
* arch/arm/src/stm32 and configs/stm32f429i-disco: Correct some bad
|
||||
commits that broke the LTDC display example. From Marco Krahl
|
||||
(2016-04-22).
|
||||
* configs/samv71-xult/vnwwm: Add a more complex NxWM configuration
|
||||
to support further VNC testing (particularly of VNC keyboard and
|
||||
mouse intputs). Initial configuration is not functional (2016-04-23).
|
||||
|
||||
|
||||
@@ -680,7 +680,10 @@
|
||||
<td><br></td>
|
||||
<td>
|
||||
<p>
|
||||
<li>Graphics: framebuffer drivers, graphic- and segment-LCD drivers.</li>
|
||||
<li>
|
||||
Graphics: framebuffer drivers, graphic- and segment-LCD drivers.
|
||||
VNC server.
|
||||
</li>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -831,7 +834,8 @@
|
||||
<td>
|
||||
<p>
|
||||
<li>Networking utilities (DHCP server and client, SMTP client, TELNET client, FTP server and client, TFTP client, HTTP server and client, PPPD, NTP client).
|
||||
Inheritable TELNET sessions (as "controlling terminal")</li>
|
||||
Inheritable TELNET sessions (as "controlling terminal").
|
||||
VNC server.</li>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+17
-2
@@ -833,14 +833,29 @@ Re-building
|
||||
a file in one of the linked (i.e., copied) directories, re-build NuttX,
|
||||
and then not see your changes when you run the program. That is because
|
||||
build is still using the version of the file in the copied directory, not
|
||||
your modified file! To work around this annoying behavior, do the
|
||||
following when you re-build:
|
||||
your modified file!
|
||||
|
||||
Older versions of NuttX did not support dependiencies in this
|
||||
configuration. So a simple work around this annoying behavior in this
|
||||
case was the following when you re-build:
|
||||
|
||||
make clean_context all
|
||||
|
||||
This 'make' command will remove of the copied directories, re-copy them,
|
||||
then make NuttX.
|
||||
|
||||
However, more recent versions of NuttX do support dependencies for the
|
||||
Cygwin build. As a result, the above command will cause everything to be
|
||||
rebuilt (beause it removes and will cause recreating the
|
||||
include/nuttx/config.h header file). A much less gracefully but still
|
||||
effective command in this case is the following for the ARM configuration:
|
||||
|
||||
rm -rf arch/arm/src/chip arch/arm/src/board
|
||||
|
||||
This "kludge" simple removes the copied directories. These directories
|
||||
will be re-created when you do a normal 'make' and your edits will then be
|
||||
effective.
|
||||
|
||||
Build Targets and Options
|
||||
-------------------------
|
||||
|
||||
|
||||
@@ -329,11 +329,21 @@
|
||||
# define GPIO_FSMC_NCE4_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN11)
|
||||
# define GPIO_FSMC_NIORD (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTF|GPIO_PIN6)
|
||||
# define GPIO_FSMC_NIOWR (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTF|GPIO_PIN8)
|
||||
# define GPIO_FSMC_SDCKE0_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTH|GPIO_PIN2)
|
||||
# define GPIO_FSMC_SDCKE0_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN3)
|
||||
# define GPIO_FSMC_SDNE0_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTH|GPIO_PIN3)
|
||||
# define GPIO_FSMC_SDNE0_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN2)
|
||||
# define GPIO_FSMC_SDNWE_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN0)
|
||||
# define GPIO_FSMC_SDNWE_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTH|GPIO_PIN5)
|
||||
# define GPIO_FSMC_SDNRAS (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTF|GPIO_PIN11)
|
||||
# define GPIO_FSMC_SDCLK (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN8)
|
||||
# define GPIO_FSMC_SDNCAS (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN15)
|
||||
# define GPIO_FSMC_BA0 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN4)
|
||||
# define GPIO_FSMC_BA1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN5)
|
||||
# define GPIO_FSMC_NREG (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTF|GPIO_PIN7)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429) || \
|
||||
defined(CONFIG_STM32_STM32F446) || defined(CONFIG_STM32_STM32F469)
|
||||
#if defined(CONFIG_STM32_STM32F446) || defined(CONFIG_STM32_STM32F469)
|
||||
# define GPIO_FSMC_SDCKE0_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN3)
|
||||
# define GPIO_FSMC_SDCKE0_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN5)
|
||||
# define GPIO_FSMC_SDNE0_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN2)
|
||||
|
||||
@@ -69,6 +69,34 @@ config STM32L4_FLASH_1024KB
|
||||
|
||||
endchoice # Embedded FLASH size
|
||||
|
||||
comment "SRAM2 Options"
|
||||
|
||||
config STM32L4_SRAM2_HEAP
|
||||
bool "SRAM2 is used for heap"
|
||||
default n
|
||||
select STM32L4_SRAM2_INIT
|
||||
---help---
|
||||
The STM32L4 SRAM2 region has special properties (power, protection, parity)
|
||||
which may be used by the application for special purposes. But if these
|
||||
special properties are not needed, it may be instead added to the heap for
|
||||
use by malloc().
|
||||
NOTE: you must also select an appropriate number of memory regions in the
|
||||
'Memory Management' section.
|
||||
|
||||
config STM32L4_SRAM2_INIT
|
||||
bool "SRAM2 is initialized to zero"
|
||||
default n
|
||||
---help---
|
||||
The STM32L4 SRAM2 region has parity checking. However, when the system
|
||||
powers on, the memory is in an unknown state, and reads from uninitialized
|
||||
memory can trigger parity faults from the random data. This can be
|
||||
avoided by first writing to all locations to force the parity into a valid
|
||||
state.
|
||||
However, if the SRAM2 is being used for it's battery-backed capability,
|
||||
this may be undesireable (because it will destroy the contents). In that
|
||||
case, the board should handle the initialization itself at the appropriate
|
||||
time.
|
||||
|
||||
menu "STM32L4 Peripheral Support"
|
||||
|
||||
# These "hidden" settings determine is a peripheral option is available for the
|
||||
@@ -79,7 +107,7 @@ config STM32L4_HAVE_LTDC
|
||||
default n
|
||||
|
||||
# These "hidden" settings are the OR of individual peripheral selections
|
||||
# indicating that the general capabilitiy is required.
|
||||
# indicating that the general capability is required.
|
||||
|
||||
config STM32L4_ADC
|
||||
bool
|
||||
@@ -133,7 +161,6 @@ config STM32L4_DMA2
|
||||
select STM32L4_DMA
|
||||
select ARCH_DMA
|
||||
|
||||
|
||||
config STM32L4_CRC
|
||||
bool "CRC"
|
||||
default n
|
||||
@@ -209,7 +236,119 @@ config STM32L4_QSPI_CSHT
|
||||
---help---
|
||||
The STM32L4 QSPI peripheral requires that it be specified the minimum number
|
||||
of AHB cycles that Chip Select be held inactive between transactions.
|
||||
|
||||
|
||||
choice
|
||||
prompt "Transfer technique"
|
||||
default STM32L4_QSPI_DMA
|
||||
---help---
|
||||
You can choose between using polling, interrupts, or DMA to transfer data
|
||||
over the QSPI interface.
|
||||
|
||||
config STM32L4_QSPI_POLLING
|
||||
bool "Polling"
|
||||
---help---
|
||||
Use conventional register I/O with status polling to transfer data.
|
||||
|
||||
config STM32L4_QSPI_INTERRUPTS
|
||||
bool "Interrupts"
|
||||
---help---
|
||||
User interrupt driven I/O transfers.
|
||||
|
||||
config STM32L4_QSPI_DMA
|
||||
bool "DMA"
|
||||
depends on STM32L4_DMA
|
||||
---help---
|
||||
Use DMA to improve QSPI transfer performance.
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "DMA Channel"
|
||||
default STM32L4_QSPI_DMA_CHAN_1_5
|
||||
depends on STM32L4_DMA
|
||||
---help---
|
||||
You can choose between two DMA channels for use with QSPI:
|
||||
either DMA1 channel 5, or DMA2 channel 7.
|
||||
If you only see one choice here, it is probably because
|
||||
you have not also enabled the associated DMA controller.
|
||||
|
||||
config STM32L4_QSPI_DMA_CHAN_1_5
|
||||
bool "DMA1 Channel 5"
|
||||
depends on STM32L4_DMA1
|
||||
---help---
|
||||
Use DMA1 channel 5 for QSPI.
|
||||
|
||||
config STM32L4_QSPI_DMA_CHAN_2_7
|
||||
bool "DMA2 Channel 7"
|
||||
depends on STM32L4_DMA2
|
||||
---help---
|
||||
Use DMA2 channel 7 for QSPI.
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "DMA Priority"
|
||||
default STM32L4_QSPI_DMAPRIORITY_MEDIUM
|
||||
depends on STM32L4_DMA
|
||||
---help---
|
||||
The DMA controller supports priority levels. You are probably fine
|
||||
with the default of 'medium' except for special cases. In the event
|
||||
of contention between to channels at the same priority, the lower
|
||||
numbered channel has hardware priority over the higher numbered one.
|
||||
|
||||
config STM32L4_QSPI_DMAPRIORITY_VERYHIGH
|
||||
bool "Very High priority"
|
||||
depends on STM32L4_DMA
|
||||
---help---
|
||||
'Highest' priority.
|
||||
|
||||
config STM32L4_QSPI_DMAPRIORITY_HIGH
|
||||
bool "High priority"
|
||||
depends on STM32L4_DMA
|
||||
---help---
|
||||
'High' priority.
|
||||
|
||||
config STM32L4_QSPI_DMAPRIORITY_MEDIUM
|
||||
bool "Medium priority"
|
||||
depends on STM32L4_DMA
|
||||
---help---
|
||||
'Medium' priority.
|
||||
|
||||
config STM32L4_QSPI_DMAPRIORITY_LOW
|
||||
bool "Low priority"
|
||||
depends on STM32L4_DMA
|
||||
---help---
|
||||
'Low' priority.
|
||||
|
||||
endchoice
|
||||
|
||||
config STM32L4_QSPI_DMATHRESHOLD
|
||||
int "QSPI DMA threshold"
|
||||
default 4
|
||||
depends on STM32L4_QSPI_DMA
|
||||
---help---
|
||||
When QSPI DMA is enabled, small DMA transfers will still be performed
|
||||
by polling logic. This value is the threshold below which transfers
|
||||
will still be performed by conventional register status polling.
|
||||
|
||||
config STM32L4_QSPI_DMADEBUG
|
||||
bool "QSPI DMA transfer debug"
|
||||
depends on STM32L4_QSPI_DMA && DEBUG && DEBUG_DMA
|
||||
default n
|
||||
---help---
|
||||
Enable special debug instrumentation to analyze QSPI DMA data transfers.
|
||||
This logic is as non-invasive as possible: It samples DMA
|
||||
registers at key points in the data transfer and then dumps all of
|
||||
the registers at the end of the transfer.
|
||||
|
||||
config STM32L4_QSPI_REGDEBUG
|
||||
bool "QSPI Register level debug"
|
||||
depends on DEBUG
|
||||
default n
|
||||
---help---
|
||||
Output detailed register-level QSPI device debug information.
|
||||
Requires also DEBUG.
|
||||
|
||||
endif
|
||||
|
||||
comment "APB1 Peripherals"
|
||||
|
||||
@@ -23,13 +23,13 @@ LSE : works, but TODO autotrim of MSI, etc
|
||||
RCC : All registers defined, peripherals enabled, basic clock working
|
||||
SYSCTL : All registers defined
|
||||
USART : Working in normal mode (no DMA, to be tested, code is written)
|
||||
DMA : Ported from STM32, code written, to be tested
|
||||
DMA : works; at least tested with QSPI
|
||||
SRAM2 : Should work with enough MM regions
|
||||
FIREWALL : Code written, to be tested, requires support from ldscript
|
||||
SPI : Code written, to be tested, including DMA
|
||||
I2C : Registers defined
|
||||
RTC : works
|
||||
QSPI : TODO (port from stm32f7)
|
||||
QSPI : works in polling, interrupt, DMA, and also memory-mapped modes
|
||||
CAN : TODO
|
||||
OTGFS : TODO
|
||||
Timers : TODO
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* These definitions apply to both the STM32 F1 and F3 families */
|
||||
/* 12 Channels Total: 7 DMA1 Channels(1-7) and 5 DMA2 channels (1-5) */
|
||||
/* 14 Channels Total: 7 DMA1 Channels(1-7) and 7 DMA2 channels (1-7) */
|
||||
|
||||
#define DMA1 0
|
||||
#define DMA2 1
|
||||
@@ -158,6 +157,8 @@
|
||||
#define STM32L4_DMA2_CCR3 (STM32L4_DMA2_BASE+STM32L4_DMA_CCR3_OFFSET)
|
||||
#define STM32L4_DMA2_CCR4 (STM32L4_DMA2_BASE+STM32L4_DMA_CCR4_OFFSET)
|
||||
#define STM32L4_DMA2_CCR5 (STM32L4_DMA2_BASE+STM32L4_DMA_CCR5_OFFSET)
|
||||
#define STM32L4_DMA2_CCR6 (STM32L4_DMA2_BASE+STM32L4_DMA_CCR6_OFFSET)
|
||||
#define STM32L4_DMA2_CCR7 (STM32L4_DMA2_BASE+STM32L4_DMA_CCR7_OFFSET)
|
||||
|
||||
#define STM32L4_DMA2_CNDTR(n) (STM32L4_DMA2_BASE+STM32L4_DMA_CNDTR_OFFSET(n))
|
||||
#define STM32L4_DMA2_CNDTR1 (STM32L4_DMA2_BASE+STM32L4_DMA_CNDTR1_OFFSET)
|
||||
@@ -165,6 +166,8 @@
|
||||
#define STM32L4_DMA2_CNDTR3 (STM32L4_DMA2_BASE+STM32L4_DMA_CNDTR3_OFFSET)
|
||||
#define STM32L4_DMA2_CNDTR4 (STM32L4_DMA2_BASE+STM32L4_DMA_CNDTR4_OFFSET)
|
||||
#define STM32L4_DMA2_CNDTR5 (STM32L4_DMA2_BASE+STM32L4_DMA_CNDTR5_OFFSET)
|
||||
#define STM32L4_DMA2_CNDTR6 (STM32L4_DMA2_BASE+STM32L4_DMA_CNDTR6_OFFSET)
|
||||
#define STM32L4_DMA2_CNDTR7 (STM32L4_DMA2_BASE+STM32L4_DMA_CNDTR7_OFFSET)
|
||||
|
||||
#define STM32L4_DMA2_CPAR(n) (STM32L4_DMA2_BASE+STM32L4_DMA_CPAR_OFFSET(n))
|
||||
#define STM32L4_DMA2_CPAR1 (STM32L4_DMA2_BASE+STM32L4_DMA_CPAR1_OFFSET)
|
||||
@@ -172,6 +175,8 @@
|
||||
#define STM32L4_DMA2_CPAR3 (STM32L4_DMA2_BASE+STM32L4_DMA_CPAR3_OFFSET)
|
||||
#define STM32L4_DMA2_CPAR4 (STM32L4_DMA2_BASE+STM32L4_DMA_CPAR4_OFFSET)
|
||||
#define STM32L4_DMA2_CPAR5 (STM32L4_DMA2_BASE+STM32L4_DMA_CPAR5_OFFSET)
|
||||
#define STM32L4_DMA2_CPAR6 (STM32L4_DMA2_BASE+STM32L4_DMA_CPAR6_OFFSET)
|
||||
#define STM32L4_DMA2_CPAR7 (STM32L4_DMA2_BASE+STM32L4_DMA_CPAR7_OFFSET)
|
||||
|
||||
#define STM32L4_DMA2_CMAR(n) (STM32L4_DMA2_BASE+STM32L4_DMA_CMAR_OFFSET(n))
|
||||
#define STM32L4_DMA2_CMAR1 (STM32L4_DMA2_BASE+STM32L4_DMA_CMAR1_OFFSET)
|
||||
@@ -179,6 +184,8 @@
|
||||
#define STM32L4_DMA2_CMAR3 (STM32L4_DMA2_BASE+STM32L4_DMA_CMAR3_OFFSET)
|
||||
#define STM32L4_DMA2_CMAR4 (STM32L4_DMA2_BASE+STM32L4_DMA_CMAR4_OFFSET)
|
||||
#define STM32L4_DMA2_CMAR5 (STM32L4_DMA2_BASE+STM32L4_DMA_CMAR5_OFFSET)
|
||||
#define STM32L4_DMA2_CMAR6 (STM32L4_DMA2_BASE+STM32L4_DMA_CMAR6_OFFSET)
|
||||
#define STM32L4_DMA2_CMAR7 (STM32L4_DMA2_BASE+STM32L4_DMA_CMAR7_OFFSET)
|
||||
|
||||
/* Register Bitfield Definitions ****************************************************/
|
||||
|
||||
|
||||
@@ -62,13 +62,13 @@
|
||||
****************************************************************************/
|
||||
/* Internal SRAM is available in all members of the STM32L4 family. The
|
||||
* following definitions must be provided to specify the size and
|
||||
* location of internal(system) SRAM:
|
||||
* location of internal (system) SRAM1 and SRAM2:
|
||||
*
|
||||
* SRAM1_END 0x20018000
|
||||
* SRAM2_START 0x10000000
|
||||
* SRAM2_END 0x10008000
|
||||
*
|
||||
* In addition to internal SRAM, SRAM may also be available through the FSMC.
|
||||
* In addition to internal SRAM, memory may also be available through the FSMC.
|
||||
* In order to use FSMC SRAM, the following additional things need to be
|
||||
* present in the NuttX configuration file:
|
||||
*
|
||||
@@ -80,15 +80,14 @@
|
||||
* CONFIG_HEAP2_SIZE : The size of the SRAM in the FSMC
|
||||
* address space
|
||||
* CONFIG_MM_REGIONS : Must be set to a large enough value to
|
||||
* include the FSMC SRAM (as determined by
|
||||
* the rules provided below)
|
||||
* include the additional regions.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_STM32L4_FSMC
|
||||
# undef CONFIG_STM32L4_FSMC_SRAM
|
||||
#endif
|
||||
|
||||
/* MSTM32L4x6xx have 128Kib in two banks, both accessible to DMA:
|
||||
/* STM32L4x6xx have 128Kib in two banks, both accessible to DMA:
|
||||
*
|
||||
* 1) 96KiB of System SRAM beginning at address 0x2000:0000 - 0x2001:8000
|
||||
* 2) 32KiB of System SRAM beginning at address 0x1000:0000 - 0x1000:8000
|
||||
@@ -105,55 +104,21 @@
|
||||
#define SRAM2_START 0x10000000
|
||||
#define SRAM2_END 0x10008000
|
||||
|
||||
/* Allocations according to the number of memory regions:
|
||||
*
|
||||
* 1 region available:
|
||||
* - map it to SRAM1
|
||||
* - warn that SRAM2 is not available for heap
|
||||
* - if FMC is enabled, warn that it is not available for heap
|
||||
*
|
||||
* 2 regions available: map them to SRAM1 and SRAM2
|
||||
* - map region 1 to SRAM1
|
||||
* - map region 2 to SRAM2
|
||||
* - if FMC is enabled, warn that it is not available for heap
|
||||
*
|
||||
* 3 or more regions
|
||||
*
|
||||
* - map them to SRAM1, SRAM2, FMC
|
||||
*/
|
||||
|
||||
#if CONFIG_MM_REGIONS < 1
|
||||
# warning heap is not usable
|
||||
|
||||
#elif CONFIG_MM_REGIONS < 2
|
||||
|
||||
# warning SRAM2 (32k) is NOT available for heap, only SRAM1 (96k) : not enough MM regions
|
||||
# undef SRAM2_START
|
||||
# undef SRAM2_END
|
||||
|
||||
# if defined(CONFIG_STM32L4_FSMC_SRAM)
|
||||
# warning FMC SRAM is NOT available for heap : not enough MM regions (1)
|
||||
# undef CONFIG_STM32L4_FSMC_SRAM
|
||||
#if defined(STM32L4_SRAM2_HEAP) && defined(CONFIG_STM32L4_FSMC_SRAM_HEAP)
|
||||
# if CONFIG_MM_REGIONS < 3
|
||||
# error you need at least 3 memory manager regions to support SRAM2 and FSMC
|
||||
# endif
|
||||
|
||||
#elif CONFIG_MM_REGIONS < 3
|
||||
|
||||
# if defined(CONFIG_STM32L4_FSMC_SRAM)
|
||||
# warning FMC SRAM is NOT available for heap : not enough MM regions (2)
|
||||
# undef CONFIG_STM32L4_FSMC_SRAM
|
||||
# endif
|
||||
|
||||
#elif CONFIG_MM_REGIONS > 3
|
||||
|
||||
/*Everything can be mapped but some entries wont be used -> warn and correct*/
|
||||
# warning "CONFIG_MM_REGIONS > 3 but I don't know what some of the region(s) are"
|
||||
# undef CONFIG_MM_REGIONS
|
||||
# define CONFIG_MM_REGIONS 3
|
||||
|
||||
#else
|
||||
/*Everything can be mapped*/
|
||||
#endif
|
||||
|
||||
#if defined(STM32L4_SRAM2_HEAP) || defined(CONFIG_STM32L4_FSMC_SRAM_HEAP)
|
||||
# if CONFIG_MM_REGIONS < 2
|
||||
# error you need at least 2 memory manager regions to support SRAM2 or FSMC
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_MM_REGIONS < 1
|
||||
# warning you have no heap; malloc() will fail. are you sure?
|
||||
#endif
|
||||
|
||||
/* If FSMC SRAM is going to be used as heap, then verify that the starting
|
||||
* address and size of the external SRAM region has been provided in the
|
||||
@@ -338,6 +303,8 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
|
||||
void up_addregion(void)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_STM32L4_SRAM2_HEAP
|
||||
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
|
||||
/* Allow user-mode access to the SRAM2 heap */
|
||||
@@ -354,7 +321,9 @@ void up_addregion(void)
|
||||
|
||||
kumm_addregion((FAR void *)SRAM2_START, SRAM2_END-SRAM2_START);
|
||||
|
||||
#ifdef CONFIG_STM32L4_FSMC_SRAM
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_FSMC_SRAM_HEAP
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
|
||||
/* Allow user-mode access to the FSMC SRAM user heap memory */
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Sebastien Lorquet <sebastien@lorquet.fr>
|
||||
* dev@ziggurat29.com
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -57,13 +59,11 @@
|
||||
* DMA callback function (see dma_callback_t).
|
||||
*/
|
||||
|
||||
# define DMA_STATUS_FEIF 0 /* (Not available in F1) */
|
||||
# define DMA_STATUS_DMEIF 0 /* (Not available in F1) */
|
||||
# define DMA_STATUS_TEIF DMA_CHAN_TEIF_BIT /* Channel Transfer Error */
|
||||
# define DMA_STATUS_HTIF DMA_CHAN_HTIF_BIT /* Channel Half Transfer */
|
||||
# define DMA_STATUS_TCIF DMA_CHAN_TCIF_BIT /* Channel Transfer Complete */
|
||||
|
||||
#define DMA_STATUS_ERROR (DMA_STATUS_FEIF|DMA_STATUS_DMEIF|DMA_STATUS_TEIF)
|
||||
#define DMA_STATUS_ERROR (DMA_STATUS_TEIF)
|
||||
#define DMA_STATUS_SUCCESS (DMA_STATUS_TCIF|DMA_STATUS_HTIF)
|
||||
|
||||
/************************************************************************************
|
||||
@@ -71,7 +71,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
/* DMA_HANDLE provides an opaque are reference that can be used to represent a DMA
|
||||
* channel (F1) or a DMA stream (F4).
|
||||
* channel.
|
||||
*/
|
||||
|
||||
typedef FAR void *DMA_HANDLE;
|
||||
@@ -81,7 +81,7 @@ typedef FAR void *DMA_HANDLE;
|
||||
* completion of the DMA.
|
||||
*
|
||||
* Input Parameters:
|
||||
* handle - Refers tot he DMA channel or stream
|
||||
* handle - Refers tot he DMA channel
|
||||
* status - A bit encoded value that provides the completion status. See the
|
||||
* DMASTATUS_* definitions above.
|
||||
* arg - A user-provided value that was provided when stm32l4_dmastart() was
|
||||
@@ -93,11 +93,12 @@ typedef void (*dma_callback_t)(DMA_HANDLE handle, uint8_t status, void *arg);
|
||||
#ifdef CONFIG_DEBUG_DMA
|
||||
struct stm32l4_dmaregs_s
|
||||
{
|
||||
uint32_t isr;
|
||||
uint32_t ccr;
|
||||
uint32_t cndtr;
|
||||
uint32_t cpar;
|
||||
uint32_t cmar;
|
||||
uint32_t isr; /* Interrupt Status Register; each channel gets 4 bits */
|
||||
uint32_t cselr; /* Channel Selection Register; chooses peripheral bound */
|
||||
uint32_t ccr; /* Channel Configuration Register; determines functionality */
|
||||
uint32_t cndtr; /* Channel Count Register; determines number of transfers */
|
||||
uint32_t cpar; /* Channel Peripheral Address Register; determines start */
|
||||
uint32_t cmar; /* Channel Memory Address Register; determines start */
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -126,7 +127,7 @@ extern "C"
|
||||
* Description:
|
||||
* Allocate a DMA channel. This function gives the caller mutually
|
||||
* exclusive access to the DMA channel specified by the 'chan' argument.
|
||||
* DMA channels are shared on the STM32: Devices sharing the same DMA
|
||||
* DMA channels are shared on the STM32L4: Devices sharing the same DMA
|
||||
* channel cannot do DMA concurrently! See the DMACHAN_* definitions in
|
||||
* stm32l4_dma.h.
|
||||
*
|
||||
@@ -142,10 +143,8 @@ extern "C"
|
||||
*
|
||||
* Input parameter:
|
||||
* chan - Identifies the stream/channel resource
|
||||
* For the STM32 F1, this is simply the channel number as provided by
|
||||
* the DMACHAN_* definitions in chip/stm32f10xxx_dma.h.
|
||||
* For the STM32 F4, this is a bit encoded value as provided by the
|
||||
* the DMAMAP_* definitions in chip/stm32f40xxx_dma.h
|
||||
* This is a bit encoded value as provided by the DMACHAN_* definitions
|
||||
* in chip/stm32l4x6xx_dma.h
|
||||
*
|
||||
* Returned Value:
|
||||
* Provided that 'chan' is valid, this function ALWAYS returns a non-NULL,
|
||||
@@ -153,8 +152,8 @@ extern "C"
|
||||
* assert if debug is enabled or do something ignorant otherwise).
|
||||
*
|
||||
* Assumptions:
|
||||
* - The caller does not hold he DMA channel.
|
||||
* - The caller can wait for the DMA channel to be freed if it is no
|
||||
* - The caller does not hold the DMA channel.
|
||||
* - The caller can wait for the DMA channel to be freed if it is not
|
||||
* available.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -97,6 +97,42 @@ extern "C"
|
||||
struct qspi_dev_s;
|
||||
FAR struct qspi_dev_s *stm32l4_qspi_initialize(int intf);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32l4_qspi_enter_memorymapped
|
||||
*
|
||||
* Description:
|
||||
* Put the QSPI device into memory mapped mode
|
||||
*
|
||||
* Input Parameter:
|
||||
* dev - QSPI device
|
||||
* meminfo - parameters like for a memory transfer used for reading
|
||||
* lpto - number of cycles to wait to automatically de-assert CS
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void stm32l4_qspi_enter_memorymapped(struct qspi_dev_s* dev,
|
||||
const struct qspi_meminfo_s *meminfo,
|
||||
uint32_t lpto);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32l4_qspi_exit_memorymapped
|
||||
*
|
||||
* Description:
|
||||
* Take the QSPI device out of memory mapped mode
|
||||
*
|
||||
* Input Parameter:
|
||||
* dev - QSPI device
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void stm32l4_qspi_exit_memorymapped(struct qspi_dev_s* dev);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
* 0x2001:7fff - End of internal SRAM and end of heap
|
||||
*/
|
||||
|
||||
#define SRAM2_START 0x10000000
|
||||
#define SRAM2_END 0x10008000
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
@@ -287,6 +289,24 @@ void __start(void)
|
||||
__asm__ volatile ("sub r10, sp, %0" : : "r" (CONFIG_IDLETHREAD_STACKSIZE - 64) : );
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_SRAM2_INIT
|
||||
/* The SRAM2 region is parity checked, but upon power up, it will be in
|
||||
* a random state and probably invalid with respect to parity, potentially
|
||||
* generating faults if accessed. If elected, we will write zeros to the
|
||||
* memory, forcing the parity to be set to a valid state.
|
||||
* NOTE: this is optional because this may be inappropriate, especially
|
||||
* if the memory is being used for it's battery backed purpose. In that
|
||||
* case, the first-time initialization needs to be performed by the board
|
||||
* under application-specific circumstances. On the other hand, if we're
|
||||
* using this memory for, say, additional heap space, then this is handy.
|
||||
*/
|
||||
|
||||
for (dest = (uint32_t *)SRAM2_START; dest < (uint32_t *)SRAM2_END; )
|
||||
{
|
||||
*dest++ = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure the UART so that we can get debug output as soon as possible */
|
||||
|
||||
stm32l4_clockconfig();
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Sebastien Lorquet <sebastien@lorquet.fr>
|
||||
* dev@ziggurat29.com
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -306,16 +308,17 @@ static int stm32l4_dmainterrupt(int irq, void *context)
|
||||
|
||||
isr = dmabase_getreg(dmach, STM32L4_DMA_ISR_OFFSET) & DMA_ISR_CHAN_MASK(dmach->chan);
|
||||
|
||||
/* Clear the interrupts we are handling */
|
||||
|
||||
dmabase_putreg(dmach, STM32L4_DMA_IFCR_OFFSET, isr);
|
||||
|
||||
/* Invoke the callback */
|
||||
|
||||
if (dmach->callback)
|
||||
{
|
||||
dmach->callback(dmach, isr >> DMA_ISR_CHAN_SHIFT(dmach->chan), dmach->arg);
|
||||
}
|
||||
|
||||
/* Clear the interrupts we are handling */
|
||||
|
||||
dmabase_putreg(dmach, STM32L4_DMA_IFCR_OFFSET, isr);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -387,9 +390,9 @@ void weak_function up_dmainitialize(void)
|
||||
* version. Feel free to do that if that is what you need.
|
||||
*
|
||||
* Input parameter:
|
||||
* chndx - Identifies the stream/channel resource. For the STM32 F1, this
|
||||
* is simply the channel number as provided by the DMACHAN_* definitions
|
||||
* in chip/stm32f10xxx_dma.h.
|
||||
* chan - Identifies the stream/channel resource
|
||||
* This is a bit encoded value as provided by the DMACHAN_* definitions
|
||||
* in chip/stm32l4x6xx_dma.h
|
||||
*
|
||||
* Returned Value:
|
||||
* Provided that 'chndx' is valid, this function ALWAYS returns a non-NULL,
|
||||
@@ -471,6 +474,9 @@ void stm32l4_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr,
|
||||
struct stm32l4_dma_s *dmach = (struct stm32l4_dma_s *)handle;
|
||||
uint32_t regval;
|
||||
|
||||
DEBUGASSERT(handle != NULL);
|
||||
DEBUGASSERT(ntransfers<65536);
|
||||
|
||||
/* Then DMA_CNDTRx register can only be modified if the DMA channel is
|
||||
* disabled.
|
||||
*/
|
||||
@@ -514,7 +520,12 @@ void stm32l4_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr,
|
||||
regval |= ccr;
|
||||
dmachan_putreg(dmach, STM32L4_DMACHAN_CCR_OFFSET, regval);
|
||||
|
||||
#warning TODO define peripheral by using dmach->function
|
||||
/* define peripheral indicated in dmach->function */
|
||||
|
||||
regval = dmabase_getreg(dmach, STM32L4_DMA_CSELR_OFFSET);
|
||||
regval &= ~(0x0f << (dmach->chan << 2));
|
||||
regval |= (dmach->function << (dmach->chan << 2));
|
||||
dmabase_putreg(dmach, STM32L4_DMA_CSELR_OFFSET, regval);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -641,7 +652,9 @@ bool stm32l4_dmacapable(uint32_t maddr, uint32_t count, uint32_t ccr)
|
||||
* Transfers to/from memory performed by the DMA controller are
|
||||
* required to be aligned to their size.
|
||||
*
|
||||
* See ST RM0090 rev4, section 9.3.11
|
||||
* Datasheet 3.13 claims
|
||||
* "Access to Flash, SRAM, APB and AHB peripherals as source
|
||||
* and destination"
|
||||
*
|
||||
* Compute mend inline to avoid a possible non-constant integer
|
||||
* multiply.
|
||||
@@ -682,13 +695,14 @@ bool stm32l4_dmacapable(uint32_t maddr, uint32_t count, uint32_t ccr)
|
||||
|
||||
switch (maddr & STM32L4_REGION_MASK)
|
||||
{
|
||||
#if defined(CONFIG_STM32L4_STM32F10XX)
|
||||
case STM32L4_PERIPH_BASE:
|
||||
case STM32L4_FSMC_BASE:
|
||||
case STM32L4_FSMC_BANK1:
|
||||
case STM32L4_FSMC_BANK2:
|
||||
case STM32L4_FSMC_BANK3:
|
||||
case STM32L4_FSMC_BANK4:
|
||||
#endif
|
||||
case STM32L4_SRAM_BASE:
|
||||
case STM32L4_SRAM2_BASE:
|
||||
case STM32L4_CODE_BASE:
|
||||
/* All RAM and flash is supported */
|
||||
|
||||
@@ -719,13 +733,14 @@ void stm32l4_dmasample(DMA_HANDLE handle, struct stm32l4_dmaregs_s *regs)
|
||||
struct stm32l4_dma_s *dmach = (struct stm32l4_dma_s *)handle;
|
||||
irqstate_t flags;
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
regs->isr = dmabase_getreg(dmach, STM32L4_DMA_ISR_OFFSET);
|
||||
regs->cselr = dmabase_getreg(dmach, STM32L4_DMA_CSELR_OFFSET);
|
||||
regs->ccr = dmachan_getreg(dmach, STM32L4_DMACHAN_CCR_OFFSET);
|
||||
regs->cndtr = dmachan_getreg(dmach, STM32L4_DMACHAN_CNDTR_OFFSET);
|
||||
regs->cpar = dmachan_getreg(dmach, STM32L4_DMACHAN_CPAR_OFFSET);
|
||||
regs->cmar = dmachan_getreg(dmach, STM32L4_DMACHAN_CMAR_OFFSET);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -748,7 +763,8 @@ void stm32l4_dmadump(DMA_HANDLE handle, const struct stm32l4_dmaregs_s *regs,
|
||||
uint32_t dmabase = DMA_BASE(dmach->base);
|
||||
|
||||
dmadbg("DMA Registers: %s\n", msg);
|
||||
dmadbg(" ISRC[%08x]: %08x\n", dmabase + STM32L4_DMA_ISR_OFFSET, regs->isr);
|
||||
dmadbg(" ISR[%08x]: %08x\n", dmabase + STM32L4_DMA_ISR_OFFSET, regs->isr);
|
||||
dmadbg(" CSELR[%08x]: %08x\n", dmabase + STM32L4_DMA_CSELR_OFFSET, regs->cselr);
|
||||
dmadbg(" CCR[%08x]: %08x\n", dmach->base + STM32L4_DMACHAN_CCR_OFFSET, regs->ccr);
|
||||
dmadbg(" CNDTR[%08x]: %08x\n", dmach->base + STM32L4_DMACHAN_CNDTR_OFFSET, regs->cndtr);
|
||||
dmadbg(" CPAR[%08x]: %08x\n", dmach->base + STM32L4_DMACHAN_CPAR_OFFSET, regs->cpar);
|
||||
|
||||
+194
-27
@@ -2206,25 +2206,25 @@ Configuration sub-directories
|
||||
|
||||
The NxWM window manager can be found here:
|
||||
|
||||
nuttx-git/NxWidgets/nxwm
|
||||
NxWidgets/nxwm
|
||||
|
||||
The NxWM unit test can be found at:
|
||||
|
||||
nuttx-git/NxWidgets/UnitTests/nxwm
|
||||
NxWidgets/UnitTests/nxwm
|
||||
|
||||
Documentation for installing the NxWM unit test can be found here:
|
||||
|
||||
nuttx-git/NxWidgets/UnitTests/README.txt
|
||||
NxWidgets/UnitTests/README.txt
|
||||
|
||||
2. Here is the quick summary of the build steps. These steps assume
|
||||
that you have the entire NuttX GIT in some directory ~/nuttx-git.
|
||||
You may have these components installed elsewhere. In that case, you
|
||||
that you have the entire NuttX GIT in some directory HOME. You may
|
||||
have these components installed elsewhere. In that case, you
|
||||
will need to adjust all of the paths in the following accordingly:
|
||||
|
||||
a. Install the nxwm configuration
|
||||
a. Install the VNC nxwm configuration
|
||||
|
||||
$ cd ~/nuttx-git/nuttx/tools
|
||||
$ ./configure.sh samv71-xult/nxwm
|
||||
$ cd HOME/nuttx/tools
|
||||
$ ./configure.sh samv71-xult/vnc
|
||||
|
||||
b. Make the build context (only)
|
||||
|
||||
@@ -2241,27 +2241,27 @@ Configuration sub-directories
|
||||
|
||||
c. Install the nxwm unit test
|
||||
|
||||
$ cd ~/nuttx-git/NxWidgets
|
||||
$ tools/install.sh ~/nuttx-git/apps nxwm
|
||||
$ cd HOME/NxWidgets
|
||||
$ tools/install.sh HOME/apps nxwm
|
||||
Creating symbolic link
|
||||
- To ~/nuttx-git/NxWidgets/UnitTests/nxwm
|
||||
- At ~/nuttx-git/apps/external
|
||||
- To HOME/NxWidgets/UnitTests/nxwm
|
||||
- At HOME/apps/external
|
||||
|
||||
d. Build the NxWidgets library
|
||||
|
||||
$ cd ~/nuttx-git/NxWidgets/libnxwidgets
|
||||
$ make TOPDIR=~/nuttx-git/nuttx
|
||||
$ cd HOME/NxWidgets/libnxwidgets
|
||||
$ make TOPDIR=HOME/nuttx
|
||||
...
|
||||
|
||||
e. Build the NxWM library
|
||||
|
||||
$ cd ~/nuttx-git/NxWidgets/nxwm
|
||||
$ make TOPDIR=~/nuttx-git/nuttx
|
||||
$ cd HOME/NxWidgets/nxwm
|
||||
$ make TOPDIR=HOME/nuttx
|
||||
...
|
||||
|
||||
f. Built NuttX with the installed unit test as the application
|
||||
|
||||
$ cd ~/nuttx-git/nuttx
|
||||
$ cd HOME/nuttx
|
||||
$ make
|
||||
|
||||
3. Reading from the LCD is not currently functional. The following
|
||||
@@ -2320,7 +2320,7 @@ Configuration sub-directories
|
||||
1. Network configuration: IP address 10.0.0.2. The is easily changed
|
||||
via 'make menuconfig'. The VNC server address is 10.0.0.2:5900.
|
||||
|
||||
2. The default (local) framebuffer configuration is 320x240 with 16-bit
|
||||
2. The default (local) framebuffer configuration is 320x240 with 8-bit
|
||||
RGB color.
|
||||
|
||||
3. There are complicated interactions between VNC and the network
|
||||
@@ -2339,13 +2339,180 @@ Configuration sub-directories
|
||||
mouse/keyboard inputs in the options/input menu. That will make
|
||||
things a little clearer.
|
||||
|
||||
STATUS:
|
||||
2016-04-21: I have gottent he apps/examples/nximage to work
|
||||
with lots issues with GRAPHICS and UPDATER debug ON. There
|
||||
are reliability problems and it hangs at the end of the test.
|
||||
If I turn UPDATE debug off (only), then the display output is
|
||||
corrupted and I get a hardfault.
|
||||
5. To select 16-bits per pixel RGB15 5:6:5
|
||||
|
||||
Mostly likely, the UPDATER debug output slows the updates and
|
||||
avoids some kind of race condition with the networking. Oddly,
|
||||
it does not work at all if I turn off TCP write buffering.
|
||||
CONFIG_NX_DISABLE_8BPP=y
|
||||
# CONFIG_NX_DISABLE_16BPP is not set
|
||||
|
||||
# CONFIG_VNCSERVER_COLORFMT_RGB8 is not set
|
||||
CONFIG_VNCSERVER_COLORFMT_RGB16=y
|
||||
|
||||
CONFIG_EXAMPLES_NXIMAGE_BPP=16
|
||||
|
||||
To re-select 8-bits per pixel RGB8 3:3:2
|
||||
|
||||
# CONFIG_NX_DISABLE_8BPP is not set
|
||||
CONFIG_NX_DISABLE_16BPP=y
|
||||
|
||||
CONFIG_VNCSERVER_COLORFMT_RGB8=y
|
||||
# CONFIG_VNCSERVER_COLORFMT_RGB16 is not set
|
||||
|
||||
# CONFIG_EXAMPLES_NXIMAGE_GREYSCALE is not set
|
||||
CONFIG_EXAMPLES_NXIMAGE_BPP=8
|
||||
|
||||
STATUS:
|
||||
2016-04-21: I have gotten the apps/examples/nximage to work with
|
||||
lots issues with 16-bit RGB and verbose GRAPHICS and UPDATER debug
|
||||
ON. There are reliability problems and it hangs at the end of the
|
||||
test.
|
||||
|
||||
2016-04-22: The default configuration now uses RGB8 which needs a lot
|
||||
less SRAM for the local frame buffer and does not degrade the color
|
||||
quality in the remote display (since it is also 8 BPP). At 8
|
||||
BPP, the remote display is correct even with both GRAPHICS and
|
||||
UPDATER debug OFF -- and there is no hang!
|
||||
|
||||
2106-04-23: The NxImage test was selected because it is a very simple
|
||||
graphics test. Continued testing, however, requires a more complex
|
||||
configuration. Hence, the vnxwm configuration was created.
|
||||
|
||||
A memory clobber error was fixed and this probably corrects some of
|
||||
the reliability problems noted on 2016-04-21.
|
||||
|
||||
vnxwm:
|
||||
|
||||
This is a special configuration setup for the NxWM window manager
|
||||
UnitTest. It provides an interactive windowing experience via a remote
|
||||
VNC client window running on your PC. The SAMV71-XULT is connected to
|
||||
the PC via Ethernet.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. The NxWM window manager is a tiny window manager tailored for use
|
||||
with smaller LCDs. It supports a task, a start window, and
|
||||
multiple application windows with toolbars. However, to make the
|
||||
best use of the visible LCD space, only one application window is
|
||||
visible at at time.
|
||||
|
||||
The NxWM window manager can be found here:
|
||||
|
||||
NxWidgets/nxwm
|
||||
|
||||
The NxWM unit test can be found at:
|
||||
|
||||
NxWidgets/UnitTests/nxwm
|
||||
|
||||
Documentation for installing the NxWM unit test can be found here:
|
||||
|
||||
NxWidgets/UnitTests/README.txt
|
||||
|
||||
2. Here is the quick summary of the build steps. These steps assume
|
||||
that you have the entire NuttX GIT in some directory HOME. You may
|
||||
have these components installed elsewhere. In that case, you
|
||||
will need to adjust all of the paths in the following accordingly:
|
||||
|
||||
a. Install the nxwm configuration
|
||||
|
||||
$ cd HOME/nuttx/tools
|
||||
$ ./configure.sh samv71-xult/nxwm
|
||||
|
||||
b. Make the build context (only)
|
||||
|
||||
$ cd ..
|
||||
$ . ./setenv.sh
|
||||
$ make context
|
||||
...
|
||||
|
||||
NOTE: the use of the setenv.sh file is optional. All that it will
|
||||
do is to adjust your PATH variable so that the build system can find
|
||||
your tools. If you use it, you will most likely need to modify the
|
||||
script so that it has the correct path to your tool binaries
|
||||
directory.
|
||||
|
||||
c. Install the nxwm unit test
|
||||
|
||||
$ cd HOME/NxWidgets
|
||||
$ tools/install.sh HOME/apps nxwm
|
||||
Creating symbolic link
|
||||
- To HOME/NxWidgets/UnitTests/nxwm
|
||||
- At HOME/apps/external
|
||||
|
||||
d. Build the NxWidgets library
|
||||
|
||||
$ cd HOME/NxWidgets/libnxwidgets
|
||||
$ make TOPDIR=HOME/nuttx
|
||||
...
|
||||
|
||||
e. Build the NxWM library
|
||||
|
||||
$ cd HOME/NxWidgets/nxwm
|
||||
$ make TOPDIR=HOME/nuttx
|
||||
...
|
||||
|
||||
f. Built NuttX with the installed unit test as the application
|
||||
|
||||
$ cd HOME/nuttx
|
||||
$ make
|
||||
|
||||
3. Network configuration: IP address 10.0.0.2. The is easily changed
|
||||
via 'make menuconfig'. The VNC server address is 10.0.0.2:5900.
|
||||
|
||||
4. The default (local) framebuffer configuration is 320x240 with 8-bit
|
||||
RGB color.
|
||||
|
||||
I had some problems at 16-bits per pixle (see STATUS below). To
|
||||
select 16-bits per pixel RGB15 5:6:5
|
||||
|
||||
CONFIG_NX_DISABLE_8BPP=y
|
||||
# CONFIG_NX_DISABLE_16BPP is not set
|
||||
|
||||
# CONFIG_VNCSERVER_COLORFMT_RGB8 is not set
|
||||
CONFIG_VNCSERVER_COLORFMT_RGB16=y
|
||||
|
||||
CONFIG_EXAMPLES_NXIMAGE_BPP=16
|
||||
|
||||
To re-select 8-bits per pixel RGB8 3:3:2
|
||||
|
||||
# CONFIG_NX_DISABLE_8BPP is not set
|
||||
CONFIG_NX_DISABLE_16BPP=y
|
||||
|
||||
CONFIG_VNCSERVER_COLORFMT_RGB8=y
|
||||
# CONFIG_VNCSERVER_COLORFMT_RGB16 is not set
|
||||
|
||||
# CONFIG_EXAMPLES_NXIMAGE_GREYSCALE is not set
|
||||
CONFIG_EXAMPLES_NXIMAGE_BPP=8
|
||||
|
||||
5. There are complicated interactions between VNC and the network
|
||||
configuration. The CONFIG_VNCSERVER_UPDATE_BUFSIZE determines the
|
||||
size of update messages. That is 1024 bytes in that configuration
|
||||
(the full message with the header will be a little larger). The
|
||||
MTU (CONFIG_NET_ETH_MTU) is set to 590 so that a full update will
|
||||
require several packets.
|
||||
|
||||
Write buffering also effects network performance. This will break
|
||||
up the large updates into small (196 byte) groups. When we run out
|
||||
of read-ahead buffers, then partial updates may be sent causing a
|
||||
loss of synchronization.
|
||||
|
||||
STATUS:
|
||||
2106-04-23: Configuration created. See status up to this data in
|
||||
the vnc configuration. That probably all applies here as well.
|
||||
|
||||
Only some initial testing has been performed: The configuration
|
||||
is partially functional. Menus do appear and mouse input is
|
||||
probably working correctly.
|
||||
|
||||
But there are a lot of instabilities. I see assertions of
|
||||
various kinds and the RealVNC client often crashes as well.
|
||||
Some of the assertions I see are:
|
||||
|
||||
while (sem_wait(&session->queuesem) < 0)
|
||||
...
|
||||
rect = (FAR struct vnc_fbupdate_s *)sq_remfirst(&session->updqueue);
|
||||
DEBUGASSERT(rect != NULL);
|
||||
|
||||
I would think that could mean only that the semaphore counting is
|
||||
out of sync with the number of updates in the queue.
|
||||
|
||||
But also the assertion at devif/devif_iobsend.c line: 102 which
|
||||
probably means some kind of memory corruption.
|
||||
|
||||
@@ -901,7 +901,6 @@ CONFIG_FS_PROCFS=y
|
||||
CONFIG_NX=y
|
||||
CONFIG_NX_NPLANES=1
|
||||
CONFIG_NX_BGCOLOR=0x0
|
||||
# CONFIG_NX_ANTIALIASING is not set
|
||||
# CONFIG_NX_WRITEONLY is not set
|
||||
CONFIG_NX_UPDATE=y
|
||||
|
||||
@@ -911,8 +910,8 @@ CONFIG_NX_UPDATE=y
|
||||
CONFIG_NX_DISABLE_1BPP=y
|
||||
CONFIG_NX_DISABLE_2BPP=y
|
||||
CONFIG_NX_DISABLE_4BPP=y
|
||||
CONFIG_NX_DISABLE_8BPP=y
|
||||
# CONFIG_NX_DISABLE_16BPP is not set
|
||||
# CONFIG_NX_DISABLE_8BPP is not set
|
||||
CONFIG_NX_DISABLE_16BPP=y
|
||||
CONFIG_NX_DISABLE_24BPP=y
|
||||
CONFIG_NX_DISABLE_32BPP=y
|
||||
CONFIG_NX_PACKEDMSFIRST=y
|
||||
@@ -994,8 +993,8 @@ CONFIG_VNCSERVER_PRIO=100
|
||||
CONFIG_VNCSERVER_STACKSIZE=2048
|
||||
CONFIG_VNCSERVER_UPDATER_PRIO=100
|
||||
CONFIG_VNCSERVER_UPDATER_STACKSIZE=2048
|
||||
# CONFIG_VNCSERVER_COLORFMT_RGB8 is not set
|
||||
CONFIG_VNCSERVER_COLORFMT_RGB16=y
|
||||
CONFIG_VNCSERVER_COLORFMT_RGB8=y
|
||||
# CONFIG_VNCSERVER_COLORFMT_RGB16 is not set
|
||||
# CONFIG_VNCSERVER_COLORFMT_RGB32 is not set
|
||||
CONFIG_VNCSERVER_SCREENWIDTH=320
|
||||
CONFIG_VNCSERVER_SCREENHEIGHT=240
|
||||
@@ -1129,7 +1128,8 @@ CONFIG_EXAMPLES_NSH=y
|
||||
CONFIG_EXAMPLES_NXIMAGE=y
|
||||
CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
|
||||
CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
|
||||
CONFIG_EXAMPLES_NXIMAGE_BPP=16
|
||||
CONFIG_EXAMPLES_NXIMAGE_BPP=8
|
||||
# CONFIG_EXAMPLES_NXIMAGE_GREYSCALE is not set
|
||||
# CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 is not set
|
||||
CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0=y
|
||||
# CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5 is not set
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
############################################################################
|
||||
# configs/samv71-xult/vnxwm/Make.defs
|
||||
#
|
||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_DTCM),y)
|
||||
LDSCRIPT = flash-dtcm.ld
|
||||
else
|
||||
LDSCRIPT = flash-sram.ld
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION)
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
ASMEXT = .S
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
# configs/samv7-xult/vnxwm/Make.defs
|
||||
#
|
||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if [ "$_" = "$0" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WD=`pwd`
|
||||
if [ ! -x "setenv.sh" ]; then
|
||||
echo "This script must be executed from the top-level NuttX build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PATH_ORIG}" ]; then
|
||||
export PATH_ORIG="${PATH}"
|
||||
fi
|
||||
|
||||
# This is the Cygwin path to the location where I installed the Atmel GCC
|
||||
# toolchain under Windows. You will also have to edit this if you install
|
||||
# this toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the CodeSourcery toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
# export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
|
||||
# This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors"
|
||||
# You can this free toolchain here https://launchpad.net/gcc-arm-embedded
|
||||
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin"
|
||||
|
||||
# This is the path to the location where I installed the devkitARM toolchain
|
||||
# You can get this free toolchain from http://devkitpro.org/ or http://sourceforge.net/projects/devkitpro/
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/devkitARM/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
@@ -50,6 +50,10 @@
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
||||
#ifdef CONFIG_VNCSERVER
|
||||
# include <nuttx/video/vnc.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -130,6 +134,17 @@ int board_tsc_setup(int minor)
|
||||
goto errout_with_fb;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VNCSERVER
|
||||
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||
|
||||
ret = vnc_default_fbinitialize(0, g_simtc.hnx);
|
||||
if (ret < 0)
|
||||
{
|
||||
idbg("vnc_default_fbinitialize failed: %d\n", ret);
|
||||
goto errout_with_fb;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set the background to the configured background color */
|
||||
|
||||
ivdbg("Set background color=%d\n", CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR);
|
||||
|
||||
@@ -69,6 +69,10 @@
|
||||
|
||||
/* spi frequency based on arch/arm/src/stm32/stm32_spi.c */
|
||||
|
||||
#ifndef CONFIG_STM32F429I_DISCO_ILI9341_SPIFREQUENCY
|
||||
# define CONFIG_STM32F429I_DISCO_ILI9341_SPIFREQUENCY 20000000
|
||||
#endif
|
||||
|
||||
#if CONFIG_STM32F429I_DISCO_ILI9341_SPIFREQUENCY >= \
|
||||
(STM32_PCLK1_FREQUENCY >> 1)
|
||||
# define ILI93414WS_SPI_BR SPI_CR1_FPCLCKd2 /* 000: fPCLK/2 */
|
||||
|
||||
@@ -144,16 +144,6 @@
|
||||
#define GPIO_QSPI_IO3 (GPIO_QSPI_BK1_IO3_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz)
|
||||
#define GPIO_QSPI_SCK (GPIO_QSPI_CLK_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz)
|
||||
|
||||
#if 0
|
||||
/* XXX hmm, elsewhere */
|
||||
|
||||
#define QSPI_USE_INTERRUPTS 1
|
||||
|
||||
/* XXX hmm, better? (2^(23+1)); this is the value that goes into FSIZE */
|
||||
|
||||
#define QSPI_FLASH_SIZE 23
|
||||
#endif
|
||||
|
||||
/* SPI */
|
||||
|
||||
/* XXX is SPI1 used on Disco? */
|
||||
|
||||
@@ -59,6 +59,7 @@ CONFIG_DEBUG_VERBOSE=y
|
||||
#
|
||||
# OS Function Debug Options
|
||||
#
|
||||
# CONFIG_DEBUG_DMA is not set
|
||||
# CONFIG_DEBUG_HEAP is not set
|
||||
# CONFIG_DEBUG_IRQ is not set
|
||||
|
||||
@@ -176,6 +177,7 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
|
||||
# CONFIG_ARMV7M_ITMSYSLOG is not set
|
||||
# CONFIG_SERIAL_TERMIOS is not set
|
||||
# CONFIG_USART2_RS485 is not set
|
||||
# CONFIG_USART2_RXDMA is not set
|
||||
# CONFIG_SERIAL_DISABLE_REORDERING is not set
|
||||
|
||||
#
|
||||
@@ -197,7 +199,7 @@ CONFIG_STM32L4_FLASH_1024KB=y
|
||||
# CONFIG_STM32L4_ADC is not set
|
||||
# CONFIG_STM32L4_CAN is not set
|
||||
# CONFIG_STM32L4_DAC is not set
|
||||
# CONFIG_STM32L4_DMA is not set
|
||||
CONFIG_STM32L4_DMA=y
|
||||
# CONFIG_STM32L4_I2C is not set
|
||||
# CONFIG_STM32L4_SAI is not set
|
||||
# CONFIG_STM32L4_SPI is not set
|
||||
@@ -207,8 +209,8 @@ CONFIG_STM32L4_USART=y
|
||||
#
|
||||
# AHB1 Peripherals
|
||||
#
|
||||
# CONFIG_STM32L4_DMA1 is not set
|
||||
# CONFIG_STM32L4_DMA2 is not set
|
||||
CONFIG_STM32L4_DMA1=y
|
||||
CONFIG_STM32L4_DMA2=y
|
||||
# CONFIG_STM32L4_CRC is not set
|
||||
# CONFIG_STM32L4_TSC is not set
|
||||
|
||||
@@ -230,6 +232,17 @@ CONFIG_STM32L4_QSPI=y
|
||||
CONFIG_STM32L4_QSPI_FLASH_SIZE=16777216
|
||||
CONFIG_STM32L4_QSPI_FIFO_THESHOLD=4
|
||||
CONFIG_STM32L4_QSPI_CSHT=1
|
||||
# CONFIG_STM32L4_QSPI_POLLING is not set
|
||||
# CONFIG_STM32L4_QSPI_INTERRUPTS is not set
|
||||
CONFIG_STM32L4_QSPI_DMA=y
|
||||
CONFIG_STM32L4_QSPI_DMA_CHAN_1_5=y
|
||||
# CONFIG_STM32L4_QSPI_DMA_CHAN_2_7 is not set
|
||||
# CONFIG_STM32L4_QSPI_DMAPRIORITY_VERYHIGH is not set
|
||||
# CONFIG_STM32L4_QSPI_DMAPRIORITY_HIGH is not set
|
||||
CONFIG_STM32L4_QSPI_DMAPRIORITY_MEDIUM=y
|
||||
# CONFIG_STM32L4_QSPI_DMAPRIORITY_LOW is not set
|
||||
CONFIG_STM32L4_QSPI_DMATHRESHOLD=4
|
||||
# CONFIG_STM32L4_QSPI_REGDEBUG is not set
|
||||
|
||||
#
|
||||
# APB1 Peripherals
|
||||
@@ -302,7 +315,7 @@ CONFIG_STM32L4_SAI1PLL=y
|
||||
#
|
||||
# CONFIG_ARCH_NOINTC is not set
|
||||
# CONFIG_ARCH_VECNOTIRQ is not set
|
||||
# CONFIG_ARCH_DMA is not set
|
||||
CONFIG_ARCH_DMA=y
|
||||
CONFIG_ARCH_HAVE_IRQPRIO=y
|
||||
# CONFIG_ARCH_L2CACHE is not set
|
||||
# CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set
|
||||
@@ -384,7 +397,7 @@ CONFIG_LIB_BOARDCTL=y
|
||||
# CONFIG_BOARDCTL_ADCTEST is not set
|
||||
# CONFIG_BOARDCTL_PWMTEST is not set
|
||||
# CONFIG_BOARDCTL_GRAPHICS is not set
|
||||
# CONFIG_BOARDCTL_IOCTL is not set
|
||||
CONFIG_BOARDCTL_IOCTL=y
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
@@ -646,12 +659,7 @@ CONFIG_USART2_2STOP=0
|
||||
#
|
||||
# System Logging
|
||||
#
|
||||
CONFIG_RAMLOG=y
|
||||
CONFIG_RAMLOG_SYSLOG=y
|
||||
# CONFIG_RAMLOG_CONSOLE is not set
|
||||
CONFIG_RAMLOG_BUFSIZE=8192
|
||||
# CONFIG_RAMLOG_CRLF is not set
|
||||
CONFIG_RAMLOG_NONBLOCKING=y
|
||||
# CONFIG_RAMLOG is not set
|
||||
# CONFIG_SYSLOG_CONSOLE is not set
|
||||
|
||||
#
|
||||
@@ -708,9 +716,8 @@ CONFIG_FS_PROCFS_REGISTER=y
|
||||
#
|
||||
# System Logging
|
||||
#
|
||||
CONFIG_SYSLOG=y
|
||||
# CONFIG_SYSLOG is not set
|
||||
# CONFIG_SYSLOG_TIMESTAMP is not set
|
||||
# CONFIG_SYSLOG_CHAR is not set
|
||||
|
||||
#
|
||||
# Graphics Support
|
||||
@@ -838,14 +845,7 @@ CONFIG_EXAMPLES_BUTTONS_NAME7="Button 7"
|
||||
# CONFIG_EXAMPLES_CXXTEST is not set
|
||||
# CONFIG_EXAMPLES_DHCPD is not set
|
||||
# CONFIG_EXAMPLES_ELF is not set
|
||||
CONFIG_EXAMPLES_FSTEST=y
|
||||
CONFIG_EXAMPLES_FSTEST_MAXNAME=32
|
||||
CONFIG_EXAMPLES_FSTEST_MAXFILE=8192
|
||||
CONFIG_EXAMPLES_FSTEST_MAXIO=347
|
||||
CONFIG_EXAMPLES_FSTEST_MAXOPEN=512
|
||||
CONFIG_EXAMPLES_FSTEST_MOUNTPT="/mnt/n25qxxx"
|
||||
CONFIG_EXAMPLES_FSTEST_NLOOPS=1
|
||||
CONFIG_EXAMPLES_FSTEST_VERBOSE=y
|
||||
# CONFIG_EXAMPLES_FSTEST is not set
|
||||
# CONFIG_EXAMPLES_FTPC is not set
|
||||
# CONFIG_EXAMPLES_FTPD is not set
|
||||
# CONFIG_EXAMPLES_HELLO is not set
|
||||
@@ -871,20 +871,12 @@ CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
||||
# CONFIG_EXAMPLES_NXIMAGE is not set
|
||||
# CONFIG_EXAMPLES_NXLINES is not set
|
||||
# CONFIG_EXAMPLES_NXTEXT is not set
|
||||
CONFIG_EXAMPLES_OSTEST=y
|
||||
CONFIG_EXAMPLES_OSTEST_LOOPS=1
|
||||
CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
|
||||
CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=8
|
||||
CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000
|
||||
CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
|
||||
CONFIG_EXAMPLES_OSTEST_WAITRESULT=y
|
||||
# CONFIG_EXAMPLES_OSTEST is not set
|
||||
# CONFIG_EXAMPLES_PCA9635 is not set
|
||||
# CONFIG_EXAMPLES_PIPE is not set
|
||||
# CONFIG_EXAMPLES_PPPD is not set
|
||||
# CONFIG_EXAMPLES_POSIXSPAWN is not set
|
||||
CONFIG_EXAMPLES_RANDOM=y
|
||||
CONFIG_EXAMPLES_MAXSAMPLES=64
|
||||
CONFIG_EXAMPLES_NSAMPLES=8
|
||||
# CONFIG_EXAMPLES_RANDOM is not set
|
||||
# CONFIG_EXAMPLES_RGBLED is not set
|
||||
# CONFIG_EXAMPLES_RGMP is not set
|
||||
# CONFIG_EXAMPLES_SENDMAIL is not set
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@@ -57,6 +59,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/ramdisk.h>
|
||||
#include <nuttx/fs/nxffs.h>
|
||||
#include <nuttx/fs/mkfatfs.h>
|
||||
#include <nuttx/binfmt/elf.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
|
||||
@@ -193,6 +196,7 @@ int board_app_initialize(void)
|
||||
#ifdef HAVE_N25QXXX_SMARTFS
|
||||
/* Configure the device with no partition support */
|
||||
|
||||
SYSLOG("doing smart_initialize()\n");
|
||||
ret = smart_initialize(N25QXXX_SMART_MINOR, mtd, NULL);
|
||||
if (ret != OK)
|
||||
{
|
||||
@@ -202,6 +206,7 @@ int board_app_initialize(void)
|
||||
#elif defined(HAVE_N25QXXX_NXFFS)
|
||||
/* Initialize to provide NXFFS on the N25QXXX MTD interface */
|
||||
|
||||
SYSLOG("doing nxffs_initialize()\n");
|
||||
ret = nxffs_initialize(mtd);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -237,9 +242,9 @@ int board_app_initialize(void)
|
||||
/* NOTE: for this to work, you will need to make sure that
|
||||
* CONFIG_FS_WRITABLE is set in the config. It's not a user-
|
||||
* visible setting, but you can make it set by selecting an
|
||||
* arbitrary writeable file system (you don't have to actually
|
||||
* arbitrary writable file system (you don't have to actually
|
||||
* use it, just select it so that the block device created via
|
||||
* ftl_initialize() will be writeable). Personally, I chose FAT,
|
||||
* ftl_initialize() will be writable). Personally, I chose FAT,
|
||||
* because SMARTFS and NXFFS will cause the other code branches
|
||||
* above to become active.
|
||||
*/
|
||||
@@ -257,3 +262,12 @@ int board_app_initialize(void)
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
|
||||
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_IOCTL
|
||||
int board_ioctl(unsigned int cmd, uintptr_t arg)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -919,8 +919,7 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile,
|
||||
totalsize = 0;
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 /* Guaranteed to be true */
|
||||
linesize = snprintf(procfile->line, STATUS_LINELEN, "\n%3-s %-8s %s\n",
|
||||
"FD", "POS", "OFLAGS");
|
||||
linesize = snprintf(procfile->line, STATUS_LINELEN, "\n%-3s %-8s %s\n",
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
|
||||
|
||||
totalsize += copysize;
|
||||
|
||||
@@ -53,22 +53,6 @@
|
||||
|
||||
#ifdef CONFIG_NX_NXSTART
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
@@ -127,9 +127,20 @@ config VNCSERVER_INBUFFER_SIZE
|
||||
int "Input buffer size"
|
||||
default 80
|
||||
|
||||
config VNCSERVER_DEBUG
|
||||
bool "VNC Server debug"
|
||||
default n
|
||||
depends on DEBUG && !DEBUG_GRAPHICS
|
||||
---help---
|
||||
Normally VNC debug output is selected with DEBUG_GRAPHICS. The VNC
|
||||
server server suupport this special option to enable GRAPHICS debug
|
||||
output for the VNC server while GRAPHICS debug is disabled. This
|
||||
provides an cleaner, less cluttered output when you only wish to
|
||||
debug the VNC server versus enabling DEBUG_GRAPHICS globally.
|
||||
|
||||
config VNCSERVER_UPDATE_DEBUG
|
||||
bool "Detailed updater debug"
|
||||
default n
|
||||
depends on DEBUG_GRAPHICS
|
||||
depends on DEBUG_GRAPHICS || VNCSERVER_DEBUG
|
||||
|
||||
endif # VNCSERVER
|
||||
|
||||
@@ -265,9 +265,14 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb)
|
||||
* Name: vnc_colors
|
||||
*
|
||||
* Description:
|
||||
* Test the update rectangle to see if it contains complex colors. If it
|
||||
* contains only a few colors, then it may be a candidate for some type
|
||||
* run-length encoding.
|
||||
* Test the update rectangle to see if it contains complex colors. If it
|
||||
* contains only a few colors, then it may be a candidate for some type
|
||||
* run-length encoding.
|
||||
*
|
||||
* REVISIT: This function is imperfect: It will fail if there are more
|
||||
* than 8 colors in the region. For small colors, we can keep a local
|
||||
* array for all color formats and always return the exact result, no
|
||||
* matter now many colors.
|
||||
*
|
||||
* Input Parameters:
|
||||
* session - An instance of the session structure.
|
||||
@@ -280,15 +285,13 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb)
|
||||
* The number of valid colors in the colors[] array are returned, the
|
||||
* first entry being the most frequent. A negated errno value is returned
|
||||
* if the colors cannot be determined. This would be the case if the color
|
||||
* depth is > 8 and there are more than 'maxcolors' colors in the update
|
||||
* rectangle.
|
||||
* there are more than 'maxcolors' colors in the update rectangle.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int vnc_colors(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect,
|
||||
unsigned int maxcolors, FAR lfb_color_t *colors)
|
||||
{
|
||||
#if RFB_PIXELDEPTH > 8
|
||||
FAR const lfb_color_t *rowstart;
|
||||
FAR const lfb_color_t *pixptr;
|
||||
lfb_color_t pixel;
|
||||
@@ -412,12 +415,4 @@ int vnc_colors(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect,
|
||||
/* And return the number of colors that we found */
|
||||
|
||||
return ncolors;
|
||||
|
||||
#else
|
||||
/* For small colors, we can keep a local array for all color formats and
|
||||
* always return the exact result, no matter now many colors. OR we could
|
||||
* just remove this conditional compilation and live with 8 colors max.
|
||||
*/
|
||||
# error No support for small colors
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -43,6 +43,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS)
|
||||
# undef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# define CONFIG_DEBUG 1
|
||||
# define CONFIG_DEBUG_VERBOSE 1
|
||||
# define CONFIG_DEBUG_GRAPHICS 1
|
||||
#endif
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kthread.h>
|
||||
@@ -481,7 +489,7 @@ static inline int vnc_wait_start(int display)
|
||||
*/
|
||||
|
||||
while (g_vnc_sessions[display] == NULL ||
|
||||
g_vnc_sessions[display]->state != VNCSERVER_UNINITIALIZED)
|
||||
g_vnc_sessions[display]->state == VNCSERVER_UNINITIALIZED)
|
||||
{
|
||||
/* The server is not yet running. Wait for the server to post the FB
|
||||
* semaphore. In certain error situations, the server may post the
|
||||
@@ -869,7 +877,7 @@ void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
|
||||
{
|
||||
/* Queue the rectangular update */
|
||||
|
||||
ret = vnc_update_rectangle(session, rect);
|
||||
ret = vnc_update_rectangle(session, rect, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
gdbg("ERROR: vnc_update_rectangle failed: %d\n", ret);
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
#define XK_LATIN1 1
|
||||
#define XK_XKB_KEYS 1
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/video/vnc.h>
|
||||
#include <nuttx/input/x11_keysymdef.h>
|
||||
#include <nuttx/input/kbd_codec.h>
|
||||
|
||||
@@ -627,4 +629,26 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym,
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: vnc_kbdout
|
||||
*
|
||||
* Description:
|
||||
* This is the default keyboard callout function. This is simply wrappers around nx_kdbout(), respectively. When configured using vnc_fbinitialize(), the 'arg' must be the correct NXHANDLE value.
|
||||
*
|
||||
* Parameters:
|
||||
* arg - The NXHANDLE from the NX graphics subsystem
|
||||
* nch - Number of characters
|
||||
* ch - An array of input characters.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch)
|
||||
{
|
||||
DEBUGASSERT(arg != NULL);
|
||||
(void)nx_kbdin((NXHANDLE)arg, nch, ch);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NX_KBD */
|
||||
@@ -43,6 +43,14 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS)
|
||||
# undef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# define CONFIG_DEBUG 1
|
||||
# define CONFIG_DEBUG_VERBOSE 1
|
||||
# define CONFIG_DEBUG_GRAPHICS 1
|
||||
#endif
|
||||
#include <debug.h>
|
||||
|
||||
#ifdef CONFIG_NET_SOCKOPTS
|
||||
@@ -154,6 +162,11 @@ int vnc_negotiate(FAR struct vnc_session_s *session)
|
||||
DEBUGASSERT(errcode > 0);
|
||||
return -errcode;
|
||||
}
|
||||
else if (nrecvd == 0)
|
||||
{
|
||||
gdbg("Connection closed\n");
|
||||
return -ECONNABORTED;
|
||||
}
|
||||
|
||||
DEBUGASSERT(nrecvd == len);
|
||||
|
||||
@@ -221,6 +234,11 @@ int vnc_negotiate(FAR struct vnc_session_s *session)
|
||||
DEBUGASSERT(errcode > 0);
|
||||
return -errcode;
|
||||
}
|
||||
else if (nrecvd == 0)
|
||||
{
|
||||
gdbg("Connection closed\n");
|
||||
return -ECONNABORTED;
|
||||
}
|
||||
|
||||
DEBUGASSERT(nrecvd == sizeof(struct rfb_selected_sectype_s));
|
||||
|
||||
@@ -305,6 +323,11 @@ int vnc_negotiate(FAR struct vnc_session_s *session)
|
||||
DEBUGASSERT(errcode > 0);
|
||||
return -errcode;
|
||||
}
|
||||
else if (nrecvd == 0)
|
||||
{
|
||||
gdbg("Connection closed\n");
|
||||
return -ECONNABORTED;
|
||||
}
|
||||
|
||||
DEBUGASSERT(nrecvd == sizeof(struct rfb_clientinit_s));
|
||||
|
||||
@@ -375,6 +398,11 @@ int vnc_negotiate(FAR struct vnc_session_s *session)
|
||||
DEBUGASSERT(errcode > 0);
|
||||
return -errcode;
|
||||
}
|
||||
else if (nrecvd == 0)
|
||||
{
|
||||
gdbg("Connection closed\n");
|
||||
return -ECONNABORTED;
|
||||
}
|
||||
else if (nrecvd != sizeof(struct rfb_setpixelformat_s))
|
||||
{
|
||||
/* Must not be a SetPixelFormat message? */
|
||||
@@ -417,8 +445,13 @@ int vnc_negotiate(FAR struct vnc_session_s *session)
|
||||
DEBUGASSERT(errcode > 0);
|
||||
return -errcode;
|
||||
}
|
||||
else if (nrecvd == 0)
|
||||
{
|
||||
gdbg("Connection closed\n");
|
||||
return -ECONNABORTED;
|
||||
}
|
||||
|
||||
if (nrecvd > 0 && encodings->msgtype == RFB_SETENCODINGS_MSG)
|
||||
if (encodings->msgtype == RFB_SETENCODINGS_MSG)
|
||||
{
|
||||
DEBUGASSERT(nrecvd >= SIZEOF_RFB_SETENCODINGS_S(0));
|
||||
|
||||
@@ -513,5 +546,6 @@ int vnc_client_pixelformat(FAR struct vnc_session_s *session,
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
session->change = true;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS)
|
||||
# undef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# define CONFIG_DEBUG 1
|
||||
# define CONFIG_DEBUG_VERBOSE 1
|
||||
# define CONFIG_DEBUG_GRAPHICS 1
|
||||
#endif
|
||||
#include <debug.h>
|
||||
|
||||
#include "vnc_server.h"
|
||||
|
||||
@@ -41,6 +41,14 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS)
|
||||
# undef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# define CONFIG_DEBUG 1
|
||||
# define CONFIG_DEBUG_VERBOSE 1
|
||||
# define CONFIG_DEBUG_GRAPHICS 1
|
||||
#endif
|
||||
#include <debug.h>
|
||||
|
||||
#ifdef CONFIG_NET_SOCKOPTS
|
||||
@@ -49,6 +57,9 @@
|
||||
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/video/rfb.h>
|
||||
#include <nuttx/video/vnc.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
||||
#include "vnc_server.h"
|
||||
|
||||
@@ -165,6 +176,16 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
||||
return -errcode;
|
||||
}
|
||||
|
||||
/* A return value of zero means that the connection was gracefully
|
||||
* closed by the VNC client.
|
||||
*/
|
||||
|
||||
else if (nrecvd == 0)
|
||||
{
|
||||
gdbg("Connection closed\n", errcode);
|
||||
return OK;
|
||||
}
|
||||
|
||||
DEBUGASSERT(nrecvd == 1);
|
||||
|
||||
/* The single byte received should be the message type. Handle the
|
||||
@@ -207,7 +228,7 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
||||
case RFB_SETENCODINGS_MSG: /* SetEncodings */
|
||||
{
|
||||
FAR struct rfb_setencodings_s *encodings;
|
||||
uint32_t nencodings;
|
||||
unsigned int nencodings;
|
||||
|
||||
gvdbg("Received SetEncodings\n");
|
||||
|
||||
@@ -228,7 +249,7 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
||||
/* Read the following encodings */
|
||||
|
||||
encodings = (FAR struct rfb_setencodings_s *)session->inbuf;
|
||||
nencodings = rfb_getbe32(encodings->nencodings);
|
||||
nencodings = rfb_getbe16(encodings->nencodings);
|
||||
|
||||
ret = vnc_read_remainder(session,
|
||||
nencodings * sizeof(uint32_t),
|
||||
@@ -280,7 +301,7 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
||||
rect.pt2.x = rect.pt1.x + rfb_getbe16(update->width);
|
||||
rect.pt2.y = rect.pt1.y + rfb_getbe16(update->height);
|
||||
|
||||
ret = vnc_update_rectangle(session, &rect);
|
||||
ret = vnc_update_rectangle(session, &rect, false);
|
||||
if (ret < 0)
|
||||
{
|
||||
gdbg("ERROR: Failed to queue update: %d\n", ret);
|
||||
@@ -452,7 +473,7 @@ int vnc_client_encodings(FAR struct vnc_session_s *session,
|
||||
|
||||
/* Loop for each client supported encoding */
|
||||
|
||||
nencodings = rfb_getbe32(encodings->nencodings);
|
||||
nencodings = rfb_getbe16(encodings->nencodings);
|
||||
for (i = 0; i < nencodings; i++)
|
||||
{
|
||||
/* Get the next encoding */
|
||||
@@ -464,9 +485,37 @@ int vnc_client_encodings(FAR struct vnc_session_s *session,
|
||||
if (encoding == RFB_ENCODING_RRE)
|
||||
{
|
||||
session->rre = true;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
session->change = true;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: vnc_mouse
|
||||
*
|
||||
* Description:
|
||||
* This is the default keyboard/mouse callout function. This is simply a
|
||||
* wrapper around nx_mousein(). When
|
||||
* configured using vnc_fbinitialize(), the 'arg' must be the correct
|
||||
* NXHANDLE value.
|
||||
*
|
||||
* Parameters:
|
||||
* See vnc_mouseout_t and vnc_kbdout_t typde definitions above. These
|
||||
* callouts have arguments that match the inputs to nx_kbdin() and
|
||||
* nx_mousein() (if arg is really of type NXHANDLE).
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NX_XYINPUT
|
||||
void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y,
|
||||
uint8_t buttons)
|
||||
{
|
||||
DEBUGASSERT(arg != NULL);
|
||||
(void)nx_mousein((NXHANDLE)arg, x, y, buttons);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -42,6 +42,14 @@
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS)
|
||||
# undef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# define CONFIG_DEBUG 1
|
||||
# define CONFIG_DEBUG_VERBOSE 1
|
||||
# define CONFIG_DEBUG_GRAPHICS 1
|
||||
#endif
|
||||
#include <debug.h>
|
||||
|
||||
#include "vnc_server.h"
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
#include <queue.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS)
|
||||
# undef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# define CONFIG_DEBUG 1
|
||||
# define CONFIG_DEBUG_VERBOSE 1
|
||||
# define CONFIG_DEBUG_GRAPHICS 1
|
||||
#endif
|
||||
#include <debug.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
@@ -121,9 +129,16 @@ static void vnc_reset_session(FAR struct vnc_session_s *session,
|
||||
|
||||
sem_reset(&session->freesem, CONFIG_VNCSERVER_NUPDATES);
|
||||
sem_reset(&session->queuesem, 0);
|
||||
|
||||
session->fb = fb;
|
||||
session->display = display;
|
||||
session->state = VNCSERVER_INITIALIZED;
|
||||
session->nwhupd = 0;
|
||||
session->change = true;
|
||||
|
||||
/* Careful not to disturb the keyboard/mouse callouts set by
|
||||
* vnc_fbinitialize(). Client related data left in garbage state.
|
||||
*/
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -336,6 +351,7 @@ int vnc_server(int argc, FAR char *argv[])
|
||||
|
||||
ret = vnc_receiver(session);
|
||||
gvdbg("Session terminated with %d\n", ret);
|
||||
UNUSED(ret);
|
||||
|
||||
/* Stop the VNC updater thread. */
|
||||
|
||||
|
||||
@@ -246,14 +246,15 @@ struct vnc_session_s
|
||||
struct socket connect; /* Connected socket */
|
||||
volatile uint8_t state; /* See enum vnc_server_e */
|
||||
volatile uint8_t nwhupd; /* Number of whole screen updates queued */
|
||||
volatile bool change; /* True: Frambebuffer data change since last whole screen update */
|
||||
|
||||
/* Display geometry and color characteristics */
|
||||
|
||||
uint8_t display; /* Display number (for debug) */
|
||||
volatile uint8_t colorfmt; /* Remote color format (See include/nuttx/fb.h) */
|
||||
volatile uint8_t bpp; /* Remote bits per pixel */
|
||||
volatile bool bigendian; /* Remote expect data in big-endian format */
|
||||
volatile bool rre; /* Remote supports RRE encoding */
|
||||
volatile bool bigendian; /* True: Remote expect data in big-endian format */
|
||||
volatile bool rre; /* True: Remote supports RRE encoding */
|
||||
FAR uint8_t *fb; /* Allocated local frame buffer */
|
||||
|
||||
/* VNC client input support */
|
||||
@@ -450,6 +451,7 @@ int vnc_stop_updater(FAR struct vnc_session_s *session);
|
||||
* Input Parameters:
|
||||
* session - An instance of the session structure.
|
||||
* rect - The rectanglular region to be updated.
|
||||
* change - True: Frame buffer data has changed
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
@@ -458,7 +460,8 @@ int vnc_stop_updater(FAR struct vnc_session_s *session);
|
||||
****************************************************************************/
|
||||
|
||||
int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||
FAR const struct nxgl_rect_s *rect);
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
bool change);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: vnc_receiver
|
||||
|
||||
@@ -47,6 +47,15 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS)
|
||||
# undef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# define CONFIG_DEBUG 1
|
||||
# define CONFIG_DEBUG_VERBOSE 1
|
||||
# define CONFIG_DEBUG_GRAPHICS 1
|
||||
#endif
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
|
||||
#include "vnc_server.h"
|
||||
@@ -55,7 +64,8 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#undef VNCSERVER_SEM_DEBUG
|
||||
#undef VNCSERVER_SEM_DEBUG /* Define to dump queue/semaphore state */
|
||||
#undef VNCSERVER_SEM_DEBUG_SILENT /* Define to dump only suspicious conditions */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@@ -103,8 +113,14 @@ static void vnc_sem_debug(FAR struct vnc_session_s *session,
|
||||
FAR const char *msg, unsigned int unattached)
|
||||
{
|
||||
FAR struct vnc_fbupdate_s *update;
|
||||
unsigned int nqueued;
|
||||
unsigned int nfree;
|
||||
int nqueued;
|
||||
int nfree;
|
||||
int freesem;
|
||||
int queuesem;
|
||||
int freecount;
|
||||
int queuecount;
|
||||
int freewaiting;
|
||||
int queuewaiting;
|
||||
|
||||
while (sem_wait(&g_dbgsem) < 0)
|
||||
{
|
||||
@@ -113,19 +129,40 @@ static void vnc_sem_debug(FAR struct vnc_session_s *session,
|
||||
|
||||
/* Count structures in the list */
|
||||
|
||||
for (nqueued = 0, update = (FAR struct vnc_fbupdate_s *)session->updqueue.head;
|
||||
update != NULL;
|
||||
nqueued++, update = update->flink);
|
||||
nqueued = sq_count(&session->updqueue);
|
||||
nfree = sq_count(&session->updfree);
|
||||
|
||||
for (nfree = 0, update = (FAR struct vnc_fbupdate_s *)session->updfree.head;
|
||||
update != NULL;
|
||||
nfree++, update = update->flink);
|
||||
freesem = session->freesem.semcount;
|
||||
queuesem = session->queuesem.semcount;
|
||||
|
||||
syslog(LOG_INFO, "FREESEM DEBUG: %s\n", msg);
|
||||
syslog(LOG_INFO, " freesem: %d\n", session->freesem.semcount);
|
||||
syslog(LOG_INFO, " queued: %u\n", nqueued);
|
||||
syslog(LOG_INFO, " free: %u\n", nfree);
|
||||
syslog(LOG_INFO, " unattached: %u\n", unattached);
|
||||
freecount = freesem > 0 ? freesem : 0;
|
||||
queuecount = queuesem > 0 ? queuesem : 0;
|
||||
|
||||
freewaiting = freesem < 0 ? -freesem : 0;
|
||||
queuewaiting = queuesem < 0 ? -queuesem : 0;
|
||||
|
||||
#ifdef VNCSERVER_SEM_DEBUG_SILENT
|
||||
/* This dumps most false alarms in the case where:
|
||||
*
|
||||
* - Updater was waiting on a semaphore (count is -1)
|
||||
* - New update added to the queue (queue count is 1)
|
||||
* - queuesem posted. Wakes up Updater and the count is 0.
|
||||
*/
|
||||
|
||||
if ((nqueued + nfree) != (freecount + queuecount))
|
||||
#endif
|
||||
{
|
||||
syslog(LOG_INFO, "FREESEM DEBUG: %s\n", msg);
|
||||
syslog(LOG_INFO, " Free list:\n");
|
||||
syslog(LOG_INFO, " semcount: %d\n", freecount);
|
||||
syslog(LOG_INFO, " queued nodes: %u\n", nfree);
|
||||
syslog(LOG_INFO, " waiting: %u\n", freewaiting);
|
||||
syslog(LOG_INFO, " Qeued Updates:\n");
|
||||
syslog(LOG_INFO, " semcount: %d\n", queuecount);
|
||||
syslog(LOG_INFO, " queued nodes: %u\n", nqueued);
|
||||
syslog(LOG_INFO, " waiting: %u\n", queuewaiting);
|
||||
syslog(LOG_INFO, " Unqueued: %u\n", unattached);
|
||||
}
|
||||
|
||||
sem_post(&g_dbgsem);
|
||||
}
|
||||
@@ -253,6 +290,8 @@ vnc_remove_queue(FAR struct vnc_session_s *session)
|
||||
/* It is reserved.. go get it */
|
||||
|
||||
rect = (FAR struct vnc_fbupdate_s *)sq_remfirst(&session->updqueue);
|
||||
|
||||
vnc_sem_debug(session, "After remove", 0);
|
||||
DEBUGASSERT(rect != NULL);
|
||||
|
||||
/* Check if we just removed the whole screen update from the queue */
|
||||
@@ -263,7 +302,6 @@ vnc_remove_queue(FAR struct vnc_session_s *session)
|
||||
updvdbg("Whole screen update: nwhupd=%d\n", session->nwhupd);
|
||||
}
|
||||
|
||||
vnc_sem_debug(session, "After remove", 0);
|
||||
sched_unlock();
|
||||
return rect;
|
||||
}
|
||||
@@ -481,6 +519,7 @@ int vnc_stop_updater(FAR struct vnc_session_s *session)
|
||||
* Input Parameters:
|
||||
* session - An instance of the session structure.
|
||||
* rect - The rectanglular region to be updated.
|
||||
* change - True: Frame buffer data has changed
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
@@ -489,7 +528,7 @@ int vnc_stop_updater(FAR struct vnc_session_s *session)
|
||||
****************************************************************************/
|
||||
|
||||
int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||
FAR const struct nxgl_rect_s *rect)
|
||||
FAR const struct nxgl_rect_s *rect, bool change)
|
||||
{
|
||||
FAR struct vnc_fbupdate_s *update;
|
||||
struct nxgl_rect_s intersection;
|
||||
@@ -497,7 +536,7 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||
|
||||
/* Clip rectangle to the screen dimensions */
|
||||
|
||||
nxgl_rectintersect(&intersection, rect, &g_wholescreen);
|
||||
nxgl_rectintersect(&intersection, rect, &g_wholescreen);
|
||||
|
||||
/* Make sure that the clipped rectangle has a area */
|
||||
|
||||
@@ -510,20 +549,34 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||
whupd = (memcmp(&intersection, &g_wholescreen,
|
||||
sizeof(struct nxgl_rect_s)) == 0);
|
||||
|
||||
/* Ignore all updates if there is a queue whole screen update */
|
||||
/* Ignore any client update requests if there have been no changes to
|
||||
* the framebuffer since the last whole screen update.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
if (!change && !session->change)
|
||||
{
|
||||
/* No.. ignore the client update. We have nothing new to report. */
|
||||
|
||||
sched_unlock();
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Ignore all updates if there is a queued whole screen update */
|
||||
|
||||
if (session->nwhupd == 0)
|
||||
{
|
||||
/* Is this a new whole screen update */
|
||||
/* No whole screen updates in the queue. Is this a new whole
|
||||
* screen update?
|
||||
*/
|
||||
|
||||
if (whupd)
|
||||
{
|
||||
/* Yes.. Discard all of the previously queued updates */
|
||||
|
||||
FAR struct vnc_fbupdate_s *curr;
|
||||
FAR struct vnc_fbupdate_s *next;
|
||||
|
||||
/* Yes.. discard all of the previously queued updates */
|
||||
|
||||
updvdbg("New whole screen update...\n");
|
||||
|
||||
curr = (FAR struct vnc_fbupdate_s *)session->updqueue.head;
|
||||
@@ -536,7 +589,20 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||
vnc_free_update(session, curr);
|
||||
}
|
||||
|
||||
/* One whole screen update will be queued. There have been
|
||||
* no frame buffer data changes since this update was queued.
|
||||
*/
|
||||
|
||||
session->nwhupd = 1;
|
||||
session->change = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We are not updating the whole screen. Remember if this
|
||||
* update (OR a preceding update) was due to a data change.
|
||||
*/
|
||||
|
||||
session->change |= change;
|
||||
}
|
||||
|
||||
/* Allocate an update structure... waiting if necessary */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/board.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -46,7 +46,8 @@
|
||||
* definitions provide the common interface between NuttX and the
|
||||
* architecture-specific implementation in arch/
|
||||
*
|
||||
* These definitions are retained in the the header file nuttx/include/arch.h
|
||||
* These definitions are retained in the the header file
|
||||
* nuttx/include/arch.h
|
||||
*
|
||||
* NOTE: up_ is supposed to stand for microprocessor; the u is like the
|
||||
* Greek letter micron: µ. So it would be µP which is a common shortening
|
||||
@@ -680,7 +681,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_CRASHDUMP
|
||||
void board_crashdump(uint32_t currentsp, void *tcb, uint8_t *filename,
|
||||
void board_crashdump(uintptr_t currentsp, FAR void *tcb,
|
||||
FAR const uint8_t *filename,
|
||||
int lineno);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -370,8 +370,8 @@ struct rfb_setpixelformat_s
|
||||
struct rfb_setencodings_s
|
||||
{
|
||||
uint8_t msgtype; /* U8 Message type */
|
||||
uint8_t padding[3];
|
||||
uint8_t nencodings[4]; /* U32 Number of encodings */
|
||||
uint8_t padding;
|
||||
uint8_t nencodings[2]; /* U16 Number of encodings */
|
||||
uint8_t encodings[4]; /* S32 Encoding type, size = 4*nencodings */
|
||||
};
|
||||
|
||||
|
||||
@@ -108,6 +108,8 @@ extern "C"
|
||||
* higher level level callouts can then call nx_kbdin() or nx_mousein() on
|
||||
* behalf of the VNC server.
|
||||
*
|
||||
* See also vnc_default_fbinitialize() below.
|
||||
*
|
||||
* Parameters:
|
||||
* display - In the case of hardware with multiple displays, this
|
||||
* specifies the display. Normally this is zero.
|
||||
@@ -129,6 +131,79 @@ extern "C"
|
||||
int vnc_fbinitialize(int display, vnc_kbdout_t kbdout,
|
||||
vnc_mouseout_t mouseout, FAR void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: vnc_mouse and vnc_kbdout
|
||||
*
|
||||
* Description:
|
||||
* These are the default keyboard/mouse callout functions. They are
|
||||
* simply wrappers around nx_mousein() and nx_kdbout(), respectively. When
|
||||
* configured using vnc_fbinitialize(), the 'arg' must be the correct
|
||||
* NXHANDLE value.
|
||||
*
|
||||
* See also vnc_default_fbinitialize() below.
|
||||
*
|
||||
* Parameters:
|
||||
* See vnc_mouseout_t and vnc_kbdout_t typde definitions above. These
|
||||
* callouts have arguments that match the inputs to nx_kbdin() and
|
||||
* nx_mousein() (if arg is really of type NXHANDLE).
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NX_KBD
|
||||
void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NX_XYINPUT
|
||||
void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y,
|
||||
uint8_t buttons);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Function: vnc_default_fbinitialize
|
||||
*
|
||||
* Description:
|
||||
* This is just a wrapper around vnc_fbinitialize() that will establish
|
||||
* the default mouse and keyboard callout functions.
|
||||
*
|
||||
* Parameters:
|
||||
* display - In the case of hardware with multiple displays, this
|
||||
* specifies the display. Normally this is zero.
|
||||
* handle - And instance of NXHANDLE returned from initialization of the
|
||||
* NX graphics system for that display.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is
|
||||
* returned to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* int vnc_default_fbinitialize(int display, NXHANDLE handle); */
|
||||
|
||||
#if defined(CONFIG_NX_KBD) && defined(CONFIG_NX_XYINPUT)
|
||||
|
||||
#define vnc_default_fbinitialize(d,h) \
|
||||
vnc_fbinitialize((d), vnc_kbdout, vnc_mouseout, (FAR void *)(h))
|
||||
|
||||
#elif defined(CONFIG_NX_KBD)
|
||||
|
||||
#define vnc_default_fbinitialize(d,h) \
|
||||
vnc_fbinitialize((d), vnc_kbdout, NULL, (FAR void *)(h))
|
||||
|
||||
#elif defined(CONFIG_NX_XYINPUT)
|
||||
|
||||
#define vnc_default_fbinitialize(d,h) \
|
||||
vnc_fbinitialize((d), NULL, vnc_mouseout, (FAR void *)(h))
|
||||
|
||||
#else
|
||||
|
||||
#define vnc_default_fbinitialize(d,h) \
|
||||
vnc_fbinitialize((d), NULL, NULL, NULL)
|
||||
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -135,6 +135,8 @@ extern "C"
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* Add nodes to queues */
|
||||
|
||||
void sq_addfirst(FAR sq_entry_t *node, FAR sq_queue_t *queue);
|
||||
void dq_addfirst(FAR dq_entry_t *node, FAR dq_queue_t *queue);
|
||||
void sq_addlast(FAR sq_entry_t *node, FAR sq_queue_t *queue);
|
||||
@@ -146,9 +148,13 @@ void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node,
|
||||
void dq_addbefore(FAR dq_entry_t *next, FAR dq_entry_t *node,
|
||||
FAR dq_queue_t *queue);
|
||||
|
||||
/* Combine queues */
|
||||
|
||||
void sq_cat(FAR sq_queue_t *queue1, FAR sq_queue_t *queue2);
|
||||
void dq_cat(FAR dq_queue_t *queue1, FAR dq_queue_t *queue2);
|
||||
|
||||
/* Remove nodes from queues */
|
||||
|
||||
FAR sq_entry_t *sq_remafter(FAR sq_entry_t *node, FAR sq_queue_t *queue);
|
||||
void sq_rem(FAR sq_entry_t *node, FAR sq_queue_t *queue);
|
||||
void dq_rem(FAR dq_entry_t *node, FAR dq_queue_t *queue);
|
||||
@@ -157,6 +163,11 @@ FAR dq_entry_t *dq_remlast(FAR dq_queue_t *queue);
|
||||
FAR sq_entry_t *sq_remfirst(FAR sq_queue_t *queue);
|
||||
FAR dq_entry_t *dq_remfirst(FAR dq_queue_t *queue);
|
||||
|
||||
/* Count nodes in queues */
|
||||
|
||||
size_t sq_count(FAR sq_queue_t *queue);
|
||||
size_t dq_count(FAR dq_queue_t *queue);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
# Add the queue C files to the build
|
||||
|
||||
CSRCS += sq_addlast.c sq_addfirst.c sq_addafter.c sq_cat.c
|
||||
CSRCS += sq_rem.c sq_remlast.c sq_remfirst.c sq_remafter.c
|
||||
CSRCS += sq_rem.c sq_remlast.c sq_remfirst.c sq_remafter.c sq_count.c
|
||||
CSRCS += dq_addlast.c dq_addfirst.c dq_addafter.c dq_addbefore.c dq_cat.c
|
||||
CSRCS += dq_rem.c dq_remlast.c dq_remfirst.c
|
||||
CSRCS += dq_rem.c dq_remlast.c dq_remfirst.c dq_count.c
|
||||
|
||||
# Add the queue directory to the build
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
* libc/queue/dq_count.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <queue.h>
|
||||
#include <assert.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: dq_count
|
||||
*
|
||||
* Description:
|
||||
* Return the number of nodes in the queue.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
size_t dq_count(FAR dq_queue_t *queue)
|
||||
{
|
||||
FAR dq_entry_t *node;
|
||||
size_t count;
|
||||
|
||||
DEBUGASSERT(queue != NULL);
|
||||
|
||||
for (node = queue->head, count = 0;
|
||||
node != NULL;
|
||||
node = node->flink, count++);
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
* libc/queue/sq_count.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <queue.h>
|
||||
#include <assert.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sq_count
|
||||
*
|
||||
* Description:
|
||||
* Return the number of nodes in the queue.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
size_t sq_count(FAR sq_queue_t *queue)
|
||||
{
|
||||
FAR sq_entry_t *node;
|
||||
size_t count;
|
||||
|
||||
DEBUGASSERT(queue != NULL);
|
||||
|
||||
for (node = queue->head, count = 0;
|
||||
node != NULL;
|
||||
node = node->flink, count++);
|
||||
|
||||
return count;
|
||||
}
|
||||
Reference in New Issue
Block a user