Merge remote-tracking branch 'origin/master' into ieee802154

This commit is contained in:
Gregory Nutt
2017-06-18 08:23:42 -06:00
7 changed files with 1686 additions and 150 deletions
+239 -30
View File
@@ -1,4 +1,4 @@
NuttX TODO List (Last updated June 14, 2017)
NuttX TODO List (Last updated June 18, 2017)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@@ -9,22 +9,22 @@ issues related to each board port.
nuttx/:
(11) Task/Scheduler (sched/)
(12) Task/Scheduler (sched/)
(1) SMP
(1) Memory Management (mm/)
(0) Power Management (drivers/pm)
(3) Signals (sched/signal, arch/)
(3) pthreads (sched/pthread)
(4) pthreads (sched/pthread)
(0) Message Queues (sched/mqueue)
(8) Kernel/Protected Build
(3) C++ Support
(6) Binary loaders (binfmt/)
(14) Network (net/, drivers/net)
(16) Network (net/, drivers/net)
(4) USB (drivers/usbdev, drivers/usbhost)
(0) Other drivers (drivers/)
(12) Libraries (libc/, libm/)
(13) Libraries (libc/, libm/)
(10) File system/Generic drivers (fs/, drivers/)
(9) Graphics Subsystem (graphics/)
(10) Graphics Subsystem (graphics/)
(3) Build system / Toolchains
(3) Linux/Cywgin simulation (arch/sim)
(4) ARM (arch/arm/)
@@ -34,6 +34,7 @@ apps/ and other Add-Ons:
(2) Network Utilities (apps/netutils/)
(1) NuttShell (NSH) (apps/nshlib)
(1) System libraries apps/system (apps/system)
(1) Modbus (apps/modbus)
(1) Pascal add-on (pcode/)
(4) Other Applications & Tests (apps/examples/)
@@ -234,32 +235,65 @@ o Task/Scheduler (sched/)
could be improved and made a little more efficient with this
change.
Title: INAPPROPRIATE USE OF sched_lock() BY pthreads
Description: In implementation of standard pthread functions, the non-
standard, NuttX function sched_lock() is used. This is very
strong sense it disables pre-emption for all threads in all
task groups. I believe it is only really necessary in most
cases to lock threads in the task group with a new non-
standard interface, say pthread_lock().
Task: IDLE THREAD TCB SETUP
Description: There are issues with setting IDLE thread stacks:
This is because the OS resources used by a thread such as
mutexes, condition variable, barriers, etc. are only
meaningful from within the task group. So, in order to
performance exclusive operations on these resources, it is
only necessary to block other threads executing within the
task group.
1. One problem is stack-related data in the IDLE threads TCB.
A solution might be to standardize the use of g_idle_topstack.
That you could add initialization like this in os_start:
This is an easy change: pthread_lock() and pthread_unlock()
would simply operate on a semaphore retained in the task
group structure. I am, however, hesitant to make this change:
I the flat build model, there is nothing that prevents people
from accessing the inter-thread controls from threads in
differnt task groups. Making this change, while correct,
might introduce subtle bugs in code by people who are not
using NuttX correctly.
Status: Open
Priority: Low. This change would improve real-time performance of the
OS but is not otherwise required.
@@ -344,6 +347,11 @@ void os_start(void)
g_idleargv[1] = NULL;
g_idletcb.argv = g_idleargv;
+ /* Set the IDLE task stack size */
+
+ g_idletcb.cmn.adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
+ g_idletcb.cmn.stack_alloc_ptr = (void *)(g_idle_topstack - CONFIG_IDLETHREAD_STACKSIZE);
+
/* Then add the idle task's TCB to the head of the ready to run list */
dq_addfirst((FAR dq_entry_t *)&g_idletcb, (FAR dq_queue_t *)&g_readytorun);
The g_idle_topstack variable is available for almost all architectures:
$ find . -name *.h | xargs grep g_idle_top
./arm/src/common/up_internal.h:EXTERN const uint32_t g_idle_topstack;
./avr/src/avr/avr.h:extern uint16_t g_idle_topstack;
./avr/src/avr32/avr32.h:extern uint32_t g_idle_topstack;
./hc/src/common/up_internal.h:extern uint16_t g_idle_topstack;
./mips/src/common/up_internal.h:extern uint32_t g_idle_topstack;
./misoc/src/lm32/lm32.h:extern uint32_t g_idle_topstack;
./renesas/src/common/up_internal.h:extern uint32_t g_idle_topstack;
./renesas/src/m16c/chip.h:extern uint32_t g_idle_topstack; /* Start of the heap */
./risc-v/src/common/up_internal.h:EXTERN uint32_t g_idle_topstack;
./x86/src/common/up_internal.h:extern uint32_t g_idle_topstack;
That omits there architectures: sh1, sim, xtensa, z16, z80,
ez80, and z8. All would have to support this common
globlal variable.
Also, the stack itself may be 8-, 16-, or 32-bits wide,
depending upon the architecture.
2. Another problem is colorizing that stack to use with
stack usage monitoring logic. There is logic in some
start functions to do this in a function called go_os_start.
It is available in these architectures:
./arm/src/efm32/efm32_start.c:static void go_os_start(void *pv, unsigned int nbytes)
./arm/src/kinetis/kinetis_start.c:static void go_os_start(void *pv, unsigned int nbytes)
./arm/src/sam34/sam_start.c:static void go_os_start(void *pv, unsigned int nbytes)
./arm/src/samv7/sam_start.c:static void go_os_start(void *pv, unsigned int nbytes)
./arm/src/stm32/stm32_start.c:static void go_os_start(void *pv, unsigned int nbytes)
./arm/src/stm32f7/stm32_start.c:static void go_os_start(void *pv, unsigned int nbytes)
./arm/src/stm32l4/stm32l4_start.c:static void go_os_start(void *pv, unsigned int nbytes)
./arm/src/tms570/tms570_boot.c:static void go_os_start(void *pv, unsigned int nbytes)
./arm/src/xmc4/xmc4_start.c:static void go_os_start(void *pv, unsigned int nbytes)
But no others.
Status: Open
Priority: Low, only needed for more complete debug.
o SMP
^^^
@@ -534,6 +568,33 @@ o pthreads (sched/pthreads)
Priority: Medium-low. Priority may be higher if system call overheade becomes
an issue.
Title: INAPPROPRIATE USE OF sched_lock() BY pthreads
Description: In implementation of standard pthread functions, the non-
standard, NuttX function sched_lock() is used. This is very
strong sense it disables pre-emption for all threads in all
task groups. I believe it is only really necessary in most
cases to lock threads in the task group with a new non-
standard interface, say pthread_lock().
This is because the OS resources used by a thread such as
mutexes, condition variable, barriers, etc. are only
meaningful from within the task group. So, in order to
performance exclusive operations on these resources, it is
only necessary to block other threads executing within the
task group.
This is an easy change: pthread_lock() and pthread_unlock()
would simply operate on a semaphore retained in the task
group structure. I am, however, hesitant to make this change:
I the flat build model, there is nothing that prevents people
from accessing the inter-thread controls from threads in
differnt task groups. Making this change, while correct,
might introduce subtle bugs in code by people who are not
using NuttX correctly.
Status: Open
Priority: Low. This change would improve real-time performance of the
OS but is not otherwise required.
o Message Queues (sched/mqueue)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1171,6 +1232,61 @@ o Network (net/, drivers/net)
deal with a list of devices. That would be a huge effect and
certainly doesn't dount as a "simple solution".
Title: ICMPv6 FOR 6loWPAN
Description: The current ICMPv6 and neighbor-related logic only works with
Ethernet MAC. For 6loWPAN, a new more conservative ICMPv6
definitions is provided by RFC 6775. This RFC needs to be
supported in order to support ping6 on a 6loWPAN network.
If RFC 6775 were implemented, then arbitrary IPv6 addresses,
including addresses from DHCPv6 could be used.
can
UPDATE: With ICMPv6 neighbor discovery, any IPv6 address may
be associated with any short or extended address. In fact,
that is the whole purpose of the neighbor discover logic: It
plays the same role as ARP in IPv4; it ultimately just manages
a neighbor table that, like the arp table, provides the
mapping between IP addresses and node addresses.
The NuttX, Contiki-based 6loWPAN implementation circumvented
the need for the neighbor discovery logic by using only MAC-
based addressing, i.e., the lower two or eight bytes of the
IP address are the node address.
Most of the 6loWPAN compression algorithms exploit this to
compress the IPv6 address to nothing but a bit indicating
that the IP address derives from the node address. So I
think ICMPv6 is useless in the current implementation.
If we want to use ICMPv6, we could dispense with the all MAC
based addressing. But if we want to retain the more compact
MAC-based addressing, then we don't need ICMPv6.
So, the full neighbor discovery logic is not currently useful,
but it would still be nice to have enough in place to support
ping6.
Status: Open
Priority: Low for now. I don't plan on implementing this. It would
only be relevant if we were to decide to abandon the use of
MAC-based addressing in the 6loWPAN implementation.
Title: ETHERNET LOCAL BROADCAST DOES NOT WORK
Description: In case of "local broadcast" the system still send ARP
request to the destination, but it shouldn't, it should
broadcast. For Example, the system has network with IP
10.0.0.88, netmask of 255.255.255.0, it should send
messages for 10.0.0.255 as broadcast, and not send ARP
for 10.0.0.255
For more easier networking, the next line should have give
me the broadcast address of the network, but it doesn't:
ioctl(_socket_fd, SIOCGIFBRDADDR, &bc_addr);
Status: Open
Priority: Medium
o USB (drivers/usbdev, drivers/usbhost)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1532,6 +1648,64 @@ o Libraries (libc/, libm/)
Status: Open
Priority: Low
Title: FORMATTING FIXED WIDTH INTEGERS
Description: Formats like this: lib_vsprintf(_, "%6.6u", 0) do not work.
There is no support for the precision/width option with
integer types. The format is simply is ignored and so can
even cause crashes.
For example:
int hello_main(int argc, char *argv[])
{
printf("Hello, World!!\n");
printf("%3.3u %3.3u %3.3u %3.3u %3.3u\n", 9, 99, 999, 9999, 99999);
return 0;
}
Generates this incorrect output:
NuttShell (NSH) NuttX-7.20
nsh> hello
Hello, World!!
9 99 999 9999 99999
nsh>
That output, of course, should have been:
9 99 999 999 999
The period and the precision value were being ignored (if
floating point was disabled). In that case, parsing of the
variable arguments could get out of sync. But a side
effect of the referenced change is that precision value is
now always parsed (but still incorrectly ignored for the
case of integer formats).
The fix would not be too difficult but would involve change
several functions. It would involve clipping the size of the
number string. For example:
/* Get the width of the output */
uwidth = getusize(FMT_CHAR, flags, n);
if (trunc > 0 && uwidth > trunc)
{
uwidth = trunc;
}
Then limiting the length of the output string to uwidth.
This would probably mean passing an additional parameter to
the many *toascii() functions like:
/* Output the number */
utoascii(obj, FMT_CHAR, flags, (unsigned int)n, uwidth);
Status: Open
Priority: Low
o File system / Generic drivers (fs/, drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1830,6 +2004,16 @@ o Graphics Subsystem (graphics/)
the single user mode, it will be yanked out from under your
feet in the not-so-distant future.
Title: WIDE-FOUNT SUPPORT
Description: Wide fonts are not currently supported by the NuttX graphics sub-
system. There is some discussion here:
https://groups.yahoo.com/neo/groups/nuttx/conversations/topics/3507
http://www.nuttx.org/doku.php?id=wiki:graphics:wide-fonts
Status: Open
Priority: Low for many, but I imagine higher in countries that use wide fonts
o Build system
^^^^^^^^^^^^
@@ -1926,6 +2110,7 @@ o Build system
The .archive file would have to be removed on 'make clean' and would
also need to appear in .gitignore files.
o Other drivers (drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -2151,6 +2336,30 @@ o System libraries apps/system (apps/system)
Priority: Low (unless you are using mixed C-buffered I/O with readline and
fgetc, for example).
o Modbus (apps/modbus)
^^^^^^^^^^^^^^^^^^^^
Title: MODBUS NOT USABLE WITH USB SERIAL
Description: Modbus can be used with USB serial, however, if the USB
serial connectiont is lost, Modbus will hang in an infinite
loop.
This is a problem in the handling of select() and read()
and could probabaly resolved by studying the Modbus error
handling.
A more USB-friendly solution would be to: (1) Re-connect and
(2) re-open the serial drviers. That is what is done is NSH.
When the serial USB device is removed, this terminates the
session and NSH will then try to re-open the USB device. See
the function nsh_waitusbready() in the file
apps/nshlib/nsh_usbconsole.c. When the USB serial is
reconnected the open() in the function will succeed and a new
session will be started.
Status: Open
Priority: Low. This is really an enhancement request: Modbus was never
designed to work with removable serial devices.
o Pascal Add-On (pcode/)
^^^^^^^^^^^^^^^^^^^^^^
+4 -2
View File
@@ -254,7 +254,8 @@
# endif
#endif
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429) || \
defined(CONFIG_STM32_STM32F469)
# define STM32_FLASH_OPTCR1_OFFSET 0x0018
#endif
@@ -287,7 +288,8 @@
# elif defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
# define STM32_FLASH_OPTCR (STM32_FLASHIF_BASE+STM32_FLASH_OPTCR_OFFSET)
# endif
# if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
# if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429) || \
defined(CONFIG_STM32_STM32F469)
# define STM32_FLASH_OPTCR1 (STM32_FLASHIF_BASE+STM32_FLASH_OPTCR1_OFFSET)
# endif
#endif
+7 -6
View File
@@ -108,7 +108,7 @@
#define STM32_HRTIM_CMN_ICR_OFFSET 0x000C /* HRTIM Interrupt Clear Register */
#define STM32_HRTIM_CMN_IER_OFFSET 0x0010 /* HRTIM Interrupt Enable Register */
#define STM32_HRTIM_CMN_OENR_OFFSET 0x0014 /* HRTIM Output Enable Register */
#define STM32_HRTIM_CMN_DISR_OFFSET 0x0018 /* HRTIM Output Disable Register */
#define STM32_HRTIM_CMN_ODISR_OFFSET 0x0018 /* HRTIM Output Disable Register */
#define STM32_HRTIM_CMN_ODSR_OFFSET 0x001C /* HRTIM Output Disable Status Register */
#define STM32_HRTIM_CMN_BMCR_OFFSET 0x0020 /* HRTIM Burst Mode Control Register */
#define STM32_HRTIM_CMN_BMTRGR_OFFSET 0x0024 /* HRTIM Burst Mode Trigger Register */
@@ -1136,11 +1136,12 @@
/* Timer X Fault Register */
#define HRTIM_TIMFLT_FLT1EN (1 << 0) /* Bit 0 */
#define HRTIM_TIMFLT_FLT2EN (1 << 1) /* Bit 1 */
#define HRTIM_TIMFLT_FLT3EN (1 << 2) /* Bit 2 */
#define HRTIM_TIMFLT_FLT4EN (1 << 3) /* Bit 3 */
#define HRTIM_TIMFLT_FLT5EN (1 << 4) /* Bit 4 */
#define HRTIM_TIMFLT_FLT1EN (1 << 0) /* Bit 0: Fault1 enable */
#define HRTIM_TIMFLT_FLT2EN (1 << 1) /* Bit 1: Fault 2 enable */
#define HRTIM_TIMFLT_FLT3EN (1 << 2) /* Bit 2: Fault 3 enable*/
#define HRTIM_TIMFLT_FLT4EN (1 << 3) /* Bit 3: Fault 4 enable */
#define HRTIM_TIMFLT_FLT5EN (1 << 4) /* Bit 4: Fault 5 enable */
#define HRTIM_TIMFLT_FLTLCK (1 << 31) /* Bit 31: Fault sources lock*/
/* Common Control Register 1 */
File diff suppressed because it is too large Load Diff
+223 -20
View File
@@ -64,22 +64,23 @@
enum stm32_hrtim_tim_e
{
HRTIM_TIMER_MASTER,
HRTIM_TIMER_MASTER = 0,
#ifdef CONFIG_STM32_HRTIM_TIMA
HRTIM_TIMER_TIMA,
HRTIM_TIMER_TIMA = 1,
#endif
#ifdef CONFIG_STM32_HRTIM_TIMB
HRTIM_TIMER_TIMB,
HRTIM_TIMER_TIMB = 2,
#endif
#ifdef CONFIG_STM32_HRTIM_TIMC
HRTIM_TIMER_TIMC,
HRTIM_TIMER_TIMC = 3,
#endif
#ifdef CONFIG_STM32_HRTIM_TIMD
HRTIM_TIMER_TIMD,
HRTIM_TIMER_TIMD = 4,
#endif
#ifdef CONFIG_STM32_HRTIM_TIME
HRTIM_TIMER_TIME,
HRTIM_TIMER_TIME = 5,
#endif
HRTIM_TIMER_COMMON = 6
};
/* Source which can force the Tx1/Tx2 output to its inactive state */
@@ -117,7 +118,7 @@ enum stm32_hrtim_out_rst_e
HRTIM_OUT_RST_CMP1 = (1 << 28),
HRTIM_OUT_RST_PER = (1 << 29),
HRTIM_OUT_RST_RESYNC = (1 << 30),
HRTIM_OUT_RST_SOFT = (1 << 31),
HRTIM_OUT_RST_SOFT = (1 << 31)
};
/* Source which can force the Tx1/Tx2 output to its active state */
@@ -155,7 +156,7 @@ enum stm32_hrtim_out_set_e
HRTIM_OUT_SET_CMP1 = (1 << 28),
HRTIM_OUT_SET_PER = (1 << 29),
HRTIM_OUT_SET_RESYNC = (1 << 30),
HRTIM_OUT_SET_SOFT = (1 << 31),
HRTIM_OUT_SET_SOFT = (1 << 31)
};
/* Events that can reset TimerX Counter */
@@ -205,7 +206,7 @@ enum stm32_hrtim_tim_rst_e
HRTIM_RST_EXTEVNT4,
HRTIM_RST_EXTEVNT3,
HRTIM_RST_EXTEVNT2,
HRTIM_RST_EXTEVNT1,
HRTIM_RST_EXTEVNT1
};
/* HRTIM Timer X prescaler */
@@ -219,41 +220,243 @@ enum stm32_hrtim_tim_prescaler_e
HRTIM_PRESCALER_16,
HRTIM_PRESCALER_32,
HRTIM_PRESCALER_64,
HRTIM_PRESCALER_128,
HRTIM_PRESCALER_128
};
/* HRTIM Slave Timer fault sources Lock */
enum stm32_hrtim_tim_fault_lock_e
{
HRTIM_TIM_FAULT_RW = 0, /* Slave Timer fault source are read/write */
HRTIM_TIM_FAULT_LOCK = (1 << 7) /* Slave Timer fault source are read only */
};
/* HRTIM Slave Timer Fault configuration */
enum stm32_hrtim_tim_fault_src_e
{
HRTIM_TIM_FAULT1 = (1 << 0),
HRTIM_TIM_FAULT2 = (1 << 2),
HRTIM_TIM_FAULT3 = (1 << 3),
HRTIM_TIM_FAULT4 = (1 << 4),
HRTIM_TIM_FAULT5 = (1 << 5)
};
/* HRTIM Fault Source */
enum stm32_hrtim_fault_src_e
{
HRTIM_FAULT_SRC_PIN,
HRTIM_FAULT_SRC_INTERNAL
HRTIM_FAULT_SRC_PIN = 0,
HRTIM_FAULT_SRC_INTERNAL = 1
};
/* HRTIM External Event Source
* NOTE: according to Table 82 from STM32F334XX Manual
* NOTE: according to Table 82 from STM32F334XX Manual.
*/
enum stm32_hrtim_eev_src_e
{
HRTIM_EEV_SRC_PIN,
HRTIM_EEV_SRC_ANALOG,
HRTIM_EEV_SRC_TRGO,
HRTIM_EEV_SRC_ADC
HRTIM_EEV_SRC_PIN = 0,
HRTIM_EEV_SRC_ANALOG = 1,
HRTIM_EEV_SRC_TRGO = 2,
HRTIM_EEV_SRC_ADC = 3
};
/* HRTIM Fault Polarity */
enum stm32_hrtim_fault_pol_e
{
HRTIM_FAULT_POL_LOW = 0,
HRTIM_FAULT_POL_HIGH = 1
};
/* HRTIM External Event Polarity */
enum stm32_hrtim_eev_pol_e
{
HRTIM_EEV_POL_HIGH = 0, /* External Event is active high */
HRTIM_EEV_POL_LOW = 1 /* External Event is active low */
};
/* HRTIM External Event sensitivity */
enum stm32_hrtim_eev_sen_e
{
HRTIM_EEV_SEN_LEVEL = 0, /* On active level defined by polarity */
HRTIM_EEV_SEN_RISING = 1, /* Rising edgne */
HRTIM_EEV_SEN_FALLING = 2, /* Falling edge */
HRTIM_EEV_SEN_BOTH = 3 /* Both edges */
};
/* External Event Sampling clock division */
enum stm32_hrtim_eev_sampling_e
{
HRTIM_EEV_SAMPLING_d1 = 0,
HRTIM_EEV_SAMPLING_d2 = 1,
HRTIM_EEV_SAMPLING_d4 = 2,
HRTIM_EEV_SAMPLING_d8 = 3
};
/* HRTIM External Event Mode.
* NOTE: supported only for EEV1-5.
*/
enum stm32_hrtim_eev_mode_e
{
HRTIM_EEV_MODE_NORMAL = 0,
HRTIM_EEV_MODE_FAST = 1 /* low latency mode */
};
/* External Event filter.
* NOTE: supported only for EEV6-10.
*/
enum stm32_hrtim_eev_filter_e
{
HRTIM_EEV_DISABLE = 0,
HRTIM_EEV_HRT_N2 = 1,
HRTIM_EEV_HRT_N4 = 2,
HRTIM_EEV_HRT_N8 = 3,
HRTIM_EEV_EEVSd2_N6 = 4,
HRTIM_EEV_EEVSd2_N8 = 5,
HRTIM_EEV_EEVSd4_N6 = 6,
HRTIM_EEV_EEVSd4_N8 = 7,
HRTIM_EEV_EEVSd8_N6 = 8,
HRTIM_EEV_EEVSd8_N8 = 9,
HRTIM_EEV_EEVSd16_N5 = 10,
HRTIM_EEV_EEVSd16_N6 = 11,
HRTIM_EEV_EEVSd16_N8 = 12,
HRTIM_EEV_EEVSd32_N5 = 13,
HRTIM_EEV_EEVSd32_N6 = 14,
HRTIM_EEV_EEVSd32_N8 = 15
};
/* Compare register index */
enum stm32_hrtim_cmp_index_e
{
HRTIM_CMP1,
HRTIM_CMP2,
HRTIM_CMP3,
HRTIM_CMP4
};
/* HRTIM Slave Timer Outputs */
enum stm32_outputs_e
{
HRTIM_OUT_TIMA_CH1 = (1 << 0),
HRTIM_OUT_TIMA_CH2 = (1 << 1),
HRTIM_OUT_TIMB_CH1 = (1 << 2),
HRTIM_OUT_TIMB_CH2 = (1 << 3),
HRTIM_OUT_TIMC_CH1 = (1 << 4),
HRTIM_OUT_TIMC_CH2 = (1 << 5),
HRTIM_OUT_TIMD_CH1 = (1 << 6),
HRTIM_OUT_TIMD_CH2 = (1 << 7),
HRTIM_OUT_TIME_CH1 = (1 << 8),
HRTIM_OUT_TIME_CH2 = (1 << 9)
};
/* DAC synchronization event */
enum stm32_hrtim_dacsync_e
{
HRTIM_DACSYNC_DIS,
HRTIM_DACSYNC_1,
HRTIM_DACSYNC_2,
HRTIM_DACSYNC_3
};
/* HRTIM Deadtime Locks */
enum stm32_deadtime_lock_e
{
HRTIM_DT_VALUE_LOCK = (1 << 0), /* Lock Deadtime value */
HRTIM_DT_SIGN_LOCK = (1 << 1) /* Lock Deadtime sign */
};
/* HRTIM Deadtime types */
enum stm32_deadtime_edge_e
{
HRTIM_DT_RISING = 0,
HRTIM_DT_FALLING = 1
};
/* Chopper start pulsewidth */
enum stm32_chopper_start_e
{
HRTIM_CHP_START_16,
HRTIM_CHP_START_32,
HRTIM_CHP_START_48,
HRTIM_CHP_START_64,
HRTIM_CHP_START_80,
HRTIM_CHP_START_96,
HRTIM_CHP_START_112,
HRTIM_CHP_START_128,
HRTIM_CHP_START_144,
HRTIM_CHP_START_160,
HRTIM_CHP_START_176,
HRTIM_CHP_START_192,
HRTIM_CHP_START_208,
HRTIM_CHP_START_224,
HRTIM_CHP_START_256
};
/* Chopper duty cycle */
enum stm32_chopper_duty_e
{
HRTIM_CHP_DUTY_0,
HRTIM_CHP_DUTY_1,
HRTIM_CHP_DUTY_2,
HRTIM_CHP_DUTY_3,
HRTIM_CHP_DUTY_4,
HRTIM_CHP_DUTY_5,
HRTIM_CHP_DUTY_6,
HRTIM_CHP_DUTY_7
};
/* Chopper carrier frequency */
enum stm32_chopper_freq_e
{
HRTIM_CHP_FREQ_d16,
HRTIM_CHP_FREQ_d32,
HRTIM_CHP_FREQ_d48,
HRTIM_CHP_FREQ_d64,
HRTIM_CHP_FREQ_d80,
HRTIM_CHP_FREQ_d96,
HRTIM_CHP_FREQ_d112,
HRTIM_CHP_FREQ_d128,
HRTIM_CHP_FREQ_d144,
HRTIM_CHP_FREQ_d160,
HRTIM_CHP_FREQ_d176,
HRTIM_CHP_FREQ_d192,
HRTIM_CHP_FREQ_d208,
HRTIM_CHP_FREQ_d224,
HRTIM_CHP_FREQ_d240,
HRTIM_CHP_FREQ_d256
};
/* */
struct hrtim_dev_s
{
#ifdef CONFIG_HRTIM
/* Fields managed by common upper half HRTIM logic */
uint8_t hd_ocount; /* The number of times the device has been opened */
sem_t hd_closesem; /* Locks out new opens while close is in progress */
uint8_t hd_ocount; /* The number of times the device has been opened */
sem_t hd_closesem; /* Locks out new opens while close is in progress */
#endif
/* Fields provided by lower half HRTIM logic */
FAR void *hd_priv; /* Used by the arch-specific logic */
FAR void *hd_priv; /* Used by the arch-specific logic */
bool initialized; /* true: HRTIM driver has been initialized */
};
/************************************************************************************
+1 -1
View File
@@ -98,7 +98,7 @@ config USBHOST_MSC
default n
depends on !BULK_DISABLE
---help---
Enable support for the keyboard class driver. This also depends on
Enable support for the mass storage class driver. This also depends on
NFILE_DESCRIPTORS > 0 && SCHED_WORKQUEUE=y
config USBHOST_CDCACM
+153
View File
@@ -0,0 +1,153 @@
/****************************************************************************
* include/nuttx/net/rfc6775.h
* Definitions for 6LoWPAN Neighbor Discovery
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Reference: RFC6775, Neighbor Discovery Optimization for IPv6 over Low-
* Power Wireless Personal Area Networks (6LoWPANs), Internet
* Engineering Task Force (IETF), November 2012
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_NET_RFC6775_H
#define __INCLUDE_NUTTX_NET_RFC6775_H
/* Acronyms (in addition to those defined in context below:
*
* 6LN - 6LoWPAN Node
* 6LR - 6LoWPAN Router
* 6LBR - 6LoWPAN Border Router
*/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* 4.2 Bit definitions for 6CO resccid field */
#define RESCCID_CID_SHIFT (0) /* Bits 0-3: Context identifier */
#define RESCCID_CID_MASK (7 << RESCCID_CID_SHIFT)
#define RESCCID_C (1 << 4) /* Bit 4: Compression Flag */
/* Bits 5-7: Reserved */
/* 9 Protocol Constants */
/* 6LBR Constants: */
#define MIN_CONTEXT_CHANGE_DELAY 300 /* Seconds */
/* 6LR Constants: */
#define MAX_RTR_ADVERTISEMENTS 3 /* Transmissions */
#define MIN_DELAY_BETWEEN_RAS 10 /* Seconds */
#define MAX_RA_DELAY_TIME 2 /* Seconds */
#define TENTATIVE_NCE_LIFETIME 20 /* Seconds */
/* Router Constants: */
#define MULTIHOP_HOPLIMI 64
/* Host Constants: */
#define RTR_SOLICITATION_INTERVAL 10 /* Seconds */
#define MAX_RTR_SOLICITATIONS 3 /* Transmissions */
#define MAX_RTR_SOLICITATION_INTERVAL 60 /* Seconds */
/****************************************************************************
* Public Types
****************************************************************************/
/* Table 1. alues for status field */
enum sixlowpan_status_e
{
SIXLOWPAN_SUCCESS = 0, /* Success */
SIXLOWPAN_DUPLICATE = 1, /* Duplicate address */
SIXLOWPAN_FULL = 2, /* Neighbor cache full */
SIXLOWPAN_ALLOCATED = 3 /* 3-255: Allocated using standard action (RFC5226 */
};
/* 4.1 Source Link-Layer Address Option (SLLAO) */
struct sixlowpan_sllao_s
{
uint8_t type; /* Byte 0: Type = 33 */
uint8_t length; /* Byte 1: Length in units of 8 bytes = 2 */
uint8_t status; /* Byte 2: Status of NS message. See enum sixlowpan_status_e */
uint8_t reserved[3]; /* Bytes 3-5: Reserved */
uint8_t lifetime[2]; /* Bytes 6-7: Registration lifetime */
uint8_t eui64[8]; /* Bytes 8-15: EUI-64 identifier assigned to interface */
};
/* 4.2 6loWPAN Context Option (6CO) */
struct sixlowpan_6co_s
{
uint8_t type; /* Byte 0: Type = 34 */
uint8_t length; /* Byte 1: Length in units of 8 bytes = 2 or 3 */
uint8_t ctxlen; /* Byte 2: Context length = 0-128 bits */
uint8_t resccid; /* Byte 3: See RESCCID_* bit definitions */
uint8_t reserved[2]; /* Bytes 4-6: Reserved */
uint8_t lifetime[2]; /* Bytes 6-7: Valid lifetime */
uint8_t prefix[1]; /* Bytes 8-15 or 8-23: Context Prefix */
};
#define SIXLOWPAN_6CO_LEN(b) ((b > 64) ? 16 : 8)
#define SIZEOF_SIXLOWPAN_6CO_S(b) (sizeof(struct sixlowpan_6co_s) + CMPV6_6CO_LEN(b) - 1)
/* 4.3 Authoritative Border Router Option (ABRO) */
struct sixlowpan_abro_s
{
uint8_t type; /* Byte 0: Type = 35 */
uint8_t length; /* Byte 1: Length in units of 8 bytes = 3 */
uint8_t verlo[2]; /* Bytes 2-3: Version low */
uint8_t verhi[2]; /* Bytes 4-5: Version high */
uint8_t lifetime[2]; /* Bytes 6-7: Valid lifetime */
uint8_t ipv6[16]; /* Bytes 8-23: IPv6 address of the 6LBR orign of version */
};
/* 4.4 Duplicate Address Messages (DAD for both DAR and DAC) */
struct sixlowpan_dad_s
{
uint8_t type; /* Byte 0: Type = 157 (DAR) or 158 (DAC) */
uint8_t code; /* Byte 1: Code */
uint8_t chksum[2]; /* Bytes 2-3: Checksum */
uint8_t status; /* Byte 4: Status of DAR. See enum sixlowpan_status_e */
uint8_t reserved; /* Byte 5: Reserved */
uint8_t lifetime[2]; /* Bytes 6-7: Registration lifetime */
uint8_t eui64[8]; /* Bytes 8-15: EUI-64 identifier registered address */
uint8_t ipv6[16]; /* Bytes 16-31: Registered address */
};
#endif /* __INCLUDE_NUTTX_NET_RFC6775_H */