Fix a couple of problems introduced in review of commit 06e27e55470c9e0b5df1c2945d4c92cbace90431.
This commit is contained in:
parent
e5ea84c1ff
commit
0344e017f9
@ -92,12 +92,9 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CONFIG_PIC32MZ_TIMER),y)
|
ifeq ($(CONFIG_PIC32MZ_TIMER),y)
|
||||||
CHIP_CSRCS += pic32mz-timer.c
|
CHIP_CSRCS += pic32mz-timer.c
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_TIMER),y)
|
ifeq ($(CONFIG_TIMER),y)
|
||||||
CHIP_CSRCS += pic32mz-timer-lowerhalf.c
|
CHIP_CSRCS += pic32mz-timer-lowerhalf.c
|
||||||
else ifeq ($(CONFIG_PIC32MZ_ONESHOT),y)
|
endif
|
||||||
CHIP_CSRCS += pic32mz-timer-lowerhalf.c
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_PIC32MZ_FREERUN),y)
|
ifeq ($(CONFIG_PIC32MZ_FREERUN),y)
|
||||||
@ -106,6 +103,9 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CONFIG_PIC32MZ_ONESHOT),y)
|
ifeq ($(CONFIG_PIC32MZ_ONESHOT),y)
|
||||||
CHIP_CSRCS += pic32mz-oneshot.c
|
CHIP_CSRCS += pic32mz-oneshot.c
|
||||||
|
ifeq ($(CONFIG_ONESHOT),y)
|
||||||
|
CHIP_CSRCS += pic32mz-oneshot-lowerhalf.c
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_PIC32MZ_ETHERNET),y)
|
ifeq ($(CONFIG_PIC32MZ_ETHERNET),y)
|
||||||
|
@ -773,7 +773,7 @@ static void pic32mz_timer_extclocksource(FAR struct pic32mz_timer_dev_s *dev,
|
|||||||
bool enable)
|
bool enable)
|
||||||
{
|
{
|
||||||
FAR struct pic32mz_timer_priv_s *priv =
|
FAR struct pic32mz_timer_priv_s *priv =
|
||||||
(FAR truct pic32mz_timer_priv_s *)dev;
|
(FAR struct pic32mz_timer_priv_s *)dev;
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
@ -944,7 +944,7 @@ static uint32_t pic32mz_timer_getfreq(FAR struct pic32mz_timer_dev_s *dev)
|
|||||||
uint8_t prescale;
|
uint8_t prescale;
|
||||||
uint32_t freq;
|
uint32_t freq;
|
||||||
|
|
||||||
prescale = ((FAR structpic32mz_timer_priv_s *)dev)->config->prescale;
|
prescale = ((FAR struct pic32mz_timer_priv_s *)dev)->config->prescale;
|
||||||
|
|
||||||
/* The prescale values are not a continuous power of 2.
|
/* The prescale values are not a continuous power of 2.
|
||||||
* There is a gap between 64 and 256 (the 128 is skipped).
|
* There is a gap between 64 and 256 (the 128 is skipped).
|
||||||
@ -1133,7 +1133,7 @@ static int pic32mz_timer_setisr(FAR struct pic32mz_timer_dev_s *dev,
|
|||||||
|
|
||||||
static void pic32mz_timer_ackint(FAR struct pic32mz_timer_dev_s *dev)
|
static void pic32mz_timer_ackint(FAR struct pic32mz_timer_dev_s *dev)
|
||||||
{
|
{
|
||||||
up_clrpend_irq(((FAR structpic32mz_timer_priv_s *)dev)->config->irq);
|
up_clrpend_irq(((FAR struct pic32mz_timer_priv_s *)dev)->config->irq);
|
||||||
|
|
||||||
if (pic32mz_timer_mode32(dev))
|
if (pic32mz_timer_mode32(dev))
|
||||||
{
|
{
|
||||||
@ -1161,7 +1161,10 @@ static bool pic32mz_timer_checkint(FAR struct pic32mz_timer_dev_s *dev)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return up_pending_irq(((FAR structpic32mz_timer_priv_s *)dev)->config->irq);
|
FAR struct pic32mz_timer_priv_s *priv =
|
||||||
|
(FAR struct pic32mz_timer_priv_s *)dev;
|
||||||
|
|
||||||
|
return up_pending_irq(priv->config->irq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1181,49 +1184,49 @@ FAR struct pic32mz_timer_dev_s *pic32mz_timer_init(int timer)
|
|||||||
{
|
{
|
||||||
#ifdef CONFIG_PIC32MZ_T2
|
#ifdef CONFIG_PIC32MZ_T2
|
||||||
case 2:
|
case 2:
|
||||||
dev = (FAR structpic32mz_timer_dev_s *)&pic32mz_t2_priv;
|
dev = (FAR struct pic32mz_timer_dev_s *)&pic32mz_t2_priv;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PIC32MZ_T3
|
#ifdef CONFIG_PIC32MZ_T3
|
||||||
case 3:
|
case 3:
|
||||||
dev = (FAR structpic32mz_timer_dev_s *)&pic32mz_t3_priv;
|
dev = (FAR struct pic32mz_timer_dev_s *)&pic32mz_t3_priv;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PIC32MZ_T4
|
#ifdef CONFIG_PIC32MZ_T4
|
||||||
case 4:
|
case 4:
|
||||||
dev = (FAR structpic32mz_timer_dev_s *)&pic32mz_t4_priv;
|
dev = (FAR struct pic32mz_timer_dev_s *)&pic32mz_t4_priv;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PIC32MZ_T5
|
#ifdef CONFIG_PIC32MZ_T5
|
||||||
case 5:
|
case 5:
|
||||||
dev = (FAR structpic32mz_timer_dev_s *)&pic32mz_t5_priv;
|
dev = (FAR struct pic32mz_timer_dev_s *)&pic32mz_t5_priv;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PIC32MZ_T6
|
#ifdef CONFIG_PIC32MZ_T6
|
||||||
case 6:
|
case 6:
|
||||||
dev = (FAR structpic32mz_timer_dev_s *)&pic32mz_t6_priv;
|
dev = (FAR struct pic32mz_timer_dev_s *)&pic32mz_t6_priv;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PIC32MZ_T7
|
#ifdef CONFIG_PIC32MZ_T7
|
||||||
case 7:
|
case 7:
|
||||||
dev = (FAR structpic32mz_timer_dev_s *)&pic32mz_t7_priv;
|
dev = (FAR struct pic32mz_timer_dev_s *)&pic32mz_t7_priv;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PIC32MZ_T8
|
#ifdef CONFIG_PIC32MZ_T8
|
||||||
case 8:
|
case 8:
|
||||||
dev = (FAR structpic32mz_timer_dev_s *)&pic32mz_t8_priv;
|
dev = (FAR struct pic32mz_timer_dev_s *)&pic32mz_t8_priv;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PIC32MZ_T9
|
#ifdef CONFIG_PIC32MZ_T9
|
||||||
case 9:
|
case 9:
|
||||||
dev = (FAR structpic32mz_timer_dev_s *)&pic32mz_t9_priv;
|
dev = (FAR struct pic32mz_timer_dev_s *)&pic32mz_t9_priv;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((FAR structpic32mz_timer_priv_s *)dev)->inuse)
|
if (((FAR struct pic32mz_timer_priv_s *)dev)->inuse)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1233,7 +1236,7 @@ FAR struct pic32mz_timer_dev_s *pic32mz_timer_init(int timer)
|
|||||||
|
|
||||||
pic32mz_timer_inithardware(dev);
|
pic32mz_timer_inithardware(dev);
|
||||||
|
|
||||||
((FAR structpic32mz_timer_priv_s *)dev)->inuse = true;
|
((FAR struct pic32mz_timer_priv_s *)dev)->inuse = true;
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
@ -1246,7 +1249,7 @@ int pic32mz_timer_deinit(FAR struct pic32mz_timer_dev_s *dev)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
pic32mz_timer_stop(dev);
|
pic32mz_timer_stop(dev);
|
||||||
((FAR structpic32mz_timer_priv_s *)dev)->inuse = false;
|
((FAR struct pic32mz_timer_priv_s *)dev)->inuse = false;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user