summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-03-31 16:59:22 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-03-31 16:59:22 -0600
commit62e6ca593af8f98726c9760ad7dd4c65d90edff9 (patch)
treefb60e22e61d85691120bbf5386ec1fc3ad9bd23a
parent920edab8e265baef8bcaa3128822f7cc41dd1ad3 (diff)
downloadpx4-nuttx-62e6ca593af8f98726c9760ad7dd4c65d90edff9.tar.gz
px4-nuttx-62e6ca593af8f98726c9760ad7dd4c65d90edff9.tar.bz2
px4-nuttx-62e6ca593af8f98726c9760ad7dd4c65d90edff9.zip
Rename pwm_devinit() to board_pwm_setup(). Add CONFIG_BOARDCTL_PWMTEST that will enable calling board_pwm_setup() from boardctl(). Replace calls to pwm_devinit() in apps/examples/pwm with calls to boardctl(). In all configurations that enable the apps/examples/pwm test, make sure that boardctl() suppoprt is properly enabled.
-rw-r--r--apps/examples/pwm/Kconfig3
-rw-r--r--apps/examples/pwm/pwm.h11
-rw-r--r--apps/examples/pwm/pwm_main.c7
-rw-r--r--nuttx/configs/freedom-kl25z/nsh/defconfig2
-rw-r--r--nuttx/configs/freedom-kl25z/src/kl_pwm.c10
-rw-r--r--nuttx/configs/freedom-kl26z/nsh/defconfig2
-rw-r--r--nuttx/configs/freedom-kl26z/src/kl_pwm.c8
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/lpc17_pwm.c10
-rw-r--r--nuttx/configs/mbed/src/lpc17_pwm.c10
-rw-r--r--nuttx/configs/mikroe-stm32f4/src/stm32_pwm.c8
-rw-r--r--nuttx/configs/sama5d3-xplained/src/sam_pwm.c8
-rw-r--r--nuttx/configs/sama5d3x-ek/src/sam_pwm.c8
-rw-r--r--nuttx/configs/sama5d4-ek/src/sam_pwm.c8
-rw-r--r--nuttx/configs/stm3220g-eval/src/stm32_pwm.c8
-rw-r--r--nuttx/configs/stm3240g-eval/src/stm32_pwm.c8
-rw-r--r--nuttx/configs/stm32_tiny/src/stm32_pwm.c8
-rw-r--r--nuttx/configs/stm32f3discovery/src/stm32_pwm.c8
-rw-r--r--nuttx/configs/stm32f4discovery/src/stm32_pm.c3
-rw-r--r--nuttx/configs/stm32f4discovery/src/stm32_pwm.c4
-rw-r--r--nuttx/configs/stm32ldiscovery/src/stm32_pwm.c8
-rw-r--r--nuttx/include/nuttx/board.h23
-rw-r--r--nuttx/include/sys/boardctl.h11
22 files changed, 114 insertions, 62 deletions
diff --git a/apps/examples/pwm/Kconfig b/apps/examples/pwm/Kconfig
index 94dc6fb7a..50672bb8f 100644
--- a/apps/examples/pwm/Kconfig
+++ b/apps/examples/pwm/Kconfig
@@ -6,7 +6,8 @@
config EXAMPLES_PWM
bool "Pulse width modulation (PWM) example"
default n
- depends on PWM && NSH_BUILTIN_APPS
+ depends on PWM && NSH_BUILTIN_APPS && LIB_BOARDCTL
+ select BOARDCTL_PWMTEST
---help---
Enable the Pulse width modulation (PWM) example
diff --git a/apps/examples/pwm/pwm.h b/apps/examples/pwm/pwm.h
index c1c6820e8..e6703991a 100644
--- a/apps/examples/pwm/pwm.h
+++ b/apps/examples/pwm/pwm.h
@@ -100,15 +100,4 @@
* Public Function Prototypes
****************************************************************************/
-/****************************************************************************
- * Name: pwm_devinit()
- *
- * Description:
- * Perform architecuture-specific initialization of the PWM hardware. This
- * interface must be provided by all configurations using apps/examples/pwm
- *
- ****************************************************************************/
-
-int pwm_devinit(void);
-
#endif /* __APPS_EXAMPLES_PWM_PWM_H */
diff --git a/apps/examples/pwm/pwm_main.c b/apps/examples/pwm/pwm_main.c
index ba5687541..844551550 100644
--- a/apps/examples/pwm/pwm_main.c
+++ b/apps/examples/pwm/pwm_main.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/pwm/pwm_main.c
*
- * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/boardctl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -313,10 +314,10 @@ int pwm_main(int argc, char *argv[])
* this test.
*/
- ret = pwm_devinit();
+ ret = boardctl(BOARDIOC_PWMTEST_SETUP, 0);
if (ret != OK)
{
- printf("pwm_main: pwm_devinit failed: %d\n", ret);
+ printf("pwm_main: boardctl failed: %d\n", ret);
goto errout;
}
diff --git a/nuttx/configs/freedom-kl25z/nsh/defconfig b/nuttx/configs/freedom-kl25z/nsh/defconfig
index 8b5048221..271d84d36 100644
--- a/nuttx/configs/freedom-kl25z/nsh/defconfig
+++ b/nuttx/configs/freedom-kl25z/nsh/defconfig
@@ -576,6 +576,8 @@ CONFIG_EXAMPLES_PWM_DEVPATH="/dev/pwm0"
CONFIG_EXAMPLES_PWM_FREQUENCY=100
CONFIG_EXAMPLES_PWM_DUTYPCT=50
CONFIG_EXAMPLES_PWM_DURATION=5
+CONFIG_LIB_BOARDCTL=y
+CONFIG_BOARDCTL_PWMTEST=y
# CONFIG_EXAMPLES_POSIXSPAWN is not set
# CONFIG_EXAMPLES_QENCODER is not set
# CONFIG_EXAMPLES_RGMP is not set
diff --git a/nuttx/configs/freedom-kl25z/src/kl_pwm.c b/nuttx/configs/freedom-kl25z/src/kl_pwm.c
index 1fbb07c32..b0c9aac5d 100644
--- a/nuttx/configs/freedom-kl25z/src/kl_pwm.c
+++ b/nuttx/configs/freedom-kl25z/src/kl_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/freedom-kl25z/src/kl_pwm.c
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Alan Carvalho de Assis <acassis@gmail.com>
*
@@ -40,11 +40,13 @@
#include <nuttx/config.h>
+#include <sys/types.h>
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
-#include <sys/types.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -73,7 +75,7 @@ extern struct pwm_lowerhalf_s *kl_pwminitialize(int timer);
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All Kinetis KL architectures must provide the following interface to work with
@@ -81,7 +83,7 @@ extern struct pwm_lowerhalf_s *kl_pwminitialize(int timer);
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/freedom-kl26z/nsh/defconfig b/nuttx/configs/freedom-kl26z/nsh/defconfig
index 996171f1b..ee8e133f9 100644
--- a/nuttx/configs/freedom-kl26z/nsh/defconfig
+++ b/nuttx/configs/freedom-kl26z/nsh/defconfig
@@ -583,6 +583,8 @@ CONFIG_EXAMPLES_PWM_DEVPATH="/dev/pwm0"
CONFIG_EXAMPLES_PWM_FREQUENCY=100
CONFIG_EXAMPLES_PWM_DUTYPCT=50
CONFIG_EXAMPLES_PWM_DURATION=5
+CONFIG_LIB_BOARDCTL=y
+CONFIG_BOARDCTL_PWMTEST=y
# CONFIG_EXAMPLES_POSIXSPAWN is not set
# CONFIG_EXAMPLES_QENCODER is not set
# CONFIG_EXAMPLES_RGMP is not set
diff --git a/nuttx/configs/freedom-kl26z/src/kl_pwm.c b/nuttx/configs/freedom-kl26z/src/kl_pwm.c
index a0e4472bb..4faf9cabe 100644
--- a/nuttx/configs/freedom-kl26z/src/kl_pwm.c
+++ b/nuttx/configs/freedom-kl26z/src/kl_pwm.c
@@ -40,11 +40,13 @@
#include <nuttx/config.h>
+#include <sys/types.h>
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
-#include <sys/types.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -73,7 +75,7 @@ extern struct pwm_lowerhalf_s *kl_pwminitialize(int timer);
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All Kinetis KL architectures must provide the following interface to work with
@@ -81,7 +83,7 @@ extern struct pwm_lowerhalf_s *kl_pwminitialize(int timer);
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_pwm.c b/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_pwm.c
index f7235f69b..a2cf647bc 100644
--- a/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_pwm.c
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/lpcexpresso-lpc1768/lpc17_pwm.c
*
- * Copyright (C) 2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -38,12 +38,14 @@
************************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+#include <sys/types.h>
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -71,7 +73,7 @@ FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer);
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All LPC17 architectures must provide the following interface to work with
@@ -79,7 +81,7 @@ FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer);
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/mbed/src/lpc17_pwm.c b/nuttx/configs/mbed/src/lpc17_pwm.c
index f994d9330..488bfe105 100644
--- a/nuttx/configs/mbed/src/lpc17_pwm.c
+++ b/nuttx/configs/mbed/src/lpc17_pwm.c
@@ -3,7 +3,7 @@
*
* Based on onfigs/lpcexpresso-lpc1768/lpc17_pwm.c
*
- * Copyright (C) 2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -40,12 +40,14 @@
************************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+#include <sys/types.h>
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -73,7 +75,7 @@ FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer);
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All LPC17 architectures must provide the following interface to work with
@@ -81,7 +83,7 @@ FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer);
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/mikroe-stm32f4/src/stm32_pwm.c b/nuttx/configs/mikroe-stm32f4/src/stm32_pwm.c
index 0a6c5b4ec..c0c847367 100644
--- a/nuttx/configs/mikroe-stm32f4/src/stm32_pwm.c
+++ b/nuttx/configs/mikroe-stm32f4/src/stm32_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/mikroe_stm32f4/src/stm32_pwm.c
*
- * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -94,7 +96,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -102,7 +104,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/sama5d3-xplained/src/sam_pwm.c b/nuttx/configs/sama5d3-xplained/src/sam_pwm.c
index 5992bd0d5..f02137157 100644
--- a/nuttx/configs/sama5d3-xplained/src/sam_pwm.c
+++ b/nuttx/configs/sama5d3-xplained/src/sam_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/sama5d3-xplained/src/sam_pwm.c
*
- * Copyright (C) 2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "sam_pwm.h"
@@ -114,7 +116,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All SAMA5 architectures must provide the following interface to work with
@@ -122,7 +124,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/sama5d3x-ek/src/sam_pwm.c b/nuttx/configs/sama5d3x-ek/src/sam_pwm.c
index 97729cd02..08fc22e1c 100644
--- a/nuttx/configs/sama5d3x-ek/src/sam_pwm.c
+++ b/nuttx/configs/sama5d3x-ek/src/sam_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/sama5d3x-ek/src/sam_pwm.c
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "sam_pwm.h"
@@ -114,7 +116,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All SAMA5 architectures must provide the following interface to work with
@@ -122,7 +124,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/sama5d4-ek/src/sam_pwm.c b/nuttx/configs/sama5d4-ek/src/sam_pwm.c
index f6a5cb407..e15e70c5a 100644
--- a/nuttx/configs/sama5d4-ek/src/sam_pwm.c
+++ b/nuttx/configs/sama5d4-ek/src/sam_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/sama5d4-ek/src/sam_pwm.c
*
- * Copyright (C) 2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "sam_pwm.h"
@@ -114,7 +116,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All SAMA5 architectures must provide the following interface to work with
@@ -122,7 +124,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/stm3220g-eval/src/stm32_pwm.c b/nuttx/configs/stm3220g-eval/src/stm32_pwm.c
index adbce846d..a519ac9e9 100644
--- a/nuttx/configs/stm3220g-eval/src/stm32_pwm.c
+++ b/nuttx/configs/stm3220g-eval/src/stm32_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/stm3220g-eval/src/stm32_pwm.c
*
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -72,7 +74,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -80,7 +82,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/stm3240g-eval/src/stm32_pwm.c b/nuttx/configs/stm3240g-eval/src/stm32_pwm.c
index 77696e2c5..86562287c 100644
--- a/nuttx/configs/stm3240g-eval/src/stm32_pwm.c
+++ b/nuttx/configs/stm3240g-eval/src/stm32_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/stm3240g-eval/src/stm32_pwm.c
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -72,7 +74,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -80,7 +82,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/stm32_tiny/src/stm32_pwm.c b/nuttx/configs/stm32_tiny/src/stm32_pwm.c
index a742d29f8..3c3e2b52d 100644
--- a/nuttx/configs/stm32_tiny/src/stm32_pwm.c
+++ b/nuttx/configs/stm32_tiny/src/stm32_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/stm32_tiny/src/stm32_pwm.c
*
- * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -70,7 +72,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -78,7 +80,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/stm32f3discovery/src/stm32_pwm.c b/nuttx/configs/stm32f3discovery/src/stm32_pwm.c
index 8b7eaacdf..fb3757d6c 100644
--- a/nuttx/configs/stm32f3discovery/src/stm32_pwm.c
+++ b/nuttx/configs/stm32f3discovery/src/stm32_pwm.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/stm32f3discovery/src/stm32_pwm.c
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -94,7 +96,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -102,7 +104,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/stm32f4discovery/src/stm32_pm.c b/nuttx/configs/stm32f4discovery/src/stm32_pm.c
index 761061a28..c012e397c 100644
--- a/nuttx/configs/stm32f4discovery/src/stm32_pm.c
+++ b/nuttx/configs/stm32f4discovery/src/stm32_pm.c
@@ -1,7 +1,7 @@
/****************************************************************************
* configs/stm32f4discovery/src/stm32_pm.c
*
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Diego Sanchez <dsanchez@nx-engineering.com>
*
@@ -40,6 +40,7 @@
#include <nuttx/config.h>
+#include <nuttx/board.h>
#include <nuttx/power/pm.h>
#include "up_internal.h"
diff --git a/nuttx/configs/stm32f4discovery/src/stm32_pwm.c b/nuttx/configs/stm32f4discovery/src/stm32_pwm.c
index 7ef3584be..944fd36c0 100644
--- a/nuttx/configs/stm32f4discovery/src/stm32_pwm.c
+++ b/nuttx/configs/stm32f4discovery/src/stm32_pwm.c
@@ -94,7 +94,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -102,7 +102,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/configs/stm32ldiscovery/src/stm32_pwm.c b/nuttx/configs/stm32ldiscovery/src/stm32_pwm.c
index c8255da40..8802931ea 100644
--- a/nuttx/configs/stm32ldiscovery/src/stm32_pwm.c
+++ b/nuttx/configs/stm32ldiscovery/src/stm32_pwm.c
@@ -2,7 +2,7 @@
* configs/stm32ldiscovery/src/up_pwm.c
* arch/arm/src/board/up_pwm.c
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,9 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/pwm.h>
+
#include <arch/board/board.h>
#include "chip.h"
@@ -95,7 +97,7 @@
************************************************************************************/
/************************************************************************************
- * Name: pwm_devinit
+ * Name: board_pwm_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -103,7 +105,7 @@
*
************************************************************************************/
-int pwm_devinit(void)
+int board_pwm_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
diff --git a/nuttx/include/nuttx/board.h b/nuttx/include/nuttx/board.h
index 643a164c0..48c995215 100644
--- a/nuttx/include/nuttx/board.h
+++ b/nuttx/include/nuttx/board.h
@@ -203,11 +203,34 @@ void board_tsc_teardown(void);
* All architectures must provide the following interface in order to
* work with examples/adc.
*
+ * This is an internal OS interface but may be invoked indirectly from
+ * application-level graphics logic. If CONFIG_LIB_BOARDCTL=y and
+ * CONFIG_BOARDCTL_ADCTEST=y, then this functions will be invoked via the
+ * (non-standard) boardctl() interface using the commands
+ * BOARDIOC_ADCTEST_SETUP command.
+ *
****************************************************************************/
int board_adc_setup(void);
/****************************************************************************
+ * Name: board_pwm_setup
+ *
+ * Description:
+ * All architectures must provide the following interface in order to
+ * work with examples/pwm.
+ *
+ * This is an internal OS interface but may be invoked indirectly from
+ * application-level graphics logic. If CONFIG_LIB_BOARDCTL=y and
+ * CONFIG_BOARDCTL_PWMTEST=y, then this functions will be invoked via the
+ * (non-standard) boardctl() interface using the commands
+ * BOARDIOC_PWMTEST_SETUP command.
+ *
+ ****************************************************************************/
+
+int board_pwm_setup(void);
+
+/****************************************************************************
* Name: board_graphics_setup
*
* Description:
diff --git a/nuttx/include/sys/boardctl.h b/nuttx/include/sys/boardctl.h
index 5b6741570..b7fa0b104 100644
--- a/nuttx/include/sys/boardctl.h
+++ b/nuttx/include/sys/boardctl.h
@@ -76,6 +76,12 @@
* CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_ADCTEST
* DEPENDENCIES: Board logic must provide board_adc_setup()
*
+ * CMD: BOARDIOC_PWMTEST_SETUP
+ * DESCRIPTION: PWM controller test configuration
+ * ARG: None
+ * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_PWMTEST
+ * DEPENDENCIES: Board logic must provide board_pwm_setup()
+ *
* CMD: BOARDIOC_GRAPHICS_SETUP
* DESCRIPTION: Configure graphics that require special initialization
* procedures
@@ -88,7 +94,8 @@
#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0002)
#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0003)
#define BOARDIOC_ADCTEST_SETUP _BOARDIOC(0x0004)
-#define BOARDIOC_GRAPHICS_SETUP _BOARDIOC(0x0005)
+#define BOARDIOC_PWMTEST_SETUP _BOARDIOC(0x0005)
+#define BOARDIOC_GRAPHICS_SETUP _BOARDIOC(0x0006)
/* If CONFIG_BOARDCTL_IOCTL=y, then boad-specific commands will be support.
* In this case, all commands not recognized by boardctl() will be forwarded
@@ -97,7 +104,7 @@
* User defined board commands may begin with this value:
*/
-#define BOARDIOC_USER _BOARDIOC(0x0006)
+#define BOARDIOC_USER _BOARDIOC(0x0007)
/****************************************************************************
* Public Type Definitions