diff options
| author | Bernard Xiong <[email protected]> | 2017-12-23 23:34:23 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2017-12-24 00:06:29 +0800 |
| commit | 7c4417855e6bc0c863e6206c369cf8fc6ec77766 (patch) | |
| tree | 35a5402b1ad9ac2dba38474231894a12816e8155 /components/drivers/include | |
| parent | ef922c30885495e1b65e1c3926e6684d65614fdb (diff) | |
[DeviceDrivers] Add CPU time
Diffstat (limited to 'components/drivers/include')
| -rw-r--r-- | components/drivers/include/drivers/cputime.h | 39 | ||||
| -rw-r--r-- | components/drivers/include/rtdevice.h | 4 |
2 files changed, 43 insertions, 0 deletions
diff --git a/components/drivers/include/drivers/cputime.h b/components/drivers/include/drivers/cputime.h new file mode 100644 index 0000000000..54037146bb --- /dev/null +++ b/components/drivers/include/drivers/cputime.h @@ -0,0 +1,39 @@ +/* + * File : cputime.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2017, RT-Thread Development Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Change Logs: + * Date Author Notes + * 2017-12-23 Bernard first version + */ + +#ifndef CPUTIME_H__ +#define CPUTIME_H__ + +struct rt_clock_cputime_ops +{ + uint32_t (*cputime_getres) (void); + uint32_t (*cputime_gettime)(void); +}; + +uint32_t clock_cpu_getres(void); +uint32_t clock_cpu_gettime(void); + +int clock_cpu_setops(const struct rt_clock_cputime_ops *ops); + +#endif diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h index 0f021da66e..f7aadd8305 100644 --- a/components/drivers/include/rtdevice.h +++ b/components/drivers/include/rtdevice.h @@ -108,6 +108,10 @@ extern "C" { #include "drivers/audio.h" #endif +#ifdef RT_USING_CPUTIME +#include "drivers/cputime.h" +#endif + #ifdef __cplusplus } #endif |
