more component for port

This commit is contained in:
2026-05-29 21:27:35 +08:00
parent 345be1983b
commit d57a09872d
6 changed files with 412 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
#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*/