Merged in slorquet/nuttx/pr_fixes (pull request #95)

Pr_fixes
This commit is contained in:
Gregory Nutt 2016-07-11 17:07:40 -06:00
commit f816e7a69b
7 changed files with 196 additions and 180 deletions

View File

@ -57,7 +57,7 @@
* Private Functions
****************************************************************************/
static struct stm32l4_freerun_s *g_freerun;
FAR static struct stm32l4_freerun_s *g_freerun;
/****************************************************************************
* Private Functions
@ -81,9 +81,9 @@ static struct stm32l4_freerun_s *g_freerun;
*
****************************************************************************/
static int stm32l4_freerun_handler(int irq, void *context)
static int stm32l4_freerun_handler(int irq, FAR void *context)
{
struct stm32l4_freerun_s *freerun = g_freerun;
FAR struct stm32l4_freerun_s *freerun = g_freerun;
DEBUGASSERT(freerun != NULL && freerun->overflow < UINT32_MAX);
freerun->overflow++;
@ -115,7 +115,7 @@ static int stm32l4_freerun_handler(int irq, void *context)
*
****************************************************************************/
int stm32l4_freerun_initialize(struct stm32l4_freerun_s *freerun, int chan,
int stm32l4_freerun_initialize(FAR struct stm32l4_freerun_s *freerun, int chan,
uint16_t resolution)
{
uint32_t frequency;
@ -183,8 +183,8 @@ int stm32l4_freerun_initialize(struct stm32l4_freerun_s *freerun, int chan,
*
****************************************************************************/
int stm32l4_freerun_counter(struct stm32l4_freerun_s *freerun,
struct timespec *ts)
int stm32l4_freerun_counter(FAR struct stm32l4_freerun_s *freerun,
FAR struct timespec *ts)
{
uint64_t usec;
uint32_t counter;
@ -275,7 +275,7 @@ int stm32l4_freerun_counter(struct stm32l4_freerun_s *freerun,
*
****************************************************************************/
int stm32l4_freerun_uninitialize(struct stm32l4_freerun_s *freerun)
int stm32l4_freerun_uninitialize(FAR struct stm32l4_freerun_s *freerun)
{
DEBUGASSERT(freerun && freerun->tch);

View File

@ -83,11 +83,11 @@ static struct stm32l4_oneshot_s *g_oneshot;
*
****************************************************************************/
static int stm32l4_oneshot_handler(int irq, void *context)
static int stm32l4_oneshot_handler(int irq, FAR void *context)
{
struct stm32l4_oneshot_s *oneshot = g_oneshot;
FAR struct stm32l4_oneshot_s *oneshot = g_oneshot;
oneshot_handler_t oneshot_handler;
void *oneshot_arg;
FAR void *oneshot_arg;
tmrinfo("Expired...\n");
DEBUGASSERT(oneshot != NULL && oneshot->handler);
@ -138,7 +138,7 @@ static int stm32l4_oneshot_handler(int irq, void *context)
*
****************************************************************************/
int stm32l4_oneshot_initialize(struct stm32l4_oneshot_s *oneshot, int chan,
int stm32l4_oneshot_initialize(FAR struct stm32l4_oneshot_s *oneshot, int chan,
uint16_t resolution)
{
uint32_t frequency;
@ -181,7 +181,8 @@ int stm32l4_oneshot_initialize(struct stm32l4_oneshot_s *oneshot, int chan,
*
****************************************************************************/
int stm32l4_oneshot_max_delay(struct stm32l4_oneshot_s *oneshot, uint64_t *usec)
int stm32l4_oneshot_max_delay(FAR struct stm32l4_oneshot_s *oneshot,
FAR uint64_t *usec)
{
DEBUGASSERT(oneshot != NULL && usec != NULL);
@ -210,9 +211,9 @@ int stm32l4_oneshot_max_delay(struct stm32l4_oneshot_s *oneshot, uint64_t *usec)
*
****************************************************************************/
int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
oneshot_handler_t handler, void *arg,
const struct timespec *ts)
int stm32l4_oneshot_start(FAR struct stm32l4_oneshot_s *oneshot,
oneshot_handler_t handler, FAR void *arg,
FAR const struct timespec *ts)
{
uint64_t usec;
uint64_t period;
@ -307,8 +308,8 @@ int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
*
****************************************************************************/
int stm32l4_oneshot_cancel(struct stm32l4_oneshot_s *oneshot,
struct timespec *ts)
int stm32l4_oneshot_cancel(FAR struct stm32l4_oneshot_s *oneshot,
FAR struct timespec *ts)
{
irqstate_t flags;
uint64_t usec;

View File

@ -305,12 +305,12 @@ static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits,
/* Semaphores ******************************************************************/
static void stm32l4_takesem(sem_t *sem);
static void stm32l4_takesem(FAR sem_t *sem);
#define stm32l4_givesem(s) sem_post(s);
/* Byte stream access helper functions *****************************************/
static inline uint16_t stm32l4_getle16(const uint8_t *val);
static inline uint16_t stm32l4_getle16(FAR const uint8_t *val);
/* Channel management **********************************************************/
@ -437,7 +437,7 @@ static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr,
FAR uint8_t **buffer, size_t buflen);
static int stm32l4_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer);
static int stm32l4_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
const struct usb_ctrlreq_s *req,
FAR const struct usb_ctrlreq_s *req,
FAR uint8_t *buffer);
static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
FAR const struct usb_ctrlreq_s *req,
@ -626,7 +626,8 @@ static void stm32l4_putreg(uint32_t addr, uint32_t val)
*
****************************************************************************/
static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits, uint32_t setbits)
static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits,
uint32_t setbits)
{
stm32l4_putreg(addr, (((stm32l4_getreg(addr)) & ~clrbits) | setbits));
}
@ -640,7 +641,7 @@ static inline void stm32l4_modifyreg(uint32_t addr, uint32_t clrbits, uint32_t s
*
****************************************************************************/
static void stm32l4_takesem(sem_t *sem)
static void stm32l4_takesem(FAR sem_t *sem)
{
/* Take the semaphore (perhaps waiting) */
@ -662,7 +663,7 @@ static void stm32l4_takesem(sem_t *sem)
*
****************************************************************************/
static inline uint16_t stm32l4_getle16(const uint8_t *val)
static inline uint16_t stm32l4_getle16(FAR const uint8_t *val)
{
return (uint16_t)val[1] << 8 | (uint16_t)val[0];
}
@ -1385,7 +1386,8 @@ static int stm32l4_xfrep_alloc(FAR struct stm32l4_usbhost_s *priv,
*
****************************************************************************/
static void stm32l4_transfer_start(FAR struct stm32l4_usbhost_s *priv, int chidx)
static void stm32l4_transfer_start(FAR struct stm32l4_usbhost_s *priv,
int chidx)
{
FAR struct stm32l4_chan_s *chan;
uint32_t regval;
@ -1823,8 +1825,9 @@ static int stm32l4_in_setup(FAR struct stm32l4_usbhost_s *priv, int chidx)
*
****************************************************************************/
static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx,
FAR uint8_t *buffer, size_t buflen)
static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv,
int chidx, FAR uint8_t *buffer,
size_t buflen)
{
FAR struct stm32l4_chan_s *chan;
systime_t start;
@ -2082,8 +2085,9 @@ static int stm32l4_out_setup(FAR struct stm32l4_usbhost_s *priv, int chidx)
*
****************************************************************************/
static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv, int chidx,
FAR uint8_t *buffer, size_t buflen)
static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv,
int chidx, FAR uint8_t *buffer,
size_t buflen)
{
FAR struct stm32l4_chan_s *chan;
systime_t start;
@ -3946,9 +3950,9 @@ static int stm32l4_enumerate(FAR struct usbhost_connection_s *conn,
*
************************************************************************************/
static int stm32l4_ep0configure(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
uint8_t funcaddr, uint8_t speed,
uint16_t maxpacketsize)
static int stm32l4_ep0configure(FAR struct usbhost_driver_s *drvr,
usbhost_ep_t ep0, uint8_t funcaddr,
uint8_t speed, uint16_t maxpacketsize)
{
FAR struct stm32l4_usbhost_s *priv = (FAR struct stm32l4_usbhost_s *)drvr;
FAR struct stm32l4_ctrlinfo_s *ep0info = (FAR struct stm32l4_ctrlinfo_s *)ep0;
@ -4129,7 +4133,7 @@ static int stm32l4_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep)
* - Never called from an interrupt handler.
*
****************************************************************************/
#warning this function name is too generic
static int stm32l4_alloc(FAR struct usbhost_driver_s *drvr,
FAR uint8_t **buffer, FAR size_t *maxlen)
{
@ -4174,7 +4178,7 @@ static int stm32l4_alloc(FAR struct usbhost_driver_s *drvr,
* - Never called from an interrupt handler.
*
****************************************************************************/
#warning this function name is too generic
static int stm32l4_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
{
/* There is no special memory requirement */
@ -4210,7 +4214,7 @@ static int stm32l4_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
* This function will *not* be called from an interrupt handler.
*
************************************************************************************/
#warning this function name is too generic
static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr,
FAR uint8_t **buffer, size_t buflen)
{
@ -4254,7 +4258,7 @@ static int stm32l4_ioalloc(FAR struct usbhost_driver_s *drvr,
* This function will *not* be called from an interrupt handler.
*
************************************************************************************/
#warning this function name is too generic
static int stm32l4_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
{
/* There is no special memory requirement */

View File

@ -535,7 +535,7 @@ static void rtc_resume(void)
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
static int stm32l4_rtc_alarm_handler(int irq, void *context)
static int stm32l4_rtc_alarm_handler(int irq, FAR void *context)
{
FAR struct alm_cbinfo_s *cbinfo;
alm_callback_t cb;

View File

@ -152,7 +152,7 @@ static struct stm32l4_tickless_s g_tickless;
*
****************************************************************************/
static void stm32l4_oneshot_handler(void *arg)
static void stm32l4_oneshot_handler(FAR void *arg)
{
tmrinfo("Expired...\n");
sched_timer_expiration();

View File

@ -217,7 +217,7 @@
struct stm32l4_tim_priv_s
{
const struct stm32l4_tim_ops_s *ops;
FAR const struct stm32l4_tim_ops_s *ops;
stm32l4_tim_mode_t mode;
uint32_t base; /* TIMn base address */
};
@ -230,15 +230,15 @@ struct stm32l4_tim_priv_s
static inline uint16_t stm32l4_getreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset);
static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev, uint8_t offset,
uint16_t value);
static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset, uint16_t value);
static inline void stm32l4_modifyreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset, uint16_t clearbits,
uint16_t setbits);
static inline uint32_t stm32l4_getreg32(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset);
static inline void stm32l4_putreg32(FAR struct stm32l4_tim_dev_s *dev, uint8_t offset,
uint32_t value);
static inline void stm32l4_putreg32(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset, uint32_t value);
/* Timer helpers */
@ -254,21 +254,26 @@ static void stm32l4_tim_gpioconfig(uint32_t cfg, stm32l4_tim_channel_t mode);
/* Timer methods */
static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev, stm32l4_tim_mode_t mode);
static int stm32l4_tim_setclock(FAR struct stm32l4_tim_dev_s *dev, uint32_t freq);
static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev,
stm32l4_tim_mode_t mode);
static int stm32l4_tim_setclock(FAR struct stm32l4_tim_dev_s *dev,
uint32_t freq);
static void stm32l4_tim_setperiod(FAR struct stm32l4_tim_dev_s *dev,
uint32_t period);
static uint32_t stm32l4_tim_getcounter(FAR struct stm32l4_tim_dev_s *dev);
static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel,
stm32l4_tim_channel_t mode);
static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel,
uint32_t compare);
static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel);
static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev,
uint8_t channel, stm32l4_tim_channel_t mode);
static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev,
uint8_t channel, uint32_t compare);
static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev,
uint8_t channel);
static int stm32l4_tim_setisr(FAR struct stm32l4_tim_dev_s *dev,
int (*handler)(int irq, void *context),
int (*handler)(int irq, FAR void *context),
int source);
static void stm32l4_tim_enableint(FAR struct stm32l4_tim_dev_s *dev,
int source);
static void stm32l4_tim_disableint(FAR struct stm32l4_tim_dev_s *dev,
int source);
static void stm32l4_tim_enableint(FAR struct stm32l4_tim_dev_s *dev, int source);
static void stm32l4_tim_disableint(FAR struct stm32l4_tim_dev_s *dev, int source);
static void stm32l4_tim_ackint(FAR struct stm32l4_tim_dev_s *dev, int source);
static int stm32l4_tim_checkint(FAR struct stm32l4_tim_dev_s *dev, int source);
@ -416,8 +421,8 @@ static inline uint16_t stm32l4_getreg16(FAR struct stm32l4_tim_dev_s *dev,
*
************************************************************************************/
static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev, uint8_t offset,
uint16_t value)
static inline void stm32l4_putreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset, uint16_t value)
{
putreg16(value, ((struct stm32l4_tim_priv_s *)dev)->base + offset);
}
@ -434,7 +439,8 @@ static inline void stm32l4_modifyreg16(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset, uint16_t clearbits,
uint16_t setbits)
{
modifyreg16(((struct stm32l4_tim_priv_s *)dev)->base + offset, clearbits, setbits);
modifyreg16(((struct stm32l4_tim_priv_s *)dev)->base + offset, clearbits,
setbits);
}
/************************************************************************************
@ -461,8 +467,8 @@ static inline uint32_t stm32l4_getreg32(FAR struct stm32l4_tim_dev_s *dev,
*
************************************************************************************/
static inline void stm32l4_putreg32(FAR struct stm32l4_tim_dev_s *dev, uint8_t offset,
uint32_t value)
static inline void stm32l4_putreg32(FAR struct stm32l4_tim_dev_s *dev,
uint8_t offset, uint32_t value)
{
putreg32(value, ((struct stm32l4_tim_priv_s *)dev)->base + offset);
}
@ -541,7 +547,8 @@ static void stm32l4_tim_gpioconfig(uint32_t cfg, stm32l4_tim_channel_t mode)
* Name: stm32l4_tim_setmode
************************************************************************************/
static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev, stm32l4_tim_mode_t mode)
static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev,
stm32l4_tim_mode_t mode)
{
uint16_t val = ATIM_CR1_CEN | ATIM_CR1_ARPE;
@ -611,7 +618,8 @@ static int stm32l4_tim_setmode(FAR struct stm32l4_tim_dev_s *dev, stm32l4_tim_mo
* Name: stm32l4_tim_setclock
************************************************************************************/
static int stm32l4_tim_setclock(FAR struct stm32l4_tim_dev_s *dev, uint32_t freq)
static int stm32l4_tim_setclock(FAR struct stm32l4_tim_dev_s *dev,
uint32_t freq)
{
uint32_t freqin;
int prescaler;
@ -747,8 +755,8 @@ static uint32_t stm32l4_tim_getcounter(FAR struct stm32l4_tim_dev_s *dev)
* Name: stm32l4_tim_setchannel
************************************************************************************/
static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel,
stm32l4_tim_channel_t mode)
static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev,
uint8_t channel, stm32l4_tim_channel_t mode)
{
uint16_t ccmr_orig = 0;
uint16_t ccmr_val = 0;
@ -1096,8 +1104,8 @@ static int stm32l4_tim_setchannel(FAR struct stm32l4_tim_dev_s *dev, uint8_t cha
* Name: stm32l4_tim_setcompare
************************************************************************************/
static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel,
uint32_t compare)
static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev,
uint8_t channel, uint32_t compare)
{
DEBUGASSERT(dev != NULL);
@ -1125,7 +1133,8 @@ static int stm32l4_tim_setcompare(FAR struct stm32l4_tim_dev_s *dev, uint8_t cha
* Name: stm32l4_tim_getcapture
************************************************************************************/
static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev, uint8_t channel)
static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev,
uint8_t channel)
{
DEBUGASSERT(dev != NULL);
@ -1149,7 +1158,7 @@ static int stm32l4_tim_getcapture(FAR struct stm32l4_tim_dev_s *dev, uint8_t cha
************************************************************************************/
static int stm32l4_tim_setisr(FAR struct stm32l4_tim_dev_s *dev,
int (*handler)(int irq, void *context),
int (*handler)(int irq, FAR void *context),
int source)
{
int vectorno;
@ -1256,7 +1265,8 @@ static void stm32l4_tim_enableint(FAR struct stm32l4_tim_dev_s *dev, int source)
* Name: stm32l4_tim_disableint
************************************************************************************/
static void stm32l4_tim_disableint(FAR struct stm32l4_tim_dev_s *dev, int source)
static void stm32l4_tim_disableint(FAR struct stm32l4_tim_dev_s *dev,
int source)
{
DEBUGASSERT(dev != NULL);
stm32l4_modifyreg16(dev, STM32L4_BTIM_DIER_OFFSET, ATIM_DIER_UIE, 0);

View File

@ -437,9 +437,9 @@ static int stm32l4_start(FAR struct timer_lowerhalf_s *lower)
*
****************************************************************************/
static int stm32l4_stop(struct timer_lowerhalf_s *lower)
static int stm32l4_stop(FAR struct timer_lowerhalf_s *lower)
{
struct stm32l4_lowerhalf_s *priv = (struct stm32l4_lowerhalf_s *)lower;
FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;
if (priv->started)
{
@ -471,7 +471,8 @@ static int stm32l4_stop(struct timer_lowerhalf_s *lower)
*
****************************************************************************/
static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower, uint32_t timeout)
static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower,
uint32_t timeout)
{
FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;
uint64_t maxtimeout;