RTEMS 6.1-rc2
Loading...
Searching...
No Matches
stm32h7xx_hal_hsem.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_HSEM_H
21#define STM32H7xx_HAL_HSEM_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
38/* 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 */
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 --------------------------------------------------------*/
130/* HSEM semaphore take (lock) using 2-Step method ****************************/
131HAL_StatusTypeDef HAL_HSEM_Take(uint32_t SemID, uint32_t ProcessID);
132/* HSEM semaphore fast take (lock) using 1-Step method ***********************/
133HAL_StatusTypeDef HAL_HSEM_FastTake(uint32_t SemID);
134/* HSEM Release **************************************************************/
135void HAL_HSEM_Release(uint32_t SemID, uint32_t ProcessID);
136/* HSEM Release All************************************************************/
137void HAL_HSEM_ReleaseAll(uint32_t Key, uint32_t CoreID);
138/* HSEM Check semaphore state Taken or not **********************************/
139uint32_t HAL_HSEM_IsSemTaken(uint32_t SemID);
140
149/* HSEM Set Clear Key *********************************************************/
150void HAL_HSEM_SetClearKey(uint32_t Key);
151/* HSEM Get Clear Key *********************************************************/
152uint32_t HAL_HSEM_GetClearKey(void);
161/* HSEM Activate HSEM Notification (When a semaphore is released) ) *****************/
162void HAL_HSEM_ActivateNotification(uint32_t SemMask);
163/* HSEM Deactivate HSEM Notification (When a semaphore is released) ****************/
164void HAL_HSEM_DeactivateNotification(uint32_t SemMask);
165/* HSEM Free Callback (When a semaphore is released) *******************************/
166void HAL_HSEM_FreeCallback(uint32_t SemMask);
167/* HSEM IRQ Handler **********************************************************/
168void HAL_HSEM_IRQHandler(void);
169
178/* Private macros ------------------------------------------------------------*/
184#define IS_HSEM_SEMID(__SEMID__) ((__SEMID__) <= HSEM_SEMID_MAX )
185
186#define IS_HSEM_PROCESSID(__PROCESSID__) ((__PROCESSID__) <= HSEM_PROCESSID_MAX )
187
188#define IS_HSEM_KEY(__KEY__) ((__KEY__) <= HSEM_CLEAR_KEY_MAX )
189
190#if defined(DUAL_CORE)
191#define IS_HSEM_COREID(__COREID__) (((__COREID__) == HSEM_CPU1_COREID) || \
192 ((__COREID__) == HSEM_CPU2_COREID))
193#else
194#define IS_HSEM_COREID(__COREID__) ((__COREID__) == HSEM_CPU1_COREID)
195#endif
196
197
210#ifdef __cplusplus
211}
212#endif
213
214#endif /* STM32H7xx_HAL_HSEM_H */
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47