20#ifndef STM32H7xx_LL_HSEM_H
21#define STM32H7xx_LL_HSEM_H
58#define LL_HSEM_COREID_NONE 0U
59#define LL_HSEM_COREID_CPU1 HSEM_CR_COREID_CPU1
61#define LL_HSEM_COREID_CPU2 HSEM_CR_COREID_CPU2
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
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
138#define LL_HSEM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
146#define LL_HSEM_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
174__STATIC_INLINE uint32_t LL_HSEM_IsSemaphoreLocked(
HSEM_TypeDef *HSEMx, uint32_t Semaphore)
189__STATIC_INLINE uint32_t LL_HSEM_GetCoreId(
HSEM_TypeDef *HSEMx, uint32_t Semaphore)
201__STATIC_INLINE uint32_t LL_HSEM_GetProcessId(
HSEM_TypeDef *HSEMx, uint32_t Semaphore)
217__STATIC_INLINE
void LL_HSEM_SetLock(
HSEM_TypeDef *HSEMx, uint32_t Semaphore, uint32_t process)
219 WRITE_REG(HSEMx->
R[Semaphore], (
HSEM_R_LOCK | LL_HSEM_COREID | process));
232__STATIC_INLINE uint32_t LL_HSEM_2StepLock(
HSEM_TypeDef *HSEMx, uint32_t Semaphore, uint32_t process)
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);
247__STATIC_INLINE uint32_t LL_HSEM_1StepLock(
HSEM_TypeDef *HSEMx, uint32_t Semaphore)
249 return ((HSEMx->
RLR[Semaphore] != (
HSEM_RLR_LOCK | LL_HSEM_COREID)) ? 1UL : 0UL);
261__STATIC_INLINE
void LL_HSEM_ReleaseLock(
HSEM_TypeDef *HSEMx, uint32_t Semaphore, uint32_t process)
263 WRITE_REG(HSEMx->
R[Semaphore], (LL_HSEM_COREID | process));
272__STATIC_INLINE uint32_t LL_HSEM_GetStatus(
HSEM_TypeDef *HSEMx, uint32_t Semaphore)
274 return ((HSEMx->
R[Semaphore] != 0U) ? 1UL : 0UL);
284__STATIC_INLINE
void LL_HSEM_SetKey(
HSEM_TypeDef *HSEMx, uint32_t key)
286 WRITE_REG(HSEMx->
KEYR, key << HSEM_KEYR_KEY_Pos);
295__STATIC_INLINE uint32_t LL_HSEM_GetKey(
HSEM_TypeDef *HSEMx)
312__STATIC_INLINE
void LL_HSEM_ResetAllLock(
HSEM_TypeDef *HSEMx, uint32_t key, uint32_t core)
314 WRITE_REG(HSEMx->
CR, (key << HSEM_CR_KEY_Pos) | core);
368__STATIC_INLINE
void LL_HSEM_EnableIT_C1IER(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
370 SET_BIT(HSEMx->
C1IER, SemaphoreMask);
415__STATIC_INLINE
void LL_HSEM_DisableIT_C1IER(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
417 CLEAR_BIT(HSEMx->
C1IER, SemaphoreMask);
462__STATIC_INLINE uint32_t LL_HSEM_IsEnabledIT_C1IER(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
464 return ((READ_BIT(HSEMx->
C1IER, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
467#if defined(DUAL_CORE)
508__STATIC_INLINE
void LL_HSEM_EnableIT_C2IER(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
510 SET_BIT(HSEMx->
C2IER, SemaphoreMask);
553__STATIC_INLINE
void LL_HSEM_DisableIT_C2IER(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
555 CLEAR_BIT(HSEMx->
C2IER, SemaphoreMask);
598__STATIC_INLINE uint32_t LL_HSEM_IsEnabledIT_C2IER(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
600 return ((READ_BIT(HSEMx->
C2IER, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
655__STATIC_INLINE
void LL_HSEM_ClearFlag_C1ICR(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
657 WRITE_REG(HSEMx->
C1ICR, SemaphoreMask);
702__STATIC_INLINE uint32_t LL_HSEM_IsActiveFlag_C1ISR(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
704 return ((READ_BIT(HSEMx->
C1ISR, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
749__STATIC_INLINE uint32_t LL_HSEM_IsActiveFlag_C1MISR(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
751 return ((READ_BIT(HSEMx->
C1MISR, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
754#if defined(DUAL_CORE)
795__STATIC_INLINE
void LL_HSEM_ClearFlag_C2ICR(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
797 WRITE_REG(HSEMx->
C2ICR, SemaphoreMask);
840__STATIC_INLINE uint32_t LL_HSEM_IsActiveFlag_C2ISR(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
842 return ((READ_BIT(HSEMx->
C2ISR, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
885__STATIC_INLINE uint32_t LL_HSEM_IsActiveFlag_C2MISR(
HSEM_TypeDef *HSEMx, uint32_t SemaphoreMask)
887 return ((READ_BIT(HSEMx->
C2MISR, SemaphoreMask) == (SemaphoreMask)) ? 1UL : 0UL);
#define HSEM_R_PROCID_Msk
Definition: stm32h723xx.h:12514
#define HSEM_RLR_LOCK
Definition: stm32h723xx.h:12532
#define HSEM_R_COREID_Msk
Definition: stm32h723xx.h:12517
#define HSEM_KEYR_KEY
Definition: stm32h723xx.h:12937
#define HSEM_R_LOCK
Definition: stm32h723xx.h:12521
#define HSEM_R_LOCK_Msk
Definition: stm32h723xx.h:12520
CMSIS STM32H7xx Device Peripheral Access Layer Header File.
HW Semaphore HSEM.
Definition: stm32h723xx.h:1453
__IO uint32_t C2IER
Definition: stm32h745xg.h:1529
__IO uint32_t C2MISR
Definition: stm32h745xg.h:1532
__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:1530
__IO uint32_t RLR[32]
Definition: stm32h723xx.h:1455
__IO uint32_t C1ICR
Definition: stm32h723xx.h:1457
__IO uint32_t C2ISR
Definition: stm32h745xg.h:1531
__IO uint32_t R[32]
Definition: stm32h723xx.h:1454