Finish removing traces of BOARDIOC_PWMSETUP

This commit is contained in:
Gregory Nutt 2016-12-05 14:56:21 -06:00
parent b999e63c82
commit 4b216ff8dd
54 changed files with 494 additions and 188 deletions

View File

@ -36,7 +36,11 @@
-include $(TOPDIR)/Make.defs -include $(TOPDIR)/Make.defs
ASRCS = ASRCS =
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_adc.c lpc17_dac.c lpc17_pwm.c CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_adc.c lpc17_dac.c
ifeq ($(CONFIG_PWM),y)
CSRCS += lpc17_pwm.c
endif
ifeq ($(CONFIG_LIB_BOARDCTL),y) ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += lpc17_appinit.c CSRCS += lpc17_appinit.c

View File

@ -139,9 +139,10 @@
int board_app_initialize(uintptr_t arg) int board_app_initialize(uintptr_t arg)
{ {
int ret;
#ifdef NSH_HAVEMMCSD #ifdef NSH_HAVEMMCSD
FAR struct spi_dev_s *ssp; FAR struct spi_dev_s *ssp;
int ret;
/* Get the SSP port */ /* Get the SSP port */
@ -169,5 +170,17 @@ int board_app_initialize(uintptr_t arg)
syslog(LOG_INFO, "Successfuly bound SSP port %d to MMC/SD slot %d\n", syslog(LOG_INFO, "Successfuly bound SSP port %d to MMC/SD slot %d\n",
CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = lpcexpresso_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: lpcexpresso_pwm_setup() failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK; return OK;
} }

View File

@ -64,24 +64,19 @@ FAR struct pwm_lowerhalf_s *lpc17_pwminitialize(int timer);
FAR struct pwm_lowerhalf_s *lpc17_mcpwminitialize(int timer); FAR struct pwm_lowerhalf_s *lpc17_mcpwminitialize(int timer);
FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer); FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer);
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: lpcexpresso_pwm_setup
* *
* Description: * Description:
* All LPC17 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int lpcexpresso_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/lpcxpresso-lpc1768/src/lpcxpresso-lpc1768.h * configs/lpcxpresso-lpc1768/src/lpcxpresso-lpc1768.h
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -230,6 +230,18 @@
void weak_function lpcxpresso_sspdev_initialize(void); void weak_function lpcxpresso_sspdev_initialize(void);
/************************************************************************************
* Name: lpcexpresso_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int lpcexpresso_pwm_setup(void);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* _CONFIGS_LPCXPRESSO_LPC1768_SRC_LPCXPRESSO_H */ #endif /* _CONFIGS_LPCXPRESSO_LPC1768_SRC_LPCXPRESSO_H */

View File

@ -36,7 +36,7 @@
-include $(TOPDIR)/Make.defs -include $(TOPDIR)/Make.defs
ASRCS = ASRCS =
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_adc.c lpc17_dac.c lpc17_pwm.c CSRCS = lpc17_boot.c lpc17_leds.c lpc17_adc.c lpc17_dac.c
ifeq ($(CONFIG_LIB_BOARDCTL),y) ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += lpc17_appinit.c CSRCS += lpc17_appinit.c
@ -45,6 +45,10 @@ ifeq ($(CONFIG_USBMSC),y)
CSRCS += lpc17_usbmsc.c CSRCS += lpc17_usbmsc.c
endif endif
ifeq ($(CONFIG_PWM),y)
CSRCS += lpc17_pwm.c
endif
ifeq ($(CONFIG_EXAMPLES_HIDKBD),y) ifeq ($(CONFIG_EXAMPLES_HIDKBD),y)
CSRCS += lpc17_hidkbd.c CSRCS += lpc17_hidkbd.c
endif endif

View File

@ -47,6 +47,8 @@
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include "mbed.h"
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
@ -97,5 +99,18 @@
int board_app_initialize(uintptr_t arg) int board_app_initialize(uintptr_t arg)
{ {
int ret;
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = mbed_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: mbed_pwm_setup() failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK; return OK;
} }

View File

@ -3,7 +3,7 @@
* *
* Based on onfigs/lpcexpresso-lpc1768/lpc17_pwm.c * Based on onfigs/lpcexpresso-lpc1768/lpc17_pwm.c
* *
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -66,24 +66,19 @@ FAR struct pwm_lowerhalf_s *lpc17_pwminitialize(int timer);
FAR struct pwm_lowerhalf_s *lpc17_mcpwminitialize(int timer); FAR struct pwm_lowerhalf_s *lpc17_mcpwminitialize(int timer);
FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer); FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer);
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: mbed_pwm_setup
* *
* Description: * Description:
* All LPC17 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int mbed_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/mbed/src/mbed.h * configs/mbed/src/mbed.h
* *
* Copyright (C) 2010 Gregory Nutt. All rights reserved. * Copyright (C) 2010, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -88,6 +88,18 @@
void weak_function mbed_sspdev_initialize(void); void weak_function mbed_sspdev_initialize(void);
/************************************************************************************
* Name: mbed_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int mbed_pwm_setup(void);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* _CONFIGS_MBED_SRC_MBED_H */ #endif /* _CONFIGS_MBED_SRC_MBED_H */

View File

@ -227,6 +227,18 @@ void weak_function stm32_spidev_initialize(void);
void weak_function stm32_usbinitialize(void); void weak_function stm32_usbinitialize(void);
#endif #endif
/************************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/**************************************************************************************************** /****************************************************************************************************
* Name: stm32_usbhost_initialize * Name: stm32_usbhost_initialize
* *

View File

@ -350,6 +350,16 @@ int board_app_initialize(uintptr_t arg)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
#if defined(CONFIG_LCD_MIO283QT2) || defined(CONFIG_LCD_MIO283QT9A) #if defined(CONFIG_LCD_MIO283QT2) || defined(CONFIG_LCD_MIO283QT9A)
/* Configure the TFT LCD module */ /* Configure the TFT LCD module */

View File

@ -58,9 +58,9 @@
/* Configuration *******************************************************************/ /* Configuration *******************************************************************/
/* PWM /* PWM
* *
* The mikroe_stm32f4 has no real on-board PWM devices, but the board can be configured to output * The mikroe_stm32f4 has no real on-board PWM devices, but the board can be
* a pulse train using TIM4 CH2. This pin is used by FSMC is connect to CN5 just for this * configured to output a pulse train using TIM4 CH2. This pin is used by FSMC is
* purpose: * connected to CN5 just for this purpose:
* *
* PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB) * PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB)
* *
@ -87,24 +87,19 @@
#ifdef HAVE_PWM #ifdef HAVE_PWM
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_pwm_setup
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int stm32_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -327,6 +327,18 @@ void stm32_spiinitialize(void);
void stm32_usbinitialize(void); void stm32_usbinitialize(void);
/************************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/************************************************************************************ /************************************************************************************
* Name: board_adc_initialize * Name: board_adc_initialize
* *

View File

@ -196,6 +196,16 @@ int board_app_initialize(uintptr_t arg)
syslog(LOG_INFO, "[boot] Initialized SDIO\n"); syslog(LOG_INFO, "[boot] Initialized SDIO\n");
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_AJOYSTICK #ifdef CONFIG_AJOYSTICK
/* Initialize and register the joystick driver */ /* Initialize and register the joystick driver */

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/nucleo-l476rg/src/stm32_pwm.c * configs/nucleo-l476rg/src/stm32_pwm.c
* *
* Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Copyright (C) 2016 Sebastien Lorquet. All rights reserved. * Copyright (C) 2016 Sebastien Lorquet. All rights reserved.
@ -68,24 +68,19 @@
#ifdef CONFIG_PWM #ifdef CONFIG_PWM
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_pwm_setup
* *
* Description: * Description:
* All STM32L4 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int stm32_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -85,11 +85,7 @@
int board_app_initialize(uintptr_t arg) int board_app_initialize(uintptr_t arg)
{ {
#if defined(HAVE_NAND) || defined(HAVE_AT25) || defined(HAVE_HSMCI) || \
defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR) || \\
defined(CONFIG_AJOYSTICK) || defined(CONFIG_FS_PROCFS)
int ret; int ret;
#endif
#ifdef HAVE_NAND #ifdef HAVE_NAND
/* Initialize the NAND driver */ /* Initialize the NAND driver */
@ -175,6 +171,17 @@ int board_app_initialize(uintptr_t arg)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = sam_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: sam_pwm_setup() failed: %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
@ -184,8 +191,10 @@ int board_app_initialize(uintptr_t arg)
syslog(LOG_ERR, syslog(LOG_ERR,
"ERROR: Failed to mount procfs at %s: %d\n", "ERROR: Failed to mount procfs at %s: %d\n",
SAMA5_PROCFS_MOUNTPOINT, ret); SAMA5_PROCFS_MOUNTPOINT, ret);
return ret;
} }
#endif #endif
UNUSED(ret);
return OK; return OK;
} }

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/sama5d3-xplained/src/sam_pwm.c * configs/sama5d3-xplained/src/sam_pwm.c
* *
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -107,24 +107,19 @@
#if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM) #if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM)
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: sam_pwm_setup
* *
* Description: * Description:
* All SAMA5 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int sam_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -725,19 +725,32 @@ bool sam_writeprotected(int slotno);
void weak_function sam_usbinitialize(void); void weak_function sam_usbinitialize(void);
#endif #endif
/**************************************************************************************************** /************************************************************************************
* Name: stm32_usbhost_initialize * Name: stm32_usbhost_initialize
* *
* Description: * Description:
* Called at application startup time to initialize the USB host functionality. This function will * Called at application startup time to initialize the USB host functionality.
* start a thread that will monitor for device connection/disconnection events. * This function will start a thread that will monitor for device connection/
* disconnection events.
* *
****************************************************************************************************/ ************************************************************************************/
#ifdef HAVE_USBHOST #ifdef HAVE_USBHOST
int sam_usbhost_initialize(void); int sam_usbhost_initialize(void);
#endif #endif
/************************************************************************************
* Name: sam_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int sam_pwm_setup(void);
#endif
/************************************************************************************ /************************************************************************************
* Name: sam_netinitialize * Name: sam_netinitialize
* *

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# configs/sama5d3x-ek/src/Makefile # configs/sama5d3x-ek/src/Makefile
# #
# Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. # Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

View File

@ -89,11 +89,7 @@
int board_app_initialize(uintptr_t arg) int board_app_initialize(uintptr_t arg)
{ {
#if defined(HAVE_NAND) || defined(HAVE_AT25) || defined(HAVE_AT24) || \
defined(HAVE_HSMCI) || defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR) ||\
defined(HAVE_WM8904) || defined(CONFIG_FS_PROCFS)
int ret; int ret;
#endif
#ifdef HAVE_NAND #ifdef HAVE_NAND
/* Initialize the NAND driver */ /* Initialize the NAND driver */
@ -188,6 +184,16 @@ int board_app_initialize(uintptr_t arg)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = sam_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: sam_pwm_setup() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
@ -199,5 +205,6 @@ int board_app_initialize(uintptr_t arg)
} }
#endif #endif
UNUSED(ret);
return OK; return OK;
} }

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/sama5d3x-ek/src/sam_pwm.c * configs/sama5d3x-ek/src/sam_pwm.c
* *
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -107,24 +107,19 @@
#if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM) #if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM)
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: sam_pwm_setup
* *
* Description: * Description:
* All SAMA5 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int sam_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -832,6 +832,18 @@ int sam_usbhost_initialize(void);
void weak_function sam_netinitialize(void); void weak_function sam_netinitialize(void);
#endif #endif
/************************************************************************************
* Name: sam_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int sam_pwm_setup(void);
#endif
/**************************************************************************** /****************************************************************************
* Name: sam_wm8904_initialize * Name: sam_wm8904_initialize
* *

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* config/sama5d4-ek/src/sam_bringup.c * config/sama5d4-ek/src/sam_bringup.c
* *
* Copyright (C) 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -146,12 +146,7 @@ static void sam_i2ctool(void)
int sam_bringup(void) int sam_bringup(void)
{ {
#if defined(HAVE_NAND) || defined(HAVE_AT25) || defined(HAVE_HSMCI) || \
defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR) || defined(HAVE_WM8904) || \
defined(HAVE_AUTOMOUNTER) || defined(HAVE_ELF) || defined(HAVE_ROMFS) || \
defined(CONFIG_FS_PROCFS)
int ret; int ret;
#endif
/* Register I2C drivers on behalf of the I2C tool */ /* Register I2C drivers on behalf of the I2C tool */
@ -293,6 +288,16 @@ int sam_bringup(void)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = sam_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: sam_pwm_setup() failed: %d\n", ret);
}
#endif
#ifdef HAVE_WM8904 #ifdef HAVE_WM8904
/* Configure WM8904 audio */ /* Configure WM8904 audio */
@ -340,5 +345,6 @@ int sam_bringup(void)
* capabilities. * capabilities.
*/ */
UNUSED(ret);
return OK; return OK;
} }

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/sama5d4-ek/src/sam_pwm.c * configs/sama5d4-ek/src/sam_pwm.c
* *
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -107,24 +107,19 @@
#if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM) #if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM)
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: sam_pwm_setup
* *
* Description: * Description:
* All SAMA5 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int sam_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -1073,6 +1073,18 @@ void weak_function sam_usbinitialize(void);
int sam_usbhost_initialize(void); int sam_usbhost_initialize(void);
#endif #endif
/************************************************************************************
* Name: sam_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int sam_pwm_setup(void);
#endif
/************************************************************************************ /************************************************************************************
* Name: sam_netinitialize * Name: sam_netinitialize
* *

View File

@ -1,7 +1,7 @@
/**************************************************************************************************** /****************************************************************************************************
* configs/stm3220g_eval/src/stm3220g.h * configs/stm3220g_eval/src/stm3220g.h
* *
* Copyright (C) 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -249,6 +249,18 @@ void weak_function stm32_usbinitialize(void);
int stm32_usbhost_initialize(void); int stm32_usbhost_initialize(void);
#endif #endif
/************************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/**************************************************************************************************** /****************************************************************************************************
* Name: stm32_extmemgpios * Name: stm32_extmemgpios
* *

View File

@ -294,5 +294,15 @@ int board_app_initialize(uintptr_t arg)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
return OK; return OK;
} }

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm3220g-eval/src/stm32_pwm.c * configs/stm3220g-eval/src/stm32_pwm.c
* *
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -65,24 +65,19 @@
#ifdef CONFIG_PWM #ifdef CONFIG_PWM
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_pwm_setup
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int stm32_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -1,7 +1,7 @@
/**************************************************************************************************** /****************************************************************************************************
* configs/stm3240g_eval/src/stm3240g_eval.h * configs/stm3240g_eval/src/stm3240g_eval.h
* *
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -262,6 +262,18 @@ int stm32_usbhost_initialize(void);
void stm32_led_initialize(void); void stm32_led_initialize(void);
#endif #endif
/************************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/**************************************************************************************************** /****************************************************************************************************
* Name: stm32_extmemgpios * Name: stm32_extmemgpios
* *

View File

@ -345,5 +345,15 @@ int board_app_initialize(uintptr_t arg)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
return OK; return OK;
} }

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm3240g-eval/src/stm32_pwm.c * configs/stm3240g-eval/src/stm32_pwm.c
* *
* Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -65,24 +65,19 @@
#ifdef CONFIG_PWM #ifdef CONFIG_PWM
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_pwm_setup
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int stm32_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -80,6 +80,18 @@
int board_app_initialize(uintptr_t arg) int board_app_initialize(uintptr_t arg)
{ {
#ifdef CONFIG_PWM
int ret;
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
#if defined(CONFIG_WL_NRF24L01) #if defined(CONFIG_WL_NRF24L01)
syslog(LOG_INFO, "Register the nRF24L01 module"); syslog(LOG_INFO, "Register the nRF24L01 module");
stm32_wlinitialize(); stm32_wlinitialize();

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32_tiny/src/stm32_pwm.c * configs/stm32_tiny/src/stm32_pwm.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -63,24 +63,19 @@
#ifdef CONFIG_PWM #ifdef CONFIG_PWM
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_pwm_setup
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int stm32_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -121,7 +121,7 @@
* *
************************************************************************************/ ************************************************************************************/
extern void stm32_spidev_initialize(void); void stm32_spidev_initialize(void);
/************************************************************************************ /************************************************************************************
* Name: stm32_usbinitialize * Name: stm32_usbinitialize
@ -131,7 +131,19 @@ extern void stm32_spidev_initialize(void);
* *
************************************************************************************/ ************************************************************************************/
extern void stm32_usbinitialize(void); void stm32_usbinitialize(void);
/************************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/************************************************************************************ /************************************************************************************
* Name: stm32_wlinitialize * Name: stm32_wlinitialize
@ -141,7 +153,7 @@ extern void stm32_usbinitialize(void);
* *
************************************************************************************/ ************************************************************************************/
extern void stm32_wlinitialize(void); void stm32_wlinitialize(void);
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_HYMINI_STM32V_H */ #endif /* __CONFIGS_HYMINI_STM32V_H */

View File

@ -127,6 +127,16 @@ int board_app_initialize(uintptr_t arg)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_QENCODER #ifdef CONFIG_QENCODER
/* Initialize and register the qencoder driver */ /* Initialize and register the qencoder driver */

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32f3discovery/src/stm32_pwm.c * configs/stm32f3discovery/src/stm32_pwm.c
* *
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -58,9 +58,9 @@
/* Configuration *******************************************************************/ /* Configuration *******************************************************************/
/* PWM /* PWM
* *
* The stm32f3discovery has no real on-board PWM devices, but the board can be configured to output * The stm32f3discovery has no real on-board PWM devices, but the board can be
* a pulse train using TIM4 CH2. This pin is used by FSMC is connect to CN5 just for this * configured to output a pulse train using TIM4 CH2. This pin is used by FSMC is
* purpose: * connected to CN5 just for this purpose:
* *
* PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB) * PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB)
* *
@ -87,24 +87,19 @@
#ifdef HAVE_PWM #ifdef HAVE_PWM
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_pwm_setup
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int stm32_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -1,6 +1,5 @@
/**************************************************************************************************** /****************************************************************************************************
* configs/stm32f3discovery/src/stm32f3discovery.h * configs/stm32f3discovery/src/stm32f3discovery.h
* arch/arm/src/board/stm32f3discovery.n
* *
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@ -162,6 +161,18 @@ void weak_function stm32_spidev_initialize(void);
void weak_function stm32_usbinitialize(void); void weak_function stm32_usbinitialize(void);
#endif #endif
/************************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/**************************************************************************** /****************************************************************************
* Name: stm32_qencoder_initialize * Name: stm32_qencoder_initialize
* *

View File

@ -159,6 +159,16 @@ int stm32_bringup(void)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_QENCODER #ifdef CONFIG_QENCODER
/* Initialize and register the qencoder driver */ /* Initialize and register the qencoder driver */

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32f4discovery/src/stm32_pwm.c * configs/stm32f4discovery/src/stm32_pwm.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -56,9 +56,9 @@
/* Configuration *******************************************************************/ /* Configuration *******************************************************************/
/* PWM /* PWM
* *
* The stm32f4discovery has no real on-board PWM devices, but the board can be configured to output * The stm32f4discovery has no real on-board PWM devices, but the board can be
* a pulse train using TIM4 CH2. This pin is used by FSMC is connect to CN5 just for this * configured to output a pulse train using TIM4 CH2. This pin is used by FSMC is
* purpose: * connected to CN5 just for this purpose:
* *
* PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB) * PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB)
* *
@ -85,24 +85,19 @@
#ifdef HAVE_PWM #ifdef HAVE_PWM
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_pwm_setup
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int stm32_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -93,11 +93,10 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_rgbled_setup
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * Configure the RGB LED.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/

View File

@ -438,6 +438,18 @@ void weak_function stm32_usbinitialize(void);
int stm32_usbhost_initialize(void); int stm32_usbhost_initialize(void);
#endif #endif
/************************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/**************************************************************************** /****************************************************************************
* Name: stm32_extmemgpios * Name: stm32_extmemgpios
* *

View File

@ -91,6 +91,16 @@ int board_app_initialize(uintptr_t arg)
} }
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_QENCODER #ifdef CONFIG_QENCODER
/* Initialize and register the qencoder driver */ /* Initialize and register the qencoder driver */

View File

@ -1,8 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32ldiscovery/src/up_pwm.c * configs/stm32ldiscovery/src/up_pwm.c
* arch/arm/src/board/up_pwm.c
* *
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -59,9 +58,9 @@
/* Configuration *******************************************************************/ /* Configuration *******************************************************************/
/* PWM /* PWM
* *
* The stm32ldiscovery has no real on-board PWM devices, but the board can be configured to output * The stm32ldiscovery has no real on-board PWM devices, but the board can be
* a pulse train using TIM4 CH2. This pin is used by FSMC is connect to CN5 just for this * configured to output a pulse train using TIM4 CH2. This pin is used by FSMC is
* purpose: * connected to CN5 just for this purpose:
* *
* PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB) * PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB)
* *
@ -88,24 +87,19 @@
#ifdef HAVE_PWM #ifdef HAVE_PWM
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: stm32_pwm_setup
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int stm32_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -243,6 +243,18 @@
void weak_function stm32_spidev_initialize(void); void weak_function stm32_spidev_initialize(void);
/************************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/**************************************************************************** /****************************************************************************
* Name: stm32_qencoder_initialize * Name: stm32_qencoder_initialize
* *

View File

@ -41,12 +41,15 @@ CSRCS = at90usb_boot.c
ifeq ($(CONFIG_ARCH_LEDS),y) ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += at90usb_leds.c CSRCS += at90usb_leds.c
endif endif
ifeq ($(CONFIG_LIB_BOARDCTL),y) ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += at90usb_appinit.c CSRCS += at90usb_appinit.c
endif endif
ifeq ($(CONFIG_USBMSC),y) ifeq ($(CONFIG_USBMSC),y)
CSRCS += at90usb_usbmsc.c CSRCS += at90usb_usbmsc.c
endif endif
ifeq ($(CONFIG_AVR_SPI),y) ifeq ($(CONFIG_AVR_SPI),y)
CSRCS += at90usb_spi.c CSRCS += at90usb_spi.c
endif endif

View File

@ -38,7 +38,10 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <syslog.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include "kinetis_usbotg.h" #include "kinetis_usbotg.h"
@ -75,6 +78,8 @@
int board_app_initialize(uintptr_t arg) int board_app_initialize(uintptr_t arg)
{ {
int ret;
#ifdef CONFIG_USBDEV #ifdef CONFIG_USBDEV
/* Teensy is powered from usb and (bug?) only boots from being programmed, /* Teensy is powered from usb and (bug?) only boots from being programmed,
* so if usb is compiled in signal the controller driver that we're attached now. * so if usb is compiled in signal the controller driver that we're attached now.
@ -83,5 +88,16 @@ int board_app_initialize(uintptr_t arg)
khci_usbattach(); khci_usbattach();
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = kinetis_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: kinetis_pwm_setup() failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK; return OK;
} }

View File

@ -66,24 +66,19 @@
extern struct pwm_lowerhalf_s *kinetis_pwminitialize(int timer); extern struct pwm_lowerhalf_s *kinetis_pwminitialize(int timer);
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: kinetis_pwm_setup
* *
* Description: * Description:
* All Kinetis K20 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int kinetis_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -115,6 +115,18 @@ void kinetis_i2cdev_initialize(void);
extern void weak_function kinetis_usbinitialize(void); extern void weak_function kinetis_usbinitialize(void);
/************************************************************************************
* Name: kinetis_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int kinetis_pwm_setup(void);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_TEENSY_3X_SRC_TEENSY_3X_H */ #endif /* __CONFIGS_TEENSY_3X_SRC_TEENSY_3X_H */

View File

@ -78,6 +78,19 @@
int board_app_initialize(uintptr_t arg) int board_app_initialize(uintptr_t arg)
{ {
int ret;
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = kl_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: kl_pwm_setup() failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK; return OK;
} }

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/teensy-lc/src/kl_pwm.c * configs/teensy-lc/src/kl_pwm.c
* *
* Copyright (C) 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* Alan Carvalho de Assis <acassis@gmail.com> * Alan Carvalho de Assis <acassis@gmail.com>
* *
@ -66,24 +66,19 @@
extern struct pwm_lowerhalf_s *kl_pwminitialize(int timer); extern struct pwm_lowerhalf_s *kl_pwminitialize(int timer);
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: kl_pwm_setup
* *
* Description: * Description:
* All Kinetis KL architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int kl_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -79,6 +79,18 @@
void weak_function kl_spidev_initialize(void); void weak_function kl_spidev_initialize(void);
/************************************************************************************
* Name: kl_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int kl_pwm_setup(void);
#endif
/**************************************************************************** /****************************************************************************
* Name: kl_led_initialize * Name: kl_led_initialize
* *

View File

@ -36,12 +36,16 @@
-include $(TOPDIR)/Make.defs -include $(TOPDIR)/Make.defs
ASRCS = ASRCS =
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_adc.c lpc17_dac.c lpc17_pwm.c CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_adc.c lpc17_dac.c
ifeq ($(CONFIG_LIB_BOARDCTL),y) ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += lpc17_appinit.c CSRCS += lpc17_appinit.c
endif endif
ifeq ($(CONFIG_PWM),y)
CSRCS += lpc17_pwm.c
endif
ifeq ($(CONFIG_MODEM_U_BLOX),y) ifeq ($(CONFIG_MODEM_U_BLOX),y)
CSRCS += lpc17_ubxmdm.c CSRCS += lpc17_ubxmdm.c
endif endif

View File

@ -195,5 +195,18 @@ int board_app_initialize(uintptr_t arg)
syslog(LOG_INFO, "Successfuly bound SSP port %d to MMC/SD slot %d\n", syslog(LOG_INFO, "Successfuly bound SSP port %d to MMC/SD slot %d\n",
CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
#endif #endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = lpc17_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: lpc17_pwm_setup() failed: %d\n", ret);
return ret;
}
#endif
UNUSED(ret);
return OK; return OK;
} }

View File

@ -69,15 +69,14 @@ FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer);
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: board_pwm_setup * Name: lpc17_pwm_setup
* *
* Description: * Description:
* All LPC17 architectures must provide the following interface to work with * Initialize PWM and register the PWM device.
* examples/pwm.
* *
************************************************************************************/ ************************************************************************************/
int board_pwm_setup(void) int lpc17_pwm_setup(void)
{ {
static bool initialized = false; static bool initialized = false;
struct pwm_lowerhalf_s *pwm; struct pwm_lowerhalf_s *pwm;

View File

@ -90,14 +90,29 @@
void weak_function c027_sspdev_initialize(void); void weak_function c027_sspdev_initialize(void);
/************************************************************************************
* Name: lpc17_ubxmdm_init
*
* Description:
* Initialisation function for the u-blox modem.
*
************************************************************************************/
#if defined(CONFIG_MODEM_U_BLOX) #if defined(CONFIG_MODEM_U_BLOX)
/*
* Initialisation function for the u-blox modem.
*/
void lpc17_ubxmdm_init(bool usb_used); void lpc17_ubxmdm_init(bool usb_used);
#endif /* CONFIG_MODEM_U_BLOX */ #endif /* CONFIG_MODEM_U_BLOX */
/************************************************************************************
* Name: lpc17_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
************************************************************************************/
#ifdef CONFIG_PWM
int lpc17_pwm_setup(void);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_U_BLOX_C027_SRC_U_BLOX_C027_H */ #endif /* __CONFIGS_U_BLOX_C027_SRC_U_BLOX_C027_H */