RTEMS 6.1-rc5
Loading...
Searching...
No Matches
stm32h7xx_ll_hsem.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_LL_HSEM_H
21#define STM32H7xx_LL_HSEM_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx.h"
29
34#if defined(HSEM)
35
41/* Private types -------------------------------------------------------------*/
42/* Private variables ---------------------------------------------------------*/
43/* Private constants ---------------------------------------------------------*/
44/* Private macros ------------------------------------------------------------*/
45
46/* Exported types ------------------------------------------------------------*/
47/* Exported constants --------------------------------------------------------*/
48
58#define LL_HSEM_COREID_NONE 0U
59#define LL_HSEM_COREID_CPU1 HSEM_CR_COREID_CPU1
60#if defined(DUAL_CORE)
61#define LL_HSEM_COREID_CPU2 HSEM_CR_COREID_CPU2
62#endif /* DUAL_CORE */
63#define LL_HSEM_COREID HSEM_CR_COREID_CURRENT
75#define LL_HSEM_SEMAPHORE_0 HSEM_C1IER_ISE0
76#define LL_HSEM_SEMAPHORE_1 HSEM_C1IER_ISE1
77#define LL_HSEM_SEMAPHORE_2 HSEM_C1IER_ISE2
78#define LL_HSEM_SEMAPHORE_3 HSEM_C1IER_ISE3
79#define LL_HSEM_SEMAPHORE_4 HSEM_C1IER_ISE4
80#define LL_HSEM_SEMAPHORE_5 HSEM_C1IER_ISE5
81#define LL_HSEM_SEMAPHORE_6 HSEM_C1IER_ISE6
82#define LL_HSEM_SEMAPHORE_7 HSEM_C1IER_ISE7
83#define LL_HSEM_SEMAPHORE_8 HSEM_C1IER_ISE8
84#define LL_HSEM_SEMAPHORE_9 HSEM_C1IER_ISE9
85#define LL_HSEM_SEMAPHORE_10 HSEM_C1IER_ISE10
86#define LL_HSEM_SEMAPHORE_11 HSEM_C1IER_ISE11
87#define LL_HSEM_SEMAPHORE_12 HSEM_C1IER_ISE12
88#define LL_HSEM_SEMAPHORE_13 HSEM_C1IER_ISE13
89#define LL_HSEM_SEMAPHORE_14 HSEM_C1IER_ISE14
90#define LL_HSEM_SEMAPHORE_15 HSEM_C1IER_ISE15
91#if (HSEM_SEMID_MAX == 15)
92#define LL_HSEM_SEMAPHORE_ALL 0x0000FFFFU
93#else /* HSEM_SEMID_MAX == 31 */
94#define LL_HSEM_SEMAPHORE_16 HSEM_C1IER_ISE16
95#define LL_HSEM_SEMAPHORE_17 HSEM_C1IER_ISE17
96#define LL_HSEM_SEMAPHORE_18 HSEM_C1IER_ISE18
97#define LL_HSEM_SEMAPHORE_19 HSEM_C1IER_ISE19
98#define LL_HSEM_SEMAPHORE_20 HSEM_C1IER_ISE20
99#define LL_HSEM_SEMAPHORE_21 HSEM_C1IER_ISE21
100#define LL_HSEM_SEMAPHORE_22 HSEM_C1IER_ISE22
101#define LL_HSEM_SEMAPHORE_23 HSEM_C1IER_ISE23
102#define LL_HSEM_SEMAPHORE_24 HSEM_C1IER_ISE24
103#define LL_HSEM_SEMAPHORE_25 HSEM_C1IER_ISE25
104#define LL_HSEM_SEMAPHORE_26 HSEM_C1IER_ISE26
105#define LL_HSEM_SEMAPHORE_27 HSEM_C1IER_ISE27
106#define LL_HSEM_SEMAPHORE_28 HSEM_C1IER_ISE28
107#define LL_HSEM_SEMAPHORE_29 HSEM_C1IER_ISE29
108#define LL_HSEM_SEMAPHORE_30 HSEM_C1IER_ISE30
109#define LL_HSEM_SEMAPHORE_31 HSEM_C1IER_ISE31
110#define LL_HSEM_SEMAPHORE_ALL 0xFFFFFFFFU
111#endif /* HSEM_SEMID_MAX == 15 */
120/* Exported macro ------------------------------------------------------------*/
138#define LL_HSEM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
139
146#define LL_HSEM_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
155/* Exported functions --------------------------------------------------------*/
174__STATIC_INLINE uint32_t LL_HSEM_IsSemaphoreLocked(HSEM_TypeDef *HSEMx, uint32_t Semaphore)
175{
176 return ((READ_BIT(HSEMx->R[Semaphore], HSEM_R_LOCK) == (HSEM_R_LOCK_Msk)) ? 1UL : 0UL);
177}
178
189__STATIC_INLINE uint32_t LL_HSEM_GetCoreId(HSEM_TypeDef *HSEMx, uint32_t Semaphore)
190{
191 return (uint32_t)(READ_BIT(HSEMx->R[Semaphore], HSEM_R_COREID_Msk));
192}
193
201__STATIC_INLINE uint32_t LL_HSEM_GetProcessId(HSEM_TypeDef *HSEMx, uint32_t Semaphore)
202{
203 return (uint32_t)(READ_BIT(HSEMx->R[Semaphore], HSEM_R_PROCID_Msk));
204}
205
217__STATIC_INLINE void LL_HSEM_SetLock(HSEM_TypeDef *HSEMx, uint32_t Semaphore, uint32_t process)
218{
219 WRITE_REG(HSEMx->R[Semaphore], (HSEM_R_LOCK | LL_HSEM_COREID | process));
220}
221
232__STATIC_INLINE uint32_t LL_HSEM_2StepLock(HSEM_TypeDef *HSEMx, uint32_t Semaphore, uint32_t process)
233{
234 WRITE_REG(HSEMx->R[Semaphore], (HSEM_R_LOCK | LL_HSEM_COREID | process));
235 return ((HSEMx->R[Semaphore] != (HSEM_R_LOCK | LL_HSEM_COREID | process)) ? 1UL : 0UL);
236}
237
247__STATIC_INLINE uint32_t LL_HSEM_1StepLock(HSEM_TypeDef *HSEMx, uint32_t Semaphore)
248{
249 return ((HSEMx->RLR[Semaphore] != (HSEM_RLR_LOCK | LL_HSEM_COREID)) ? 1UL : 0UL);
250}
251
261__STATIC_INLINE void LL_HSEM_ReleaseLock(HSEM_TypeDef *HSEMx, uint32_t Semaphore, uint32_t process)
262{
263 WRITE_REG(HSEMx->R[Semaphore], (LL_HSEM_COREID | process));
264}
265
272__STATIC_INLINE uint32_t LL_HSEM_GetStatus(HSEM_TypeDef *HSEMx, uint32_t Semaphore)
273{
274 return ((HSEMx->R[Semaphore] != 0U) ? 1UL : 0UL);
275}
276
284__STATIC_INLINE void LL_HSEM_SetKey(HSEM_TypeDef *HSEMx, uint32_t key)
285{
286 WRITE_REG(HSEMx->KEYR, key << HSEM_KEYR_KEY_Pos);
287}
288
295__STATIC_INLINE uint32_t LL_HSEM_GetKey(HSEM_TypeDef *HSEMx)
296{
297 return (uint32_t)(READ_BIT(HSEMx->KEYR, HSEM_KEYR_KEY) >> HSEM_KEYR_KEY_Pos);
298}
299
312__STATIC_INLINE void LL_HSEM_ResetAllLock(HSEM_TypeDef *HSEMx, uint32_t key, uint32_t core)
313{
314 WRITE_REG(HSEMx->CR, (key << HSEM_CR_KEY_Pos) | core);
315}
316
368__STATIC_INLINE void LL_HSEM_EnableIT_C1IER(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
369{
370 SET_BIT(HSEMx->C1IER, SemaphoreMask);
371}
372
415__STATIC_INLINE void LL_HSEM_DisableIT_C1IER(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
416{
417 CLEAR_BIT(HSEMx->C1IER, SemaphoreMask);
418}
419
462__STATIC_INLINE uint32_t LL_HSEM_IsEnabledIT_C1IER(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
463{
464 return ((READ_BIT(HSEMx->C1IER, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
465}
466
467#if defined(DUAL_CORE)
508__STATIC_INLINE void LL_HSEM_EnableIT_C2IER(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
509{
510 SET_BIT(HSEMx->C2IER, SemaphoreMask);
511}
512
553__STATIC_INLINE void LL_HSEM_DisableIT_C2IER(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
554{
555 CLEAR_BIT(HSEMx->C2IER, SemaphoreMask);
556}
557
598__STATIC_INLINE uint32_t LL_HSEM_IsEnabledIT_C2IER(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
599{
600 return ((READ_BIT(HSEMx->C2IER, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
601}
602#endif /* DUAL_CORE */
603
655__STATIC_INLINE void LL_HSEM_ClearFlag_C1ICR(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
656{
657 WRITE_REG(HSEMx->C1ICR, SemaphoreMask);
658}
659
702__STATIC_INLINE uint32_t LL_HSEM_IsActiveFlag_C1ISR(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
703{
704 return ((READ_BIT(HSEMx->C1ISR, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
705}
706
749__STATIC_INLINE uint32_t LL_HSEM_IsActiveFlag_C1MISR(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
750{
751 return ((READ_BIT(HSEMx->C1MISR, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
752}
753
754#if defined(DUAL_CORE)
795__STATIC_INLINE void LL_HSEM_ClearFlag_C2ICR(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
796{
797 WRITE_REG(HSEMx->C2ICR, SemaphoreMask);
798}
799
840__STATIC_INLINE uint32_t LL_HSEM_IsActiveFlag_C2ISR(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
841{
842 return ((READ_BIT(HSEMx->C2ISR, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
843}
844
885__STATIC_INLINE uint32_t LL_HSEM_IsActiveFlag_C2MISR(HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
886{
887 return ((READ_BIT(HSEMx->C2MISR, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
888}
889#endif /* DUAL_CORE */
902#endif /* defined(HSEM) */
903
908#ifdef __cplusplus
909}
910#endif
911
912#endif /* __STM32H7xx_LL_HSEM_H */
#define HSEM_R_PROCID_Msk
Definition: stm32h723xx.h:12522
#define HSEM_RLR_LOCK
Definition: stm32h723xx.h:12540
#define HSEM_R_COREID_Msk
Definition: stm32h723xx.h:12525
#define HSEM_KEYR_KEY
Definition: stm32h723xx.h:12945
#define HSEM_R_LOCK
Definition: stm32h723xx.h:12529
#define HSEM_R_LOCK_Msk
Definition: stm32h723xx.h:12528
CMSIS STM32H7xx Device Peripheral Access Layer Header File.
HW Semaphore HSEM.
Definition: stm32h723xx.h:1453
__IO uint32_t C2IER
Definition: stm32h745xg.h:1528
__IO uint32_t C2MISR
Definition: stm32h745xg.h:1531
__IO uint32_t KEYR
Definition: stm32h723xx.h:1462
__IO uint32_t C1ISR
Definition: stm32h723xx.h:1458
__IO uint32_t C1IER
Definition: stm32h723xx.h:1456
__IO uint32_t C1MISR
Definition: stm32h723xx.h:1459
__IO uint32_t CR
Definition: stm32h723xx.h:1461
__IO uint32_t C2ICR
Definition: stm32h745xg.h:1529
__IO uint32_t RLR[32]
Definition: stm32h723xx.h:1455
__IO uint32_t C1ICR
Definition: stm32h723xx.h:1457
__IO uint32_t C2ISR
Definition: stm32h745xg.h:1530
__IO uint32_t R[32]
Definition: stm32h723xx.h:1454