forked from stm32duino/Arduino_Core_STM32
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdwt.h
61 lines (50 loc) · 1.37 KB
/
dwt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
******************************************************************************
* @file dwt.h
* @author Frederic Pillon
* @brief Header for dwt.c module
******************************************************************************
* @attention
*
* Copyright (c) 2019, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef _DWT_H_
#define _DWT_H_
#include "stm32_def.h"
#include <stdbool.h>
#ifdef DWT_BASE
#ifdef __cplusplus
extern "C" {
#endif
uint32_t dwt_init(void);
void dwt_access(bool ena);
static inline uint32_t dwt_max_sec(void)
{
return (UINT32_MAX / SystemCoreClock);
};
static inline uint32_t dwt_max_msec(void)
{
return (UINT32_MAX / (SystemCoreClock / 1000));
};
static inline uint32_t dwt_max_usec(void)
{
return (UINT32_MAX / (SystemCoreClock / 1000000));
};
static inline uint32_t dwt_getCycles(void)
{
return (DWT->CYCCNT);
};
#ifdef __cplusplus
}
#endif
#endif /* DWT_BASE */
#endif /* _DWT_H_ */