From 6722e186e25afca3c5876555aa018248ca499106 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 31 Mar 2015 16:59:22 -0600 Subject: [PATCH] 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. --- configs/freedom-kl25z/nsh/defconfig | 2 ++ configs/freedom-kl25z/src/kl_pwm.c | 10 ++++++---- configs/freedom-kl26z/nsh/defconfig | 2 ++ configs/freedom-kl26z/src/kl_pwm.c | 8 +++++--- configs/lpcxpresso-lpc1768/src/lpc17_pwm.c | 10 ++++++---- configs/mbed/src/lpc17_pwm.c | 10 ++++++---- configs/mikroe-stm32f4/src/stm32_pwm.c | 8 +++++--- configs/sama5d3-xplained/src/sam_pwm.c | 8 +++++--- configs/sama5d3x-ek/src/sam_pwm.c | 8 +++++--- configs/sama5d4-ek/src/sam_pwm.c | 8 +++++--- configs/stm3220g-eval/src/stm32_pwm.c | 8 +++++--- configs/stm3240g-eval/src/stm32_pwm.c | 8 +++++--- configs/stm32_tiny/src/stm32_pwm.c | 8 +++++--- configs/stm32f3discovery/src/stm32_pwm.c | 8 +++++--- configs/stm32f4discovery/src/stm32_pm.c | 3 ++- configs/stm32f4discovery/src/stm32_pwm.c | 4 ++-- configs/stm32ldiscovery/src/stm32_pwm.c | 8 +++++--- 17 files changed, 76 insertions(+), 45 deletions(-) diff --git a/configs/freedom-kl25z/nsh/defconfig b/configs/freedom-kl25z/nsh/defconfig index 8b50482219b..271d84d36c9 100644 --- a/configs/freedom-kl25z/nsh/defconfig +++ b/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/configs/freedom-kl25z/src/kl_pwm.c b/configs/freedom-kl25z/src/kl_pwm.c index 1fbb07c3206..b0c9aac5daf 100644 --- a/configs/freedom-kl25z/src/kl_pwm.c +++ b/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 * Alan Carvalho de Assis * @@ -40,11 +40,13 @@ #include +#include #include #include +#include #include -#include + #include #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/configs/freedom-kl26z/nsh/defconfig b/configs/freedom-kl26z/nsh/defconfig index 996171f1bcf..ee8e133f96e 100644 --- a/configs/freedom-kl26z/nsh/defconfig +++ b/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/configs/freedom-kl26z/src/kl_pwm.c b/configs/freedom-kl26z/src/kl_pwm.c index a0e4472bbcd..4faf9cabe8d 100644 --- a/configs/freedom-kl26z/src/kl_pwm.c +++ b/configs/freedom-kl26z/src/kl_pwm.c @@ -40,11 +40,13 @@ #include +#include #include #include +#include #include -#include + #include #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/configs/lpcxpresso-lpc1768/src/lpc17_pwm.c b/configs/lpcxpresso-lpc1768/src/lpc17_pwm.c index f7235f69b51..a2cf647bc7d 100644 --- a/configs/lpcxpresso-lpc1768/src/lpc17_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -38,12 +38,14 @@ ************************************************************************************/ #include -#include +#include #include #include +#include #include + #include #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/configs/mbed/src/lpc17_pwm.c b/configs/mbed/src/lpc17_pwm.c index f994d933069..488bfe1052a 100644 --- a/configs/mbed/src/lpc17_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -40,12 +40,14 @@ ************************************************************************************/ #include -#include +#include #include #include +#include #include + #include #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/configs/mikroe-stm32f4/src/stm32_pwm.c b/configs/mikroe-stm32f4/src/stm32_pwm.c index 0a6c5b4ecb3..c0c847367e5 100644 --- a/configs/mikroe-stm32f4/src/stm32_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ #include #include +#include #include + #include #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/configs/sama5d3-xplained/src/sam_pwm.c b/configs/sama5d3-xplained/src/sam_pwm.c index 5992bd0d541..f0213715731 100644 --- a/configs/sama5d3-xplained/src/sam_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,9 @@ #include #include +#include #include + #include #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/configs/sama5d3x-ek/src/sam_pwm.c b/configs/sama5d3x-ek/src/sam_pwm.c index 97729cd029a..08fc22e1ca4 100644 --- a/configs/sama5d3x-ek/src/sam_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,9 @@ #include #include +#include #include + #include #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/configs/sama5d4-ek/src/sam_pwm.c b/configs/sama5d4-ek/src/sam_pwm.c index f6a5cb40740..e15e70c5a0d 100644 --- a/configs/sama5d4-ek/src/sam_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,9 @@ #include #include +#include #include + #include #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/configs/stm3220g-eval/src/stm32_pwm.c b/configs/stm3220g-eval/src/stm32_pwm.c index adbce846d13..a519ac9e985 100644 --- a/configs/stm3220g-eval/src/stm32_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ #include #include +#include #include + #include #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/configs/stm3240g-eval/src/stm32_pwm.c b/configs/stm3240g-eval/src/stm32_pwm.c index 77696e2c594..86562287c4b 100644 --- a/configs/stm3240g-eval/src/stm32_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ #include #include +#include #include + #include #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/configs/stm32_tiny/src/stm32_pwm.c b/configs/stm32_tiny/src/stm32_pwm.c index a742d29f869..3c3e2b52d90 100644 --- a/configs/stm32_tiny/src/stm32_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ #include #include +#include #include + #include #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/configs/stm32f3discovery/src/stm32_pwm.c b/configs/stm32f3discovery/src/stm32_pwm.c index 8b7eaacdfe1..fb3757d6c5f 100644 --- a/configs/stm32f3discovery/src/stm32_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ #include #include +#include #include + #include #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/configs/stm32f4discovery/src/stm32_pm.c b/configs/stm32f4discovery/src/stm32_pm.c index 761061a2859..c012e397c30 100644 --- a/configs/stm32f4discovery/src/stm32_pm.c +++ b/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 * Diego Sanchez * @@ -40,6 +40,7 @@ #include +#include #include #include "up_internal.h" diff --git a/configs/stm32f4discovery/src/stm32_pwm.c b/configs/stm32f4discovery/src/stm32_pwm.c index 7ef3584be2a..944fd36c052 100644 --- a/configs/stm32f4discovery/src/stm32_pwm.c +++ b/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/configs/stm32ldiscovery/src/stm32_pwm.c b/configs/stm32ldiscovery/src/stm32_pwm.c index c8255da40a7..8802931ea85 100644 --- a/configs/stm32ldiscovery/src/stm32_pwm.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,9 @@ #include #include +#include #include + #include #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;