RTEMS 6.1-rc1
fsl_common_dsp.h
1/*
2 * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2020 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef _FSL_COMMON_DSP_H_
10#define _FSL_COMMON_DSP_H_
11
17/*******************************************************************************
18 * Definitions
19 ******************************************************************************/
20
22/* @{ */
24#define USEC_TO_COUNT(us, clockFreqInHz) (uint64_t)(((uint64_t)(us) * (clockFreqInHz)) / 1000000U)
26#define COUNT_TO_USEC(count, clockFreqInHz) (uint64_t)((uint64_t)(count) * 1000000U / (clockFreqInHz))
27
29#define MSEC_TO_COUNT(ms, clockFreqInHz) (uint64_t)((uint64_t)(ms) * (clockFreqInHz) / 1000U)
31#define COUNT_TO_MSEC(count, clockFreqInHz) (uint64_t)((uint64_t)(count) * 1000U / (clockFreqInHz))
32/* @} */
33
34#define SDK_ISR_EXIT_BARRIER
35
37/* @{ */
39#define SDK_ALIGN(var, alignbytes) var __attribute__((aligned(alignbytes)))
40
42#if defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)
43#define SDK_L1DCACHE_ALIGN(var) SDK_ALIGN(var, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)
44#endif
45
47#if defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)
48#define SDK_L2CACHE_ALIGN(var) SDK_ALIGN(var, FSL_FEATURE_L2CACHE_LINESIZE_BYTE)
49#endif
50
52#define SDK_SIZEALIGN(var, alignbytes) \
53 ((unsigned int)((var) + ((alignbytes)-1U)) & (unsigned int)(~(unsigned int)((alignbytes)-1U)))
54/* @} */
55
57/* For initialized non-zero non-cacheable variables, please using "AT_NONCACHEABLE_SECTION_INIT(var) ={xx};" or
58 * "AT_NONCACHEABLE_SECTION_ALIGN_INIT(var) ={xx};" in your projects to define them, for zero-inited non-cacheable variables,
59 * please using "AT_NONCACHEABLE_SECTION(var);" or "AT_NONCACHEABLE_SECTION_ALIGN(var);" to define them, these zero-inited variables
60 * will be initialized to zero in system startup.
61 */
62/* @{ */
63
64#define AT_NONCACHEABLE_SECTION_INIT(var) __attribute__((section("NonCacheable.init"))) var
65#define AT_NONCACHEABLE_SECTION(var) __attribute__((section("NonCacheable"))) var
66#define AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) \
67 __attribute__((section("NonCacheable.init"))) var __attribute__((aligned(alignbytes)))
68#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) \
69 __attribute__((section("NonCacheable"))) var __attribute__((aligned(alignbytes)))
70
71/* @} */
72
77#if (defined(FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE) && FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE)
78
79#define AT_QUICKACCESS_SECTION_CODE(func) __attribute__((section("CodeQuickAccess"), __noinline__)) func
80#define AT_QUICKACCESS_SECTION_DATA(func) __attribute__((section("DataQuickAccess"))) func
81
82#else /* __FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE */
83
84#define AT_QUICKACCESS_SECTION_CODE(func) func
85#define AT_QUICKACCESS_SECTION_DATA(func) func
86
87#endif /* __FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE */
88/* @} */
89
90/* Macros for compatibility. */
91#define NVIC_SetPriorityGrouping(value) do {} while(0)
92#define NVIC_GetPriorityGrouping() do {} while(0)
93#define NVIC_EnableIRQ(value) do {} while(0)
94#define NVIC_GetEnableIRQ(value) do {} while(0)
95#define NVIC_DisableIRQ(value) do {} while(0)
96#define NVIC_GetPendingIRQ(value) do {} while(0)
97#define NVIC_SetPendingIRQ(value) do {} while(0)
98#define NVIC_ClearPendingIRQ(value) do {} while(0)
99#define NVIC_GetActive(value) do {} while(0)
100
101/*
102 * The fsl_clock.h is included here because it needs MAKE_VERSION/MAKE_STATUS/status_t
103 * defined in previous of this file.
104 */
105#include "fsl_clock.h"
106
107/*******************************************************************************
108 * API
109 ******************************************************************************/
110
111#if defined(__cplusplus)
112extern "C" {
113#endif
114
123static inline status_t EnableIRQ(IRQn_Type interrupt)
124{
125 return kStatus_Success;
126}
127
136static inline status_t DisableIRQ(IRQn_Type interrupt)
137{
138 return kStatus_Success;
139}
140
148static inline uint32_t DisableGlobalIRQ(void)
149{
150 return 0;
151}
152
160static inline void EnableGlobalIRQ(uint32_t primask)
161{
162}
163
164#if defined(__cplusplus)
165}
166#endif
167
170#endif /* _FSL_COMMON_DSP_H_ */
IRQn_Type
STM32H7XX Interrupt Number Definition, according to the selected device in Library_configuration_sect...
Definition: stm32h723xx.h:49
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
@ kStatus_Success
Definition: fsl_common.h:211