From 08f57f5d90b5ab531d61f75de2001bdbbd2c7d51 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. --- examples/pwm/Kconfig | 3 ++- examples/pwm/pwm.h | 11 ----------- examples/pwm/pwm_main.c | 7 ++++--- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/examples/pwm/Kconfig b/examples/pwm/Kconfig index 94dc6fb7a..50672bb8f 100644 --- a/examples/pwm/Kconfig +++ b/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/examples/pwm/pwm.h b/examples/pwm/pwm.h index c1c6820e8..e6703991a 100644 --- a/examples/pwm/pwm.h +++ b/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/examples/pwm/pwm_main.c b/examples/pwm/pwm_main.c index ba5687541..844551550 100644 --- a/examples/pwm/pwm_main.c +++ b/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 * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -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; }