diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-07 18:00:38 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-07 18:00:38 -0600 |
commit | f4f8030be0af79250de05d323106dd34a5e7dc85 (patch) | |
tree | ac6ac62508e391422efee525bc3c438206e31259 /nuttx/arch/arm | |
parent | f39ae5a8b656f320d99f391972e8b81a8c2d52fd (diff) | |
download | px4-nuttx-f4f8030be0af79250de05d323106dd34a5e7dc85.tar.gz px4-nuttx-f4f8030be0af79250de05d323106dd34a5e7dc85.tar.bz2 px4-nuttx-f4f8030be0af79250de05d323106dd34a5e7dc85.zip |
Change all time conversions. Yech. New timer units in microseconds breaks all existing logic that used milliseconds in the conversions. Something likely got broken doing this, probably because I confused a MSEC2TICK conversion with a TICK2MSEC conversion. Also, the tickless OS no appears fully functional and passes the OS test on the simulator with no errors
Diffstat (limited to 'nuttx/arch/arm')
-rw-r--r-- | nuttx/arch/arm/src/arm/up_unblocktask.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_unblocktask.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv7-a/arm_unblocktask.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv7-m/up_unblocktask.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/c5471/c5471_timerisr.c | 4 | ||||
-rw-r--r-- | nuttx/arch/arm/src/dm320/dm320_timerisr.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_timerisr.c | 4 | ||||
-rw-r--r-- | nuttx/arch/arm/src/kinetis/kinetis_sdhc.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sam34/sam_hsmci.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sam34/sam_spi.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_hsmci.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_spi.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_ssc.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_tsd.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_twi.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_otgfshost.c | 4 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_sdio.c | 2 |
18 files changed, 21 insertions, 21 deletions
diff --git a/nuttx/arch/arm/src/arm/up_unblocktask.c b/nuttx/arch/arm/src/arm/up_unblocktask.c index 64536d959..3476441b4 100644 --- a/nuttx/arch/arm/src/arm/up_unblocktask.c +++ b/nuttx/arch/arm/src/arm/up_unblocktask.c @@ -97,7 +97,7 @@ void up_unblock_task(struct tcb_s *tcb) */ #if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK; + tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); #endif /* Add the task in the correct location in the prioritized diff --git a/nuttx/arch/arm/src/armv6-m/up_unblocktask.c b/nuttx/arch/arm/src/armv6-m/up_unblocktask.c index 0d51d21ca..7a76a24d8 100644 --- a/nuttx/arch/arm/src/armv6-m/up_unblocktask.c +++ b/nuttx/arch/arm/src/armv6-m/up_unblocktask.c @@ -96,7 +96,7 @@ void up_unblock_task(struct tcb_s *tcb) */ #if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK; + tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); #endif /* Add the task in the correct location in the prioritized diff --git a/nuttx/arch/arm/src/armv7-a/arm_unblocktask.c b/nuttx/arch/arm/src/armv7-a/arm_unblocktask.c index f08ceeca3..c5ca09092 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_unblocktask.c +++ b/nuttx/arch/arm/src/armv7-a/arm_unblocktask.c @@ -97,7 +97,7 @@ void up_unblock_task(struct tcb_s *tcb) */ #if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK; + tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); #endif /* Add the task in the correct location in the prioritized diff --git a/nuttx/arch/arm/src/armv7-m/up_unblocktask.c b/nuttx/arch/arm/src/armv7-m/up_unblocktask.c index 551e5b67b..f2455e594 100644 --- a/nuttx/arch/arm/src/armv7-m/up_unblocktask.c +++ b/nuttx/arch/arm/src/armv7-m/up_unblocktask.c @@ -97,7 +97,7 @@ void up_unblock_task(struct tcb_s *tcb) */ #if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK; + tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); #endif /* Add the task in the correct location in the prioritized diff --git a/nuttx/arch/arm/src/c5471/c5471_timerisr.c b/nuttx/arch/arm/src/c5471/c5471_timerisr.c index 1021fb84a..fc1143162 100644 --- a/nuttx/arch/arm/src/c5471/c5471_timerisr.c +++ b/nuttx/arch/arm/src/c5471/c5471_timerisr.c @@ -53,7 +53,7 @@ ************************************************************/ /* We want the general purpose timer running at the rate - * MSEC_PER_TICK. The C5471 clock is 47.5MHz and we're using + * USEC_PER_TICK. The C5471 clock is 47.5MHz and we're using * a timer PTV value of 3 (3 == divide incoming frequency by * 16) which then yields a 16 bitCLKS_PER_INT value * of 29687. @@ -114,7 +114,7 @@ void up_timer_initialize(void) up_disable_irq(C5471_IRQ_SYSTIMER); /* Start the general purpose timer running in auto-reload mode - * so that an interrupt is generated at the rate MSEC_PER_TICK. + * so that an interrupt is generated at the rate USEC_PER_TICK. */ val = ((CLKS_PER_INT-1) << CLKS_PER_INT_SHIFT) | AR | ST | PTV; diff --git a/nuttx/arch/arm/src/dm320/dm320_timerisr.c b/nuttx/arch/arm/src/dm320/dm320_timerisr.c index a92478aa3..fae340714 100644 --- a/nuttx/arch/arm/src/dm320/dm320_timerisr.c +++ b/nuttx/arch/arm/src/dm320/dm320_timerisr.c @@ -139,7 +139,7 @@ void up_timer_initialize(void) up_disable_irq(DM320_IRQ_SYSTIMER); /* Start timer0 running so that an interrupt is generated at - * the rate MSEC_PER_TICK. + * the rate USEC_PER_TICK. */ putreg16(DM320_TMR0_PRSCL, DM320_TIMER0_TMPRSCL); /* Timer 0 Prescalar */ diff --git a/nuttx/arch/arm/src/imx/imx_timerisr.c b/nuttx/arch/arm/src/imx/imx_timerisr.c index 64db2e06d..d21b804c6 100644 --- a/nuttx/arch/arm/src/imx/imx_timerisr.c +++ b/nuttx/arch/arm/src/imx/imx_timerisr.c @@ -138,11 +138,11 @@ void up_timer_initialize(void) * putreg(0, IMX_TIMER1_TPRER); -- already the case * * Set the compare register so that the COMP interrupt is generated - * with a period of MSEC_PER_TICK. The value IMX_PERCLK1_FREQ/1000 + * with a period of USEC_PER_TICK. The value IMX_PERCLK1_FREQ/1000 * (defined in board.h) is the number of counts in millisecond, so: */ - putreg32((IMX_PERCLK1_FREQ / 1000) * MSEC_PER_TICK, IMX_TIMER1_TCMP); + putreg32(MSEC2TICK(IMX_PERCLK1_FREQ / 1000), IMX_TIMER1_TCMP); /* Configure to provide timer COMP interrupts when TCN increments * to TCMP. diff --git a/nuttx/arch/arm/src/kinetis/kinetis_sdhc.c b/nuttx/arch/arm/src/kinetis/kinetis_sdhc.c index 3ba8c4299..6ff5092e5 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_sdhc.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_sdhc.c @@ -2409,7 +2409,7 @@ static sdio_eventset_t kinetis_eventwait(FAR struct sdio_dev_s *dev, /* Start the watchdog timer */ - delay = (timeout + (MSEC_PER_TICK-1)) / MSEC_PER_TICK; + delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)kinetis_eventtimeout, 1, (uint32_t)priv); if (ret != OK) diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c b/nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c index 0fd719f24..d5b143118 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c @@ -2266,7 +2266,7 @@ static sdio_eventset_t lpc17_eventwait(FAR struct sdio_dev_s *dev, /* Start the watchdog timer */ - delay = (timeout + (MSEC_PER_TICK-1)) / MSEC_PER_TICK; + delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)lpc17_eventtimeout, 1, (uint32_t)priv); if (ret != OK) diff --git a/nuttx/arch/arm/src/sam34/sam_hsmci.c b/nuttx/arch/arm/src/sam34/sam_hsmci.c index 94d052bd1..d770b2d2b 100644 --- a/nuttx/arch/arm/src/sam34/sam_hsmci.c +++ b/nuttx/arch/arm/src/sam34/sam_hsmci.c @@ -2273,7 +2273,7 @@ static sdio_eventset_t sam_eventwait(FAR struct sdio_dev_s *dev, /* Start the watchdog timer */ - delay = (timeout + (MSEC_PER_TICK-1)) / MSEC_PER_TICK; + delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)sam_eventtimeout, 1, (uint32_t)priv); if (ret != OK) diff --git a/nuttx/arch/arm/src/sam34/sam_spi.c b/nuttx/arch/arm/src/sam34/sam_spi.c index 5e32faf69..81c73a76f 100644 --- a/nuttx/arch/arm/src/sam34/sam_spi.c +++ b/nuttx/arch/arm/src/sam34/sam_spi.c @@ -127,7 +127,7 @@ */ #define DMA_TIMEOUT_MS (800) -#define DMA_TIMEOUT_TICKS ((DMA_TIMEOUT_MS + (MSEC_PER_TICK-1)) / MSEC_PER_TICK) +#define DMA_TIMEOUT_TICKS MSEC2TICK(DMA_TIMEOUT_MS) /* Debug *******************************************************************/ /* Check if SPI debut is enabled (non-standard.. no support in diff --git a/nuttx/arch/arm/src/sama5/sam_hsmci.c b/nuttx/arch/arm/src/sama5/sam_hsmci.c index f0a0d3be1..670c3a69f 100644 --- a/nuttx/arch/arm/src/sama5/sam_hsmci.c +++ b/nuttx/arch/arm/src/sama5/sam_hsmci.c @@ -2737,7 +2737,7 @@ static sdio_eventset_t sam_eventwait(FAR struct sdio_dev_s *dev, timeout = MAX(5000, timeout); } - delay = (timeout + (MSEC_PER_TICK-1)) / MSEC_PER_TICK; + delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)sam_eventtimeout, 1, (uint32_t)priv); if (ret != OK) diff --git a/nuttx/arch/arm/src/sama5/sam_spi.c b/nuttx/arch/arm/src/sama5/sam_spi.c index 104691077..3a1a4652a 100644 --- a/nuttx/arch/arm/src/sama5/sam_spi.c +++ b/nuttx/arch/arm/src/sama5/sam_spi.c @@ -120,7 +120,7 @@ */ #define DMA_TIMEOUT_MS (800) -#define DMA_TIMEOUT_TICKS ((DMA_TIMEOUT_MS + (MSEC_PER_TICK-1)) / MSEC_PER_TICK) +#define DMA_TIMEOUT_TICKS MSEC2TICK(DMA_TIMEOUT_MS) /* Debug *******************************************************************/ /* Check if SPI debut is enabled (non-standard.. no support in diff --git a/nuttx/arch/arm/src/sama5/sam_ssc.c b/nuttx/arch/arm/src/sama5/sam_ssc.c index 475cf06b2..570b85078 100644 --- a/nuttx/arch/arm/src/sama5/sam_ssc.c +++ b/nuttx/arch/arm/src/sama5/sam_ssc.c @@ -390,7 +390,7 @@ */ #define DMA_TIMEOUT_MS (800) -#define DMA_TIMEOUT_TICKS ((DMA_TIMEOUT_MS + (MSEC_PER_TICK-1)) / MSEC_PER_TICK) +#define DMA_TIMEOUT_TICKS MSEC2TICK(DMA_TIMEOUT_MS) /* Debug *******************************************************************/ /* Check if SSC debut is enabled (non-standard.. no support in diff --git a/nuttx/arch/arm/src/sama5/sam_tsd.c b/nuttx/arch/arm/src/sama5/sam_tsd.c index c3d45307f..fe73afc3d 100644 --- a/nuttx/arch/arm/src/sama5/sam_tsd.c +++ b/nuttx/arch/arm/src/sama5/sam_tsd.c @@ -89,7 +89,7 @@ /* Poll the pen position while the pen is down at this rate (50MS): */ -#define TSD_WDOG_DELAY ((50 + (MSEC_PER_TICK-1))/ MSEC_PER_TICK) +#define TSD_WDOG_DELAY MSEC2TICK(50) /* This is a value for the threshold that guantees a big difference on the * first pendown (but can't overflow). diff --git a/nuttx/arch/arm/src/sama5/sam_twi.c b/nuttx/arch/arm/src/sama5/sam_twi.c index 2e1c6a1a9..eec19f6e6 100644 --- a/nuttx/arch/arm/src/sama5/sam_twi.c +++ b/nuttx/arch/arm/src/sama5/sam_twi.c @@ -527,7 +527,7 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size) * There is no concern about arithmetic overflow for reasonable transfer sizes. */ - timeout = (TWI_TIMEOUT_MSPB * size) / MSEC_PER_TICK; + timeout = MSEC2TICK(TWI_TIMEOUT_MSPB); if (timeout < 1) { timeout = 1; diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfshost.c b/nuttx/arch/arm/src/stm32/stm32_otgfshost.c index 7866365d9..7fe99c1c3 100644 --- a/nuttx/arch/arm/src/stm32/stm32_otgfshost.c +++ b/nuttx/arch/arm/src/stm32/stm32_otgfshost.c @@ -151,8 +151,8 @@ #define STM32_READY_DELAY 200000 /* In loop counts */ #define STM32_FLUSH_DELAY 200000 /* In loop counts */ -#define STM32_SETUP_DELAY (5000 / MSEC_PER_TICK) /* 5 seconds in system ticks */ -#define STM32_DATANAK_DELAY (5000 / MSEC_PER_TICK) /* 5 seconds in system ticks */ +#define STM32_SETUP_DELAY SEC2TICK(5) /* 5 seconds in system ticks */ +#define STM32_DATANAK_DELAY SEC2TICK(5) /* 5 seconds in system ticks */ /* Ever-present MIN/MAX macros */ diff --git a/nuttx/arch/arm/src/stm32/stm32_sdio.c b/nuttx/arch/arm/src/stm32/stm32_sdio.c index f731ad75c..cc164bc80 100644 --- a/nuttx/arch/arm/src/stm32/stm32_sdio.c +++ b/nuttx/arch/arm/src/stm32/stm32_sdio.c @@ -2315,7 +2315,7 @@ static sdio_eventset_t stm32_eventwait(FAR struct sdio_dev_s *dev, /* Start the watchdog timer */ - delay = (timeout + (MSEC_PER_TICK-1)) / MSEC_PER_TICK; + delay = MSEC2TICK(timeout); ret = wd_start(priv->waitwdog, delay, (wdentry_t)stm32_eventtimeout, 1, (uint32_t)priv); if (ret != OK) |