39 lines
1015 B
C
39 lines
1015 B
C
#ifndef INCLUDED_DWT_DELAY_H
|
|||
|
|
#define INCLUDED_DWT_DELAY_H
|
||
|
|
|
||
|
|
#ifndef INCLUDED_OS_TYPES_H
|
||
|
|
#include <os_types.h>
|
||
|
|
#endif /*INCLUDED_OS_TYPES_H*/
|
||
|
|
|
||
|
|
#ifndef INCLUDED_OS_COMPILER_H
|
||
|
|
#include <os_compiler.h>
|
||
|
|
#endif /*INCLUDED_OS_COMPILER_H*/
|
||
|
|
|
||
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
||
|
|
/* */
|
||
|
|
|
||
|
|
//寄存器基地址
|
||
|
|
#define DWT_CR *(uint32_t*)0xE0001000
|
||
|
|
#define DWT_CYCCNT *(uint32_t*)0xE0001004
|
||
|
|
#define DEM_CR *(uint32_t*)0xE000EDFC
|
||
|
|
|
||
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
||
|
|
/* */
|
||
|
|
|
||
|
|
OS_STATIC_FORCE_INLINE
|
||
|
|
uint32_t DWT_Get(void){
|
||
|
|
return ((uint32_t )DWT_CYCCNT);
|
||
|
|
}
|
||
|
|
|
||
|
|
void DWT_Init(void);
|
||
|
|
|
||
|
|
void DWT_DelayUs(uint32_t us);
|
||
|
|
|
||
|
|
void DWT_DelayMs(uint32_t ms);
|
||
|
|
|
||
|
|
float DTW_Time_DiffMs(volatile uint32_t start, volatile uint32_t stop);
|
||
|
|
|
||
|
|
float DTW_Time_DiffUs(volatile uint32_t start, volatile uint32_t stop);
|
||
|
|
|
||
|
|
#endif /*INCLUDED_DWT_DELAY_H*/
|