(Hopefully) cosmetic changes from review of recent merges for conformance to coding standard

This commit is contained in:
Gregory Nutt 2015-11-17 16:53:21 -06:00
parent c09622b0f6
commit 3c84aa3b5f
2 changed files with 184 additions and 166 deletions

View File

@ -201,6 +201,7 @@ int stm32_tim_deinit(FAR struct stm32_tim_dev_s * dev);
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_TIMER
int stm32_timer_initialize(FAR const char *devpath, int timer);
#endif

View File

@ -52,8 +52,9 @@
#include "stm32_tim.h"
#if defined(CONFIG_TIMER) && \
( defined(CONFIG_STM32_TIM1) || defined(CONFIG_STM32_TIM2) || defined(CONFIG_STM32_TIM3) || \
defined(CONFIG_STM32_TIM4) || defined(CONFIG_STM32_TIM5) || defined(CONFIG_STM32_TIM6) || \
(defined(CONFIG_STM32_TIM1) || defined(CONFIG_STM32_TIM2) || \
defined(CONFIG_STM32_TIM3) || defined(CONFIG_STM32_TIM4) || \
defined(CONFIG_STM32_TIM5) || defined(CONFIG_STM32_TIM6) || \
defined(CONFIG_STM32_TIM7) || defined(CONFIG_STM32_TIM8) )
/****************************************************************************
@ -67,6 +68,7 @@
* driver state structure. This structure must be cast-compatible with the
* timer_lowerhalf_s structure.
*/
struct stm32_lowerhalf_s
{
const struct timer_ops_s *ops; /* Lower half operations */
@ -81,11 +83,12 @@ struct stm32_lowerhalf_s
****************************************************************************/
/* Helper functions *********************************************************/
static struct stm32_lowerhalf_s* stm32_get_lowerhalf(int timer);
static xcpt_t stm32_get_interrupt(int timer);
/* Interrupt handling *******************************************************/
#ifdef CONFIG_STM32_TIM1
static int stm32_tim1_interrupt(int irq, FAR void *context);
#endif
@ -132,17 +135,19 @@ static int stm32_tim14_interrupt(int irq, FAR void *context);
static int stm32_timer_handler(struct stm32_lowerhalf_s* attr);
/* "Lower half" driver methods **********************************************/
static int stm32_start(struct timer_lowerhalf_s *lower);
static int stm32_stop(struct timer_lowerhalf_s *lower);
static int stm32_settimeout(struct timer_lowerhalf_s *lower, uint32_t timeout);
static tccb_t stm32_sethandler(struct timer_lowerhalf_s *lower, tccb_t handler);
static int stm32_settimeout(struct timer_lowerhalf_s *lower,
uint32_t timeout);
static tccb_t stm32_sethandler(struct timer_lowerhalf_s *lower,
tccb_t handler);
/****************************************************************************
* Private Data
****************************************************************************/
/* "Lower half" driver methods */
static const struct timer_ops_s g_timer_ops =
{
.start = stm32_start,
@ -213,6 +218,7 @@ static struct stm32_lowerhalf_s g_tim14_lowerHalf;
* A pointer to the lower half structure on success, NULL on failure
*
****************************************************************************/
static struct stm32_lowerhalf_s* stm32_get_lowerhalf(int timer)
{
struct stm32_lowerhalf_s* lower;
@ -309,6 +315,7 @@ static struct stm32_lowerhalf_s* stm32_get_lowerhalf(int timer)
* A pointer to the interrupt handler on success, NULL on failure
*
****************************************************************************/
static xcpt_t stm32_get_interrupt(int timer)
{
xcpt_t intr;
@ -399,6 +406,7 @@ static xcpt_t stm32_get_interrupt(int timer)
* Individual interrupt handlers for each timer
*
****************************************************************************/
#ifdef CONFIG_STM32_TIM1
static int stm32_tim1_interrupt(int irq, FAR void *context)
{
@ -505,11 +513,10 @@ static int stm32_tim14_interrupt(int irq, FAR void *context)
*
* Input Parameters:
*
*
* Returned Values:
*
*
****************************************************************************/
static int stm32_timer_handler(struct stm32_lowerhalf_s* lower)
{
STM32_TIM_ACKINT(lower->tim, 0);
@ -520,8 +527,10 @@ static int stm32_timer_handler(struct stm32_lowerhalf_s* lower)
if(ret == OK)
{
if(next_interval_us > 0)
{
STM32_TIM_SETPERIOD(lower->tim, next_interval_us);
}
}
else
{
stm32_stop(lower);
@ -565,6 +574,7 @@ static int stm32_start(struct timer_lowerhalf_s *lower)
}
/* Return EBUSY to indicate that the timer was already running */
return -EBUSY;
}
@ -597,6 +607,7 @@ static int stm32_stop(struct timer_lowerhalf_s *lower)
}
/* Return ENODEV to indicate that the timer was not running */
return -ENODEV;
}
@ -647,16 +658,20 @@ static int stm32_settimeout(struct timer_lowerhalf_s *lower, uint32_t timeout)
* no previous function pointer.
*
****************************************************************************/
static tccb_t stm32_sethandler(struct timer_lowerhalf_s *lower, tccb_t newhandler)
static tccb_t stm32_sethandler(struct timer_lowerhalf_s *lower,
tccb_t newhandler)
{
struct stm32_lowerhalf_s *priv = (struct stm32_lowerhalf_s *)lower;
irqstate_t flags = irqsave();
/* Get the old handler return value */
tccb_t oldhandler = priv->handlerUsr;
/* Save the new handler */
priv->handlerUsr = newhandler;
if(newhandler)
@ -671,11 +686,9 @@ static tccb_t stm32_sethandler(struct timer_lowerhalf_s *lower, tccb_t newhandle
}
irqrestore(flags);
return oldhandler;
}
/****************************************************************************
* Public Functions
****************************************************************************/
@ -704,9 +717,11 @@ int stm32_timer_initialize(FAR const char *devpath, int timer)
memset(lower, 0, sizeof(struct stm32_lowerhalf_s));
/* Initialize the non-zero elements of lower half state structure */
lower->ops = &g_timer_ops;
lower->handlerTim = stm32_get_interrupt(timer);
lower->tim = stm32_tim_init(timer);
if(!lower->tim)
{
return -EINVAL;
@ -716,6 +731,7 @@ int stm32_timer_initialize(FAR const char *devpath, int timer)
* timer_register is a handle that could be used with timer_unregister().
* REVISIT: The returned handle is discard here.
*/
void *drvr = timer_register(devpath, (struct timer_lowerhalf_s *)lower);
if (!drvr)
{
@ -724,6 +740,7 @@ int stm32_timer_initialize(FAR const char *devpath, int timer)
* 'depath' were not unique). We know here but we return EEXIST to
* indicate the failure (implying the non-unique devpath).
*/
return -EEXIST;
}