MSPM0L111X Driver Library  2.05.01.00
dl_core.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!****************************************************************************
33  * @file dl_core.h
34  * @brief CPU Core Driver Library
35  * @defgroup CORE M0P Core
36  *
37  * @anchor ti_dl_m0p_dl_core_Overview
38  * # Overview
39  *
40  * The Core module enables software to read from core registers of the CPU to
41  * get more information about the device at runtime.
42  *
43  * <hr>
44  ******************************************************************************
45  */
49 #ifndef ti_dl_m0p_dl_core__include
50 #define ti_dl_m0p_dl_core__include
51 
52 #include <stdint.h>
53 
54 #include <ti/devices/msp/msp.h>
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 /* clang-format off */
61 
69 #define DL_CORE_CACHE_ENABLED (CPUSS_CTL_ICACHE_ENABLE)
70 
74 #define DL_CORE_CACHE_DISABLED (CPUSS_CTL_ICACHE_DISABLE)
75 
85 #define DL_CORE_PREFETCH_ENABLED (CPUSS_CTL_PREFETCH_ENABLE)
86 
90 #define DL_CORE_PREFETCH_DISABLED (CPUSS_CTL_PREFETCH_DISABLE)
91 
102 #define DL_CORE_LITERAL_CACHE_ENABLED (CPUSS_CTL_LITEN_ENABLE)
103 
107 #define DL_CORE_LITERAL_CACHE_DISABLED (CPUSS_CTL_LITEN_DISABLE)
108 
115 #define delay_cycles(cycles) DL_Common_delayCycles(cycles)
116 
119 /* clang-format on */
120 
121 
129 __STATIC_INLINE uint32_t DL_CORE_getImplementer(void)
130 {
131  return (
132  (SCB->CPUID & SCB_CPUID_IMPLEMENTER_Msk) >> SCB_CPUID_IMPLEMENTER_Pos);
133 }
134 
142 __STATIC_INLINE uint32_t DL_CORE_getVariant(void)
143 {
144  return ((SCB->CPUID & SCB_CPUID_VARIANT_Msk) >> SCB_CPUID_VARIANT_Pos);
145 }
146 
154 __STATIC_INLINE uint32_t DL_CORE_getArchitecture(void)
155 {
156  return ((SCB->CPUID & SCB_CPUID_ARCHITECTURE_Msk) >>
157  SCB_CPUID_ARCHITECTURE_Pos);
158 }
159 
167 __STATIC_INLINE uint32_t DL_CORE_getPartNumber(void)
168 {
169  return ((SCB->CPUID & SCB_CPUID_PARTNO_Msk) >> SCB_CPUID_PARTNO_Pos);
170 }
171 
179 __STATIC_INLINE uint32_t DL_CORE_getRevision(void)
180 {
181  return ((SCB->CPUID & (uint32_t)SCB_CPUID_REVISION_Msk) >> (uint32_t)SCB_CPUID_REVISION_Pos);
182 }
183 
193 __STATIC_INLINE void DL_CORE_configInstruction(uint32_t icache, uint32_t prefetch, uint32_t litCache)
194 {
195  CPUSS->CTL = (icache | prefetch | litCache);
196 }
197 
204 __STATIC_INLINE uint32_t DL_CORE_getInstructionConfig(void)
205 {
206  return(CPUSS->CTL & (CPUSS_CTL_ICACHE_MASK | CPUSS_CTL_PREFETCH_MASK | CPUSS_CTL_LITEN_MASK));
207 }
208 
209 #ifdef __cplusplus
210 }
211 
212 #endif
213 
214 #endif /* ti_dl_m0p_dl_core__include */
215 
__STATIC_INLINE uint32_t DL_CORE_getImplementer(void)
Get the implementer code for the processor.
Definition: dl_core.h:129
__STATIC_INLINE uint32_t DL_CORE_getVariant(void)
Get the major revision number &#39;n&#39; in the &#39;npm&#39; revision status.
Definition: dl_core.h:142
__STATIC_INLINE void DL_CORE_configInstruction(uint32_t icache, uint32_t prefetch, uint32_t litCache)
Configures instruction caching in flash accesses and instruction prefetch to flash.
Definition: dl_core.h:193
__STATIC_INLINE uint32_t DL_CORE_getArchitecture(void)
Get the architecture of the processor.
Definition: dl_core.h:154
__STATIC_INLINE uint32_t DL_CORE_getRevision(void)
Get the minor revision number &#39;m&#39; in the &#39;npm&#39; revision status.
Definition: dl_core.h:179
__STATIC_INLINE uint32_t DL_CORE_getPartNumber(void)
Get part number of the processor (not the device)
Definition: dl_core.h:167
__STATIC_INLINE uint32_t DL_CORE_getInstructionConfig(void)
Returns instruction caching, prefetch, and literal cache configuration.
Definition: dl_core.h:204
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale