Merged nuttx/nuttx into master
This commit is contained in:
commit
0ac4e2e7a4
@ -118,6 +118,12 @@ ifeq ($(CONFIG_WIRELESS),y)
|
|||||||
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
|
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Add C++ library
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||||
|
NUTTXLIBS += lib$(DELIM)libcxx$(LIBEXT)
|
||||||
|
endif
|
||||||
|
|
||||||
# Export all libraries
|
# Export all libraries
|
||||||
|
|
||||||
EXPORTLIBS = $(NUTTXLIBS)
|
EXPORTLIBS = $(NUTTXLIBS)
|
||||||
|
32
Kconfig
32
Kconfig
@ -732,6 +732,38 @@ config DEBUG_NET_INFO
|
|||||||
|
|
||||||
endif # DEBUG_NET
|
endif # DEBUG_NET
|
||||||
|
|
||||||
|
config DEBUG_WIRELESS
|
||||||
|
bool "Wireless Debug Features"
|
||||||
|
default n
|
||||||
|
depends on WIRELESS || DRIVERS_WIRELESS
|
||||||
|
---help---
|
||||||
|
Enable DEBUG_WIRELESS debug features.
|
||||||
|
|
||||||
|
if DEBUG_WIRELESS
|
||||||
|
|
||||||
|
config DEBUG_WIRELESS_ERROR
|
||||||
|
bool "Wireless Error Output"
|
||||||
|
default n
|
||||||
|
depends on DEBUG_ERROR
|
||||||
|
---help---
|
||||||
|
Enable wireless error output to SYSLOG.
|
||||||
|
|
||||||
|
config DEBUG_WIRELESS_WARN
|
||||||
|
bool "Wireless Warnings Output"
|
||||||
|
default n
|
||||||
|
depends on DEBUG_WARN
|
||||||
|
---help---
|
||||||
|
Enable wireless warning output to SYSLOG.
|
||||||
|
|
||||||
|
config DEBUG_WIRELESS_INFO
|
||||||
|
bool "Wireless Informational Output"
|
||||||
|
default n
|
||||||
|
depends on DEBUG_INFO
|
||||||
|
---help---
|
||||||
|
Enable wireless informational output to SYSLOG.
|
||||||
|
|
||||||
|
endif # DEBUG_WIRELESS
|
||||||
|
|
||||||
config DEBUG_SCHED
|
config DEBUG_SCHED
|
||||||
bool "Scheduler Debug Features"
|
bool "Scheduler Debug Features"
|
||||||
default n
|
default n
|
||||||
|
@ -113,6 +113,12 @@ ifeq ($(CONFIG_WIRELESS),y)
|
|||||||
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
|
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Add C++ library
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||||
|
NUTTXLIBS += lib$(DELIM)libcxx$(LIBEXT)
|
||||||
|
endif
|
||||||
|
|
||||||
# Export only the user libraries
|
# Export only the user libraries
|
||||||
|
|
||||||
EXPORTLIBS = $(USERLIBS)
|
EXPORTLIBS = $(USERLIBS)
|
||||||
|
@ -123,6 +123,12 @@ ifeq ($(CONFIG_WIRELESS),y)
|
|||||||
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
|
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Add C++ library
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||||
|
NUTTXLIBS += lib$(DELIM)libcxx$(LIBEXT)
|
||||||
|
endif
|
||||||
|
|
||||||
# Export only the user libraries
|
# Export only the user libraries
|
||||||
|
|
||||||
EXPORTLIBS = $(USERLIBS)
|
EXPORTLIBS = $(USERLIBS)
|
||||||
|
20
TODO
20
TODO
@ -1,4 +1,4 @@
|
|||||||
NuttX TODO List (Last updated March 7, 2017)
|
NuttX TODO List (Last updated March 14, 2017)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
||||||
@ -19,7 +19,7 @@ nuttx/:
|
|||||||
(8) Kernel/Protected Build
|
(8) Kernel/Protected Build
|
||||||
(3) C++ Support
|
(3) C++ Support
|
||||||
(6) Binary loaders (binfmt/)
|
(6) Binary loaders (binfmt/)
|
||||||
(13) Network (net/, drivers/net)
|
(14) Network (net/, drivers/net)
|
||||||
(4) USB (drivers/usbdev, drivers/usbhost)
|
(4) USB (drivers/usbdev, drivers/usbhost)
|
||||||
(0) Other drivers (drivers/)
|
(0) Other drivers (drivers/)
|
||||||
(12) Libraries (libc/, libm/)
|
(12) Libraries (libc/, libm/)
|
||||||
@ -507,7 +507,7 @@ o Kernel/Protected Build
|
|||||||
in the nuttx/ directory. However, the user interfaces must be
|
in the nuttx/ directory. However, the user interfaces must be
|
||||||
moved into a NuttX library or into apps/. Currently
|
moved into a NuttX library or into apps/. Currently
|
||||||
applications calls to the NxTerm user interfaces are
|
applications calls to the NxTerm user interfaces are
|
||||||
undefined.
|
undefined in the Kernel/Protected builds.
|
||||||
Status: Open
|
Status: Open
|
||||||
Priority: Medium
|
Priority: Medium
|
||||||
|
|
||||||
@ -1065,6 +1065,20 @@ o Network (net/, drivers/net)
|
|||||||
Status: Open
|
Status: Open
|
||||||
Priority: High if you happen to be using Ethernet in this configuration.
|
Priority: High if you happen to be using Ethernet in this configuration.
|
||||||
|
|
||||||
|
Title: REPARTITION DRIVER FUNCTIONALITY
|
||||||
|
Description: Every network driver performs the first level of packet decoding.
|
||||||
|
It examines the packet header and calls ipv4_input(), ipv6_input().
|
||||||
|
icmp_input(), etc. as appropriate. This is a maintenance problem
|
||||||
|
because it means that any changes to the network input interfaces
|
||||||
|
affects all drivers.
|
||||||
|
|
||||||
|
A better, more maintainable solution would use a single net_input()
|
||||||
|
function that would receive all incoming packets. This function
|
||||||
|
would then perform that common packet decoding logic that is
|
||||||
|
currently implemented in every network driver.
|
||||||
|
Status: Open
|
||||||
|
Priority: Low. Really just as aesthetic maintainability issue.
|
||||||
|
|
||||||
o USB (drivers/usbdev, drivers/usbhost)
|
o USB (drivers/usbdev, drivers/usbhost)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ config ARCH_CHIP_NUC1XX
|
|||||||
select ARCH_CORTEXM0
|
select ARCH_CORTEXM0
|
||||||
select ARCH_HAVE_CMNVECTOR
|
select ARCH_HAVE_CMNVECTOR
|
||||||
---help---
|
---help---
|
||||||
NPX LPC43XX architectures (ARM Cortex-M4).
|
Nuvoton NUC100/120 architectures (ARM Cortex-M0).
|
||||||
|
|
||||||
config ARCH_CHIP_SAMA5
|
config ARCH_CHIP_SAMA5
|
||||||
bool "Atmel SAMA5"
|
bool "Atmel SAMA5"
|
||||||
|
@ -159,16 +159,6 @@ void up_irqinitialize(void)
|
|||||||
(void)getreg32(A1X_INTC_IRQ_PEND(i)); /* Reading status clears pending interrupts */
|
(void)getreg32(A1X_INTC_IRQ_PEND(i)); /* Reading status clears pending interrupts */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set the interrupt base address to zero. We do not use the vectored
|
/* Set the interrupt base address to zero. We do not use the vectored
|
||||||
* interrupts.
|
* interrupts.
|
||||||
*/
|
*/
|
||||||
|
@ -323,7 +323,7 @@ exception_common:
|
|||||||
.global g_intstackbase
|
.global g_intstackbase
|
||||||
.align 8
|
.align 8
|
||||||
g_intstackalloc:
|
g_intstackalloc:
|
||||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||||
g_intstackbase:
|
g_intstackbase:
|
||||||
.size g_intstackalloc, .-g_intstackalloc
|
.size g_intstackalloc, .-g_intstackalloc
|
||||||
#endif
|
#endif
|
||||||
|
@ -235,7 +235,7 @@ exception_common:
|
|||||||
*
|
*
|
||||||
* Here:
|
* Here:
|
||||||
* r0 = Address of the register save area
|
* r0 = Address of the register save area
|
||||||
|
*
|
||||||
* NOTE: It is a requirement that up_restorefpu() preserve the value of
|
* NOTE: It is a requirement that up_restorefpu() preserve the value of
|
||||||
* r0!
|
* r0!
|
||||||
*/
|
*/
|
||||||
@ -355,7 +355,7 @@ exception_common:
|
|||||||
.global g_intstackbase
|
.global g_intstackbase
|
||||||
.align 8
|
.align 8
|
||||||
g_intstackalloc:
|
g_intstackalloc:
|
||||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||||
g_intstackbase:
|
g_intstackbase:
|
||||||
.size g_intstackalloc, .-g_intstackalloc
|
.size g_intstackalloc, .-g_intstackalloc
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,22 +66,11 @@
|
|||||||
# define HAVE_KERNEL_HEAP 1
|
# define HAVE_KERNEL_HEAP 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
|
/* For use with EABI and floating point, the stack must be aligned to 8-byte
|
||||||
* floating point, the stack must be aligned to 8-byte addresses.
|
* addresses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_STACK_ALIGNMENT
|
#define CONFIG_STACK_ALIGNMENT 8
|
||||||
|
|
||||||
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
|
|
||||||
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
|
|
||||||
*/
|
|
||||||
|
|
||||||
# ifdef __ARM_EABI__
|
|
||||||
# define CONFIG_STACK_ALIGNMENT 8
|
|
||||||
# else
|
|
||||||
# define CONFIG_STACK_ALIGNMENT 4
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Stack alignment macros */
|
/* Stack alignment macros */
|
||||||
|
|
||||||
@ -233,9 +222,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
|
|
||||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||||
|
|
||||||
/* The ARM stack must be aligned; 4 byte alignment for OABI and
|
/* The ARM stack must be aligned to 8-byte alignment for EABI.
|
||||||
* 8-byte alignment for EABI. If necessary top_of_stack must be
|
* If necessary top_of_stack must be rounded down to the next
|
||||||
* rounded down to the next boundary
|
* boundary
|
||||||
*/
|
*/
|
||||||
|
|
||||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||||
|
@ -100,7 +100,7 @@ static void up_calibratedelay(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
static inline void up_color_intstack(void)
|
static inline void up_color_intstack(void)
|
||||||
{
|
{
|
||||||
uint32_t *ptr = (uint32_t *)&g_intstackalloc;
|
uint32_t *ptr = (uint32_t *)&g_intstackalloc;
|
||||||
|
@ -53,22 +53,11 @@
|
|||||||
* Pre-processor Macros
|
* Pre-processor Macros
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
|
/* For use with EABI and floating point, the stack must be aligned to 8-byte
|
||||||
* floating point, the stack must be aligned to 8-byte addresses.
|
* addresses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_STACK_ALIGNMENT
|
#define CONFIG_STACK_ALIGNMENT 8
|
||||||
|
|
||||||
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
|
|
||||||
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
|
|
||||||
*/
|
|
||||||
|
|
||||||
# ifdef __ARM_EABI__
|
|
||||||
# define CONFIG_STACK_ALIGNMENT 8
|
|
||||||
# else
|
|
||||||
# define CONFIG_STACK_ALIGNMENT 4
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Stack alignment macros */
|
/* Stack alignment macros */
|
||||||
|
|
||||||
|
@ -56,22 +56,11 @@
|
|||||||
* Pre-processor Macros
|
* Pre-processor Macros
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
|
/* For use with EABI and floating point, the stack must be aligned to 8-byte
|
||||||
* floating point, the stack must be aligned to 8-byte addresses.
|
* addresses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_STACK_ALIGNMENT
|
#define CONFIG_STACK_ALIGNMENT 8
|
||||||
|
|
||||||
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
|
|
||||||
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
|
|
||||||
*/
|
|
||||||
|
|
||||||
# ifdef __ARM_EABI__
|
|
||||||
# define CONFIG_STACK_ALIGNMENT 8
|
|
||||||
# else
|
|
||||||
# define CONFIG_STACK_ALIGNMENT 4
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Stack alignment macros */
|
/* Stack alignment macros */
|
||||||
|
|
||||||
@ -143,9 +132,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
|||||||
|
|
||||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||||
|
|
||||||
/* The ARM stack must be aligned; 4 byte alignment for OABI and 8-byte
|
/* The ARM stack must be aligned to 8-byte alignment for EABI.
|
||||||
* alignment for EABI. If necessary top_of_stack must be rounded down
|
* If necessary top_of_stack must be rounded down to the next
|
||||||
* to the next boundary
|
* boundary
|
||||||
*/
|
*/
|
||||||
|
|
||||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||||
|
@ -56,22 +56,11 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
|
/* For use with EABI and floating point, the stack must be aligned to 8-byte
|
||||||
* floating point, the stack must be aligned to 8-byte addresses.
|
* addresses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_STACK_ALIGNMENT
|
#define CONFIG_STACK_ALIGNMENT 8
|
||||||
|
|
||||||
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
|
|
||||||
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
|
|
||||||
*/
|
|
||||||
|
|
||||||
# ifdef __ARM_EABI__
|
|
||||||
# define CONFIG_STACK_ALIGNMENT 8
|
|
||||||
# else
|
|
||||||
# define CONFIG_STACK_ALIGNMENT 4
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
@ -319,16 +319,6 @@ void up_irqinitialize(void)
|
|||||||
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
|
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure that we are using the correct vector table. The default
|
/* Make sure that we are using the correct vector table. The default
|
||||||
* vector address is 0x0000:0000 but if we are executing code that is
|
* vector address is 0x0000:0000 but if we are executing code that is
|
||||||
* positioned in SRAM or in external FLASH, then we may need to reset
|
* positioned in SRAM or in external FLASH, then we may need to reset
|
||||||
|
@ -93,16 +93,6 @@ void up_irqinitialize(void)
|
|||||||
* access to the GIC.
|
* access to the GIC.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialize the Generic Interrupt Controller (GIC) for CPU0 */
|
/* Initialize the Generic Interrupt Controller (GIC) for CPU0 */
|
||||||
|
|
||||||
arm_gic0_initialize(); /* Initialization unique to CPU0 */
|
arm_gic0_initialize(); /* Initialization unique to CPU0 */
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
/* If the common ARMv7-M vector handling logic is used, then it expects the
|
/* If the common ARMv7-M vector handling logic is used, then it expects the
|
||||||
* following definition in this file that provides the number of supported external
|
* following definition in this file that provides the number of supported external
|
||||||
* interrupts which, for this architecture, is provided in the arch/stm32f7/chip.h
|
* interrupts which, for this architecture, is provided in the arch/kinetis/chip.h
|
||||||
* header file.
|
* header file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/kinetis/kinetis_clrpend.c
|
* arch/arm/src/kinetis/kinetis_clrpend.c
|
||||||
* arch/arm/src/chip/kinetis_clrpend.c
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/kinetis/kinetis_start.c
|
* arch/arm/src/kinetis/kinetis_start.c
|
||||||
* arch/arm/src/chip/kinetis_start.c
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -327,6 +326,7 @@ void __start(void)
|
|||||||
* can get debug output as soon as possible (This depends on clock
|
* can get debug output as soon as possible (This depends on clock
|
||||||
* configuration).
|
* configuration).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
kinetis_fpuconfig();
|
kinetis_fpuconfig();
|
||||||
kinetis_lowsetup();
|
kinetis_lowsetup();
|
||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
|
@ -484,7 +484,7 @@ exception_common:
|
|||||||
.global g_intstackbase
|
.global g_intstackbase
|
||||||
.align 8
|
.align 8
|
||||||
g_intstackalloc:
|
g_intstackalloc:
|
||||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||||
g_intstackbase:
|
g_intstackbase:
|
||||||
.size g_intstackalloc, .-g_intstackalloc
|
.size g_intstackalloc, .-g_intstackalloc
|
||||||
#endif
|
#endif
|
||||||
|
@ -348,7 +348,7 @@ exception_common:
|
|||||||
*
|
*
|
||||||
* Here:
|
* Here:
|
||||||
* r0 = Address of the register save area
|
* r0 = Address of the register save area
|
||||||
|
*
|
||||||
* NOTE: It is a requirement that up_restorefpu() preserve the value of
|
* NOTE: It is a requirement that up_restorefpu() preserve the value of
|
||||||
* r0!
|
* r0!
|
||||||
*/
|
*/
|
||||||
@ -468,7 +468,7 @@ exception_common:
|
|||||||
.global g_intstackbase
|
.global g_intstackbase
|
||||||
.align 8
|
.align 8
|
||||||
g_intstackalloc:
|
g_intstackalloc:
|
||||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||||
g_intstackbase:
|
g_intstackbase:
|
||||||
.size g_intstackalloc, .-g_intstackalloc
|
.size g_intstackalloc, .-g_intstackalloc
|
||||||
#endif
|
#endif
|
||||||
|
@ -385,16 +385,6 @@ void up_irqinitialize(void)
|
|||||||
putreg32(0, regaddr);
|
putreg32(0, regaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure that we are using the correct vector table. The default
|
/* Make sure that we are using the correct vector table. The default
|
||||||
* vector address is 0x0000:0000 but if we are executing code that is
|
* vector address is 0x0000:0000 but if we are executing code that is
|
||||||
* positioned in SRAM or in external FLASH, then we may need to reset
|
* positioned in SRAM or in external FLASH, then we may need to reset
|
||||||
|
@ -362,7 +362,7 @@ exception_common:
|
|||||||
*
|
*
|
||||||
* Here:
|
* Here:
|
||||||
* r0 = Address of the register save area
|
* r0 = Address of the register save area
|
||||||
|
*
|
||||||
* NOTE: It is a requirement that up_restorefpu() preserve the value of
|
* NOTE: It is a requirement that up_restorefpu() preserve the value of
|
||||||
* r0!
|
* r0!
|
||||||
*/
|
*/
|
||||||
@ -482,7 +482,7 @@ exception_common:
|
|||||||
.global g_intstackbase
|
.global g_intstackbase
|
||||||
.align 8
|
.align 8
|
||||||
g_intstackalloc:
|
g_intstackalloc:
|
||||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||||
g_intstackbase:
|
g_intstackbase:
|
||||||
.size g_intstackalloc, .-g_intstackalloc
|
.size g_intstackalloc, .-g_intstackalloc
|
||||||
#endif
|
#endif
|
||||||
|
@ -431,16 +431,6 @@ void up_irqinitialize(void)
|
|||||||
* access to the AIC.
|
* access to the AIC.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Redirect all interrupts to the AIC if so configured */
|
/* Redirect all interrupts to the AIC if so configured */
|
||||||
|
|
||||||
sam_aic_redirection();
|
sam_aic_redirection();
|
||||||
|
@ -381,16 +381,6 @@ void up_irqinitialize(void)
|
|||||||
putreg32(0, regaddr);
|
putreg32(0, regaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure that we are using the correct vector table. The default
|
/* Make sure that we are using the correct vector table. The default
|
||||||
* vector address is 0x0000:0000 but if we are executing code that is
|
* vector address is 0x0000:0000 but if we are executing code that is
|
||||||
* positioned in SRAM or in external FLASH, then we may need to reset
|
* positioned in SRAM or in external FLASH, then we may need to reset
|
||||||
|
@ -49,13 +49,13 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************************************/
|
****************************************************************************************************/
|
||||||
|
|
||||||
#define STM32_ADC1_BASE_OFFSET 0x0000
|
#define STM32_ADC1_OFFSET 0x0000
|
||||||
#define STM32_ADC2_BASE_OFFSET 0x0100
|
#define STM32_ADC2_OFFSET 0x0100
|
||||||
#define STM32_ADC12_BASE_OFFSET 0x0300
|
#define STM32_ADC12_CMN_OFFSET 0x0300
|
||||||
|
|
||||||
#define STM32_ADC1_BASE (STM32_ADC1_BASE_OFFSET+STM32_ADC12_BASE) /* ADC1 Master ADC */
|
#define STM32_ADC1_BASE (STM32_ADC1_OFFSET+STM32_ADC12_BASE) /* ADC1 Master ADC */
|
||||||
#define STM32_ADC2_BASE (STM32_ADC1_BASE_OFFSET+STM32_ADC12_BASE) /* ADC2 Slave ADC */
|
#define STM32_ADC2_BASE (STM32_ADC2_OFFSET+STM32_ADC12_BASE) /* ADC2 Slave ADC */
|
||||||
#define STM32_ADC12_BASE (STM32_ADC1_BASE_OFFSET+STM32_ADC12_BASE) /* ADC1, ADC2 common */
|
#define STM32_ADC12_CMN_BASE (STM32_ADC12_CMN_OFFSET+STM32_ADC12_BASE) /* ADC1, ADC2 common */
|
||||||
|
|
||||||
/* Register Offsets *********************************************************************************/
|
/* Register Offsets *********************************************************************************/
|
||||||
|
|
||||||
@ -151,9 +151,9 @@
|
|||||||
#define STM32_ADC2_DIFSEL (STM32_ADC2_BASE+STM32_ADC_DIFSEL_OFFSET)
|
#define STM32_ADC2_DIFSEL (STM32_ADC2_BASE+STM32_ADC_DIFSEL_OFFSET)
|
||||||
#define STM32_ADC2_CALFACT (STM32_ADC2_BASE+STM32_ADC_CALFACT_OFFSET)
|
#define STM32_ADC2_CALFACT (STM32_ADC2_BASE+STM32_ADC_CALFACT_OFFSET)
|
||||||
|
|
||||||
#define STM32_ADC12_CSR (STM32_ADC12_BASE+STM32_ADC_CSR_OFFSET)
|
#define STM32_ADC12_CSR (STM32_ADC12_CMN_BASE+STM32_ADC_CSR_OFFSET)
|
||||||
#define STM32_ADC12_CCR (STM32_ADC12_BASE+STM32_ADC_CCR_OFFSET)
|
#define STM32_ADC12_CCR (STM32_ADC12_CMN_BASE+STM32_ADC_CCR_OFFSET)
|
||||||
#define STM32_ADC12_CDR (STM32_ADC12_BASE+STM32_ADC_CDR_OFFSET)
|
#define STM32_ADC12_CDR (STM32_ADC12_CMN_BASE+STM32_ADC_CDR_OFFSET)
|
||||||
|
|
||||||
/* Register Bitfield Definitions ********************************************************************/
|
/* Register Bitfield Definitions ********************************************************************/
|
||||||
/* ADC interrupt and status register (ISR) and ADC interrupt enable register (IER) */
|
/* ADC interrupt and status register (ISR) and ADC interrupt enable register (IER) */
|
||||||
|
@ -497,7 +497,7 @@ exception_common:
|
|||||||
.global g_intstackbase
|
.global g_intstackbase
|
||||||
.align 8
|
.align 8
|
||||||
g_intstackalloc:
|
g_intstackalloc:
|
||||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||||
g_intstackbase:
|
g_intstackbase:
|
||||||
.size g_intstackalloc, .-g_intstackalloc
|
.size g_intstackalloc, .-g_intstackalloc
|
||||||
#endif
|
#endif
|
||||||
|
@ -1055,7 +1055,7 @@ l5:
|
|||||||
.global g_intstackbase
|
.global g_intstackbase
|
||||||
.align 8
|
.align 8
|
||||||
g_intstackalloc:
|
g_intstackalloc:
|
||||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||||
g_intstackbase:
|
g_intstackbase:
|
||||||
.size g_intstackalloc, .-g_intstackalloc
|
.size g_intstackalloc, .-g_intstackalloc
|
||||||
#endif
|
#endif
|
||||||
|
@ -729,6 +729,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
start = clock_systimer();
|
start = clock_systimer();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
/* Calculate the elapsed time */
|
||||||
|
|
||||||
|
elapsed = clock_systimer() - start;
|
||||||
|
|
||||||
/* Check for STOP condition */
|
/* Check for STOP condition */
|
||||||
|
|
||||||
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
|
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
|
||||||
@ -744,10 +748,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the elapsed time */
|
|
||||||
|
|
||||||
elapsed = clock_systimer() - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop until the stop is complete or a timeout occurs. */
|
/* Loop until the stop is complete or a timeout occurs. */
|
||||||
|
@ -737,6 +737,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
start = clock_systimer();
|
start = clock_systimer();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
/* Calculate the elapsed time */
|
||||||
|
|
||||||
|
elapsed = clock_systimer() - start;
|
||||||
|
|
||||||
/* Check for STOP condition */
|
/* Check for STOP condition */
|
||||||
|
|
||||||
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
|
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
|
||||||
@ -752,10 +756,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the elapsed time */
|
|
||||||
|
|
||||||
elapsed = clock_systimer() - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop until the stop is complete or a timeout occurs. */
|
/* Loop until the stop is complete or a timeout occurs. */
|
||||||
|
@ -310,16 +310,6 @@ void up_irqinitialize(void)
|
|||||||
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
|
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The standard location for the vector table is at the beginning of FLASH
|
/* The standard location for the vector table is at the beginning of FLASH
|
||||||
* at address 0x0800:0000. If we are using the STMicro DFU bootloader, then
|
* at address 0x0800:0000. If we are using the STMicro DFU bootloader, then
|
||||||
* the vector table will be offset to a different location in FLASH and we
|
* the vector table will be offset to a different location in FLASH and we
|
||||||
|
@ -212,6 +212,7 @@ struct stm32_chan_s
|
|||||||
uint8_t eptype; /* See OTGFS_EPTYPE_* definitions */
|
uint8_t eptype; /* See OTGFS_EPTYPE_* definitions */
|
||||||
uint8_t funcaddr; /* Device function address */
|
uint8_t funcaddr; /* Device function address */
|
||||||
uint8_t speed; /* Device speed */
|
uint8_t speed; /* Device speed */
|
||||||
|
uint8_t interval; /* Interrupt/isochronous EP polling interval */
|
||||||
uint8_t pid; /* Data PID */
|
uint8_t pid; /* Data PID */
|
||||||
uint8_t npackets; /* Number of packets (for data toggle) */
|
uint8_t npackets; /* Number of packets (for data toggle) */
|
||||||
bool inuse; /* True: This channel is "in use" */
|
bool inuse; /* True: This channel is "in use" */
|
||||||
@ -1210,6 +1211,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = OTGFS_EPTYPE_CTRL;
|
chan->eptype = OTGFS_EPTYPE_CTRL;
|
||||||
chan->funcaddr = funcaddr;
|
chan->funcaddr = funcaddr;
|
||||||
chan->speed = speed;
|
chan->speed = speed;
|
||||||
|
chan->interval = 0;
|
||||||
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1234,6 +1236,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = OTGFS_EPTYPE_CTRL;
|
chan->eptype = OTGFS_EPTYPE_CTRL;
|
||||||
chan->funcaddr = funcaddr;
|
chan->funcaddr = funcaddr;
|
||||||
chan->speed = speed;
|
chan->speed = speed;
|
||||||
|
chan->interval = 0;
|
||||||
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1363,6 +1366,7 @@ static int stm32_xfrep_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = epdesc->xfrtype;
|
chan->eptype = epdesc->xfrtype;
|
||||||
chan->funcaddr = hport->funcaddr;
|
chan->funcaddr = hport->funcaddr;
|
||||||
chan->speed = hport->speed;
|
chan->speed = hport->speed;
|
||||||
|
chan->interval = epdesc->interval;
|
||||||
chan->maxpacket = epdesc->mxpacketsize;
|
chan->maxpacket = epdesc->mxpacketsize;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1893,6 +1897,8 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
useconds_t delay;
|
||||||
|
|
||||||
/* Get the elapsed time. Has the timeout elapsed?
|
/* Get the elapsed time. Has the timeout elapsed?
|
||||||
* if not then try again.
|
* if not then try again.
|
||||||
*/
|
*/
|
||||||
@ -1906,6 +1912,54 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
|
|
||||||
return (ssize_t)ret;
|
return (ssize_t)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait a bit before retrying after a NAK. */
|
||||||
|
|
||||||
|
if (chan->eptype == OTGFS_HCCHAR_EPTYP_INTR)
|
||||||
|
{
|
||||||
|
/* For interrupt (and isochronous) endpoints, the
|
||||||
|
* polling rate is determined by the bInterval field
|
||||||
|
* of the endpoint descriptor (in units of frames
|
||||||
|
* which we treat as milliseconds here).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (chan->interval > 0)
|
||||||
|
{
|
||||||
|
/* Convert the delay to units of microseconds */
|
||||||
|
|
||||||
|
delay = (useconds_t)chan->interval * 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Out of range! For interrupt endpoints, the valid
|
||||||
|
* range is 1-255 frames. Assume one frame.
|
||||||
|
*/
|
||||||
|
|
||||||
|
delay = 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* For Isochronous endpoints, bInterval must be 1. Bulk
|
||||||
|
* endpoints do not have a polling interval. Rather,
|
||||||
|
* the should wait until data is received.
|
||||||
|
*
|
||||||
|
* REVISIT: For bulk endpoints this 1 msec delay is only
|
||||||
|
* intended to give the CPU a break from the bulk EP tight
|
||||||
|
* polling loop. But are there performance issues?
|
||||||
|
*/
|
||||||
|
|
||||||
|
delay = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait for the next polling interval.
|
||||||
|
*
|
||||||
|
* REVISIT: This delay could require more resolution than
|
||||||
|
* is provided by the system timer. In that case, the
|
||||||
|
* delay could be significantly longer than required.
|
||||||
|
*/
|
||||||
|
|
||||||
|
usleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -5319,20 +5319,22 @@ static void stm32_hwinitialize(FAR struct stm32_usbdev_s *priv)
|
|||||||
|
|
||||||
stm32_putreg(0xbfffffff, STM32_OTGHS_GINTSTS);
|
stm32_putreg(0xbfffffff, STM32_OTGHS_GINTSTS);
|
||||||
|
|
||||||
|
#ifndef BOARD_ENABLE_USBOTG_HSULPI
|
||||||
/* Disable the ULPI Clock enable in RCC AHB1 Register. This must
|
/* Disable the ULPI Clock enable in RCC AHB1 Register. This must
|
||||||
* be done because if both the ULPI and the FS PHY clock enable bits
|
* be done because if both the ULPI and the FS PHY clock enable bits
|
||||||
* are set at the same time, the ARM never awakens from WFI due to
|
* are set at the same time, the ARM never awakens from WFI due to
|
||||||
* some bug / errata in the chip.
|
* some bug / errata in the chip.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regval = stm32_getreg(STM32_RCC_AHB1LPENR);
|
regval = stm32_getreg(STM32_RCC_AHB1LPENR);
|
||||||
regval &= ~RCC_AHB1ENR_OTGHSULPIEN;
|
regval &= ~RCC_AHB1ENR_OTGHSULPIEN;
|
||||||
stm32_putreg(regval, STM32_RCC_AHB1LPENR);
|
stm32_putreg(regval, STM32_RCC_AHB1LPENR);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enable the interrupts in the INTMSK */
|
/* Enable the interrupts in the INTMSK */
|
||||||
|
|
||||||
regval = (OTGHS_GINT_RXFLVL | OTGHS_GINT_USBSUSP | OTGHS_GINT_ENUMDNE |
|
regval = (OTGHS_GINT_RXFLVL | OTGHS_GINT_USBSUSP | OTGHS_GINT_ENUMDNE |
|
||||||
OTGHS_GINT_IEP | OTGHS_GINT_OEP | OTGHS_GINT_USBRST);
|
OTGHS_GINT_IEP | OTGHS_GINT_OEP | OTGHS_GINT_USBRST);
|
||||||
|
|
||||||
#ifdef CONFIG_USBDEV_ISOCHRONOUS
|
#ifdef CONFIG_USBDEV_ISOCHRONOUS
|
||||||
regval |= (OTGHS_GINT_IISOIXFR | OTGHS_GINT_IISOOXFR);
|
regval |= (OTGHS_GINT_IISOIXFR | OTGHS_GINT_IISOOXFR);
|
||||||
|
@ -217,6 +217,7 @@ struct stm32_chan_s
|
|||||||
uint8_t eptype; /* See OTGHS_EPTYPE_* definitions */
|
uint8_t eptype; /* See OTGHS_EPTYPE_* definitions */
|
||||||
uint8_t funcaddr; /* Device function address */
|
uint8_t funcaddr; /* Device function address */
|
||||||
uint8_t speed; /* Device speed */
|
uint8_t speed; /* Device speed */
|
||||||
|
uint8_t interval; /* Interrupt/isochronous EP polling interval */
|
||||||
uint8_t pid; /* Data PID */
|
uint8_t pid; /* Data PID */
|
||||||
uint8_t npackets; /* Number of packets (for data toggle) */
|
uint8_t npackets; /* Number of packets (for data toggle) */
|
||||||
bool inuse; /* True: This channel is "in use" */
|
bool inuse; /* True: This channel is "in use" */
|
||||||
@ -1215,6 +1216,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = OTGHS_EPTYPE_CTRL;
|
chan->eptype = OTGHS_EPTYPE_CTRL;
|
||||||
chan->funcaddr = funcaddr;
|
chan->funcaddr = funcaddr;
|
||||||
chan->speed = speed;
|
chan->speed = speed;
|
||||||
|
chan->interval = 0;
|
||||||
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1239,6 +1241,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = OTGHS_EPTYPE_CTRL;
|
chan->eptype = OTGHS_EPTYPE_CTRL;
|
||||||
chan->funcaddr = funcaddr;
|
chan->funcaddr = funcaddr;
|
||||||
chan->speed = speed;
|
chan->speed = speed;
|
||||||
|
chan->interval = 0;
|
||||||
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1368,6 +1371,7 @@ static int stm32_xfrep_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = epdesc->xfrtype;
|
chan->eptype = epdesc->xfrtype;
|
||||||
chan->funcaddr = hport->funcaddr;
|
chan->funcaddr = hport->funcaddr;
|
||||||
chan->speed = hport->speed;
|
chan->speed = hport->speed;
|
||||||
|
chan->interval = epdesc->interval;
|
||||||
chan->maxpacket = epdesc->mxpacketsize;
|
chan->maxpacket = epdesc->mxpacketsize;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1898,6 +1902,8 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
useconds_t delay;
|
||||||
|
|
||||||
/* Get the elapsed time. Has the timeout elapsed?
|
/* Get the elapsed time. Has the timeout elapsed?
|
||||||
* if not then try again.
|
* if not then try again.
|
||||||
*/
|
*/
|
||||||
@ -1911,6 +1917,54 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
|
|
||||||
return (ssize_t)ret;
|
return (ssize_t)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait a bit before retrying after a NAK. */
|
||||||
|
|
||||||
|
if (chan->eptype == OTGFS_HCCHAR_EPTYP_INTR)
|
||||||
|
{
|
||||||
|
/* For interrupt (and isochronous) endpoints, the
|
||||||
|
* polling rate is determined by the bInterval field
|
||||||
|
* of the endpoint descriptor (in units of frames
|
||||||
|
* which we treat as milliseconds here).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (chan->interval > 0)
|
||||||
|
{
|
||||||
|
/* Convert the delay to units of microseconds */
|
||||||
|
|
||||||
|
delay = (useconds_t)chan->interval * 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Out of range! For interrupt endpoints, the valid
|
||||||
|
* range is 1-255 frames. Assume one frame.
|
||||||
|
*/
|
||||||
|
|
||||||
|
delay = 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* For Isochronous endpoints, bInterval must be 1. Bulk
|
||||||
|
* endpoints do not have a polling interval. Rather,
|
||||||
|
* the should wait until data is received.
|
||||||
|
*
|
||||||
|
* REVISIT: For bulk endpoints this 1 msec delay is only
|
||||||
|
* intended to give the CPU a break from the bulk EP tight
|
||||||
|
* polling loop. But are there performance issues?
|
||||||
|
*/
|
||||||
|
|
||||||
|
delay = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait for the next polling interval.
|
||||||
|
*
|
||||||
|
* REVISIT: This delay could require more resolution than
|
||||||
|
* is provided by the system timer. In that case, the
|
||||||
|
* delay could be significantly longer than required.
|
||||||
|
*/
|
||||||
|
|
||||||
|
usleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -193,10 +193,16 @@ static inline void rcc_enableahb1(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGHS
|
#ifdef CONFIG_STM32_OTGHS
|
||||||
/* USB OTG HS */
|
#ifdef BOARD_ENABLE_USBOTG_HSULPI
|
||||||
|
/* Enable clocking for USB OTG HS and external PHY */
|
||||||
|
|
||||||
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
|
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
|
||||||
|
#else
|
||||||
|
/* Enable only clocking for USB OTG HS */
|
||||||
|
|
||||||
|
regval |= (RCC_AHB1ENR_OTGHSEN);
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* CONFIG_STM32_OTGHS */
|
||||||
|
|
||||||
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */
|
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */
|
||||||
}
|
}
|
||||||
|
@ -844,6 +844,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
start = clock_systimer();
|
start = clock_systimer();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
/* Calculate the elapsed time */
|
||||||
|
|
||||||
|
elapsed = clock_systimer() - start;
|
||||||
|
|
||||||
/* Check for STOP condition */
|
/* Check for STOP condition */
|
||||||
|
|
||||||
cr = stm32_i2c_getreg32(priv, STM32_I2C_CR2_OFFSET);
|
cr = stm32_i2c_getreg32(priv, STM32_I2C_CR2_OFFSET);
|
||||||
@ -860,9 +864,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the elapsed time */
|
|
||||||
|
|
||||||
elapsed = clock_systimer() - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop until the stop is complete or a timeout occurs. */
|
/* Loop until the stop is complete or a timeout occurs. */
|
||||||
|
@ -731,6 +731,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
start = clock_systimer();
|
start = clock_systimer();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
/* Calculate the elapsed time */
|
||||||
|
|
||||||
|
elapsed = clock_systimer() - start;
|
||||||
|
|
||||||
/* Check for STOP condition */
|
/* Check for STOP condition */
|
||||||
|
|
||||||
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
|
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
|
||||||
@ -747,9 +751,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the elapsed time */
|
|
||||||
|
|
||||||
elapsed = clock_systimer() - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop until the stop is complete or a timeout occurs. */
|
/* Loop until the stop is complete or a timeout occurs. */
|
||||||
|
@ -215,10 +215,15 @@ static inline void rcc_enableahb1(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGHS
|
#ifdef CONFIG_STM32_OTGHS
|
||||||
/* USB OTG HS */
|
#ifdef BOARD_ENABLE_USBOTG_HSULPI
|
||||||
|
/* Enable clocking for USB OTG HS and external PHY */
|
||||||
|
|
||||||
|
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
|
||||||
|
#else
|
||||||
|
/* Enable only clocking for USB OTG HS */
|
||||||
|
|
||||||
regval |= RCC_AHB1ENR_OTGHSEN;
|
regval |= RCC_AHB1ENR_OTGHSEN;
|
||||||
|
#endif
|
||||||
#endif /* CONFIG_STM32_OTGHS */
|
#endif /* CONFIG_STM32_OTGHS */
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_DMA2D
|
#ifdef CONFIG_STM32_DMA2D
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* With extensions and modifications for the F1, F2, and F4 by:
|
* With extensions and modifications for the F1, F2, and F4 by:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Gregroy Nutt <gnutt@nuttx.org>
|
* Authors: Gregroy Nutt <gnutt@nuttx.org>
|
||||||
* John Wharington
|
* John Wharington
|
||||||
* David Sidrane <david_s5@nscdg.com>
|
* David Sidrane <david_s5@nscdg.com>
|
||||||
@ -1034,6 +1034,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
start = clock_systimer();
|
start = clock_systimer();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
/* Calculate the elapsed time */
|
||||||
|
|
||||||
|
elapsed = clock_systimer() - start;
|
||||||
|
|
||||||
/* Check for STOP condition */
|
/* Check for STOP condition */
|
||||||
|
|
||||||
cr = stm32_i2c_getreg32(priv, STM32_I2C_CR2_OFFSET);
|
cr = stm32_i2c_getreg32(priv, STM32_I2C_CR2_OFFSET);
|
||||||
@ -1050,9 +1054,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the elapsed time */
|
|
||||||
|
|
||||||
elapsed = clock_systimer() - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop until the stop is complete or a timeout occurs. */
|
/* Loop until the stop is complete or a timeout occurs. */
|
||||||
|
@ -415,16 +415,6 @@ void up_irqinitialize(void)
|
|||||||
putreg32(0, regaddr);
|
putreg32(0, regaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure that we are using the correct vector table. The default
|
/* Make sure that we are using the correct vector table. The default
|
||||||
* vector address is 0x0000:0000 but if we are executing code that is
|
* vector address is 0x0000:0000 but if we are executing code that is
|
||||||
* positioned in SRAM or in external FLASH, then we may need to reset
|
* positioned in SRAM or in external FLASH, then we may need to reset
|
||||||
|
@ -5446,7 +5446,7 @@ static void stm32_hwinitialize(FAR struct stm32_usbdev_s *priv)
|
|||||||
regval &= OTG_GINT_RESERVED;
|
regval &= OTG_GINT_RESERVED;
|
||||||
stm32_putreg(regval | OTG_GINT_RC_W1, STM32_OTG_GINTSTS);
|
stm32_putreg(regval | OTG_GINT_RC_W1, STM32_OTG_GINTSTS);
|
||||||
|
|
||||||
#if defined(CONFIG_STM32F7_OTGHS)
|
#if defined(CONFIG_STM32F7_OTGHS) && !defined(BOARD_ENABLE_USBOTG_HSULPI)
|
||||||
/* Disable the ULPI Clock enable in RCC AHB1 Register. This must
|
/* Disable the ULPI Clock enable in RCC AHB1 Register. This must
|
||||||
* be done because if both the ULPI and the FS PHY clock enable bits
|
* be done because if both the ULPI and the FS PHY clock enable bits
|
||||||
* are set at the same time, the ARM never awakens from WFI due to
|
* are set at the same time, the ARM never awakens from WFI due to
|
||||||
|
@ -214,6 +214,7 @@ struct stm32_chan_s
|
|||||||
uint8_t eptype; /* See OTG_EPTYPE_* definitions */
|
uint8_t eptype; /* See OTG_EPTYPE_* definitions */
|
||||||
uint8_t funcaddr; /* Device function address */
|
uint8_t funcaddr; /* Device function address */
|
||||||
uint8_t speed; /* Device speed */
|
uint8_t speed; /* Device speed */
|
||||||
|
uint8_t interval; /* Interrupt/isochronous EP polling interval */
|
||||||
uint8_t pid; /* Data PID */
|
uint8_t pid; /* Data PID */
|
||||||
uint8_t npackets; /* Number of packets (for data toggle) */
|
uint8_t npackets; /* Number of packets (for data toggle) */
|
||||||
bool inuse; /* True: This channel is "in use" */
|
bool inuse; /* True: This channel is "in use" */
|
||||||
@ -1209,6 +1210,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = OTG_EPTYPE_CTRL;
|
chan->eptype = OTG_EPTYPE_CTRL;
|
||||||
chan->funcaddr = funcaddr;
|
chan->funcaddr = funcaddr;
|
||||||
chan->speed = speed;
|
chan->speed = speed;
|
||||||
|
chan->interval = 0;
|
||||||
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1233,6 +1235,7 @@ static int stm32_ctrlchan_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = OTG_EPTYPE_CTRL;
|
chan->eptype = OTG_EPTYPE_CTRL;
|
||||||
chan->funcaddr = funcaddr;
|
chan->funcaddr = funcaddr;
|
||||||
chan->speed = speed;
|
chan->speed = speed;
|
||||||
|
chan->interval = 0;
|
||||||
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
chan->maxpacket = STM32_EP0_DEF_PACKET_SIZE;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1362,6 +1365,7 @@ static int stm32_xfrep_alloc(FAR struct stm32_usbhost_s *priv,
|
|||||||
chan->eptype = epdesc->xfrtype;
|
chan->eptype = epdesc->xfrtype;
|
||||||
chan->funcaddr = hport->funcaddr;
|
chan->funcaddr = hport->funcaddr;
|
||||||
chan->speed = hport->speed;
|
chan->speed = hport->speed;
|
||||||
|
chan->interval = epdesc->interval;
|
||||||
chan->maxpacket = epdesc->mxpacketsize;
|
chan->maxpacket = epdesc->mxpacketsize;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1892,6 +1896,8 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
useconds_t delay;
|
||||||
|
|
||||||
/* Get the elapsed time. Has the timeout elapsed?
|
/* Get the elapsed time. Has the timeout elapsed?
|
||||||
* if not then try again.
|
* if not then try again.
|
||||||
*/
|
*/
|
||||||
@ -1905,6 +1911,54 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
|
|
||||||
return (ssize_t)ret;
|
return (ssize_t)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait a bit before retrying after a NAK. */
|
||||||
|
|
||||||
|
if (chan->eptype == OTGFS_HCCHAR_EPTYP_INTR)
|
||||||
|
{
|
||||||
|
/* For interrupt (and isochronous) endpoints, the
|
||||||
|
* polling rate is determined by the bInterval field
|
||||||
|
* of the endpoint descriptor (in units of frames
|
||||||
|
* which we treat as milliseconds here).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (chan->interval > 0)
|
||||||
|
{
|
||||||
|
/* Convert the delay to units of microseconds */
|
||||||
|
|
||||||
|
delay = (useconds_t)chan->interval * 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Out of range! For interrupt endpoints, the valid
|
||||||
|
* range is 1-255 frames. Assume one frame.
|
||||||
|
*/
|
||||||
|
|
||||||
|
delay = 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* For Isochronous endpoints, bInterval must be 1. Bulk
|
||||||
|
* endpoints do not have a polling interval. Rather,
|
||||||
|
* the should wait until data is received.
|
||||||
|
*
|
||||||
|
* REVISIT: For bulk endpoints this 1 msec delay is only
|
||||||
|
* intended to give the CPU a break from the bulk EP tight
|
||||||
|
* polling loop. But are there performance issues?
|
||||||
|
*/
|
||||||
|
|
||||||
|
delay = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait for the next polling interval.
|
||||||
|
*
|
||||||
|
* REVISIT: This delay could require more resolution than
|
||||||
|
* is provided by the system timer. In that case, the
|
||||||
|
* delay could be significantly longer than required.
|
||||||
|
*/
|
||||||
|
|
||||||
|
usleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -225,10 +225,15 @@ static inline void rcc_enableahb1(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_OTGHS
|
#ifdef CONFIG_STM32F7_OTGHS
|
||||||
/* USB OTG HS */
|
#ifdef BOARD_ENABLE_USBOTG_HSULPI
|
||||||
|
/* Enable clocking for USB OTG HS and external PHY */
|
||||||
|
|
||||||
|
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
|
||||||
|
#else
|
||||||
|
/* Enable only clocking for USB OTG HS */
|
||||||
|
|
||||||
regval |= RCC_AHB1ENR_OTGHSEN;
|
regval |= RCC_AHB1ENR_OTGHSEN;
|
||||||
|
#endif
|
||||||
#endif /* CONFIG_STM32F7_OTGHS */
|
#endif /* CONFIG_STM32F7_OTGHS */
|
||||||
|
|
||||||
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */
|
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */
|
||||||
|
@ -221,10 +221,15 @@ static inline void rcc_enableahb1(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_OTGHS
|
#ifdef CONFIG_STM32F7_OTGHS
|
||||||
/* USB OTG HS */
|
#ifdef BOARD_ENABLE_USBOTG_HSULPI
|
||||||
|
/* Enable clocking for USB OTG HS and external PHY */
|
||||||
|
|
||||||
|
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
|
||||||
|
#else
|
||||||
|
/* Enable only clocking for USB OTG HS */
|
||||||
|
|
||||||
regval |= RCC_AHB1ENR_OTGHSEN;
|
regval |= RCC_AHB1ENR_OTGHSEN;
|
||||||
|
#endif
|
||||||
#endif /* CONFIG_STM32F7_OTGHS */
|
#endif /* CONFIG_STM32F7_OTGHS */
|
||||||
|
|
||||||
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */
|
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */
|
||||||
|
@ -788,6 +788,10 @@ static inline void stm32l4_i2c_sem_waitstop(FAR struct stm32l4_i2c_priv_s *priv)
|
|||||||
start = clock_systimer();
|
start = clock_systimer();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
/* Calculate the elapsed time */
|
||||||
|
|
||||||
|
elapsed = clock_systimer() - start;
|
||||||
|
|
||||||
/* Check for STOP condition */
|
/* Check for STOP condition */
|
||||||
|
|
||||||
cr = stm32l4_i2c_getreg32(priv, STM32L4_I2C_CR2_OFFSET);
|
cr = stm32l4_i2c_getreg32(priv, STM32L4_I2C_CR2_OFFSET);
|
||||||
@ -804,9 +808,6 @@ static inline void stm32l4_i2c_sem_waitstop(FAR struct stm32l4_i2c_priv_s *priv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the elapsed time */
|
|
||||||
|
|
||||||
elapsed = clock_systimer() - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop until the stop is complete or a timeout occurs. */
|
/* Loop until the stop is complete or a timeout occurs. */
|
||||||
|
@ -304,16 +304,6 @@ void up_irqinitialize(void)
|
|||||||
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
|
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The standard location for the vector table is at the beginning of FLASH
|
/* The standard location for the vector table is at the beginning of FLASH
|
||||||
* at address 0x0800:0000. If we are using the STMicro DFU bootloader, then
|
* at address 0x0800:0000. If we are using the STMicro DFU bootloader, then
|
||||||
* the vector table will be offset to a different location in FLASH and we
|
* the vector table will be offset to a different location in FLASH and we
|
||||||
|
@ -213,6 +213,7 @@ struct stm32l4_chan_s
|
|||||||
uint8_t eptype; /* See OTGFS_EPTYPE_* definitions */
|
uint8_t eptype; /* See OTGFS_EPTYPE_* definitions */
|
||||||
uint8_t funcaddr; /* Device function address */
|
uint8_t funcaddr; /* Device function address */
|
||||||
uint8_t speed; /* Device speed */
|
uint8_t speed; /* Device speed */
|
||||||
|
uint8_t interval; /* Interrupt/isochronous EP polling interval */
|
||||||
uint8_t pid; /* Data PID */
|
uint8_t pid; /* Data PID */
|
||||||
uint8_t npackets; /* Number of packets (for data toggle) */
|
uint8_t npackets; /* Number of packets (for data toggle) */
|
||||||
bool inuse; /* True: This channel is "in use" */
|
bool inuse; /* True: This channel is "in use" */
|
||||||
@ -1212,6 +1213,7 @@ static int stm32l4_ctrlchan_alloc(FAR struct stm32l4_usbhost_s *priv,
|
|||||||
chan->eptype = OTGFS_EPTYPE_CTRL;
|
chan->eptype = OTGFS_EPTYPE_CTRL;
|
||||||
chan->funcaddr = funcaddr;
|
chan->funcaddr = funcaddr;
|
||||||
chan->speed = speed;
|
chan->speed = speed;
|
||||||
|
chan->interval = 0;
|
||||||
chan->maxpacket = STM32L4_EP0_DEF_PACKET_SIZE;
|
chan->maxpacket = STM32L4_EP0_DEF_PACKET_SIZE;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1236,6 +1238,7 @@ static int stm32l4_ctrlchan_alloc(FAR struct stm32l4_usbhost_s *priv,
|
|||||||
chan->eptype = OTGFS_EPTYPE_CTRL;
|
chan->eptype = OTGFS_EPTYPE_CTRL;
|
||||||
chan->funcaddr = funcaddr;
|
chan->funcaddr = funcaddr;
|
||||||
chan->speed = speed;
|
chan->speed = speed;
|
||||||
|
chan->interval = 0;
|
||||||
chan->maxpacket = STM32L4_EP0_DEF_PACKET_SIZE;
|
chan->maxpacket = STM32L4_EP0_DEF_PACKET_SIZE;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1365,6 +1368,7 @@ static int stm32l4_xfrep_alloc(FAR struct stm32l4_usbhost_s *priv,
|
|||||||
chan->eptype = epdesc->xfrtype;
|
chan->eptype = epdesc->xfrtype;
|
||||||
chan->funcaddr = hport->funcaddr;
|
chan->funcaddr = hport->funcaddr;
|
||||||
chan->speed = hport->speed;
|
chan->speed = hport->speed;
|
||||||
|
chan->interval = epdesc->interval;
|
||||||
chan->maxpacket = epdesc->mxpacketsize;
|
chan->maxpacket = epdesc->mxpacketsize;
|
||||||
chan->indata1 = false;
|
chan->indata1 = false;
|
||||||
chan->outdata1 = false;
|
chan->outdata1 = false;
|
||||||
@ -1897,6 +1901,8 @@ static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
useconds_t delay;
|
||||||
|
|
||||||
/* Get the elapsed time. Has the timeout elapsed?
|
/* Get the elapsed time. Has the timeout elapsed?
|
||||||
* if not then try again.
|
* if not then try again.
|
||||||
*/
|
*/
|
||||||
@ -1910,6 +1916,54 @@ static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv,
|
|||||||
|
|
||||||
return (ssize_t)ret;
|
return (ssize_t)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait a bit before retrying after a NAK. */
|
||||||
|
|
||||||
|
if (chan->eptype == OTGFS_HCCHAR_EPTYP_INTR)
|
||||||
|
{
|
||||||
|
/* For interrupt (and isochronous) endpoints, the
|
||||||
|
* polling rate is determined by the bInterval field
|
||||||
|
* of the endpoint descriptor (in units of frames
|
||||||
|
* which we treat as milliseconds here).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (chan->interval > 0)
|
||||||
|
{
|
||||||
|
/* Convert the delay to units of microseconds */
|
||||||
|
|
||||||
|
delay = (useconds_t)chan->interval * 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Out of range! For interrupt endpoints, the valid
|
||||||
|
* range is 1-255 frames. Assume one frame.
|
||||||
|
*/
|
||||||
|
|
||||||
|
delay = 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* For Isochronous endpoints, bInterval must be 1. Bulk
|
||||||
|
* endpoints do not have a polling interval. Rather,
|
||||||
|
* the should wait until data is received.
|
||||||
|
*
|
||||||
|
* REVISIT: For bulk endpoints this 1 msec delay is only
|
||||||
|
* intended to give the CPU a break from the bulk EP tight
|
||||||
|
* polling loop. But are there performance issues?
|
||||||
|
*/
|
||||||
|
|
||||||
|
delay = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait for the next polling interval.
|
||||||
|
*
|
||||||
|
* REVISIT: This delay could require more resolution than
|
||||||
|
* is provided by the system timer. In that case, the
|
||||||
|
* delay could be significantly longer than required.
|
||||||
|
*/
|
||||||
|
|
||||||
|
usleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -339,7 +339,7 @@ exception_common:
|
|||||||
*
|
*
|
||||||
* Here:
|
* Here:
|
||||||
* r0 = Address of the register save area
|
* r0 = Address of the register save area
|
||||||
|
*
|
||||||
* NOTE: It is a requirement that up_restorefpu() preserve the value of
|
* NOTE: It is a requirement that up_restorefpu() preserve the value of
|
||||||
* r0!
|
* r0!
|
||||||
*/
|
*/
|
||||||
@ -459,7 +459,7 @@ exception_common:
|
|||||||
.global g_intstackbase
|
.global g_intstackbase
|
||||||
.align 8
|
.align 8
|
||||||
g_intstackalloc:
|
g_intstackalloc:
|
||||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||||
g_intstackbase:
|
g_intstackbase:
|
||||||
.size g_intstackalloc, .-g_intstackalloc
|
.size g_intstackalloc, .-g_intstackalloc
|
||||||
#endif
|
#endif
|
||||||
|
@ -115,14 +115,6 @@ void up_irqinitialize(void)
|
|||||||
FAR uintptr_t *vimram;
|
FAR uintptr_t *vimram;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
|
||||||
intstack_size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialize VIM RAM vectors. These vectors are not used in the current
|
/* Initialize VIM RAM vectors. These vectors are not used in the current
|
||||||
* interrupt handler logic.
|
* interrupt handler logic.
|
||||||
*/
|
*/
|
||||||
|
@ -956,6 +956,17 @@ config ARCH_BOARD_SPARK
|
|||||||
(http://www.spark.io). This board features the STM32103CBT6
|
(http://www.spark.io). This board features the STM32103CBT6
|
||||||
MCU from STMicro.
|
MCU from STMicro.
|
||||||
|
|
||||||
|
config ARCH_BOARD_PHOTON
|
||||||
|
bool "Photon wifi board"
|
||||||
|
depends on ARCH_CHIP_STM32F205RG
|
||||||
|
select ARCH_HAVE_LEDS
|
||||||
|
select ARCH_HAVE_BUTTONS
|
||||||
|
select ARCH_HAVE_IRQBUTTONS
|
||||||
|
---help---
|
||||||
|
A configuration for the Photon from Particle Devices
|
||||||
|
(https://www.particle.io). This board features the STM32F205RGY6
|
||||||
|
MCU from STMicro.
|
||||||
|
|
||||||
config ARCH_BOARD_STM32_BUTTERFLY2
|
config ARCH_BOARD_STM32_BUTTERFLY2
|
||||||
bool "Kamami STM32Butterfly2 development board"
|
bool "Kamami STM32Butterfly2 development board"
|
||||||
depends on ARCH_CHIP_STM32F107VC
|
depends on ARCH_CHIP_STM32F107VC
|
||||||
@ -1489,6 +1500,7 @@ config ARCH_BOARD
|
|||||||
default "shenzhou" if ARCH_BOARD_SHENZHOU
|
default "shenzhou" if ARCH_BOARD_SHENZHOU
|
||||||
default "skp16c26" if ARCH_BOARD_SKP16C26
|
default "skp16c26" if ARCH_BOARD_SKP16C26
|
||||||
default "spark" if ARCH_BOARD_SPARK
|
default "spark" if ARCH_BOARD_SPARK
|
||||||
|
default "photon" if ARCH_BOARD_PHOTON
|
||||||
default "stm32butterfly2" if ARCH_BOARD_STM32_BUTTERFLY2
|
default "stm32butterfly2" if ARCH_BOARD_STM32_BUTTERFLY2
|
||||||
default "stm32_tiny" if ARCH_BOARD_STM32_TINY
|
default "stm32_tiny" if ARCH_BOARD_STM32_TINY
|
||||||
default "stm32f103-minimum" if ARCH_BOARD_STM32F103_MINIMUM
|
default "stm32f103-minimum" if ARCH_BOARD_STM32F103_MINIMUM
|
||||||
@ -1837,6 +1849,9 @@ endif
|
|||||||
if ARCH_BOARD_SPARK
|
if ARCH_BOARD_SPARK
|
||||||
source "configs/spark/Kconfig"
|
source "configs/spark/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
if ARCH_BOARD_PHOTON
|
||||||
|
source "configs/photon/Kconfig"
|
||||||
|
endif
|
||||||
if ARCH_BOARD_STM32_BUTTERFLY2
|
if ARCH_BOARD_STM32_BUTTERFLY2
|
||||||
source "configs/stm32butterfly2/Kconfig"
|
source "configs/stm32butterfly2/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
@ -519,6 +519,11 @@ configs/p112
|
|||||||
Dave Brooks was successfully funded through Kickstarter for and another
|
Dave Brooks was successfully funded through Kickstarter for and another
|
||||||
run of P112 boards in November of 2012.
|
run of P112 boards in November of 2012.
|
||||||
|
|
||||||
|
configs/photon
|
||||||
|
A configuration for the Photon Wifi board from Particle Devices
|
||||||
|
(https://www.particle.io). This board features the STM32F205RGY6 MCU from
|
||||||
|
STMicro.
|
||||||
|
|
||||||
configs/pic32mx-starterkit
|
configs/pic32mx-starterkit
|
||||||
This directory contains the port of NuttX to the Microchip PIC32 Ethernet
|
This directory contains the port of NuttX to the Microchip PIC32 Ethernet
|
||||||
Starter Kit (DM320004) with the Multimedia Expansion Board (MEB, DM320005).
|
Starter Kit (DM320004) with the Multimedia Expansion Board (MEB, DM320005).
|
||||||
|
@ -700,6 +700,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -998,7 +999,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -702,6 +702,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1008,7 +1009,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -684,6 +684,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1011,7 +1012,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -712,6 +712,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1040,7 +1041,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -20,25 +20,43 @@ Board Support
|
|||||||
|
|
||||||
The following peripherals are available in this configuration.
|
The following peripherals are available in this configuration.
|
||||||
|
|
||||||
- LEDs: show the sytem status
|
- LEDs: Show the sytem status
|
||||||
|
|
||||||
- Buttons: TAMPER-button, WKUP-button, J1-Joystick (consists of RIGHT-,
|
- Buttons: TAMPER-button, WKUP-button, J1-Joystick (consists of RIGHT-,
|
||||||
UP-, LEFT-, DOWN-, and CENTER-button). Built in app
|
UP-, LEFT-, DOWN-, and CENTER-button).
|
||||||
'buttons' works.
|
|
||||||
|
|
||||||
- ADC: ADC1 samples the red trim potentiometer AN_TR
|
- ADC: ADC1 samples the red trim potentiometer AN_TR
|
||||||
Built in app 'adc' works.
|
Built in app 'adc' works.
|
||||||
|
|
||||||
- USB-FS-OTG: There is a USB-A-connector (host) connected to the full
|
- USB-FS-OTG: There is a USB-A-connector (host) connected to the full
|
||||||
speed STM32 inputs.
|
speed STM32 OTG inputs.
|
||||||
|
|
||||||
- USB-HS-OTG: The other connector (device) is connected to the high speed
|
- USB-HS-OTG: The other connector (device) is connected to the high speed
|
||||||
STM32 inputs.
|
STM32 OTG inputs.
|
||||||
|
|
||||||
- CAN: Built in app 'can' works, but apart from that not really tested.
|
- CAN: Built in app 'can' works, but apart from that not really
|
||||||
|
tested.
|
||||||
|
|
||||||
- Ethernet: Ping to other station on the network works.
|
- Ethernet: Ping to other station on the network works.
|
||||||
|
|
||||||
|
- microSD: Not fully functional. See below.
|
||||||
|
|
||||||
|
- LCD: Nokia 6610. This is similar the Nokia 6100 LCD used on other
|
||||||
|
Olimex boards. There is a driver for that LCD at
|
||||||
|
drivers/lcd/nokia6100.c, however, it is not properly
|
||||||
|
integrated. It uses a 9-bit SPI interface which is difficult
|
||||||
|
to get working properly.
|
||||||
|
|
||||||
|
- External Support is included for the onboard SRAM. It uses SRAM
|
||||||
|
SRAM: settings from another board that might need to be tweaked.
|
||||||
|
Difficult to test because the SRAM conflicts with both
|
||||||
|
RS232 ports.
|
||||||
|
|
||||||
|
- Other: Buzzer, Camera, Temperature sensor, audio have not been
|
||||||
|
tested.
|
||||||
|
|
||||||
|
If so, then it requires a 9-bit
|
||||||
|
|
||||||
microSD Card Interface
|
microSD Card Interface
|
||||||
======================
|
======================
|
||||||
|
|
||||||
@ -205,6 +223,13 @@ OTGFS Host
|
|||||||
CONFIG_EXAMPLES_HIDKBD_DEVNAME="/dev/kbda"
|
CONFIG_EXAMPLES_HIDKBD_DEVNAME="/dev/kbda"
|
||||||
CONFIG_EXAMPLES_HIDKBD_STACKSIZE=1024
|
CONFIG_EXAMPLES_HIDKBD_STACKSIZE=1024
|
||||||
|
|
||||||
|
STATUS: The MSC configurations seems fully functional. The HIDKBD seems rather
|
||||||
|
flaky. Sometimes the LEDs become very bright (indicating that it is being
|
||||||
|
swamped with interrupts). Data input is not clean with apps/examples/hidkbd:
|
||||||
|
There are missing characters and sometimes duplicated characters. This implies
|
||||||
|
some logic issues, probably in drivers/usbhost/usbhost_hidkbd, with polling and
|
||||||
|
data filtering.
|
||||||
|
|
||||||
Configurations
|
Configurations
|
||||||
==============
|
==============
|
||||||
|
|
||||||
@ -404,7 +429,7 @@ STATUS
|
|||||||
feature configurations.
|
feature configurations.
|
||||||
|
|
||||||
CCM memory is not included in the heap (CONFIG_STM32_CCMEXCLUDE=y) because
|
CCM memory is not included in the heap (CONFIG_STM32_CCMEXCLUDE=y) because
|
||||||
it does no suport DMA, leaving only 128KiB for program usage.
|
it does not suport DMA, leaving only 128KiB for program usage.
|
||||||
|
|
||||||
2107-01-23: Added the the knsh configuration and support for the PROTECTED
|
2107-01-23: Added the the knsh configuration and support for the PROTECTED
|
||||||
build mode.
|
build mode.
|
||||||
|
58
configs/photon/Kconfig
Normal file
58
configs/photon/Kconfig
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ARCH_BOARD_PHOTON
|
||||||
|
|
||||||
|
config PHOTON_DFU_BOOTLOADER
|
||||||
|
bool "Stock photon bootloader support"
|
||||||
|
select STM32_DFU
|
||||||
|
---help---
|
||||||
|
Build image that can be uploaded using stock DFU bootloader.
|
||||||
|
|
||||||
|
config PHOTON_WDG
|
||||||
|
bool
|
||||||
|
|
||||||
|
config PHOTON_IWDG
|
||||||
|
bool "Photon iwdg kicker support"
|
||||||
|
depends on STM32_IWDG
|
||||||
|
depends on WATCHDOG
|
||||||
|
select PHOTON_WDG
|
||||||
|
|
||||||
|
config PHOTON_IWDG_TIMEOUT
|
||||||
|
int "Photon iwdg Timeout (ms)"
|
||||||
|
default 32000
|
||||||
|
depends on PHOTON_IWDG
|
||||||
|
---help---
|
||||||
|
Watchdog timeout value in milliseconds.
|
||||||
|
|
||||||
|
if PHOTON_WDG
|
||||||
|
config PHOTON_WDG_THREAD
|
||||||
|
bool "Watchdog Deamon Thread"
|
||||||
|
|
||||||
|
if PHOTON_WDG_THREAD
|
||||||
|
config PHOTON_WDG_THREAD_NAME
|
||||||
|
string "Watchdog Thread Name"
|
||||||
|
default "wdog"
|
||||||
|
|
||||||
|
config PHOTON_WDG_THREAD_INTERVAL
|
||||||
|
int "Watchdog Thread Interval (ms)"
|
||||||
|
default 2500
|
||||||
|
|
||||||
|
config PHOTON_WDG_THREAD_PRIORITY
|
||||||
|
int "Watchdog Thread Priority"
|
||||||
|
default 200
|
||||||
|
|
||||||
|
config PHOTON_WDG_THREAD_STACKSIZE
|
||||||
|
int "Watchdog Thread Stacksize"
|
||||||
|
default 1024
|
||||||
|
|
||||||
|
endif # PHOTON_WDG_THREAD
|
||||||
|
endif # PHOTON_WDG
|
||||||
|
|
||||||
|
config PHOTON_WLAN
|
||||||
|
bool "Enable WLAN chip support"
|
||||||
|
depends on IEEE80211_BROADCOM_FULLMAC_SDIO
|
||||||
|
|
||||||
|
endif
|
244
configs/photon/include/board.h
Normal file
244
configs/photon/include/board.h
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/photon/include/board.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 __CONFIG_PHOTON_INCLUDE_BOARD_H
|
||||||
|
#define __CONFIG_PHOTON_INCLUDE_BOARD_H
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
# include <stdbool.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "stm32_rcc.h"
|
||||||
|
#include "stm32.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Clocking *************************************************************************/
|
||||||
|
/* The Particle photon board features a single 26MHz crystal.
|
||||||
|
*
|
||||||
|
* This is the canonical configuration:
|
||||||
|
* System Clock source : PLL (HSE)
|
||||||
|
* SYSCLK(Hz) : 120000000 Determined by PLL configuration
|
||||||
|
* HCLK(Hz) : 120000000 (STM32_RCC_CFGR_HPRE)
|
||||||
|
* AHB Prescaler : 1 (STM32_RCC_CFGR_HPRE)
|
||||||
|
* APB1 Prescaler : 4 (STM32_RCC_CFGR_PPRE1)
|
||||||
|
* APB2 Prescaler : 2 (STM32_RCC_CFGR_PPRE2)
|
||||||
|
* HSE Frequency(Hz) : 26000000 (STM32_BOARD_XTAL)
|
||||||
|
* PLLM : 26 (STM32_PLLCFG_PLLM)
|
||||||
|
* PLLN : 240 (STM32_PLLCFG_PLLN)
|
||||||
|
* PLLP : 2 (STM32_PLLCFG_PLLP)
|
||||||
|
* PLLQ : 5 (STM32_PLLCFG_PLLQ)
|
||||||
|
* Main regulator output voltage : Scale1 mode Needed for high speed SYSCLK
|
||||||
|
* Flash Latency(WS) : 3
|
||||||
|
* Prefetch Buffer : OFF
|
||||||
|
* Instruction cache : ON
|
||||||
|
* Data cache : ON
|
||||||
|
* Require 48MHz for USB OTG HS : Enabled
|
||||||
|
* SDIO and RNG clock
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* HSI - 16 MHz RC factory-trimmed
|
||||||
|
* LSI - 32 KHz RC
|
||||||
|
* HSE - On-board crystal frequency is 26MHz
|
||||||
|
* LSE - 32.768 kHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STM32_BOARD_XTAL 26000000ul
|
||||||
|
|
||||||
|
#define STM32_HSI_FREQUENCY 16000000ul
|
||||||
|
#define STM32_LSI_FREQUENCY 32000
|
||||||
|
#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
|
||||||
|
#define STM32_LSE_FREQUENCY 32768
|
||||||
|
|
||||||
|
/* Main PLL Configuration.
|
||||||
|
*
|
||||||
|
* PLL source is HSE
|
||||||
|
* PLL_VCO = (STM32_HSE_FREQUENCY / PLLM) * PLLN
|
||||||
|
* = (26,000,000 / 26) * 240
|
||||||
|
* = 240,000,000
|
||||||
|
* SYSCLK = PLL_VCO / PLLP
|
||||||
|
* = 240,000,000 / 2 = 120,000,000
|
||||||
|
* USB OTG FS, SDIO and RNG Clock
|
||||||
|
* = PLL_VCO / PLLQ
|
||||||
|
* = 48,000,000
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STM32_PLLCFG_PLLM RCC_PLLCFG_PLLM(26)
|
||||||
|
#define STM32_PLLCFG_PLLN RCC_PLLCFG_PLLN(240)
|
||||||
|
#define STM32_PLLCFG_PLLP RCC_PLLCFG_PLLP_2
|
||||||
|
#define STM32_PLLCFG_PLLQ RCC_PLLCFG_PLLQ(5)
|
||||||
|
|
||||||
|
#define STM32_SYSCLK_FREQUENCY 120000000ul
|
||||||
|
|
||||||
|
/* AHB clock (HCLK) is SYSCLK (120MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */
|
||||||
|
#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
|
||||||
|
#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
|
||||||
|
|
||||||
|
/* APB1 clock (PCLK1) is HCLK/4 (30MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd4 /* PCLK1 = HCLK / 4 */
|
||||||
|
#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/4)
|
||||||
|
|
||||||
|
/* Timers driven from APB1 will be twice PCLK1 */
|
||||||
|
|
||||||
|
#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM12_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM13_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
|
||||||
|
/* APB2 clock (PCLK2) is HCLK/2 (60MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */
|
||||||
|
#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2)
|
||||||
|
|
||||||
|
/* Timers driven from APB2 will be twice PCLK2 */
|
||||||
|
|
||||||
|
#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
#define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
#define STM32_APB2_TIM10_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
#define STM32_APB2_TIM11_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
|
||||||
|
/* USB OTG HS definitions ***********************************************************/
|
||||||
|
/* Do not enable external PHY clock or OTG_HS module will not work */
|
||||||
|
|
||||||
|
#undef BOARD_ENABLE_USBOTG_HSULPI
|
||||||
|
|
||||||
|
/* LED definitions ******************************************************************/
|
||||||
|
|
||||||
|
#define BOARD_LED1 0
|
||||||
|
#define BOARD_NLEDS 1
|
||||||
|
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||||
|
|
||||||
|
/* Button definitions ***************************************************************/
|
||||||
|
|
||||||
|
#define BOARD_BUTTON1 0
|
||||||
|
#define NUM_BUTTONS 1
|
||||||
|
#define BOARD_BUTTON1_BIT (1 << BOARD_BUTTON1)
|
||||||
|
|
||||||
|
/* Alternate function pin selections ************************************************/
|
||||||
|
/* UART1 */
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_USART1
|
||||||
|
# define GPIO_USART1_RX GPIO_USART1_RX_1
|
||||||
|
# define GPIO_USART1_TX GPIO_USART1_TX_1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* SDIO definitions *****************************************************************/
|
||||||
|
|
||||||
|
/* Note that slower clocking is required when DMA is disabled in order
|
||||||
|
* to avoid RX overrun/TX underrun errors due to delayed responses
|
||||||
|
* to service FIFOs in interrupt driven mode.
|
||||||
|
*
|
||||||
|
* These values have not been tuned!!!
|
||||||
|
*
|
||||||
|
* SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SDIO_INIT_CLKDIV (118 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
|
||||||
|
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
|
||||||
|
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SDIO_DMA
|
||||||
|
# define SDIO_MMCXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
#else
|
||||||
|
# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
|
||||||
|
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SDIO_DMA
|
||||||
|
# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
#else
|
||||||
|
# define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Data
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following entry point. This entry point
|
||||||
|
* is called early in the initialization -- after all memory has been configured
|
||||||
|
* and mapped but before any devices have been initialized.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void stm32_boardinitialize(void);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __CONFIG_PHOTON_INCLUDE_BOARD_H */
|
116
configs/photon/nsh/Make.defs
Normal file
116
configs/photon/nsh/Make.defs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/photon/nsh/Make.defs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 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_PHOTON_DFU_BOOTLOADER),y)
|
||||||
|
LDSCRIPT = photon_dfu.ld
|
||||||
|
else
|
||||||
|
LDSCRIPT = ld.script
|
||||||
|
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 = $(ARCROSSDEV)ar rcs
|
||||||
|
NM = $(ARCROSSDEV)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) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHCFLAGS = -fno-builtin
|
||||||
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
|
||||||
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||||
|
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 =
|
1276
configs/photon/nsh/defconfig
Normal file
1276
configs/photon/nsh/defconfig
Normal file
File diff suppressed because it is too large
Load Diff
84
configs/photon/nsh/setenv.sh
Executable file
84
configs/photon/nsh/setenv.sh
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# configs/photon/nsh/setenv.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 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 RIDE
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the RIDE toolchain in any other location
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/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/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"
|
||||||
|
|
||||||
|
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the Atollic toolchain in any other location. /usr/bin is added before
|
||||||
|
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
|
||||||
|
# at those locations as well.
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/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 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 variable
|
||||||
|
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||||
|
|
||||||
|
echo "PATH : ${PATH}"
|
117
configs/photon/scripts/ld.script
Normal file
117
configs/photon/scripts/ld.script
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/photon/scripts/ld.script
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* The STM32F205RG has 1024Kb of FLASH beginning at address 0x0800:0000 and
|
||||||
|
* 112Kb of SRAM.
|
||||||
|
*
|
||||||
|
* When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
|
||||||
|
* where the code expects to begin execution by jumping to the entry point in
|
||||||
|
* the 0x0800:0000 address
|
||||||
|
* range.
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
|
||||||
|
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
ENTRY(_stext)
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.vectors)
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.init_section : {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
*(.init_array .init_array.*)
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
.ARM.exidx : {
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} > flash
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > sram AT > flash
|
||||||
|
|
||||||
|
.bss : {
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > sram
|
||||||
|
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
125
configs/photon/scripts/photon_dfu.ld
Normal file
125
configs/photon/scripts/photon_dfu.ld
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/photon/scripts/photon_dfu.ld
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* The STM32F205RG has 1024Kb of FLASH beginning at address 0x0800:0000 and
|
||||||
|
* 112Kb of SRAM.
|
||||||
|
*
|
||||||
|
* Bootloader jumps at 0x0802:0000.
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
flash (rx) : ORIGIN = 0x08020000, LENGTH = 896K
|
||||||
|
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
ENTRY(_stext)
|
||||||
|
EXTERN(dfu_sign)
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.firmware_start : {
|
||||||
|
_firmware_start = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.vectors)
|
||||||
|
*(.dfu_signature)
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.init_section : {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
*(.init_array .init_array.*)
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
.ARM.exidx : {
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} > flash
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > sram AT > flash
|
||||||
|
|
||||||
|
.firmware_end : {
|
||||||
|
_firmware_end = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.bss : {
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > sram
|
||||||
|
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
68
configs/photon/src/Makefile
Normal file
68
configs/photon/src/Makefile
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/photon/src/Makefile
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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)/Make.defs
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
CSRCS = stm32_boot.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_PHOTON_DFU_BOOTLOADER),y)
|
||||||
|
CSRCS += dfu_signature.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BUTTONS),y)
|
||||||
|
CSRCS += stm32_buttons.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_USERLED),y)
|
||||||
|
CSRCS += stm32_leds.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_PHOTON_WDG),y)
|
||||||
|
CSRCS += stm32_wdt.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_PHOTON_WLAN),y)
|
||||||
|
CSRCS += stm32_wlan.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STM32_OTGHS),y)
|
||||||
|
CSRCS += stm32_usb.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_NSH_LIBRARY),y)
|
||||||
|
CSRCS += stm32_appinit.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(TOPDIR)/configs/Board.mk
|
77
configs/photon/src/dfu_signature.c
Normal file
77
configs/photon/src/dfu_signature.c
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/photon/src/dfu_signature.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <stdint.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
__attribute__((packed)) struct dfu_signature
|
||||||
|
{
|
||||||
|
uint32_t linker_start_address;
|
||||||
|
uint32_t linker_end_address;
|
||||||
|
uint8_t reserved[4];
|
||||||
|
uint16_t board_id;
|
||||||
|
uint8_t firmware_type1;
|
||||||
|
uint8_t firmware_type2;
|
||||||
|
uint8_t reserved2[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
extern uint32_t _firmware_start;
|
||||||
|
extern uint32_t _firmware_end;
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
__attribute__((externally_visible, section(".dfu_signature")))
|
||||||
|
const struct dfu_signature dfu_sign =
|
||||||
|
{
|
||||||
|
(uint32_t)&_firmware_start, /* Flash image start address */
|
||||||
|
(uint32_t)&_firmware_end, /* Flash image end address */
|
||||||
|
{0, 0, 0, 0}, /* reserved */
|
||||||
|
6, /* Current board is photon */
|
||||||
|
4, 1, /* Firmware is "system-part1" */
|
||||||
|
{0, 0, 0, 0, 0, 0, 0, 0} /* reserved */
|
||||||
|
};
|
142
configs/photon/src/photon.h
Normal file
142
configs/photon/src/photon.h
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/photon/src/photon.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 __CONFIGS_PHOTON_SRC_PHOTON_H
|
||||||
|
#define __CONFIGS_PHOTON_SRC_PHOTON_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
#include <arch/stm32/chip.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* LEDs */
|
||||||
|
|
||||||
|
#define GPIO_LED1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
|
||||||
|
GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN13)
|
||||||
|
|
||||||
|
/* BUTTONS -- EXTI interrupts are available on Photon board button */
|
||||||
|
|
||||||
|
#define MIN_IRQBUTTON BOARD_BUTTON1
|
||||||
|
#define MAX_IRQBUTTON BOARD_BUTTON1
|
||||||
|
#define NUM_IRQBUTTONS 1
|
||||||
|
|
||||||
|
#define GPIO_BUTTON1 (GPIO_INPUT|GPIO_PULLUP|GPIO_EXTI|GPIO_PORTC|GPIO_PIN7)
|
||||||
|
|
||||||
|
/* WLAN chip */
|
||||||
|
|
||||||
|
#define SDIO_WLAN0_SLOTNO 0 /* Photon board has only one sdio device */
|
||||||
|
#define SDIO_WLAN0_MINOR 0 /* Register "wlan0" device */
|
||||||
|
|
||||||
|
#define GPIO_WLAN0_RESET (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
|
||||||
|
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN1)
|
||||||
|
|
||||||
|
#define GPIO_WLAN0_32K_CLK (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
|
||||||
|
GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN1)
|
||||||
|
|
||||||
|
#define GPIO_WLAN0_OOB_INT (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|\
|
||||||
|
GPIO_PORTB|GPIO_PIN0)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: photon_watchdog_initialize()
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture-specific initialization of the Watchdog hardware.
|
||||||
|
*
|
||||||
|
* Input parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero on success; a negated errno value on failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_PHOTON_WDG
|
||||||
|
int photon_watchdog_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: photon_wlan_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize wlan hardware and driver for Photon board.
|
||||||
|
*
|
||||||
|
* Input parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero on success; a negated errno value on failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_PHOTON_WLAN
|
||||||
|
int photon_wlan_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_usbinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called from stm32_usbinitialize very early in initialization to setup
|
||||||
|
* USB-related GPIO pins for the Photon board.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_OTGHS
|
||||||
|
void weak_function stm32_usbinitialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __CONFIGS_PHOTON_SRC_PHOTON_H */
|
151
configs/photon/src/stm32_appinit.c
Normal file
151
configs/photon/src/stm32_appinit.c
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* config/photon/src/stm32_appinit.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include <syslog.h>
|
||||||
|
|
||||||
|
#include "photon.h"
|
||||||
|
#include "stm32_wdg.h"
|
||||||
|
#include <nuttx/input/buttons.h>
|
||||||
|
#include <nuttx/leds/userled.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef OK
|
||||||
|
# define OK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_app_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform application specific initialization. This function is never
|
||||||
|
* called directly from application code, but only indirectly via the
|
||||||
|
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||||
|
* implementation without modification. The argument has no
|
||||||
|
* meaning to NuttX; the meaning of the argument is a contract
|
||||||
|
* between the board-specific initalization logic and the the
|
||||||
|
* matching application logic. The value cold be such things as a
|
||||||
|
* mode enumeration value, a set of DIP switch switch settings, a
|
||||||
|
* pointer to configuration data read from a file or serial FLASH,
|
||||||
|
* or whatever you would like to do with it. Every implementation
|
||||||
|
* should accept zero/NULL as a default configuration.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_app_initialize(uintptr_t arg)
|
||||||
|
{
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
|
#ifdef CONFIG_USERLED
|
||||||
|
#ifdef CONFIG_USERLED_LOWER
|
||||||
|
/* Register the LED driver */
|
||||||
|
|
||||||
|
ret = userled_lower_initialize("/dev/userleds");
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
board_userled_initialize();
|
||||||
|
#endif /* CONFIG_USERLED_LOWER */
|
||||||
|
#endif /* CONFIG_USERLED */
|
||||||
|
|
||||||
|
#ifdef CONFIG_BUTTONS
|
||||||
|
#ifdef CONFIG_BUTTONS_LOWER
|
||||||
|
/* Register the BUTTON driver */
|
||||||
|
|
||||||
|
ret = btn_lower_initialize("/dev/buttons");
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
board_button_initialize();
|
||||||
|
#endif /* CONFIG_BUTTONS_LOWER */
|
||||||
|
#endif /* CONFIG_BUTTONS */
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_IWDG
|
||||||
|
stm32_iwdginitialize("/dev/watchdog0", STM32_LSI_FREQUENCY);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PHOTON_WDG
|
||||||
|
|
||||||
|
/* Start WDG kicker thread */
|
||||||
|
|
||||||
|
ret = photon_watchdog_initialize();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to start watchdog thread: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PHOTON_WLAN
|
||||||
|
|
||||||
|
/* Initialize wlan driver and hardware */
|
||||||
|
|
||||||
|
ret = photon_wlan_initialize();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to initialize wlan: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
76
configs/photon/src/stm32_boot.c
Normal file
76
configs/photon/src/stm32_boot.c
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/photon/src/stm32_boot.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "photon.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following entry point. This entry point
|
||||||
|
* is called early in the initialization -- after all memory has been configured
|
||||||
|
* and mapped but before any devices have been initialized.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void stm32_boardinitialize(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_STM32_OTGHS
|
||||||
|
/* Initialize USB if the 1) OTG HS controller is in the configuration and 2)
|
||||||
|
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||||
|
* into the build. Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also
|
||||||
|
* selected.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (stm32_usbinitialize)
|
||||||
|
{
|
||||||
|
stm32_usbinitialize();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
100
configs/photon/src/stm32_buttons.c
Normal file
100
configs/photon/src/stm32_buttons.c
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/photon/src/stm32_buttons.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <debug.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include "photon.h"
|
||||||
|
|
||||||
|
#include "stm32_gpio.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_button_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_button_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure Photon button gpio as input */
|
||||||
|
|
||||||
|
stm32_configgpio(GPIO_BUTTON1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_buttons
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
uint8_t board_buttons(void)
|
||||||
|
{
|
||||||
|
/* Check the state of the only button */
|
||||||
|
|
||||||
|
if (stm32_gpioread(GPIO_BUTTON1))
|
||||||
|
{
|
||||||
|
return BOARD_BUTTON1_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_button_irq
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
|
{
|
||||||
|
if (id != BOARD_BUTTON1)
|
||||||
|
{
|
||||||
|
/* Invalid button id */
|
||||||
|
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Configure interrupt on falling edge only */
|
||||||
|
|
||||||
|
return stm32_gpiosetevent(GPIO_BUTTON1, false, true, false,
|
||||||
|
irqhandler, arg);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_ARCH_IRQBUTTONS */
|
82
configs/photon/src/stm32_leds.c
Normal file
82
configs/photon/src/stm32_leds.c
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/photon/src/stm32_leds.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <debug.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include "photon.h"
|
||||||
|
|
||||||
|
#include "stm32_gpio.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure Photon LED gpio as output */
|
||||||
|
|
||||||
|
stm32_configgpio(GPIO_LED1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled(int led, bool ledon)
|
||||||
|
{
|
||||||
|
if (led == BOARD_LED1)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_LED1, ledon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled_all
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled_all(uint8_t ledset)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_LED1, !!(ledset & BOARD_LED1_BIT));
|
||||||
|
}
|
91
configs/photon/src/stm32_usb.c
Normal file
91
configs/photon/src/stm32_usb.c
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/photon/src/stm32_usb.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||||
|
*
|
||||||
|
* 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 "photon.h"
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <nuttx/usb/usbdev.h>
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Data
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
||||||
|
* GPIO pins for the Photon board.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void stm32_usbinitialize(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbsuspend
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
||||||
|
* used. This function is called whenever the USB enters or leaves suspend mode.
|
||||||
|
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
||||||
|
* while the USB is suspended.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBDEV
|
||||||
|
void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
|
||||||
|
{
|
||||||
|
uinfo("resume: %d\n", resume);
|
||||||
|
}
|
||||||
|
#endif
|
179
configs/photon/src/stm32_wdt.c
Normal file
179
configs/photon/src/stm32_wdt.c
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/photon/src/stm32_wdt.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <sys/types.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <sched.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <nuttx/timers/watchdog.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include <nuttx/kthread.h>
|
||||||
|
#include <nuttx/clock.h>
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
/* Configuration *******************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Watchdog daemon thread */
|
||||||
|
|
||||||
|
#if defined(CONFIG_PHOTON_WDG_THREAD)
|
||||||
|
|
||||||
|
static int wdog_daemon(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* Open watchdog device */
|
||||||
|
|
||||||
|
fd = open(CONFIG_WATCHDOG_DEVPATH, O_RDONLY);
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
wderr("ERROR: open %s failed: %d\n", CONFIG_WATCHDOG_DEVPATH, errno);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Start watchdog timer */
|
||||||
|
|
||||||
|
ret = ioctl(fd, WDIOC_START, 0);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
wderr("ERROR: ioctl(WDIOC_START) failed: %d\n", errno);
|
||||||
|
goto exit_close_dev;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
usleep((CONFIG_PHOTON_WDG_THREAD_INTERVAL)*1000);
|
||||||
|
|
||||||
|
/* Send keep alive ioctl */
|
||||||
|
|
||||||
|
ret = ioctl(fd, WDIOC_KEEPALIVE, 0);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
wderr("ERROR: ioctl(WDIOC_KEEPALIVE) failed: %d\n", errno);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit_close_dev:
|
||||||
|
|
||||||
|
/* Close watchdog device and exit. */
|
||||||
|
close(fd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_PHOTON_WDG_THREAD */
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: photon_watchdog_initialize()
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture-specific initialization of the Watchdog hardware.
|
||||||
|
* This interface must be provided by all configurations using
|
||||||
|
* apps/examples/watchdog
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int photon_watchdog_initialize(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
/* Open the watchdog device */
|
||||||
|
|
||||||
|
fd = open(CONFIG_WATCHDOG_DEVPATH, O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
wderr("ERROR: open %s failed: %d\n", CONFIG_WATCHDOG_DEVPATH, errno);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the watchdog timeout */
|
||||||
|
|
||||||
|
#ifdef CONFIG_PHOTON_IWDG
|
||||||
|
wdinfo("Timeout = %d.\n", CONFIG_PHOTON_IWDG_TIMEOUT);
|
||||||
|
ret = ioctl(fd, WDIOC_SETTIMEOUT, (unsigned long)CONFIG_PHOTON_IWDG_TIMEOUT);
|
||||||
|
#else
|
||||||
|
# error "No watchdog configured"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Close watchdog as it is not needed here anymore */
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
wderr("ERROR: watchdog configuration failed: %d\n", errno);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_PHOTON_WDG_THREAD)
|
||||||
|
|
||||||
|
/* Spawn wdog deamon thread */
|
||||||
|
|
||||||
|
int taskid = kernel_thread(CONFIG_PHOTON_WDG_THREAD_NAME,
|
||||||
|
CONFIG_PHOTON_WDG_THREAD_PRIORITY,
|
||||||
|
CONFIG_PHOTON_WDG_THREAD_STACKSIZE,
|
||||||
|
(main_t)wdog_daemon, (FAR char * const *)NULL);
|
||||||
|
|
||||||
|
if (taskid <= 0)
|
||||||
|
{
|
||||||
|
wderr("ERROR: cannot spawn wdog_daemon thread\n");
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_PHOTON_WDG_THREAD */
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
129
configs/photon/src/stm32_wlan.c
Normal file
129
configs/photon/src/stm32_wlan.c
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/photon/src/stm32_wlan.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <debug.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include <nuttx/wireless/ieee80211/bcmf_sdio.h>
|
||||||
|
#include <nuttx/wireless/ieee80211/bcmf_board.h>
|
||||||
|
#include "photon.h"
|
||||||
|
|
||||||
|
#include "stm32_gpio.h"
|
||||||
|
#include "stm32_sdio.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bcmf_board_reset
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void bcmf_board_reset(int minor, bool reset)
|
||||||
|
{
|
||||||
|
if (minor != SDIO_WLAN0_MINOR)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
stm32_gpiowrite(GPIO_WLAN0_RESET, !reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bcmf_board_power
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void bcmf_board_power(int minor, bool power)
|
||||||
|
{
|
||||||
|
/* Power signal is not used on Photon board */
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bcmf_board_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void bcmf_board_initialize(int minor)
|
||||||
|
{
|
||||||
|
if (minor != SDIO_WLAN0_MINOR)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Configure reset pin */
|
||||||
|
|
||||||
|
stm32_configgpio(GPIO_WLAN0_RESET);
|
||||||
|
|
||||||
|
/* Put wlan chip in reset state */
|
||||||
|
|
||||||
|
bcmf_board_reset(minor, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: photon_wlan_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int photon_wlan_initialize()
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct sdio_dev_s *sdio_dev;
|
||||||
|
|
||||||
|
/* Initialize sdio interface */
|
||||||
|
_info("Initializing SDIO slot %d\n", SDIO_WLAN0_SLOTNO);
|
||||||
|
|
||||||
|
sdio_dev = sdio_initialize(SDIO_WLAN0_SLOTNO);
|
||||||
|
|
||||||
|
if (!sdio_dev)
|
||||||
|
{
|
||||||
|
_err("ERROR: Failed to initialize SDIO with slot %d\n",
|
||||||
|
SDIO_WLAN0_SLOTNO);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bind the SDIO interface to the bcmf driver */
|
||||||
|
ret = bcmf_sdio_initialize(SDIO_WLAN0_MINOR, sdio_dev);
|
||||||
|
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
_err("ERROR: Failed to bind SDIO to bcmf driver\n");
|
||||||
|
/* FIXME deinitialize sdio device */
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
116
configs/photon/usbnsh/Make.defs
Normal file
116
configs/photon/usbnsh/Make.defs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/photon/usbnsh/Make.defs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 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_PHOTON_DFU_BOOTLOADER),y)
|
||||||
|
LDSCRIPT = photon_dfu.ld
|
||||||
|
else
|
||||||
|
LDSCRIPT = ld.script
|
||||||
|
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 = $(ARCROSSDEV)ar rcs
|
||||||
|
NM = $(ARCROSSDEV)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) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHCFLAGS = -fno-builtin
|
||||||
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
|
||||||
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||||
|
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 =
|
1319
configs/photon/usbnsh/defconfig
Normal file
1319
configs/photon/usbnsh/defconfig
Normal file
File diff suppressed because it is too large
Load Diff
84
configs/photon/usbnsh/setenv.sh
Executable file
84
configs/photon/usbnsh/setenv.sh
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# configs/photon/usbnsh/setenv.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 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 RIDE
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the RIDE toolchain in any other location
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/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/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"
|
||||||
|
|
||||||
|
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the Atollic toolchain in any other location. /usr/bin is added before
|
||||||
|
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
|
||||||
|
# at those locations as well.
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/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 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 variable
|
||||||
|
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||||
|
|
||||||
|
echo "PATH : ${PATH}"
|
@ -793,6 +793,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1121,7 +1122,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -796,6 +796,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1125,7 +1126,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -797,6 +797,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1216,7 +1217,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -800,6 +800,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1258,7 +1259,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
# CONFIG_EXAMPLES_NSH is not set
|
# CONFIG_EXAMPLES_NSH is not set
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -988,6 +988,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1329,7 +1330,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
|
@ -661,6 +661,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -957,7 +958,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -663,6 +663,7 @@ CONFIG_NET_ETHERNET=y
|
|||||||
#
|
#
|
||||||
# Network Device Operations
|
# Network Device Operations
|
||||||
#
|
#
|
||||||
|
CONFIG_NETDEV_IOCTL=y
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -969,7 +970,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
# CONFIG_EXAMPLES_MODBUS is not set
|
# CONFIG_EXAMPLES_MODBUS is not set
|
||||||
# CONFIG_EXAMPLES_MOUNT is not set
|
# CONFIG_EXAMPLES_MOUNT is not set
|
||||||
# CONFIG_EXAMPLES_NETTEST is not set
|
# CONFIG_EXAMPLES_NETTEST is not set
|
||||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
# CONFIG_EXAMPLES_NULL is not set
|
# CONFIG_EXAMPLES_NULL is not set
|
||||||
# CONFIG_EXAMPLES_NX is not set
|
# CONFIG_EXAMPLES_NX is not set
|
||||||
|
@ -26,6 +26,15 @@ menuconfig DRIVERS_IEEE802154
|
|||||||
|
|
||||||
source drivers/wireless/ieee802154/Kconfig
|
source drivers/wireless/ieee802154/Kconfig
|
||||||
|
|
||||||
|
menuconfig DRIVERS_IEEE80211
|
||||||
|
bool "IEEE 802.11 Device Support"
|
||||||
|
default n
|
||||||
|
depends on EXPERIMENTAL
|
||||||
|
---help---
|
||||||
|
This directory holds implementations of IEEE802.11 device drivers.
|
||||||
|
|
||||||
|
source drivers/wireless/ieee80211/Kconfig
|
||||||
|
|
||||||
config WL_NRF24L01
|
config WL_NRF24L01
|
||||||
bool "nRF24l01+ transceiver support"
|
bool "nRF24l01+ transceiver support"
|
||||||
default n
|
default n
|
||||||
|
@ -41,6 +41,12 @@ ifeq ($(CONFIG_DRIVERS_IEEE802154),y)
|
|||||||
include wireless$(DELIM)ieee802154$(DELIM)Make.defs
|
include wireless$(DELIM)ieee802154$(DELIM)Make.defs
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Include IEEE 802.11 support
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DRIVERS_IEEE80211),y)
|
||||||
|
include wireless$(DELIM)ieee80211$(DELIM)Make.defs
|
||||||
|
endif
|
||||||
|
|
||||||
# Include wireless drivers
|
# Include wireless drivers
|
||||||
|
|
||||||
ifeq ($(CONFIG_WL_CC1101),y)
|
ifeq ($(CONFIG_WL_CC1101),y)
|
||||||
|
20
drivers/wireless/ieee80211/Kconfig
Normal file
20
drivers/wireless/ieee80211/Kconfig
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
if DRIVERS_IEEE80211
|
||||||
|
|
||||||
|
config IEEE80211_BROADCOM_FULLMAC
|
||||||
|
bool
|
||||||
|
|
||||||
|
config IEEE80211_BROADCOM_FULLMAC_SDIO
|
||||||
|
bool "Broadcom FullMAC driver on SDIO bus"
|
||||||
|
depends on ARCH_HAVE_SDIO
|
||||||
|
select IEEE80211_BROADCOM_FULLMAC
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
This selection enables support for broadcom
|
||||||
|
FullMAC-compliant devices using SDIO bus.
|
||||||
|
|
||||||
|
endif # DRIVERS_IEEE80211
|
53
drivers/wireless/ieee80211/Make.defs
Normal file
53
drivers/wireless/ieee80211/Make.defs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
############################################################################
|
||||||
|
# drivers/wireless/ieee80211/Make.defs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 nothing if IEEE 802.11 is disabled
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DRIVERS_IEEE80211),y)
|
||||||
|
|
||||||
|
# Include common IEEE 802.11 files into the build
|
||||||
|
|
||||||
|
# Include IEEE 802.11 drivers into the build
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_IEEE80211_BROADCOM_FULLMAC_SDIO),y)
|
||||||
|
CSRCS += bcmf_sdio.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Include IEEE 802.11 build support
|
||||||
|
|
||||||
|
DEPPATH += --dep-path wireless$(DELIM)ieee80211
|
||||||
|
VPATH += :wireless$(DELIM)ieee80211
|
||||||
|
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless$(DELIM)ieee80211}
|
||||||
|
|
||||||
|
endif # CONFIG_DRIVERS_IEEE80211
|
271
drivers/wireless/ieee80211/bcmf_sdio.c
Normal file
271
drivers/wireless/ieee80211/bcmf_sdio.c
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* drivers/wireless/ieee80211/bcmf_sdio.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 <nuttx/compiler.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/kmalloc.h>
|
||||||
|
#include <nuttx/sdio.h>
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
|
||||||
|
#include <nuttx/wireless/ieee80211/bcmf_sdio.h>
|
||||||
|
#include <nuttx/wireless/ieee80211/bcmf_board.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define BCMF_DEVICE_RESET_DELAY_MS 10
|
||||||
|
#define BCMF_DEVICE_START_DELAY_MS 10
|
||||||
|
#define BCMF_DEVICE_IDLE_DELAY_MS 50
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* This structure is contains the unique state of the Broadcom FullMAC driver */
|
||||||
|
|
||||||
|
struct bcmf_dev_s
|
||||||
|
{
|
||||||
|
FAR struct sdio_dev_s *sdio_dev; /* The SDIO device bound to this instance */
|
||||||
|
int minor; /* Device minor number */
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int bcmf_sendcmdpoll(FAR struct bcmf_dev_s *priv,
|
||||||
|
uint32_t cmd, uint32_t arg);
|
||||||
|
|
||||||
|
static int bcmf_probe(FAR struct bcmf_dev_s *priv);
|
||||||
|
static int bcmf_hwinitialize(FAR struct bcmf_dev_s *priv);
|
||||||
|
static void bcmf_hwuninitialize(FAR struct bcmf_dev_s *priv);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bcmf_sendcmdpoll
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int bcmf_sendcmdpoll(FAR struct bcmf_dev_s *priv, uint32_t cmd, uint32_t arg)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* Send the command */
|
||||||
|
|
||||||
|
ret = SDIO_SENDCMD(priv->sdio_dev, cmd, arg);
|
||||||
|
if (ret == OK)
|
||||||
|
{
|
||||||
|
/* Then poll-wait until the response is available */
|
||||||
|
|
||||||
|
ret = SDIO_WAITRESPONSE(priv->sdio_dev, cmd);
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
_err("ERROR: Wait for response to cmd: %08x failed: %d\n",
|
||||||
|
cmd, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bcmf_probe
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int bcmf_probe(FAR struct bcmf_dev_s *priv)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
uint32_t data = 0;
|
||||||
|
|
||||||
|
/* Set device state from reset to idle */
|
||||||
|
|
||||||
|
bcmf_sendcmdpoll(priv, MMCSD_CMD0, 0);
|
||||||
|
up_mdelay(BCMF_DEVICE_START_DELAY_MS);
|
||||||
|
|
||||||
|
/* Send IO_SEND_OP_COND command */
|
||||||
|
|
||||||
|
ret = bcmf_sendcmdpoll(priv, SDIO_CMD5, 0);
|
||||||
|
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
goto exit_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Receive R4 response */
|
||||||
|
|
||||||
|
ret = SDIO_RECVR4(priv->sdio_dev, SDIO_CMD5, &data);
|
||||||
|
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
goto exit_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Broadcom chips have 2 additional functions and wide voltage range */
|
||||||
|
|
||||||
|
if ((((data >> 28) & 7) != 2) ||
|
||||||
|
(((data >> 8) & 0xff80) != 0xff80))
|
||||||
|
{
|
||||||
|
goto exit_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
|
||||||
|
exit_error:
|
||||||
|
|
||||||
|
_err("ERROR: failed to probe device %d\n", priv->minor);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bcmf_hwinitialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int bcmf_hwinitialize(FAR struct bcmf_dev_s *priv)
|
||||||
|
{
|
||||||
|
/* Attach and prepare SDIO interrupts */
|
||||||
|
|
||||||
|
SDIO_ATTACH(priv->sdio_dev);
|
||||||
|
|
||||||
|
/* Set ID mode clocking (<400KHz) */
|
||||||
|
|
||||||
|
SDIO_CLOCK(priv->sdio_dev, CLOCK_IDMODE);
|
||||||
|
|
||||||
|
/* Configure hardware */
|
||||||
|
|
||||||
|
bcmf_board_initialize(priv->minor);
|
||||||
|
|
||||||
|
/* Reset and power device */
|
||||||
|
|
||||||
|
bcmf_board_reset(priv->minor, true);
|
||||||
|
bcmf_board_power(priv->minor, true);
|
||||||
|
up_mdelay(BCMF_DEVICE_RESET_DELAY_MS);
|
||||||
|
bcmf_board_reset(priv->minor, false);
|
||||||
|
|
||||||
|
/* Wait for device to start */
|
||||||
|
|
||||||
|
up_mdelay(BCMF_DEVICE_START_DELAY_MS);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bcmf_hwuninitialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void bcmf_hwuninitialize(FAR struct bcmf_dev_s *priv)
|
||||||
|
{
|
||||||
|
/* Shutdown device */
|
||||||
|
|
||||||
|
bcmf_board_power(priv->minor, false);
|
||||||
|
bcmf_board_reset(priv->minor, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: bcmf_sdio_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int bcmf_sdio_initialize(int minor, FAR struct sdio_dev_s *dev)
|
||||||
|
{
|
||||||
|
FAR struct bcmf_dev_s *priv;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
_info("minor: %d\n", minor);
|
||||||
|
|
||||||
|
/* Allocate a bcmf device structure */
|
||||||
|
|
||||||
|
priv = (FAR struct bcmf_dev_s *)kmm_malloc(sizeof(*priv));
|
||||||
|
|
||||||
|
if (!priv)
|
||||||
|
{
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize bcmf device structure */
|
||||||
|
|
||||||
|
memset(priv, 0, sizeof(*priv));
|
||||||
|
priv->sdio_dev = dev;
|
||||||
|
priv->minor = minor;
|
||||||
|
|
||||||
|
/* Initialize device hardware */
|
||||||
|
|
||||||
|
ret = bcmf_hwinitialize(priv);
|
||||||
|
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
goto exit_free_priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Probe device */
|
||||||
|
|
||||||
|
ret = bcmf_probe(priv);
|
||||||
|
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
goto exit_uninit_hw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO Create a wlan device name and register network driver here */
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
|
||||||
|
exit_uninit_hw:
|
||||||
|
bcmf_hwuninitialize(priv);
|
||||||
|
|
||||||
|
exit_free_priv:
|
||||||
|
kmm_free(priv);
|
||||||
|
return ret;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1044,7 +1044,7 @@ static off_t smartfs_seek_internal(struct smartfs_mountpt_s *fs,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
newpos = sf->entry.datlen - offset;
|
newpos = sf->entry.datlen + offset;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +233,24 @@
|
|||||||
# define ninfo(x...)
|
# define ninfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_WIRELESS_ERROR
|
||||||
|
# define wlerr(format, ...) _err(format, ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
# define wlerr(x...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_WIRELESS_WARN
|
||||||
|
# define wlwarn(format, ...) _warn(format, ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
# define wlwarn(x...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_WIRELESS_INFO
|
||||||
|
# define wlinfo(format, ...) _info(format, ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
# define wlinfo(x...)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS_ERROR
|
#ifdef CONFIG_DEBUG_FS_ERROR
|
||||||
# define ferr(format, ...) _err(format, ##__VA_ARGS__)
|
# define ferr(format, ...) _err(format, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
@ -777,6 +795,24 @@
|
|||||||
# define ninfo (void)
|
# define ninfo (void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_WIRELESS_ERROR
|
||||||
|
# define wlerr _err
|
||||||
|
#else
|
||||||
|
# define wlerr (void)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_WIRELESS_WARN
|
||||||
|
# define wlwarn _warn
|
||||||
|
#else
|
||||||
|
# define wlwarn (void)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_WIRELESS_INFO
|
||||||
|
# define wlinfo _info
|
||||||
|
#else
|
||||||
|
# define wlinfo (void)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS_ERROR
|
#ifdef CONFIG_DEBUG_FS_ERROR
|
||||||
# define ferr _err
|
# define ferr _err
|
||||||
#else
|
#else
|
||||||
@ -1267,6 +1303,14 @@
|
|||||||
# define ninfodumpbuffer(m,b,n)
|
# define ninfodumpbuffer(m,b,n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_WIRELESS
|
||||||
|
# define wlerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
|
||||||
|
# define wlinfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
|
||||||
|
#else
|
||||||
|
# define wlerrdumpbuffer(m,b,n)
|
||||||
|
# define wlinfodumpbuffer(m,b,n)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
# define ferrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
|
# define ferrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
|
||||||
# define finfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
|
# define finfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
#define _I2CBASE (0x2000) /* I2C driver commands */
|
#define _I2CBASE (0x2000) /* I2C driver commands */
|
||||||
#define _SPIBASE (0x2100) /* SPI driver commands */
|
#define _SPIBASE (0x2100) /* SPI driver commands */
|
||||||
#define _GPIOBASE (0x2200) /* GPIO driver commands */
|
#define _GPIOBASE (0x2200) /* GPIO driver commands */
|
||||||
#define _CLIOCBASE (0x1200) /* Contactless modules ioctl commands */
|
#define _CLIOCBASE (0x2300) /* Contactless modules ioctl commands */
|
||||||
|
|
||||||
/* boardctl() commands share the same number space */
|
/* boardctl() commands share the same number space */
|
||||||
|
|
||||||
|
@ -109,84 +109,22 @@
|
|||||||
#define SIOCADDRT _SIOC(0x001f) /* Add an entry to the routing table */
|
#define SIOCADDRT _SIOC(0x001f) /* Add an entry to the routing table */
|
||||||
#define SIOCDELRT _SIOC(0x0020) /* Delete an entry from the routing table */
|
#define SIOCDELRT _SIOC(0x0020) /* Delete an entry from the routing table */
|
||||||
|
|
||||||
/* Wireless ioctl commands **************************************************/
|
|
||||||
/* Not currently used */
|
|
||||||
|
|
||||||
#define SIOCSIWCOMMIT _SIOC(0x0021) /* Commit pending changes to driver */
|
|
||||||
#define SIOCGIWNAME _SIOC(0x0022) /* Get name of wireless protocol */
|
|
||||||
|
|
||||||
#define SIOCSIWNWID _SIOC(0x0023) /* Set network ID (pre-802.11) */
|
|
||||||
#define SIOCGIWNWID _SIOC(0x0024) /* Get network ID (the cell) */
|
|
||||||
#define SIOCSIWFREQ _SIOC(0x0025) /* Set channel/frequency (Hz) */
|
|
||||||
#define SIOCGIWFREQ _SIOC(0x0026) /* Get channel/frequency (Hz) */
|
|
||||||
#define SIOCSIWMODE _SIOC(0x0027) /* Set operation mode */
|
|
||||||
#define SIOCGIWMODE _SIOC(0x0028) /* Get operation mode */
|
|
||||||
#define SIOCSIWSENS _SIOC(0x0029) /* Set sensitivity (dBm) */
|
|
||||||
#define SIOCGIWSENS _SIOC(0x002a) /* Get sensitivity (dBm) */
|
|
||||||
|
|
||||||
#define SIOCGIWRANGE _SIOC(0x002b) /* Get range of parameters */
|
|
||||||
#define SIOCGIWPRIV _SIOC(0x002c) /* Get private ioctl interface info */
|
|
||||||
#define SIOCGIWSTATS _SIOC(0x002d) /* Get wireless stats */
|
|
||||||
|
|
||||||
#define SIOCSIWSPY _SIOC(0x002e) /* Set spy addresses */
|
|
||||||
#define SIOCGIWSPY _SIOC(0x002f) /* Get spy info (quality of link) */
|
|
||||||
#define SIOCSIWTHRSPY _SIOC(0x0030) /* Set spy threshold (spy event) */
|
|
||||||
#define SIOCGIWTHRSPY _SIOC(0x0031) /* Get spy threshold */
|
|
||||||
|
|
||||||
#define SIOCSIWAP _SIOC(0x0032) /* Set access point MAC addresses */
|
|
||||||
#define SIOCGIWAP _SIOC(0x0033) /* Get access point MAC addresses */
|
|
||||||
#define SIOCGIWAPLIST _SIOC(0x0034) /* Deprecated in favor of scanning */
|
|
||||||
#define SIOCSIWSCAN _SIOC(0x0035) /* Trigger scanning (list cells) */
|
|
||||||
#define SIOCGIWSCAN _SIOC(0x0036) /* Get scanning results */
|
|
||||||
|
|
||||||
#define SIOCSIWESSID _SIOC(0x0037) /* Set ESSID (network name) */
|
|
||||||
#define SIOCGIWESSID _SIOC(0x0038) /* Get ESSID */
|
|
||||||
#define SIOCSIWNICKN _SIOC(0x0039) /* Set node name/nickname */
|
|
||||||
#define SIOCGIWNICKN _SIOC(0x003a) /* Get node name/nickname */
|
|
||||||
|
|
||||||
#define SIOCSIWRATE _SIOC(0x003b) /* Set default bit rate (bps) */
|
|
||||||
#define SIOCGIWRATE _SIOC(0x003c) /* Get default bit rate (bps) */
|
|
||||||
#define SIOCSIWRTS _SIOC(0x003d) /* Set RTS/CTS threshold (bytes) */
|
|
||||||
#define SIOCGIWRTS _SIOC(0x003e) /* Get RTS/CTS threshold (bytes) */
|
|
||||||
#define SIOCSIWFRAG _SIOC(0x003f) /* Set fragmentation thr (bytes) */
|
|
||||||
#define SIOCGIWFRAG _SIOC(0x0040) /* Get fragmentation thr (bytes) */
|
|
||||||
#define SIOCSIWTXPOW _SIOC(0x0041) /* Set transmit power (dBm) */
|
|
||||||
#define SIOCGIWTXPOW _SIOC(0x0042) /* Get transmit power (dBm) */
|
|
||||||
#define SIOCSIWRETRY _SIOC(0x0043) /* Set retry limits and lifetime */
|
|
||||||
#define SIOCGIWRETRY _SIOC(0x0044) /* Get retry limits and lifetime */
|
|
||||||
|
|
||||||
#define SIOCSIWPOWER _SIOC(0x0045) /* Set Power Management settings */
|
|
||||||
#define SIOCGIWPOWER _SIOC(0x0046) /* Get Power Management settings */
|
|
||||||
|
|
||||||
#define SIOCSIWGENIE _SIOC(0x0047) /* Set generic IE */
|
|
||||||
#define SIOCGIWGENIE _SIOC(0x0048) /* Get generic IE */
|
|
||||||
|
|
||||||
#define SIOCSIWMLME _SIOC(0x0049) /* Request MLME operation */
|
|
||||||
|
|
||||||
#define SIOCSIWAUTH _SIOC(0x004a) /* Set authentication mode params */
|
|
||||||
#define SIOCGIWAUTH _SIOC(0x004b) /* Get authentication mode params */
|
|
||||||
|
|
||||||
#define SIOCSIWENCODEEXT _SIOC(0x004c) /* Set encoding token & mode */
|
|
||||||
#define SIOCGIWENCODEEXT _SIOC(0x004d) /* Get encoding token & mode */
|
|
||||||
|
|
||||||
#define SIOCSIWPMKSA _SIOC(0x004e) /* PMKSA cache operation */
|
|
||||||
|
|
||||||
/* MDIO/MCD *****************************************************************/
|
/* MDIO/MCD *****************************************************************/
|
||||||
|
|
||||||
#define SIOCMIINOTIFY _SIOC(0x004f) /* Receive notificaion via signal on
|
#define SIOCMIINOTIFY _SIOC(0x0021) /* Receive notificaion via signal on
|
||||||
* PHY state change */
|
* PHY state change */
|
||||||
#define SIOCGMIIPHY _SIOC(0x0050) /* Get address of MII PHY in use */
|
#define SIOCGMIIPHY _SIOC(0x0022) /* Get address of MII PHY in use */
|
||||||
#define SIOCGMIIREG _SIOC(0x0051) /* Get a MII register via MDIO */
|
#define SIOCGMIIREG _SIOC(0x0023) /* Get a MII register via MDIO */
|
||||||
#define SIOCSMIIREG _SIOC(0x0052) /* Set a MII register via MDIO */
|
#define SIOCSMIIREG _SIOC(0x0024) /* Set a MII register via MDIO */
|
||||||
|
|
||||||
/* Unix domain sockets ******************************************************/
|
/* Unix domain sockets ******************************************************/
|
||||||
|
|
||||||
#define SIOCINQ _SIOC(0x0053) /* Returns the amount of queued unread
|
#define SIOCINQ _SIOC(0x0025) /* Returns the amount of queued unread
|
||||||
* data in the receive */
|
* data in the receive */
|
||||||
|
|
||||||
/* Telnet driver ************************************************************/
|
/* Telnet driver ************************************************************/
|
||||||
|
|
||||||
#define SIOCTELNET _SIOC(0x0054) /* Create a Telnet sessions.
|
#define SIOCTELNET _SIOC(0x0026) /* Create a Telnet sessions.
|
||||||
* See include/nuttx/net/telnet.h */
|
* See include/nuttx/net/telnet.h */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/net/net.h
|
* include/nuttx/net/net.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009-2014, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009-2014, 2016-2017 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -67,7 +67,10 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Data link layer type */
|
|
||||||
|
/* Data link layer type. This type is used with netdev_register in order to
|
||||||
|
* identify the type of the network driver.
|
||||||
|
*/
|
||||||
|
|
||||||
enum net_lltype_e
|
enum net_lltype_e
|
||||||
{
|
{
|
||||||
@ -75,7 +78,8 @@ enum net_lltype_e
|
|||||||
NET_LL_LOOPBACK, /* Local loopback */
|
NET_LL_LOOPBACK, /* Local loopback */
|
||||||
NET_LL_SLIP, /* Serial Line Internet Protocol (SLIP) */
|
NET_LL_SLIP, /* Serial Line Internet Protocol (SLIP) */
|
||||||
NET_LL_TUN, /* TUN Virtual Network Device */
|
NET_LL_TUN, /* TUN Virtual Network Device */
|
||||||
NET_LL_6LOWPAN /* IEEE 802.15.4 6LoWPAN*/
|
NET_LL_IEEE80211, /* IEEE 802.11 */
|
||||||
|
NET_LL_6LOWPAN /* IEEE 802.15.4 6LoWPAN */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This defines a bitmap big enough for one bit for each socket option */
|
/* This defines a bitmap big enough for one bit for each socket option */
|
||||||
|
@ -330,7 +330,7 @@ struct net_driver_s
|
|||||||
int (*d_addmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac);
|
int (*d_addmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac);
|
||||||
int (*d_rmmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac);
|
int (*d_rmmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_NETDEV_PHY_IOCTL
|
#ifdef CONFIG_NETDEV_IOCTL
|
||||||
int (*d_ioctl)(FAR struct net_driver_s *dev, int cmd, long arg);
|
int (*d_ioctl)(FAR struct net_driver_s *dev, int cmd, long arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
110
include/nuttx/wireless/ieee80211/bcmf_board.h
Normal file
110
include/nuttx/wireless/ieee80211/bcmf_board.h
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/nuttx/wireless/ieee80211/bcmf_board.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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_WIRELESS_IEEE80211_BCMF_BOARD_H
|
||||||
|
#define __INCLUDE_NUTTX_WIRELESS_IEEE80211_BCMF_BOARD_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Function: bcmf_board_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Board specific function called from Broadcom FullMAC driver
|
||||||
|
* that must be implemented to configure WLAN chip GPIOs
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* minor - zero based minor device number which is unique
|
||||||
|
* for each wlan device.
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void bcmf_board_initialize(int minor);
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Function: bcmf_board_power
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Board specific function called from Broadcom FullMAC driver
|
||||||
|
* that must be implemented to power WLAN chip
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* minor - zero based minor device number which is unique
|
||||||
|
* for each wlan device.
|
||||||
|
* power - true to power WLAN chip else false
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void bcmf_board_power(int minor, bool power);
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Function: bcmf_board_reset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Board specific function called from Broadcom FullMAC driver
|
||||||
|
* that must be implemented to reset WLAN chip
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* minor - zero based minor device number which is unique
|
||||||
|
* for each wlan device.
|
||||||
|
* reset - true to set WLAN chip in reset state else false
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void bcmf_board_reset(int minor, bool reset);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_NUTTX_WIRELESS_IEEE80211_BCMF_BOARD_H */
|
86
include/nuttx/wireless/ieee80211/bcmf_sdio.h
Normal file
86
include/nuttx/wireless/ieee80211/bcmf_sdio.h
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/nuttx/wireless/ieee80211/bcmf_sdio.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
|
*
|
||||||
|
* 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_WIRELESS_IEEE80211_BCMF_SDIO_H
|
||||||
|
#define __INCLUDE_NUTTX_WIRELESS_IEEE80211_BCMF_SDIO_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/mmcsd.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: bcmf_sdio_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize Broadcom FullMAC driver.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* minor - zero based minor device number which is unique
|
||||||
|
* for each wlan device.
|
||||||
|
* dev - SDIO device used to communicate with the wlan chip
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* OK on success; Negated errno on failure.
|
||||||
|
*
|
||||||
|
* Assumptions:
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int bcmf_sdio_initialize(int minor, FAR struct sdio_dev_s *dev);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_NUTTX_WIRELESS_IEEE80211_BCMF_SDIO_H */
|
@ -64,8 +64,6 @@
|
|||||||
#define NRF24L01_DYN_LENGTH 33 /* Specific length value to use to enable dynamic packet length */
|
#define NRF24L01_DYN_LENGTH 33 /* Specific length value to use to enable dynamic packet length */
|
||||||
#define NRF24L01_XMIT_MAXRT 255 /* Specific value returned by Number of available pipes */
|
#define NRF24L01_XMIT_MAXRT 255 /* Specific value returned by Number of available pipes */
|
||||||
|
|
||||||
/* #define NRF24L01_DEBUG 1 */
|
|
||||||
|
|
||||||
/* IOCTL commands */
|
/* IOCTL commands */
|
||||||
|
|
||||||
#define NRF24L01IOC_SETRETRCFG _WLIOC(NRF24L01_FIRST+0) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
#define NRF24L01IOC_SETRETRCFG _WLIOC(NRF24L01_FIRST+0) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
||||||
@ -88,18 +86,6 @@
|
|||||||
#define NRF24L01IOC_SETTXADDR WLIOC_SETADDR
|
#define NRF24L01IOC_SETTXADDR WLIOC_SETADDR
|
||||||
#define NRF24L01IOC_GETTXADDR WLIOC_GETADDR
|
#define NRF24L01IOC_GETTXADDR WLIOC_GETADDR
|
||||||
|
|
||||||
/* NRF24L01 debug */
|
|
||||||
|
|
||||||
#ifdef NRF24L01_DEBUG
|
|
||||||
# define werr(format, ...) _err(format, ##__VA_ARGS__)
|
|
||||||
# define werr(format, ...) _err(format, ##__VA_ARGS__)
|
|
||||||
# define winfo(format, ...) _info(format, ##__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
# define werr(x...)
|
|
||||||
# define werr(x...)
|
|
||||||
# define winfo(x...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data Types
|
* Public Data Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -507,12 +493,9 @@ ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NRF24L01_DEBUG
|
#ifdef CONFIG_DEBUG_WIRELESS
|
||||||
|
|
||||||
void nrf24l01_dumpregs(FAR struct nrf24l01_dev_s *dev);
|
void nrf24l01_dumpregs(FAR struct nrf24l01_dev_s *dev);
|
||||||
|
|
||||||
void nrf24l01_dumprxfifo(FAR struct nrf24l01_dev_s *dev);
|
void nrf24l01_dumprxfifo(FAR struct nrf24l01_dev_s *dev);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
@ -45,6 +45,11 @@
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <net/if.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
|
|
||||||
#ifdef CONFIG_DRIVERS_WIRELESS
|
#ifdef CONFIG_DRIVERS_WIRELESS
|
||||||
@ -53,18 +58,127 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/* IOCTL Commands *******************************************************************/
|
/* Network Driver IOCTL Commands ****************************************************/
|
||||||
/* Common wireless IOCTL commands */
|
/* Use of these IOCTL commands requires a socket descriptor created by the socket()
|
||||||
|
* interface.
|
||||||
|
*/
|
||||||
|
|
||||||
#define WLIOC_SETRADIOFREQ _WLIOC(0x0001) /* arg: Pointer to uint32_t, frequency value (in Mhz) */
|
/* Wireless identification */
|
||||||
#define WLIOC_GETRADIOFREQ _WLIOC(0x0002) /* arg: Pointer to uint32_t, frequency value (in Mhz) */
|
|
||||||
#define WLIOC_SETADDR _WLIOC(0x0003) /* arg: Pointer to address value, format of the address is driver specific */
|
|
||||||
#define WLIOC_GETADDR _WLIOC(0x0004) /* arg: Pointer to address value, format of the address is driver specific */
|
|
||||||
#define WLIOC_SETTXPOWER _WLIOC(0x0005) /* arg: Pointer to int32_t, output power (in dBm) */
|
|
||||||
#define WLIOC_GETTXPOWER _WLIOC(0x0006) /* arg: Pointer to int32_t, output power (in dBm) */
|
|
||||||
|
|
||||||
#define WL_FIRST 0x0001 /* First common command */
|
#define SIOCSIWCOMMIT _WLIOC(0x0001) /* Commit pending changes to driver */
|
||||||
#define WL_NCMDS 6 /* Six common commands */
|
#define SIOCGIWNAME _WLIOC(0x0002) /* Get name of wireless protocol */
|
||||||
|
|
||||||
|
/* Basic Operations */
|
||||||
|
|
||||||
|
#define SIOCSIWNWID _WLIOC(0x0003) /* Set network ID (pre-802.11) */
|
||||||
|
#define SIOCGIWNWID _WLIOC(0x0004) /* Get network ID (the cell) */
|
||||||
|
#define SIOCSIWFREQ _WLIOC(0x0005) /* Set channel/frequency (Hz) */
|
||||||
|
#define SIOCGIWFREQ _WLIOC(0x0006) /* Get channel/frequency (Hz) */
|
||||||
|
#define SIOCSIWMODE _WLIOC(0x0007) /* Set operation mode */
|
||||||
|
#define SIOCGIWMODE _WLIOC(0x0008) /* Get operation mode */
|
||||||
|
#define SIOCSIWSENS _WLIOC(0x0009) /* Set sensitivity (dBm) */
|
||||||
|
#define SIOCGIWSENS _WLIOC(0x000a) /* Get sensitivity (dBm) */
|
||||||
|
|
||||||
|
/* Informational */
|
||||||
|
|
||||||
|
#define SIOCGIWRANGE _WLIOC(0x000b) /* Get range of parameters */
|
||||||
|
#define SIOCGIWPRIV _WLIOC(0x000c) /* Get private ioctl interface info */
|
||||||
|
#define SIOCGIWRANGE _WLIOC(0x000d) /* Get range of parameters */
|
||||||
|
#define SIOCGIWPRIV _WLIOC(0x000e) /* Get private ioctl interface info */
|
||||||
|
#define SIOCGIWSTATS _WLIOC(0x000f) /* Get wireless stats */
|
||||||
|
|
||||||
|
/* Spy support (statistics per MAC address - used for Mobile IP support) */
|
||||||
|
|
||||||
|
#define SIOCSIWSPY _WLIOC(0x0010) /* Set spy addresses */
|
||||||
|
#define SIOCGIWSPY _WLIOC(0x0011) /* Get spy info (quality of link) */
|
||||||
|
#define SIOCSIWTHRSPY _WLIOC(0x0012) /* Set spy threshold (spy event) */
|
||||||
|
#define SIOCGIWTHRSPY _WLIOC(0x0013) /* Get spy threshold */
|
||||||
|
|
||||||
|
/* Access point manipulation */
|
||||||
|
|
||||||
|
#define SIOCSIWAP _WLIOC(0x0014) /* Set access point MAC addresses */
|
||||||
|
#define SIOCGIWAP _WLIOC(0x0015) /* Get access point MAC addresses */
|
||||||
|
#define SIOCGIWAPLIST _WLIOC(0x0016) /* Deprecated in favor of scanning */
|
||||||
|
#define SIOCSIWSCAN _WLIOC(0x0017) /* Trigger scanning (list cells) */
|
||||||
|
#define SIOCGIWSCAN _WLIOC(0x0018) /* Get scanning results */
|
||||||
|
|
||||||
|
/* 802.11 specific support */
|
||||||
|
|
||||||
|
#define SIOCSIWESSID _WLIOC(0x0019) /* Set ESSID (network name) */
|
||||||
|
#define SIOCGIWESSID _WLIOC(0x001a) /* Get ESSID */
|
||||||
|
#define SIOCSIWNICKN _WLIOC(0x001b) /* Set node name/nickname */
|
||||||
|
#define SIOCGIWNICKN _WLIOC(0x001c) /* Get node name/nickname */
|
||||||
|
|
||||||
|
#define SIOCSIWRATE _WLIOC(0x001d) /* Set default bit rate (bps) */
|
||||||
|
#define SIOCGIWRATE _WLIOC(0x001e) /* Get default bit rate (bps) */
|
||||||
|
#define SIOCSIWRTS _WLIOC(0x001f) /* Set RTS/CTS threshold (bytes) */
|
||||||
|
#define SIOCGIWRTS _WLIOC(0x0010) /* Get RTS/CTS threshold (bytes) */
|
||||||
|
#define SIOCSIWFRAG _WLIOC(0x0011) /* Set fragmentation thr (bytes) */
|
||||||
|
#define SIOCGIWFRAG _WLIOC(0x0022) /* Get fragmentation thr (bytes) */
|
||||||
|
#define SIOCSIWTXPOW _WLIOC(0x0023) /* Set transmit power (dBm) */
|
||||||
|
#define SIOCGIWTXPOW _WLIOC(0x0024) /* Get transmit power (dBm) */
|
||||||
|
#define SIOCSIWRETRY _WLIOC(0x0025) /* Set retry limits and lifetime */
|
||||||
|
#define SIOCGIWRETRY _WLIOC(0x0026) /* Get retry limits and lifetime */
|
||||||
|
|
||||||
|
/* Encoding */
|
||||||
|
|
||||||
|
#define SIOCSIWENCODE _WLIOC(0x0027) /* Set encoding token & mode */
|
||||||
|
#define SIOCGIWENCODE _WLIOC(0x0028) /* Get encoding token & mode */
|
||||||
|
|
||||||
|
/* Power saving */
|
||||||
|
|
||||||
|
#define SIOCSIWPOWER _WLIOC(0x0029) /* Set Power Management settings */
|
||||||
|
#define SIOCGIWPOWER _WLIOC(0x002a) /* Get Power Management settings */
|
||||||
|
|
||||||
|
/* WPA : Generic IEEE 802.11 information element */
|
||||||
|
|
||||||
|
#define SIOCSIWGENIE _WLIOC(0x002b) /* Set generic IE */
|
||||||
|
#define SIOCGIWGENIE _WLIOC(0x002c) /* Get generic IE */
|
||||||
|
|
||||||
|
/* WPA : IEEE 802.11 MLME requests */
|
||||||
|
|
||||||
|
#define SIOCSIWMLME _WLIOC(0x002d) /* Request MLME operation */
|
||||||
|
|
||||||
|
/* WPA : Authentication mode parameters */
|
||||||
|
|
||||||
|
#define SIOCSIWAUTH _WLIOC(0x002e) /* Set authentication mode params */
|
||||||
|
#define SIOCGIWAUTH _WLIOC(0x002f) /* Get authentication mode params */
|
||||||
|
|
||||||
|
/* WPA : Extended version of encoding configuration */
|
||||||
|
|
||||||
|
#define SIOCSIWENCODEEXT _WLIOC(0x0030) /* Set encoding token & mode */
|
||||||
|
#define SIOCGIWENCODEEXT _WLIOC(0x0031) /* Get encoding token & mode */
|
||||||
|
|
||||||
|
/* WPA2 : PMKSA cache management */
|
||||||
|
|
||||||
|
#define SIOCSIWPMKSA _WLIOC(0x0032) /* PMKSA cache operation */
|
||||||
|
|
||||||
|
#define WL_FIRSTCHAR 0x0033
|
||||||
|
#define WL_NNETCMDS 0x0032
|
||||||
|
|
||||||
|
/* Character Driver IOCTL commands *************************************************/
|
||||||
|
/* Non-compatible, NuttX only IOCTL definitions for use with low-level wireless
|
||||||
|
* drivers that are accessed via a character device. Use of these IOCTL commands
|
||||||
|
* requires a file descriptor created by the open() interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WLIOC_SETRADIOFREQ _WLIOC(0x0033) /* arg: Pointer to uint32_t, frequency
|
||||||
|
* value (in Mhz) */
|
||||||
|
#define WLIOC_GETRADIOFREQ _WLIOC(0x0034) /* arg: Pointer to uint32_t, frequency
|
||||||
|
* value (in Mhz) */
|
||||||
|
#define WLIOC_SETADDR _WLIOC(0x0035) /* arg: Pointer to address value, format
|
||||||
|
* of the address is driver specific */
|
||||||
|
#define WLIOC_GETADDR _WLIOC(0x0036) /* arg: Pointer to address value, format
|
||||||
|
* of the address is driver specific */
|
||||||
|
#define WLIOC_SETTXPOWER _WLIOC(0x0037) /* arg: Pointer to int32_t, output power
|
||||||
|
* (in dBm) */
|
||||||
|
#define WLIOC_GETTXPOWER _WLIOC(0x0038) /* arg: Pointer to int32_t, output power
|
||||||
|
* (in dBm) */
|
||||||
|
|
||||||
|
/* Device-specific IOCTL commands **************************************************/
|
||||||
|
|
||||||
|
#define WL_FIRST 0x0001 /* First common command */
|
||||||
|
#define WL_NCMDS 0x0038 /* Number of common commands */
|
||||||
|
|
||||||
/* User defined ioctl commands are also supported. These will be forwarded
|
/* User defined ioctl commands are also supported. These will be forwarded
|
||||||
* by the upper-half QE driver to the lower-half QE driver via the ioctl()
|
* by the upper-half QE driver to the lower-half QE driver via the ioctl()
|
||||||
@ -75,13 +189,123 @@
|
|||||||
|
|
||||||
/* See include/nuttx/wireless/cc3000.h */
|
/* See include/nuttx/wireless/cc3000.h */
|
||||||
|
|
||||||
#define CC3000_FIRST (WL_FIRST + WL_NCMDS)
|
#define CC3000_FIRST (WL_FIRST + WL_NCMDS)
|
||||||
#define CC3000_NCMDS 7
|
#define CC3000_NCMDS 7
|
||||||
|
|
||||||
/* See include/nuttx/wireless/nrf24l01.h */
|
/* See include/nuttx/wireless/nrf24l01.h */
|
||||||
|
|
||||||
#define NRF24L01_FIRST (CC3000_FIRST + CC3000_NCMDS)
|
#define NRF24L01_FIRST (CC3000_FIRST + CC3000_NCMDS)
|
||||||
#define NRF24L01_NCMDS 14
|
#define NRF24L01_NCMDS 14
|
||||||
|
|
||||||
|
/* Other Common Wireless Definitions ***********************************************/
|
||||||
|
|
||||||
|
/* Maximum size of the ESSID and NICKN strings */
|
||||||
|
|
||||||
|
#define IW_ESSID_MAX_SIZE 32
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Types
|
||||||
|
************************************************************************************/
|
||||||
|
/* TODO:
|
||||||
|
*
|
||||||
|
* - Add types for statistics (struct iw_statistics and related)
|
||||||
|
* - Add struct iw_range for use with IOCTL commands that need exchange mode data
|
||||||
|
* that could not fit in iwreq.
|
||||||
|
* - Private IOCTL data support (struct iw_priv_arg)
|
||||||
|
* - Quality
|
||||||
|
* - WPA support.
|
||||||
|
* - Wireless events.
|
||||||
|
* - Various flag definitions.
|
||||||
|
*
|
||||||
|
* These future additions will all need to be compatible with BSD/Linux definitions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Generic format for most parameters that fit in a int32_t */
|
||||||
|
|
||||||
|
struct iw_param
|
||||||
|
{
|
||||||
|
int32_t value; /* The value of the parameter itself */
|
||||||
|
uint8_t fixed; /* Hardware should not use auto select */
|
||||||
|
uint8_t disabled; /* Disable the feature */
|
||||||
|
uint16_t flags; /* Optional flags */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Large data reference. For all data larger than 16 octets, we need to use a
|
||||||
|
* pointer to memory allocated in user space.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct iw_point
|
||||||
|
{
|
||||||
|
FAR void *pointer; /* Pointer to the data (in user space) */
|
||||||
|
uint16_t length; /* number of fields or size in bytes */
|
||||||
|
uint16_t flags; /* Optional flags */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* For numbers lower than 10^9, we encode the number in 'm' and set 'e' to 0
|
||||||
|
* For number greater than 10^9, we divide it by the lowest power of 10 to
|
||||||
|
* get 'm' lower than 10^9, with 'm'= f / (10^'e')...
|
||||||
|
* The power of 10 is in 'e', the result of the division is in 'm'.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct iw_freq
|
||||||
|
{
|
||||||
|
int32_t m; /* Mantissa */
|
||||||
|
int16_t e; /* Exponent */
|
||||||
|
uint8_t i; /* List index (when in range struct) */
|
||||||
|
uint8_t flags; /* Flags (fixed/auto) */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Quality of the link */
|
||||||
|
|
||||||
|
struct iw_quality
|
||||||
|
{
|
||||||
|
uint8_t qual; /* link quality (%retries, SNR,
|
||||||
|
* %missed beacons or better...) */
|
||||||
|
uint8_t level; /* signal level (dBm) */
|
||||||
|
uint8_t noise; /* noise level (dBm) */
|
||||||
|
uint8_t updated; /* Flags to know if updated */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This union defines the data payload of an ioctl, and is used in struct iwreq
|
||||||
|
* below.
|
||||||
|
*/
|
||||||
|
|
||||||
|
union iwreq_data
|
||||||
|
{
|
||||||
|
char name[IFNAMSIZ]; /* Network interface name */
|
||||||
|
struct iw_point essid; /* Extended network name */
|
||||||
|
struct iw_param nwid; /* Network id (or domain - the cell) */
|
||||||
|
struct iw_freq freq; /* frequency or channel :
|
||||||
|
* 0-1000 = channel
|
||||||
|
* > 1000 = frequency in Hz */
|
||||||
|
struct iw_param sens; /* signal level threshold */
|
||||||
|
struct iw_param bitrate; /* default bit rate */
|
||||||
|
struct iw_param txpower; /* default transmit power */
|
||||||
|
struct iw_param rts; /* RTS threshold threshold */
|
||||||
|
struct iw_param frag; /* Fragmentation threshold */
|
||||||
|
uint32_t mode; /* Operation mode */
|
||||||
|
struct iw_param retry; /* Retry limits & lifetime */
|
||||||
|
|
||||||
|
struct iw_point encoding; /* Encoding stuff : tokens */
|
||||||
|
struct iw_param power; /* PM duration/timeout */
|
||||||
|
struct iw_quality qual; /* Quality part of statistics */
|
||||||
|
|
||||||
|
struct sockaddr ap_addr; /* Access point address */
|
||||||
|
struct sockaddr addr; /* Destination address (hw/mac) */
|
||||||
|
|
||||||
|
struct iw_param param; /* Other small parameters */
|
||||||
|
struct iw_point data; /* Other large parameters */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This is the structure used to exchange data in wireless IOCTLs. This structure
|
||||||
|
* is the same as 'struct ifreq', but defined for use with wireless IOCTLs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct iwreq
|
||||||
|
{
|
||||||
|
char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "eth0" */
|
||||||
|
union iwreq_data u; /* Data payload */
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_DRIVERS_WIRELESS */
|
#endif /* CONFIG_DRIVERS_WIRELESS */
|
||||||
#endif /* __INCLUDE_NUTTX_WIRELESS_H */
|
#endif /* __INCLUDE_NUTTX_WIRELESS_H */
|
||||||
|
@ -93,7 +93,7 @@ struct sem_s
|
|||||||
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
||||||
FAR struct semholder_s *hhead; /* List of holders of semaphore counts */
|
FAR struct semholder_s *hhead; /* List of holders of semaphore counts */
|
||||||
# else
|
# else
|
||||||
struct semholder_s holder; /* Single holder */
|
struct semholder_s holder[2]; /* Slot for old and new holder */
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -104,12 +104,15 @@ typedef struct sem_s sem_t;
|
|||||||
|
|
||||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||||
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
||||||
# define SEM_INITIALIZER(c) {(c), 0, NULL} /* semcount, flags, hhead */
|
# define SEM_INITIALIZER(c) \
|
||||||
|
{(c), 0, NULL} /* semcount, flags, hhead */
|
||||||
# else
|
# else
|
||||||
# define SEM_INITIALIZER(c) {(c), 0, SEMHOLDER_INITIALIZER} /* semcount, flags, holder */
|
# define SEM_INITIALIZER(c) \
|
||||||
|
{(c), 0, {SEMHOLDER_INITIALIZER, SEMHOLDER_INITIALIZER}} /* semcount, flags, holder[2] */
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define SEM_INITIALIZER(c) {(c)} /* semcount */
|
# define SEM_INITIALIZER(c) \
|
||||||
|
{(c)} /* semcount */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user