stm32h747/stm32h747i-disco/CM7/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_hsem.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32H7xx_HAL_HSEM_H
22 #define STM32H7xx_HAL_HSEM_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32h7xx_hal_def.h"
30 
39 /* Exported macro ------------------------------------------------------------*/
49 #define __HAL_HSEM_SEMID_TO_MASK(__SEMID__) (1 << (__SEMID__))
50 
56 #if defined(DUAL_CORE)
57 #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \
58  (HSEM->C1IER |= (__SEM_MASK__)) : \
59  (HSEM->C2IER |= (__SEM_MASK__)))
60 #else
61 #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) (HSEM->IER |= (__SEM_MASK__))
62 #endif /* DUAL_CORE */
63 
68 #if defined(DUAL_CORE)
69 #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \
70  (HSEM->C1IER &= ~(__SEM_MASK__)) : \
71  (HSEM->C2IER &= ~(__SEM_MASK__)))
72 #else
73 #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) (HSEM->IER &= ~(__SEM_MASK__))
74 #endif /* DUAL_CORE */
75 
81 #if defined(DUAL_CORE)
82 #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \
83  ((__SEM_MASK__) & HSEM->C1MISR) : \
84  ((__SEM_MASK__) & HSEM->C2MISR1))
85 #else
86 #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((__SEM_MASK__) & HSEM->MISR)
87 #endif /* DUAL_CORE */
88 
94 #if defined(DUAL_CORE)
95 #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \
96  (__SEM_MASK__) & HSEM->C1ISR : \
97  (__SEM_MASK__) & HSEM->C2ISR)
98 #else
99 #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((__SEM_MASK__) & HSEM->ISR)
100 #endif /* DUAL_CORE */
101 
107 #if defined(DUAL_CORE)
108 #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \
109  (HSEM->C1ICR |= (__SEM_MASK__)) : \
110  (HSEM->C2ICR |= (__SEM_MASK__)))
111 #else
112 #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) (HSEM->ICR |= (__SEM_MASK__))
113 #endif /* DUAL_CORE */
114 
119 /* Exported functions --------------------------------------------------------*/
129 /* HSEM semaphore take (lock) using 2-Step method ****************************/
130 HAL_StatusTypeDef HAL_HSEM_Take(uint32_t SemID, uint32_t ProcessID);
131 /* HSEM semaphore fast take (lock) using 1-Step method ***********************/
132 HAL_StatusTypeDef HAL_HSEM_FastTake(uint32_t SemID);
133 /* HSEM Check semaphore state Taken or not **********************************/
134 uint32_t HAL_HSEM_IsSemTaken(uint32_t SemID);
135 /* HSEM Release **************************************************************/
136 void HAL_HSEM_Release(uint32_t SemID, uint32_t ProcessID);
137 /* HSEM Release All************************************************************/
138 void HAL_HSEM_ReleaseAll(uint32_t Key, uint32_t CoreID);
139 
148 /* HSEM Set Clear Key *********************************************************/
149 void HAL_HSEM_SetClearKey(uint32_t Key);
150 /* HSEM Get Clear Key *********************************************************/
151 uint32_t HAL_HSEM_GetClearKey(void);
160 /* HSEM Activate HSEM Notification (When a semaphore is released) ) *****************/
161 void HAL_HSEM_ActivateNotification(uint32_t SemMask);
162 /* HSEM Deactivate HSEM Notification (When a semaphore is released) ****************/
163 void HAL_HSEM_DeactivateNotification(uint32_t SemMask);
164 /* HSEM Free Callback (When a semaphore is released) *******************************/
165 void HAL_HSEM_FreeCallback(uint32_t SemMask);
166 /* HSEM IRQ Handler **********************************************************/
167 void HAL_HSEM_IRQHandler(void);
168 
177 /* Private macros ------------------------------------------------------------*/
182 #define IS_HSEM_SEMID(__SEMID__) ((__SEMID__) <= HSEM_SEMID_MAX )
183 
184 #define IS_HSEM_PROCESSID(__PROCESSID__) ((__PROCESSID__) <= HSEM_PROCESSID_MAX )
185 
186 #define IS_HSEM_KEY(__KEY__) ((__KEY__) <= HSEM_CLEAR_KEY_MAX )
187 
188 #if defined(DUAL_CORE)
189 #define IS_HSEM_COREID(__COREID__) (((__COREID__) == HSEM_CPU1_COREID) || \
190  ((__COREID__) == HSEM_CPU2_COREID))
191 #else
192 #define IS_HSEM_COREID(__COREID__) ((__COREID__) == HSEM_CPU1_COREID)
193 #endif
194 
195 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* STM32H7xx_HAL_HSEM_H */
213 
214 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_HSEM_ActivateNotification
void HAL_HSEM_ActivateNotification(uint32_t SemMask)
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
HAL_HSEM_FastTake
HAL_StatusTypeDef HAL_HSEM_FastTake(uint32_t SemID)
HAL_HSEM_DeactivateNotification
void HAL_HSEM_DeactivateNotification(uint32_t SemMask)
HAL_HSEM_ReleaseAll
void HAL_HSEM_ReleaseAll(uint32_t Key, uint32_t CoreID)
HAL_HSEM_FreeCallback
void HAL_HSEM_FreeCallback(uint32_t SemMask)
HAL_HSEM_Release
void HAL_HSEM_Release(uint32_t SemID, uint32_t ProcessID)
HAL_HSEM_SetClearKey
void HAL_HSEM_SetClearKey(uint32_t Key)
HAL_HSEM_IsSemTaken
uint32_t HAL_HSEM_IsSemTaken(uint32_t SemID)
stm32h7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_HSEM_Take
HAL_StatusTypeDef HAL_HSEM_Take(uint32_t SemID, uint32_t ProcessID)
HAL_HSEM_GetClearKey
uint32_t HAL_HSEM_GetClearKey(void)
HAL_HSEM_IRQHandler
void HAL_HSEM_IRQHandler(void)


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:54