Merged nuttx/nuttx into master
This commit is contained in:
commit
4489d3bdca
@ -8,7 +8,7 @@
|
||||
<tr align="center" bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1>
|
||||
<p>Last Updated: March 23, 2017</p>
|
||||
<p>Last Updated: April 8, 2017</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -362,6 +362,8 @@ nuttx/
|
||||
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/mm/shm/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
| `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/mm/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
|- net/
|
||||
| |- sixlowpan/
|
||||
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/net/sixlowpan/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
| `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/net/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
|- syscall/
|
||||
| `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/syscall/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
|
@ -1750,6 +1750,8 @@ nuttx/
|
||||
| | `- README.txt
|
||||
| `- README.txt
|
||||
|- net/
|
||||
| |- sixlowpan
|
||||
| | `- README.txt
|
||||
| `- README.txt
|
||||
|- syscall/
|
||||
| `- README.txt
|
||||
|
52
TODO
52
TODO
@ -1,4 +1,4 @@
|
||||
NuttX TODO List (Last updated March 26, 2017)
|
||||
NuttX TODO List (Last updated April 12, 2017)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
||||
@ -9,7 +9,7 @@ issues related to each board port.
|
||||
|
||||
nuttx/:
|
||||
|
||||
(10) Task/Scheduler (sched/)
|
||||
(11) Task/Scheduler (sched/)
|
||||
(1) SMP
|
||||
(1) Memory Management (mm/)
|
||||
(0) Power Management (drivers/pm)
|
||||
@ -108,9 +108,10 @@ o Task/Scheduler (sched/)
|
||||
2. They run in supervisor mode (if applicable), and
|
||||
3. They do not obey any setup of PIC or address
|
||||
environments. Do they need to?
|
||||
4. In the case of task_delete() and pthread_cancel(), these
|
||||
callbacks will run on the thread of execution and address
|
||||
context of the caller of task. That is very bad!
|
||||
4. In the case of task_delete() and pthread_cancel() without
|
||||
defferred cancellation, these callbacks will run on the
|
||||
thread of execution and address context of the caller of
|
||||
task_delete() or pthread_cancel(). That is very bad!
|
||||
|
||||
The fix for all of these issues it to have the callbacks
|
||||
run on the caller's thread as is currently done with
|
||||
@ -185,6 +186,47 @@ o Task/Scheduler (sched/)
|
||||
Priority: Low. Things are just the way that we want them for the way
|
||||
that NuttX is used today.
|
||||
|
||||
Title: INTERNAL VERSIONS OF USER FUNCTIONS
|
||||
Description: The internal NuttX logic uses the same interfaces as does
|
||||
the application. That sometime produces a problem because
|
||||
there is "overloaded" functionality in those user interfaces
|
||||
that are not desireable.
|
||||
|
||||
For example, having cancellation points hidden inside of the
|
||||
OS can cause non-cancellation point interfaces to behave
|
||||
strangely. There was a change recently in pthread_cond_wait()
|
||||
and pthread_cond_timedwait() recently to effectively disable
|
||||
the cancellation point behavior of sem_init(). This was
|
||||
accomplished with two functions: pthread_disable_cancel()
|
||||
and pthread_enable_cancel()
|
||||
|
||||
Here is another issue: Internal OS functions should not set
|
||||
errno and should never have to look at the errno value to
|
||||
determine the cause of the failure. The errno is provided
|
||||
for compatibility with POSIX application interface
|
||||
requirements and really doesn't need to be used within the
|
||||
OS.
|
||||
|
||||
Both of these could be fixed if there were special internal
|
||||
versions these functions. For example, there could be a an
|
||||
nx_sem_wait() that does all of the same things as sem_wait()
|
||||
was does not create a cancellation point and does not set
|
||||
the errno value on failures.
|
||||
|
||||
Everything inside the OS would use nx_sem_wait().
|
||||
Applications would call sem_wait() which would just be a
|
||||
wrapper around nx_sem_wait() that adds the cancellation point
|
||||
and that sets the errno value on failures.
|
||||
|
||||
Changes like that could clean up some of this internal
|
||||
craziness. The condition variable change described above is
|
||||
really a "bandaid" to handle the case that sem_wait() is a
|
||||
cancellation point.
|
||||
Status: Open
|
||||
Priority: Low. Things are working OK the way they are. But the design
|
||||
could be improved and made a little more efficient with this
|
||||
change.
|
||||
|
||||
o SMP
|
||||
^^^
|
||||
|
||||
|
@ -188,9 +188,9 @@
|
||||
|
||||
/* Pending register */
|
||||
|
||||
#define EXTI_IMR_BIT(n) STM32_EXTI_BIT(n) /* 1=Selected trigger request occurred */
|
||||
#define EXTI_IMR_SHIFT (0) /* Bits 0-X: Pending bit for all lines */
|
||||
#define EXTI_IMR_MASK STM32_EXTI_MASK
|
||||
#define EXTI_PR_BIT(n) STM32_EXTI_BIT(n) /* 1=Selected trigger request occurred */
|
||||
#define EXTI_PR_SHIFT (0) /* Bits 0-X: Pending bit for all lines */
|
||||
#define EXTI_PR_MASK STM32_EXTI_MASK
|
||||
|
||||
/* Compatibility Definitions ********************************************************/
|
||||
|
||||
|
@ -44,6 +44,8 @@
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
#ifdef CONFIG_STM32_COMP
|
||||
|
||||
#if defined(CONFIG_STM32_STM32F30XX)
|
||||
# error "COMP support for STM32F30XX not implemented yet"
|
||||
#elif defined(CONFIG_STM32_STM32F33XX)
|
||||
@ -211,4 +213,5 @@ FAR struct comp_dev_s* stm32_compinitialize(int intf);
|
||||
#endif
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* CONFIG_STM23_COMP */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_STM32_COMP_H */
|
||||
|
@ -1634,7 +1634,7 @@ config SERIAL_DISABLE_REORDERING
|
||||
|
||||
config STM32F7_FLOWCONTROL_BROKEN
|
||||
bool "Use Software UART RTS flow control"
|
||||
depends on STM32F7_USART
|
||||
depends on STM32F7_USART && SERIAL_IFLOWCONTROL_WATERMARKS
|
||||
default n
|
||||
---help---
|
||||
Enable UART RTS flow control using Software. Because STM
|
||||
|
@ -125,9 +125,9 @@
|
||||
|
||||
/* Pending register */
|
||||
|
||||
#define EXTI_IMR_BIT(n) STM32_EXTI_BIT(n) /* 1=Selected trigger request occurred */
|
||||
#define EXTI_IMR_SHIFT (0) /* Bits 0-X: Pending bit for all lines */
|
||||
#define EXTI_IMR_MASK STM32_EXTI_MASK
|
||||
#define EXTI_PR_BIT(n) STM32_EXTI_BIT(n) /* 1=Selected trigger request occurred */
|
||||
#define EXTI_PR_SHIFT (0) /* Bits 0-X: Pending bit for all lines */
|
||||
#define EXTI_PR_MASK STM32_EXTI_MASK
|
||||
|
||||
#endif /* CONFIG_STM32F7_STM32F74XX || CONFIG_STM32F7_STM32F75XX || CONFIG_STM32F7_STM32F76XX || CONFIG_STM32F7_STM32F77XX */
|
||||
#endif /* __ARCH_ARM_SRC_STM32F7_CHIP_STM32_EXTI_H */
|
||||
|
@ -220,43 +220,56 @@
|
||||
|
||||
/* Warnings for potentially unsafe configuration combinations. */
|
||||
|
||||
#if defined(CONFIG_STM32F7_FLOWCONTROL_BROKEN) && \
|
||||
!defined(CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS)
|
||||
# error "CONFIG_STM32F7_FLOWCONTROL_BROKEN requires \
|
||||
CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS to be enabled."
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32F7_FLOWCONTROL_BROKEN
|
||||
/* Combination of RXDMA + IFLOWCONTROL does not work as one might expect.
|
||||
* Since RXDMA uses circular DMA-buffer, DMA will always keep reading new
|
||||
* data from USART peripheral even if DMA buffer underruns. Thus this
|
||||
* combination only does following: RTS is asserted on USART setup and
|
||||
* deasserted on shutdown and does not perform actual RTS flow-control.
|
||||
*
|
||||
* With SW flow-control, RTS is asserted before UART receive buffer fully
|
||||
* fills, thus preventing data loss if application is slow to process data
|
||||
* from serial device node. However, if RxDMA interrupt is blocked for too
|
||||
* long, data loss is still possible as SW flow-control would also be
|
||||
* blocked.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USART1_RXDMA) && defined(CONFIG_USART1_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for USART1. \
|
||||
This combination can lead to data loss."
|
||||
#endif
|
||||
# if defined(CONFIG_USART1_RXDMA) && defined(CONFIG_USART1_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for USART1. \
|
||||
This combination can lead to data loss."
|
||||
# endif
|
||||
|
||||
#if defined(CONFIG_USART2_RXDMA) && defined(CONFIG_USART2_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for USART2. \
|
||||
This combination can lead to data loss."
|
||||
#endif
|
||||
# if defined(CONFIG_USART2_RXDMA) && defined(CONFIG_USART2_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for USART2. \
|
||||
This combination can lead to data loss."
|
||||
# endif
|
||||
|
||||
#if defined(CONFIG_USART3_RXDMA) && defined(CONFIG_USART3_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for USART3. \
|
||||
This combination can lead to data loss."
|
||||
#endif
|
||||
# if defined(CONFIG_USART3_RXDMA) && defined(CONFIG_USART3_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for USART3. \
|
||||
This combination can lead to data loss."
|
||||
# endif
|
||||
|
||||
#if defined(CONFIG_USART6_RXDMA) && defined(CONFIG_USART6_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for USART6. \
|
||||
This combination can lead to data loss."
|
||||
#endif
|
||||
# if defined(CONFIG_USART6_RXDMA) && defined(CONFIG_USART6_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for USART6. \
|
||||
This combination can lead to data loss."
|
||||
# endif
|
||||
|
||||
#if defined(CONFIG_UART7_RXDMA) && defined(CONFIG_UART7_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for UART7. \
|
||||
This combination can lead to data loss."
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_UART8_RXDMA) && defined(CONFIG_UART8_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for UART8. \
|
||||
This combination can lead to data loss."
|
||||
#endif
|
||||
# if defined(CONFIG_UART7_RXDMA) && defined(CONFIG_UART7_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for UART7. \
|
||||
This combination can lead to data loss."
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_UART8_RXDMA) && defined(CONFIG_UART8_IFLOWCONTROL)
|
||||
# warning "RXDMA and IFLOWCONTROL both enabled for UART8. \
|
||||
This combination can lead to data loss."
|
||||
# endif
|
||||
#endif /* CONFIG_STM32F7_FLOWCONTROL_BROKEN */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@ -2211,6 +2224,22 @@ static bool up_rxflowcontrol(struct uart_dev_s *dev,
|
||||
/* Assert/de-assert nRTS set it high resume/stop sending */
|
||||
|
||||
stm32_gpiowrite(priv->rts_gpio, upper);
|
||||
|
||||
if (upper)
|
||||
{
|
||||
/* With heavy Rx traffic, RXNE might be set and data pending.
|
||||
* Returning 'true' in such case would cause RXNE left unhandled
|
||||
* and causing interrupt storm. Sending end might be also be slow
|
||||
* to react on nRTS, and returning 'true' here would prevent
|
||||
* processing that data.
|
||||
*
|
||||
* Therefore, return 'false' so input data is still being processed
|
||||
* until sending end reacts on nRTS signal and stops sending more.
|
||||
*/
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return upper;
|
||||
}
|
||||
|
||||
|
@ -167,13 +167,13 @@
|
||||
|
||||
/* Pending register */
|
||||
|
||||
#define EXTI_IMR1_BIT(n) STM32L4_EXTI1_BIT(n) /* 1=Selected trigger request occurred */
|
||||
#define EXTI_IMR1_SHIFT (0) /* Bits 0-X: Pending bit for all lines */
|
||||
#define EXTI_IMR1_MASK STM32L4_EXTI1_MASK
|
||||
#define EXTI_PR1_BIT(n) STM32L4_EXTI1_BIT(n) /* 1=Selected trigger request occurred */
|
||||
#define EXTI_PR1_SHIFT (0) /* Bits 0-X: Pending bit for all lines */
|
||||
#define EXTI_PR1_MASK STM32L4_EXTI1_MASK
|
||||
|
||||
#define EXTI_IMR2_BIT(n) STM32L4_EXTI2_BIT(n) /* 1=Selected trigger request occurred */
|
||||
#define EXTI_IMR2_SHIFT (0) /* Bits 0-X: Pending bit for all lines */
|
||||
#define EXTI_IMR2_MASK STM32L4_EXTI2_MASK
|
||||
#define EXTI_PR2_BIT(n) STM32L4_EXTI2_BIT(n) /* 1=Selected trigger request occurred */
|
||||
#define EXTI_PR2_SHIFT (0) /* Bits 0-X: Pending bit for all lines */
|
||||
#define EXTI_PR2_MASK STM32L4_EXTI2_MASK
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32L4_CHIP_STM32L4_EXTI_H */
|
||||
|
||||
|
@ -306,7 +306,12 @@
|
||||
#define STM32L4_DMA2_CHAN6 (12)
|
||||
#define STM32L4_DMA2_CHAN7 (13)
|
||||
|
||||
#define DMACHAN_SETTING(chan, sel) ( ( ( (sel) & 0xff) << 8) | ( (chan) & 0xff) )
|
||||
/* DMA Channel settings include a channel and an alternative function.
|
||||
* Channel is in bits 0..7
|
||||
* Request number is in bits 8..15
|
||||
*/
|
||||
|
||||
#define DMACHAN_SETTING(chan, req) ((((req) & 0xff) << 8) | ((chan) & 0xff))
|
||||
#define DMACHAN_SETTING_CHANNEL_MASK 0x00FF
|
||||
#define DMACHAN_SETTING_CHANNEL_SHIFT (0)
|
||||
#define DMACHAN_SETTING_FUNCTION_MASK 0xFF00
|
||||
@ -384,7 +389,7 @@
|
||||
|
||||
#define DMACHAN_SPI1_RX_1 DMACHAN_SETTING(STM32L4_DMA1_CHAN2, 1)
|
||||
#define DMACHAN_SPI1_RX_2 DMACHAN_SETTING(STM32L4_DMA2_CHAN3, 4)
|
||||
#define DMACHAN_SPI1_TX_1 DMACHAN_SETTING(STM32L4_DMA1_CHAN3, 0)
|
||||
#define DMACHAN_SPI1_TX_1 DMACHAN_SETTING(STM32L4_DMA1_CHAN3, 1)
|
||||
#define DMACHAN_SPI1_TX_2 DMACHAN_SETTING(STM32L4_DMA2_CHAN4, 4)
|
||||
|
||||
#define DMACHAN_SPI2_RX DMACHAN_SETTING(STM32L4_DMA1_CHAN4, 1)
|
||||
|
@ -187,7 +187,7 @@ void up_initialize(void)
|
||||
* separately.
|
||||
*/
|
||||
|
||||
syslog(LOG_INFO, "SIM: Initializing");
|
||||
syslog(LOG_INFO, "SIM: Initializing\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
@ -120,15 +120,15 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions in the board.h header file for the meaning of each bit in
|
||||
* the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t retval;
|
||||
uint32_t retval;
|
||||
|
||||
retval = at32uc3_gpioread(PINMUX_GPIO_BUTTON1) ? 0 : BUTTON1;
|
||||
retval |= at32uc3_gpioread(PINMUX_GPIO_BUTTON2) ? 0 : BUTTON2;
|
||||
|
@ -120,9 +120,9 @@ void board_button_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
@ -79,9 +79,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* Check that state of each key. A low value will be sensed when the
|
||||
* button is pressed.
|
||||
@ -110,7 +110,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -104,9 +104,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -145,7 +145,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
|
@ -77,7 +77,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -137,7 +137,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -49,18 +49,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -77,7 +65,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,18 +49,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -77,7 +65,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return inp(EZ80_PB_DDR) & 7;
|
||||
}
|
||||
|
@ -91,9 +91,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* Check that state of each key. A LOW value means that the key is pressed, */
|
||||
|
||||
@ -121,7 +121,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
|
@ -92,9 +92,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (kinetis_gpioread(GPIO_SW2))
|
||||
{
|
||||
@ -120,7 +120,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may
|
||||
* be called to collect the state of all buttons. board_buttons() returns
|
||||
* an 8-bit bit set with each bit associated with a button. See the
|
||||
* an 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (kinetis_gpioread(GPIO_SW2))
|
||||
{
|
||||
@ -124,7 +124,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may
|
||||
* be called to collect the state of all buttons. board_buttons() returns
|
||||
* an 8-bit bit set with each bit associated with a button. See the
|
||||
* an 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
|
@ -79,9 +79,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
bool pinValue;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -120,7 +120,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
|
@ -74,7 +74,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
/* The KwikStik-K40 board has no standard GPIO contact buttons */
|
||||
|
||||
@ -92,7 +92,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
|
@ -154,12 +154,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return tms570_gioread(GIO_BUTTON) ? BUTTON_GIOA7_BIT : 0;
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ void board_button_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
@ -126,9 +126,9 @@ void board_button_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
@ -129,10 +129,10 @@ void board_button_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
#if 0 /* Not yet implemented */
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
@ -94,9 +94,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (hcs12_gpioread(NE64BADGE_BUTTON1))
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return stm32_gpioread(GPIO_BTN_USER) ? 1 : 0;
|
||||
}
|
||||
@ -92,7 +92,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -83,12 +83,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit unsigned integer with each bit associated with a button. See the
|
||||
* 32-bit unsigned integer with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
/* Check the state of the USER button. A LOW value means that the key is
|
||||
* pressed.
|
||||
|
@ -102,12 +102,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MMCSD
|
||||
/* First, get an instance of the SDIO interface */
|
||||
|
||||
|
@ -78,7 +78,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
/* Check that state of each USER button. A LOW value means that the key is
|
||||
* pressed.
|
||||
@ -98,7 +98,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -120,12 +120,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
|
||||
(void)ret;
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
/* Mount the proc filesystem */
|
||||
|
||||
|
@ -78,7 +78,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
/* Check that state of each USER button. A LOW value means that the key is
|
||||
* pressed.
|
||||
@ -98,7 +98,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -120,14 +120,14 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret;
|
||||
uint32_t ret;
|
||||
int i;
|
||||
|
||||
/* Check each button */
|
||||
|
@ -130,9 +130,9 @@ void board_button_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
@ -121,7 +121,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
@ -120,7 +120,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
@ -121,7 +121,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
|
@ -102,9 +102,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
@ -156,7 +156,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -104,9 +104,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
@ -158,7 +158,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -112,9 +112,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
|
||||
if ((getreg16(STR71X_GPIO0_PD) & STR71X_WAKEUPBUTTON_GPIO0) != 0)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button.
|
||||
* 32-bit bit set with each bit associated with a button.
|
||||
* See the BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
@ -97,12 +97,12 @@ void board_button_initialize(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button.
|
||||
* 32-bit bit set with each bit associated with a button.
|
||||
* See the BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return stm32_gpioread(BUTTON_BOOT0n) ? 0 : BUTTON_BOOT0_MASK;
|
||||
}
|
||||
|
@ -149,9 +149,9 @@ void board_button_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
@ -78,13 +78,13 @@ void board_button_initialize(void)
|
||||
*
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON* definitions
|
||||
* above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
# warning Missing logic
|
||||
}
|
||||
|
@ -152,11 +152,44 @@
|
||||
#undef BOARD_ENABLE_USBOTG_HSULPI
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* LEDs
|
||||
*
|
||||
* A single LED is available driven by PA13.
|
||||
*/
|
||||
|
||||
/* LED index values for use with board_userled() */
|
||||
|
||||
#define BOARD_LED1 0
|
||||
#define BOARD_NLEDS 1
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||
|
||||
/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/sam_autoleds.c. The LEDs are used to encode
|
||||
* OS-related events as follows:
|
||||
*
|
||||
* ------------------- ---------------------------- ------
|
||||
* SYMBOL Meaning LED
|
||||
* ------------------- ---------------------------- ------ */
|
||||
|
||||
#define LED_STARTED 0 /* NuttX has been started OFF */
|
||||
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF */
|
||||
#define LED_STACKCREATED 1 /* Idle stack created ON */
|
||||
#define LED_INIRQ 2 /* In an interrupt N/C */
|
||||
#define LED_SIGNAL 2 /* In a signal handler N/C */
|
||||
#define LED_ASSERTION 2 /* An assertion failed N/C */
|
||||
#define LED_PANIC 3 /* The system has crashed FLASH */
|
||||
#undef LED_IDLE /* MCU is is sleep mode Not used */
|
||||
|
||||
/* Thus if LED is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normally. If LED is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
|
||||
#define BOARD_BUTTON1 0
|
||||
|
@ -90,6 +90,7 @@ CONFIG_ARCH="arm"
|
||||
# CONFIG_ARCH_CHIP_LPC2378 is not set
|
||||
# CONFIG_ARCH_CHIP_LPC31XX is not set
|
||||
# CONFIG_ARCH_CHIP_LPC43XX is not set
|
||||
# CONFIG_ARCH_CHIP_MOXART is not set
|
||||
# CONFIG_ARCH_CHIP_NUC1XX is not set
|
||||
# CONFIG_ARCH_CHIP_SAMA5 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD is not set
|
||||
@ -101,7 +102,7 @@ CONFIG_ARCH_CHIP_STM32=y
|
||||
# CONFIG_ARCH_CHIP_STM32L4 is not set
|
||||
# CONFIG_ARCH_CHIP_STR71X is not set
|
||||
# CONFIG_ARCH_CHIP_TMS570 is not set
|
||||
# CONFIG_ARCH_CHIP_MOXART is not set
|
||||
# CONFIG_ARCH_CHIP_XMC4 is not set
|
||||
# CONFIG_ARCH_ARM7TDMI is not set
|
||||
# CONFIG_ARCH_ARM926EJS is not set
|
||||
# CONFIG_ARCH_ARM920T is not set
|
||||
@ -371,9 +372,13 @@ CONFIG_STM32_HAVE_ADC3=y
|
||||
# CONFIG_STM32_HAVE_SDADC3_DMA is not set
|
||||
CONFIG_STM32_HAVE_CAN1=y
|
||||
CONFIG_STM32_HAVE_CAN2=y
|
||||
# CONFIG_STM32_HAVE_COMP1 is not set
|
||||
# CONFIG_STM32_HAVE_COMP2 is not set
|
||||
# CONFIG_STM32_HAVE_COMP3 is not set
|
||||
# CONFIG_STM32_HAVE_COMP4 is not set
|
||||
# CONFIG_STM32_HAVE_COMP5 is not set
|
||||
# CONFIG_STM32_HAVE_COMP6 is not set
|
||||
# CONFIG_STM32_HAVE_COMP7 is not set
|
||||
CONFIG_STM32_HAVE_DAC1=y
|
||||
CONFIG_STM32_HAVE_DAC2=y
|
||||
CONFIG_STM32_HAVE_RNG=y
|
||||
@ -387,7 +392,10 @@ CONFIG_STM32_HAVE_SPI3=y
|
||||
# CONFIG_STM32_HAVE_SPI6 is not set
|
||||
# CONFIG_STM32_HAVE_SAIPLL is not set
|
||||
# CONFIG_STM32_HAVE_I2SPLL is not set
|
||||
# CONFIG_STM32_HAVE_OPAMP is not set
|
||||
# CONFIG_STM32_HAVE_OPAMP1 is not set
|
||||
# CONFIG_STM32_HAVE_OPAMP2 is not set
|
||||
# CONFIG_STM32_HAVE_OPAMP3 is not set
|
||||
# CONFIG_STM32_HAVE_OPAMP4 is not set
|
||||
# CONFIG_STM32_ADC1 is not set
|
||||
# CONFIG_STM32_ADC2 is not set
|
||||
# CONFIG_STM32_ADC3 is not set
|
||||
@ -401,6 +409,7 @@ CONFIG_STM32_HAVE_SPI3=y
|
||||
# CONFIG_STM32_I2C1 is not set
|
||||
# CONFIG_STM32_I2C2 is not set
|
||||
# CONFIG_STM32_I2C3 is not set
|
||||
# CONFIG_STM32_OPAMP is not set
|
||||
# CONFIG_STM32_OTGFS is not set
|
||||
# CONFIG_STM32_OTGHS is not set
|
||||
# CONFIG_STM32_PWR is not set
|
||||
@ -436,6 +445,7 @@ CONFIG_STM32_IWDG=y
|
||||
#
|
||||
# Alternate Pin Mapping
|
||||
#
|
||||
# CONFIG_STM32_FLASH_WORKAROUND_DATA_CACHE_CORRUPTION_ON_RWW is not set
|
||||
# CONFIG_STM32_JTAG_DISABLE is not set
|
||||
# CONFIG_STM32_JTAG_FULL_ENABLE is not set
|
||||
# CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set
|
||||
@ -569,6 +579,11 @@ CONFIG_ARCH_BOARD="photon"
|
||||
#
|
||||
# Common Board Options
|
||||
#
|
||||
CONFIG_ARCH_HAVE_LEDS=y
|
||||
# CONFIG_ARCH_LEDS is not set
|
||||
CONFIG_ARCH_HAVE_BUTTONS=y
|
||||
# CONFIG_ARCH_BUTTONS is not set
|
||||
CONFIG_ARCH_HAVE_IRQBUTTONS=y
|
||||
|
||||
#
|
||||
# Board-Specific Options
|
||||
@ -638,6 +653,8 @@ CONFIG_SCHED_WAITPID=y
|
||||
#
|
||||
# CONFIG_PTHREAD_MUTEX_TYPES is not set
|
||||
CONFIG_PTHREAD_MUTEX_ROBUST=y
|
||||
# CONFIG_PTHREAD_MUTEX_UNSAFE is not set
|
||||
# CONFIG_PTHREAD_MUTEX_BOTH is not set
|
||||
CONFIG_NPTHREAD_KEYS=4
|
||||
# CONFIG_PTHREAD_CLEANUP is not set
|
||||
# CONFIG_CANCELLATION_POINTS is not set
|
||||
@ -755,6 +772,7 @@ CONFIG_WATCHDOG_DEVPATH="/dev/watchdog0"
|
||||
#
|
||||
# LED Support
|
||||
#
|
||||
# CONFIG_USERLED is not set
|
||||
# CONFIG_RGBLED is not set
|
||||
# CONFIG_PCA9635PW is not set
|
||||
# CONFIG_NCP5623C is not set
|
||||
@ -818,6 +836,7 @@ CONFIG_USART1_2STOP=0
|
||||
# CONFIG_PSEUDOTERM is not set
|
||||
# CONFIG_USBDEV is not set
|
||||
# CONFIG_USBHOST is not set
|
||||
# CONFIG_USBMISC is not set
|
||||
# CONFIG_HAVE_USBTRACE is not set
|
||||
# CONFIG_DRIVERS_WIRELESS is not set
|
||||
# CONFIG_DRIVERS_CONTACTLESS is not set
|
||||
@ -1042,10 +1061,6 @@ CONFIG_HAVE_CXXINITIALIZE=y
|
||||
# Application Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# NxWidgets/NxWM
|
||||
#
|
||||
|
||||
#
|
||||
# Built-In Applications
|
||||
#
|
||||
@ -1058,6 +1073,7 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
||||
#
|
||||
# Examples
|
||||
#
|
||||
# CONFIG_EXAMPLES_BUTTONS is not set
|
||||
# CONFIG_EXAMPLES_CCTYPE is not set
|
||||
# CONFIG_EXAMPLES_CHAT is not set
|
||||
# CONFIG_EXAMPLES_CONFIGDATA is not set
|
||||
@ -1072,6 +1088,7 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
||||
# CONFIG_EXAMPLES_IGMP is not set
|
||||
# CONFIG_EXAMPLES_JSON is not set
|
||||
# CONFIG_EXAMPLES_KEYPADTEST is not set
|
||||
# CONFIG_EXAMPLES_LEDS is not set
|
||||
# CONFIG_EXAMPLES_MEDIA is not set
|
||||
# CONFIG_EXAMPLES_MM is not set
|
||||
# CONFIG_EXAMPLES_MODBUS is not set
|
||||
@ -1106,9 +1123,9 @@ CONFIG_EXAMPLES_NSH=y
|
||||
# CONFIG_EXAMPLES_TIFF is not set
|
||||
# CONFIG_EXAMPLES_TOUCHSCREEN is not set
|
||||
# CONFIG_EXAMPLES_USBSERIAL is not set
|
||||
# CONFIG_EXAMPLES_USBTERM is not set
|
||||
# CONFIG_EXAMPLES_WATCHDOG is not set
|
||||
# CONFIG_EXAMPLES_WEBSERVER is not set
|
||||
# CONFIG_EXAMPLES_XBC_TEST is not set
|
||||
|
||||
#
|
||||
# File System Utilities
|
||||
@ -1249,6 +1266,10 @@ CONFIG_NSH_ARCHINIT=y
|
||||
# CONFIG_NSH_LOGIN is not set
|
||||
# CONFIG_NSH_CONSOLE_LOGIN is not set
|
||||
|
||||
#
|
||||
# NxWidgets/NxWM
|
||||
#
|
||||
|
||||
#
|
||||
# Platform-specific Support
|
||||
#
|
||||
|
@ -35,18 +35,24 @@
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = stm32_boot.c
|
||||
CSRCS = stm32_boot.c stm32_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_PHOTON_DFU_BOOTLOADER),y)
|
||||
CSRCS += dfu_signature.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += stm32_appinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BUTTONS),y)
|
||||
CSRCS += stm32_buttons.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USERLED),y)
|
||||
CSRCS += stm32_leds.c
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += stm32_autoleds.c
|
||||
else
|
||||
CSRCS += stm32_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PHOTON_WDG),y)
|
||||
@ -61,8 +67,4 @@ 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
|
||||
|
@ -89,6 +89,21 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Called either by board_intialize() if CONFIG_BOARD_INITIALIZE or by
|
||||
* board_app_initialize if CONFIG_LIB_BOARDCTL is selected. This function
|
||||
* initializes and configures all on-board features appropriate for the
|
||||
* selected configuration.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_INITIALIZE)
|
||||
int stm32_bringup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: photon_watchdog_initialize()
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
* config/photon/src/stm32_appinit.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||
* 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
|
||||
@ -38,23 +38,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include <syslog.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <nuttx/board.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
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -87,65 +78,13 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
int ret = OK;
|
||||
#ifndef CONFIG_BOARD_INITIALIZE
|
||||
/* Perform board initialization */
|
||||
|
||||
#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;
|
||||
}
|
||||
return stm32_bringup();
|
||||
#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);
|
||||
return OK;
|
||||
#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;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
|
116
configs/photon/src/stm32_autoleds.c
Normal file
116
configs/photon/src/stm32_autoleds.c
Normal file
@ -0,0 +1,116 @@
|
||||
/****************************************************************************
|
||||
* configs/photon/src/stm32_autoleds.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* LEDs
|
||||
*
|
||||
* A single LED is available driven by PA13.
|
||||
*
|
||||
* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/sam_autoleds.c. The LEDs are used to encode
|
||||
* OS-related events as follows:
|
||||
*
|
||||
* ------------------- ----------------------- ------
|
||||
* SYMBOL Meaning LED
|
||||
* ------------------- ----------------------- ------
|
||||
* LED_STARTED NuttX has been started OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF
|
||||
* LED_IRQSENABLED Interrupts enabled OFF
|
||||
* LED_STACKCREATED Idle stack created ON
|
||||
* LED_INIRQ In an interrupt N/C
|
||||
* LED_SIGNAL In a signal handler N/C
|
||||
* LED_ASSERTION An assertion failed N/C
|
||||
* LED_PANIC The system has crashed FLASH
|
||||
*
|
||||
* Thus is LED is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normally. If LED is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
#include "photon.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
/* Configure Photon LED gpio as output */
|
||||
|
||||
stm32_configgpio(GPIO_LED1);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if (led == 1 || led == 3)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED1, true);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if (led == 3)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED1, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
@ -73,4 +73,32 @@ void stm32_boardinitialize(void)
|
||||
stm32_usbinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
board_autoled_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_INITIALIZE is selected, then an additional
|
||||
* initialization call will be performed in the boot-up sequence to a
|
||||
* function called board_initialize(). board_initialize() will be
|
||||
* called immediately after up_intitialize() is called and just before the
|
||||
* initial application is started. This additional initialization phase
|
||||
* may be used, for example, to initialize board-specific device drivers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_INITIALIZE
|
||||
void board_initialize(void)
|
||||
{
|
||||
/* Perform board initialization */
|
||||
|
||||
(void)stm32_bringup();
|
||||
}
|
||||
#endif /* CONFIG_BOARD_INITIALIZE */
|
||||
|
147
configs/photon/src/stm32_bringup.c
Normal file
147
configs/photon/src/stm32_bringup.c
Normal file
@ -0,0 +1,147 @@
|
||||
/****************************************************************************
|
||||
* config/photon/src/stm32_bringup.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/mount.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/input/buttons.h>
|
||||
#include <nuttx/leds/userled.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "photon.h"
|
||||
#include "stm32_wdg.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Called either by board_intialize() if CONFIG_BOARD_INITIALIZE or by
|
||||
* board_app_initialize if CONFIG_LIB_BOARDCTL is selected. This function
|
||||
* initializes and configures all on-board features appropriate for the
|
||||
* selected configuration.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USERLED) && !defined(CONFIG_ARCH_LEDS)
|
||||
#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
|
||||
/* Enable USER LED support for some other purpose */
|
||||
|
||||
board_userled_initialize();
|
||||
#endif /* CONFIG_USERLED_LOWER */
|
||||
#endif /* CONFIG_USERLED && !CONFIG_ARCH_LEDS */
|
||||
|
||||
#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
|
||||
/* Enable BUTTON support for some other purpose */
|
||||
|
||||
board_button_initialize();
|
||||
#endif /* CONFIG_BUTTONS_LOWER */
|
||||
#endif /* CONFIG_BUTTONS */
|
||||
|
||||
#ifdef CONFIG_STM32_IWDG
|
||||
/* Initialize the watchdog timer */
|
||||
|
||||
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;
|
||||
}
|
@ -66,7 +66,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
/* Check the state of the only button */
|
||||
|
||||
|
@ -43,18 +43,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <nuttx/usb/usbdev.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* configs/photon/src/stm32_leds.c
|
||||
* configs/photon/src/stm32_userleds.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||
@ -45,6 +45,8 @@
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -80,3 +82,5 @@ void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED1, !!(ledset & BOARD_LED1_BIT));
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
@ -53,11 +53,6 @@
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* Configuration *******************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
@ -38,16 +38,19 @@
|
||||
****************************************************************************/
|
||||
|
||||
#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 <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_sdio.h"
|
||||
|
||||
#include "photon.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -105,25 +108,29 @@ int photon_wlan_initialize()
|
||||
struct sdio_dev_s *sdio_dev;
|
||||
|
||||
/* Initialize sdio interface */
|
||||
_info("Initializing SDIO slot %d\n", SDIO_WLAN0_SLOTNO);
|
||||
|
||||
wlinfo("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",
|
||||
wlerr("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");
|
||||
wlerr("ERROR: Failed to bind SDIO to bcmf driver\n");
|
||||
|
||||
/* FIXME deinitialize sdio device */
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -105,9 +105,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -140,7 +140,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
|
@ -127,15 +127,15 @@ void board_button_initialize(void)
|
||||
*
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to collect
|
||||
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
|
||||
* the state of all buttons. board_buttons() returns an 32-bit bit set with each bit
|
||||
* associated with a button. See the BUTTON* definitions above for the meaning of
|
||||
* each bit in the returned value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t retval;
|
||||
uint32_t retval;
|
||||
|
||||
retval = sam_gpioread(GPIO_BUTTON1) ? 0 : BUTTON1;
|
||||
retval |= sam_gpioread(GPIO_BUTTON2) ? 0 : BUTTON2;
|
||||
|
@ -130,14 +130,14 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t retval;
|
||||
uint32_t retval;
|
||||
|
||||
retval = sam_gpioread(GPIO_SCROLLUP) ? 0 : BUTTON_SCROLLUP;
|
||||
retval |= sam_gpioread(GPIO_SCROLLDWN) ? 0 : BUTTON_SCROLLDOWN;
|
||||
|
@ -53,10 +53,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -83,12 +79,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
|
||||
}
|
||||
|
@ -81,12 +81,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
|
||||
}
|
||||
|
@ -80,12 +80,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_gpioread(GPIO_BP2) ? 0 : BUTTON_BP2_BIT;
|
||||
}
|
||||
|
@ -91,12 +91,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_pioread(PIO_BTN_USER) ? 0 : BUTTON_USER_BIT;
|
||||
}
|
||||
|
@ -95,12 +95,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_pioread(PIO_USER) ? 0 : BUTTON_USER_BIT;
|
||||
}
|
||||
|
@ -95,12 +95,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_pioread(PIO_USER1) ? 0 : BUTTON_USER1_BIT;
|
||||
}
|
||||
|
@ -91,12 +91,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_pioread(PIO_BTN_USER) ? 0 : BUTTON_USER_BIT;
|
||||
}
|
||||
|
@ -79,13 +79,13 @@ void board_button_initialize(void)
|
||||
*
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to collect
|
||||
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
|
||||
* the state of all buttons. board_buttons() returns an 32-bit bit set with each bit
|
||||
* associated with a button. See the BUTTON* definitions above for the meaning of
|
||||
* each bit in the returned value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT;
|
||||
}
|
||||
|
@ -79,13 +79,13 @@ void board_button_initialize(void)
|
||||
*
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to collect
|
||||
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
|
||||
* the state of all buttons. board_buttons() returns an 32-bit bit set with each bit
|
||||
* associated with a button. See the BUTTON* definitions above for the meaning of
|
||||
* each bit in the returned value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* configs/same70-xplained/include/sam_autoleds.c
|
||||
* configs/same70-xplained/src/sam_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
@ -142,12 +142,12 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
|
||||
}
|
||||
|
@ -79,13 +79,13 @@ void board_button_initialize(void)
|
||||
*
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to collect
|
||||
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
|
||||
* the state of all buttons. board_buttons() returns an 32-bit bit set with each bit
|
||||
* associated with a button. See the BUTTON* definitions above for the meaning of
|
||||
* each bit in the returned value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT;
|
||||
}
|
||||
|
@ -158,14 +158,14 @@ void board_button_initialize(void)
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON*
|
||||
* definitions above for the meaning of each bit in the returned value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t retval;
|
||||
uint32_t retval;
|
||||
|
||||
retval = sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
|
||||
retval |= sam_gpioread(GPIO_SW1) ? 0 : BUTTON_SW1_BIT;
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -136,7 +136,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -539,7 +539,7 @@ CONFIG_NET_6LOWPAN_MAXADDRCONTEXT=1
|
||||
CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_0=0xaa
|
||||
CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_1=0xaa
|
||||
# CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_1 is not set
|
||||
CONFIG_NET_6LOWPAN_RIMEADDR_SIZE=2
|
||||
# CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED is not set
|
||||
CONFIG_NET_6LOWPAN_MAXAGE=20
|
||||
CONFIG_NET_6LOWPAN_MAX_MACTRANSMITS=4
|
||||
CONFIG_NET_6LOWPAN_MAXPAYLOAD=102
|
||||
|
@ -89,9 +89,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t swset = 0;
|
||||
uint32_t swset = 0;
|
||||
uint8_t regval = getreg8(M16C_P8);
|
||||
|
||||
if (SW_PRESSED(regval, SW1_BIT))
|
||||
|
@ -80,7 +80,7 @@ void board_button_initialize(void)
|
||||
* N.B The return state in true logic, the button polarity is dealt here in
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return stm32_gpioread(GPIO_BTN)==0 ? BUTTON_USER_BIT : 0;
|
||||
}
|
||||
@ -95,7 +95,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -108,9 +108,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -148,7 +148,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -136,7 +136,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -104,9 +104,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -144,7 +144,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -92,9 +92,9 @@ void board_button_initialize(void)
|
||||
* Reads keys
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t rv = 0;
|
||||
uint32_t rv = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i != NUM_BUTTONS; ++i)
|
||||
|
@ -104,9 +104,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -140,7 +140,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns
|
||||
* an 8-bit bit set with each bit associated with a button. See the
|
||||
* an 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -131,7 +131,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -5,4 +5,14 @@
|
||||
|
||||
if ARCH_BOARD_STM32F411E_DISCO
|
||||
|
||||
config STM32F411DISCO_USBHOST_STACKSIZE
|
||||
int "USB host waiter stack size"
|
||||
default 1024
|
||||
depends on USBHOST
|
||||
|
||||
config STM32F411DISCO_USBHOST_PRIO
|
||||
int "USB host waiter task priority"
|
||||
default 100
|
||||
depends on USBHOST
|
||||
|
||||
endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# configs/stm32f411e-disco/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -36,10 +36,14 @@
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = stm32_boot.c
|
||||
CSRCS = stm32_boot.c stm32_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_NSH_LIBRARY),y)
|
||||
CSRCS += stm32_appinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_OTGFS),y)
|
||||
CSRCS += stm32_usb.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/configs/Board.mk
|
||||
|
@ -84,11 +84,11 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
#ifndef CONFIG_BOARD_INITIALIZE
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return stm32_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
@ -72,18 +72,18 @@ void stm32_boardinitialize(void)
|
||||
board_autoled_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
|
||||
/* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the weak function
|
||||
* stm32_spidev_initialize() has been brought into the link.
|
||||
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || \
|
||||
defined(CONFIG_STM32_SPI3)
|
||||
/* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the
|
||||
* weak function stm32_spidev_initialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
stm32_spidev_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
|
||||
/* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
|
||||
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||
* into the build.
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
/* Initialize USB if the OTG FS controller is in the configuration.
|
||||
* Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also selected.
|
||||
*/
|
||||
|
||||
stm32_usbinitialize();
|
||||
@ -106,14 +106,8 @@ void stm32_boardinitialize(void)
|
||||
#ifdef CONFIG_BOARD_INITIALIZE
|
||||
void board_initialize(void)
|
||||
{
|
||||
#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_LIB_BOARDCTL)
|
||||
/* Perform NSH initialization here instead of from the NSH. This
|
||||
* alternative NSH initialization is necessary when NSH is ran in user-space
|
||||
* but the initialization function must run in kernel space.
|
||||
*/
|
||||
|
||||
board_app_initialize(0);
|
||||
#endif
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
(void)stm32_bringup();
|
||||
}
|
||||
#endif
|
||||
|
100
configs/stm32f411e-disco/src/stm32_bringup.c
Normal file
100
configs/stm32f411e-disco/src/stm32_bringup.c
Normal file
@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
* config/stm32f411e-disco/src/stm32_bringup.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "stm32.h"
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
# include "stm32_usbhost.h"
|
||||
#endif
|
||||
|
||||
#include "stm32f411e-disco.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_INITIALIZE=y :
|
||||
* Called from board_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
|
||||
/* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
|
||||
* will monitor for USB connection and disconnection events.
|
||||
*/
|
||||
|
||||
ret = stm32_usbhost_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to initialize USB host: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: Failed to mount procfs at %s: %d\n",
|
||||
STM32_PROCFS_MOUNTPOINT, ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
349
configs/stm32f411e-disco/src/stm32_usb.c
Normal file
349
configs/stm32f411e-disco/src/stm32_usb.c
Normal file
@ -0,0 +1,349 @@
|
||||
/************************************************************************************
|
||||
* configs/stm32f411e-disco/src/stm32_usb.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Copyright (C) 2017 Brian Webb. All rights reserved.
|
||||
* Author: Brian Webb <webbbn@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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/usb/usbdev.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "stm32.h"
|
||||
#include "stm32_otgfs.h"
|
||||
#include "stm32f411e-disco.h"
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_USBDEV) && !defined(CONFIG_USBHOST)
|
||||
# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32F411DISCO_USBHOST_PRIO
|
||||
# define CONFIG_STM32F411DISCO_USBHOST_PRIO 100
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32F411DISCO_USBHOST_STACKSIZE
|
||||
# define CONFIG_STM32F411DISCO_USBHOST_STACKSIZE 1024
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: usbhost_waiter
|
||||
*
|
||||
* Description:
|
||||
* Wait for USB devices to be connected.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
static int usbhost_waiter(int argc, char *argv[])
|
||||
{
|
||||
struct usbhost_hubport_s *hport;
|
||||
|
||||
uinfo("Running\n");
|
||||
for (;;)
|
||||
{
|
||||
/* Wait for the device to change state */
|
||||
|
||||
DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
|
||||
uinfo("%s\n", hport->connected ? "connected" : "disconnected");
|
||||
|
||||
/* Did we just become connected? */
|
||||
|
||||
if (hport->connected)
|
||||
{
|
||||
/* Yes.. enumerate the newly connected device */
|
||||
|
||||
(void)CONN_ENUMERATE(g_usbconn, hport);
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep the compiler from complaining */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
||||
* GPIO pins for the STM32F411 Discovery board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void stm32_usbinitialize(void)
|
||||
{
|
||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
||||
|
||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||
stm32_configgpio(GPIO_OTGFS_PWRON);
|
||||
stm32_configgpio(GPIO_OTGFS_OVER);
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
* Name: stm32_usbhost_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the USB host functionality.
|
||||
* This function will start a thread that will monitor for device
|
||||
* connection/disconnection events.
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
int stm32_usbhost_initialize(void)
|
||||
{
|
||||
int pid;
|
||||
#if defined(CONFIG_USBHOST_HUB) || defined(CONFIG_USBHOST_MSC) || \
|
||||
defined(CONFIG_USBHOST_HIDKBD) || defined(CONFIG_USBHOST_HIDMOUSE) || \
|
||||
defined(CONFIG_USBHOST_XBOXCONTROLLER)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* First, register all of the class drivers needed to support the drivers
|
||||
* that we care about:
|
||||
*/
|
||||
|
||||
uinfo("Register class drivers\n");
|
||||
|
||||
#ifdef CONFIG_USBHOST_HUB
|
||||
/* Initialize USB hub class support */
|
||||
|
||||
ret = usbhost_hub_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
uerr("ERROR: usbhost_hub_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_MSC
|
||||
/* Register the USB mass storage class class */
|
||||
|
||||
ret = usbhost_msc_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the mass storage class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_CDCACM
|
||||
/* Register the CDC/ACM serial class */
|
||||
|
||||
ret = usbhost_cdcacm_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_HIDKBD
|
||||
/* Initialize the HID keyboard class */
|
||||
|
||||
ret = usbhost_kbdinit();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the HID keyboard class\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_HIDMOUSE
|
||||
/* Initialize the HID mouse class */
|
||||
|
||||
ret = usbhost_mouse_init();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the HID mouse class\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_XBOXCONTROLLER
|
||||
/* Initialize the HID mouse class */
|
||||
|
||||
ret = usbhost_xboxcontroller_init();
|
||||
if (ret != OK)
|
||||
{
|
||||
uerr("ERROR: Failed to register the XBox Controller class\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
uinfo("Initialize USB host\n");
|
||||
g_usbconn = stm32_otgfshost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
uinfo("Start usbhost_waiter\n");
|
||||
|
||||
pid = task_create("usbhost", CONFIG_STM32F411DISCO_USBHOST_PRIO,
|
||||
CONFIG_STM32F411DISCO_USBHOST_STACKSIZE,
|
||||
(main_t)usbhost_waiter, (FAR char * const *)NULL);
|
||||
return pid < 0 ? -ENOEXEC : OK;
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***********************************************************************************
|
||||
* Name: stm32_usbhost_vbusdrive
|
||||
*
|
||||
* Description:
|
||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
||||
* each platform that implements the STM32 OTG FS host interface
|
||||
*
|
||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
||||
* or, if 5 V are available on the application board, a basic power switch, must
|
||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
||||
*
|
||||
* "The application uses this field to control power to this port, and the core
|
||||
* clears this bit on an overcurrent condition."
|
||||
*
|
||||
* Input Parameters:
|
||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
||||
* enable - true: enable VBUS power; false: disable VBUS power
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||
{
|
||||
DEBUGASSERT(iface == 0);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
/* Enable the Power Switch by driving the enable pin low */
|
||||
|
||||
stm32_gpiowrite(GPIO_OTGFS_PWRON, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the Power Switch by driving the enable pin high */
|
||||
|
||||
stm32_gpiowrite(GPIO_OTGFS_PWRON, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_setup_overcurrent
|
||||
*
|
||||
* Description:
|
||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
||||
* detected.
|
||||
*
|
||||
* Input Parameter:
|
||||
* handler - New overcurrent interrupt handler
|
||||
* arg - The argument provided for the interrupt handler
|
||||
*
|
||||
* Returned value:
|
||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
||||
* to indicate the nature of the failure.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
||||
{
|
||||
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* 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
|
||||
|
||||
#endif /* CONFIG_STM32_OTGFS */
|
@ -1,4 +1,4 @@
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* configs/stm32f411e-disco/src/stm32f411e-disco.h
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
@ -32,28 +32,28 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CONFIGS_STM32F411E_DISCO_SRC_STM32F411E_DISCO_H
|
||||
#define __CONFIGS_STM32F411E_DISCO_SRC_STM32F411E_DISCO_H
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* Configuration ********************************************************************/
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* LED. User LD2: the green LED is a user LED connected to Arduino signal D13
|
||||
* corresponding to MCU I/O PA5 (pin 21) or PB13 (pin 34) depending on the STM32
|
||||
* target.
|
||||
/* LED. User LD2: the green LED is a user LED connected to Arduino signal
|
||||
* D13 corresponding to MCU I/O PA5 (pin 21) or PB13 (pin 34) depending on
|
||||
* the STM32 target.
|
||||
*
|
||||
* - When the I/O is HIGH value, the LED is on.
|
||||
* - When the I/O is LOW, the LED is off.
|
||||
@ -85,9 +85,41 @@
|
||||
#define GPIO_SPI1_SCK_OFF (GPIO_INPUT | GPIO_PULLDOWN | \
|
||||
GPIO_PORTA | GPIO_PIN5)
|
||||
|
||||
/************************************************************************************
|
||||
/* USB OTG FS
|
||||
*
|
||||
* PA9 OTG_FS_VBUS VBUS sensing (also connected to the green LED)
|
||||
* PC0 OTG_FS_PowerSwitchOn
|
||||
* PD5 OTG_FS_Overcurrent
|
||||
*/
|
||||
|
||||
#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|\
|
||||
GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
|
||||
#define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|\
|
||||
GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN0)
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT|\
|
||||
GPIO_SPEED_100MHz|GPIO_PUSHPULL|\
|
||||
GPIO_PORTD|GPIO_PIN5)
|
||||
|
||||
#else
|
||||
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|\
|
||||
GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5)
|
||||
#endif
|
||||
|
||||
/* procfs File System */
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
# ifdef CONFIG_NSH_PROC_MOUNTPOINT
|
||||
# define STM32_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
|
||||
# else
|
||||
# define STM32_PROCFS_MOUNTPOINT "/proc"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/* Global driver instances */
|
||||
|
||||
@ -98,28 +130,61 @@ extern struct spi_dev_s *g_spi1;
|
||||
extern struct spi_dev_s *g_spi2;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: stm32_spidev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void stm32_spidev_initialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: stm32_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to setup USB-related GPIO pins.
|
||||
* Called from stm32_boardinitialize very early in initialization to setup
|
||||
* USB-related GPIO pins for the STM32F4Discovery board.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
void stm32_usbinitialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_usbhost_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the USB host
|
||||
* functionality. This function will start a thread that will monitor for
|
||||
* device connection/disconnection events.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
|
||||
int stm32_usbhost_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_INITIALIZE=y :
|
||||
* Called from board_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void);
|
||||
|
||||
#endif /* __CONFIGS_STM32F411E_DISCO_SRC_STM32F411E_DISCO_H */
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -131,7 +131,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -96,9 +96,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -131,7 +131,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -77,7 +77,7 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return stm32_gpioread(GPIO_BTN_USER) ? 1 : 0;
|
||||
}
|
||||
@ -92,7 +92,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
@ -113,12 +113,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
|
||||
(void)ret;
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
/* mount the proc filesystem */
|
||||
|
||||
|
@ -103,9 +103,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -138,7 +138,7 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 8-bit bit set with each bit associated with a button. See the
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
|
@ -140,12 +140,6 @@ FAR struct mtd_dev_s *mtd_temp;
|
||||
int ret;
|
||||
|
||||
(void)ret;
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
/* mount the proc filesystem */
|
||||
@ -208,7 +202,7 @@ FAR struct mtd_dev_s *mtd_temp;
|
||||
return ret;
|
||||
}
|
||||
g_mtd_fs = mtd_temp;
|
||||
|
||||
|
||||
#ifdef CONFIG_MTD_PARTITION
|
||||
{
|
||||
FAR struct mtd_geometry_s geo;
|
||||
@ -342,7 +336,7 @@ int board_ioctl(unsigned int cmd, uintptr_t arg)
|
||||
* 6 = CONFIG_N25QXXX_DUMMIES;
|
||||
* 0xeb = N25QXXX_FAST_READ_QUADIO;
|
||||
*/
|
||||
|
||||
|
||||
meminfo.flags = QSPIMEM_READ | QSPIMEM_QUADIO;
|
||||
meminfo.addrlen = 3;
|
||||
meminfo.dummies = 6; //CONFIG_N25QXXX_DUMMIES;
|
||||
@ -350,17 +344,17 @@ int board_ioctl(unsigned int cmd, uintptr_t arg)
|
||||
meminfo.addr = 0;
|
||||
meminfo.buflen = 0;
|
||||
meminfo.buffer = NULL;
|
||||
|
||||
|
||||
stm32l4_qspi_enter_memorymapped(g_qspi, &meminfo, 80000000);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BIOC_EXIT_MEMMAP:
|
||||
stm32l4_qspi_exit_memorymapped(g_qspi);
|
||||
break;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
break;
|
||||
|
@ -261,9 +261,9 @@ void board_button_initialize(void)
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
@ -306,7 +306,7 @@ uint8_t board_buttons(void)
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user