![]() |
|
|||
File indexing completed on 2025-05-11 08:23:35
0001 /** 0002 ****************************************************************************** 0003 * @file stm32h7xx_hal_hsem.h 0004 * @author MCD Application Team 0005 * @brief Header file of HSEM HAL module. 0006 ****************************************************************************** 0007 * @attention 0008 * 0009 * Copyright (c) 2017 STMicroelectronics. 0010 * All rights reserved. 0011 * 0012 * This software is licensed under terms that can be found in the LICENSE file 0013 * in the root directory of this software component. 0014 * If no LICENSE file comes with this software, it is provided AS-IS. 0015 * 0016 ****************************************************************************** 0017 */ 0018 0019 /* Define to prevent recursive inclusion -------------------------------------*/ 0020 #ifndef STM32H7xx_HAL_HSEM_H 0021 #define STM32H7xx_HAL_HSEM_H 0022 0023 #ifdef __cplusplus 0024 extern "C" { 0025 #endif 0026 0027 /* Includes ------------------------------------------------------------------*/ 0028 #include "stm32h7xx_hal_def.h" 0029 0030 /** @addtogroup STM32H7xx_HAL_Driver 0031 * @{ 0032 */ 0033 0034 /** @addtogroup HSEM 0035 * @{ 0036 */ 0037 0038 /* Exported macro ------------------------------------------------------------*/ 0039 /** @defgroup HSEM_Exported_Macros HSEM Exported Macros 0040 * @ingroup RTEMSBSPsARMSTM32H7 0041 * @{ 0042 */ 0043 0044 /** 0045 * @brief SemID to mask helper Macro. 0046 * @param __SEMID__: semaphore ID from 0 to 31 0047 * @retval Semaphore Mask. 0048 */ 0049 #define __HAL_HSEM_SEMID_TO_MASK(__SEMID__) (1 << (__SEMID__)) 0050 0051 /** 0052 * @brief Enables the specified HSEM interrupts. 0053 * @param __SEM_MASK__: semaphores Mask 0054 * @retval None. 0055 */ 0056 #if defined(DUAL_CORE) 0057 #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 0058 (HSEM->C1IER |= (__SEM_MASK__)) : \ 0059 (HSEM->C2IER |= (__SEM_MASK__))) 0060 #else 0061 #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) (HSEM->IER |= (__SEM_MASK__)) 0062 #endif /* DUAL_CORE */ 0063 /** 0064 * @brief Disables the specified HSEM interrupts. 0065 * @param __SEM_MASK__: semaphores Mask 0066 * @retval None. 0067 */ 0068 #if defined(DUAL_CORE) 0069 #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 0070 (HSEM->C1IER &= ~(__SEM_MASK__)) : \ 0071 (HSEM->C2IER &= ~(__SEM_MASK__))) 0072 #else 0073 #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) (HSEM->IER &= ~(__SEM_MASK__)) 0074 #endif /* DUAL_CORE */ 0075 0076 /** 0077 * @brief Checks whether interrupt has occurred or not for semaphores specified by a mask. 0078 * @param __SEM_MASK__: semaphores Mask 0079 * @retval semaphores Mask : Semaphores where an interrupt occurred. 0080 */ 0081 #if defined(DUAL_CORE) 0082 #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 0083 ((__SEM_MASK__) & HSEM->C1MISR) : \ 0084 ((__SEM_MASK__) & HSEM->C2MISR1)) 0085 #else 0086 #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((__SEM_MASK__) & HSEM->MISR) 0087 #endif /* DUAL_CORE */ 0088 0089 /** 0090 * @brief Get the semaphores release status flags. 0091 * @param __SEM_MASK__: semaphores Mask 0092 * @retval semaphores Mask : Semaphores where Release flags rise. 0093 */ 0094 #if defined(DUAL_CORE) 0095 #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 0096 (__SEM_MASK__) & HSEM->C1ISR : \ 0097 (__SEM_MASK__) & HSEM->C2ISR) 0098 #else 0099 #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((__SEM_MASK__) & HSEM->ISR) 0100 #endif /* DUAL_CORE */ 0101 0102 /** 0103 * @brief Clears the HSEM Interrupt flags. 0104 * @param __SEM_MASK__: semaphores Mask 0105 * @retval None. 0106 */ 0107 #if defined(DUAL_CORE) 0108 #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 0109 (HSEM->C1ICR |= (__SEM_MASK__)) : \ 0110 (HSEM->C2ICR |= (__SEM_MASK__))) 0111 #else 0112 #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) (HSEM->ICR |= (__SEM_MASK__)) 0113 #endif /* DUAL_CORE */ 0114 0115 /** 0116 * @} 0117 */ 0118 0119 /* Exported functions --------------------------------------------------------*/ 0120 /** @defgroup HSEM_Exported_Functions HSEM Exported Functions 0121 * @ingroup RTEMSBSPsARMSTM32H7 0122 * @{ 0123 */ 0124 0125 /** @addtogroup HSEM_Exported_Functions_Group1 Take and Release functions 0126 * @brief HSEM Take and Release functions 0127 * @{ 0128 */ 0129 0130 /* HSEM semaphore take (lock) using 2-Step method ****************************/ 0131 HAL_StatusTypeDef HAL_HSEM_Take(uint32_t SemID, uint32_t ProcessID); 0132 /* HSEM semaphore fast take (lock) using 1-Step method ***********************/ 0133 HAL_StatusTypeDef HAL_HSEM_FastTake(uint32_t SemID); 0134 /* HSEM Release **************************************************************/ 0135 void HAL_HSEM_Release(uint32_t SemID, uint32_t ProcessID); 0136 /* HSEM Release All************************************************************/ 0137 void HAL_HSEM_ReleaseAll(uint32_t Key, uint32_t CoreID); 0138 /* HSEM Check semaphore state Taken or not **********************************/ 0139 uint32_t HAL_HSEM_IsSemTaken(uint32_t SemID); 0140 0141 /** 0142 * @} 0143 */ 0144 0145 /** @addtogroup HSEM_Exported_Functions_Group2 HSEM Set and Get Key functions 0146 * @brief HSEM Set and Get Key functions. 0147 * @{ 0148 */ 0149 /* HSEM Set Clear Key *********************************************************/ 0150 void HAL_HSEM_SetClearKey(uint32_t Key); 0151 /* HSEM Get Clear Key *********************************************************/ 0152 uint32_t HAL_HSEM_GetClearKey(void); 0153 /** 0154 * @} 0155 */ 0156 0157 /** @addtogroup HSEM_Exported_Functions_Group3 0158 * @brief HSEM Notification functions 0159 * @{ 0160 */ 0161 /* HSEM Activate HSEM Notification (When a semaphore is released) ) *****************/ 0162 void HAL_HSEM_ActivateNotification(uint32_t SemMask); 0163 /* HSEM Deactivate HSEM Notification (When a semaphore is released) ****************/ 0164 void HAL_HSEM_DeactivateNotification(uint32_t SemMask); 0165 /* HSEM Free Callback (When a semaphore is released) *******************************/ 0166 void HAL_HSEM_FreeCallback(uint32_t SemMask); 0167 /* HSEM IRQ Handler **********************************************************/ 0168 void HAL_HSEM_IRQHandler(void); 0169 0170 /** 0171 * @} 0172 */ 0173 0174 /** 0175 * @} 0176 */ 0177 0178 /* Private macros ------------------------------------------------------------*/ 0179 /** @defgroup HSEM_Private_Macros HSEM Private Macros 0180 * @ingroup RTEMSBSPsARMSTM32H7 0181 * @{ 0182 */ 0183 0184 #define IS_HSEM_SEMID(__SEMID__) ((__SEMID__) <= HSEM_SEMID_MAX ) 0185 0186 #define IS_HSEM_PROCESSID(__PROCESSID__) ((__PROCESSID__) <= HSEM_PROCESSID_MAX ) 0187 0188 #define IS_HSEM_KEY(__KEY__) ((__KEY__) <= HSEM_CLEAR_KEY_MAX ) 0189 0190 #if defined(DUAL_CORE) 0191 #define IS_HSEM_COREID(__COREID__) (((__COREID__) == HSEM_CPU1_COREID) || \ 0192 ((__COREID__) == HSEM_CPU2_COREID)) 0193 #else 0194 #define IS_HSEM_COREID(__COREID__) ((__COREID__) == HSEM_CPU1_COREID) 0195 #endif 0196 0197 0198 /** 0199 * @} 0200 */ 0201 0202 /** 0203 * @} 0204 */ 0205 0206 /** 0207 * @} 0208 */ 0209 0210 #ifdef __cplusplus 0211 } 0212 #endif 0213 0214 #endif /* STM32H7xx_HAL_HSEM_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |