diff options
| author | BernardXiong <[email protected]> | 2017-12-31 14:44:04 +0800 |
|---|---|---|
| committer | BernardXiong <[email protected]> | 2017-12-31 14:44:04 +0800 |
| commit | 341f78fed7bc2ea53f454cfb0966e43b45cb1786 (patch) | |
| tree | 435da9a1f97c8a07d1fa1d15457c208f974b5afa /components/drivers/Kconfig | |
| parent | 872975b0ab7208c60c1a46be38e58642f146d9e6 (diff) | |
[DeviceDrivers] Add more API.
1. Use float type for clock_cpu_getres() return value;
2. Add clock_cpu_microsecond/millisecond APIs.
Diffstat (limited to 'components/drivers/Kconfig')
| -rwxr-xr-x | components/drivers/Kconfig | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index 4e47b21408..dcd23715b0 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -7,7 +7,7 @@ config RT_USING_DEVICE_IPC config RT_USING_SERIAL bool "Using serial device drivers" select RT_USING_DEVICE_IPC - select RT_USING_DEVICE + select RT_USING_DEVICE default y config RT_USING_CAN @@ -24,13 +24,17 @@ config RT_USING_CPUTIME help When enable this option, the BSP should provide a rt_clock_cputime_ops for CPU time by: - clock_cpu_setops(const struct rt_clock_cputime_ops *ops); + const static struct rt_clock_cputime_ops _ops = {...}; + clock_cpu_setops(&_ops); - Then developer can use high resolution clock counter with: + Then user can use high resolution clock counter with: - ts = clock_cpu_gettime(); - /* The unit of clock_cpu_gettime() can be returned by */ - unit = clock_cpu_getres(); /* number for nanosecond */ + ts1 = clock_cpu_gettime(); + ts2 = clock_cpu_gettime(); + + /* and get the ms of delta tick with API: */ + ms_tick = clock_cpu_millisecond(t2 - t1); + us_tick = clock_cpu_microsecond(t2 - t1); if RT_USING_CPUTIME config RT_USING_CPUTIME_CORTEXM |
