summaryrefslogtreecommitdiff
path: root/components/drivers/cputime
diff options
context:
space:
mode:
Diffstat (limited to 'components/drivers/cputime')
-rw-r--r--components/drivers/cputime/cputime.c10
-rw-r--r--components/drivers/cputime/cputime_cortexm.c12
2 files changed, 11 insertions, 11 deletions
diff --git a/components/drivers/cputime/cputime.c b/components/drivers/cputime/cputime.c
index 3ec860d5c5..4a9eee3a71 100644
--- a/components/drivers/cputime/cputime.c
+++ b/components/drivers/cputime/cputime.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -14,7 +14,7 @@
static const struct rt_clock_cputime_ops *_cputime_ops = RT_NULL;
/**
- * The clock_cpu_getres() function shall return the resolution of CPU time, the
+ * The clock_cpu_getres() function shall return the resolution of CPU time, the
* number of nanosecond per tick.
*
* @return the number of nanosecond per tick
@@ -43,7 +43,7 @@ uint32_t clock_cpu_gettime(void)
}
/**
- * The clock_cpu_microsecond() fucntion shall return the microsecond according to
+ * The clock_cpu_microsecond() fucntion shall return the microsecond according to
* cpu_tick parameter.
*
* @param cpu_tick the cpu tick
@@ -58,7 +58,7 @@ uint32_t clock_cpu_microsecond(uint32_t cpu_tick)
}
/**
- * The clock_cpu_microsecond() fucntion shall return the millisecond according to
+ * The clock_cpu_microsecond() fucntion shall return the millisecond according to
* cpu_tick parameter.
*
* @param cpu_tick the cpu tick
@@ -74,7 +74,7 @@ uint32_t clock_cpu_millisecond(uint32_t cpu_tick)
/**
* The clock_cpu_seops() function shall set the ops of cpu time.
- *
+ *
* @return always return 0.
*/
int clock_cpu_setops(const struct rt_clock_cputime_ops *ops)
diff --git a/components/drivers/cputime/cputime_cortexm.c b/components/drivers/cputime/cputime_cortexm.c
index 05ed6ed447..071acfe9bb 100644
--- a/components/drivers/cputime/cputime_cortexm.c
+++ b/components/drivers/cputime/cputime_cortexm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -19,7 +19,7 @@
static float cortexm_cputime_getres(void)
{
float ret = 1000 * 1000 * 1000;
-
+
ret = ret / SystemCoreClock;
return ret;
}
@@ -29,7 +29,7 @@ static uint32_t cortexm_cputime_gettime(void)
return DWT->CYCCNT;
}
-const static struct rt_clock_cputime_ops _cortexm_ops =
+const static struct rt_clock_cputime_ops _cortexm_ops =
{
cortexm_cputime_getres,
cortexm_cputime_gettime
@@ -38,13 +38,13 @@ const static struct rt_clock_cputime_ops _cortexm_ops =
int cortexm_cputime_init(void)
{
/* check support bit */
- if ((DWT->CTRL & (1UL << DWT_CTRL_NOCYCCNT_Pos)) == 0)
+ if ((DWT->CTRL & (1UL << DWT_CTRL_NOCYCCNT_Pos)) == 0)
{
/* enable trace*/
CoreDebug->DEMCR |= (1UL << CoreDebug_DEMCR_TRCENA_Pos);
-
+
/* whether cycle counter not enabled */
- if ((DWT->CTRL & (1UL << DWT_CTRL_CYCCNTENA_Pos)) == 0)
+ if ((DWT->CTRL & (1UL << DWT_CTRL_CYCCNTENA_Pos)) == 0)
{
/* enable cycle counter */
DWT->CTRL |= (1UL << DWT_CTRL_CYCCNTENA_Pos);