STM32H735xx HAL User Manual
Functions
stm32h7xx_hal_hsem.c File Reference

HSEM HAL module driver. This file provides firmware functions to manage the following functionalities of the semaphore peripheral: + Semaphore Take function (2-Step Procedure) , non blocking + Semaphore FastTake function (1-Step Procedure) , non blocking + Semaphore Status check + Semaphore Clear Key Set and Get + Release and release all functions + Semaphore notification enabling and disabling and callnack functions + IRQ handler management. More...

#include "stm32h7xx_hal.h"

Go to the source code of this file.

Functions

HAL_StatusTypeDef HAL_HSEM_Take (uint32_t SemID, uint32_t ProcessID)
 Take a semaphore in 2 Step mode.
HAL_StatusTypeDef HAL_HSEM_FastTake (uint32_t SemID)
 Fast Take a semaphore with 1 Step mode.
uint32_t HAL_HSEM_IsSemTaken (uint32_t SemID)
 Check semaphore state Taken or not.
void HAL_HSEM_Release (uint32_t SemID, uint32_t ProcessID)
 Release a semaphore.
void HAL_HSEM_ReleaseAll (uint32_t Key, uint32_t CoreID)
 Release All semaphore used by a given Master .
void HAL_HSEM_SetClearKey (uint32_t Key)
 Set semaphore Key .
uint32_t HAL_HSEM_GetClearKey (void)
 Get semaphore Key .
void HAL_HSEM_ActivateNotification (uint32_t SemMask)
 Activate Semaphore release Notification for a given Semaphores Mask .
void HAL_HSEM_DeactivateNotification (uint32_t SemMask)
 Deactivate Semaphore release Notification for a given Semaphores Mask .
void HAL_HSEM_IRQHandler (void)
 This function handles HSEM interrupt request.
__weak void HAL_HSEM_FreeCallback (uint32_t SemMask)
 Semaphore Released Callback.

Detailed Description

HSEM HAL module driver. This file provides firmware functions to manage the following functionalities of the semaphore peripheral: + Semaphore Take function (2-Step Procedure) , non blocking + Semaphore FastTake function (1-Step Procedure) , non blocking + Semaphore Status check + Semaphore Clear Key Set and Get + Release and release all functions + Semaphore notification enabling and disabling and callnack functions + IRQ handler management.

Author:
MCD Application Team
Attention:

Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

  ==============================================================================
                     ##### How to use this driver #####
  ==============================================================================
  [..]
      (#)Take a semaphore In 2-Step mode Using function HAL_HSEM_Take. This function takes as parameters :
           (++) the semaphore ID from 0 to 31
           (++) the process ID from 0 to 255
      (#) Fast Take semaphore In 1-Step mode Using function HAL_HSEM_FastTake. This function takes as parameter :
           (++) the semaphore ID from 0_ID to 31. Note that the process ID value is implicitly assumed as zero
      (#) Check if a semaphore is Taken using function HAL_HSEM_IsSemTaken. This function takes as parameter :
          (++) the semaphore ID from 0_ID to 31
          (++) It returns 1 if the given semaphore is taken otherwise (Free) zero
      (#)Release a semaphore using function with HAL_HSEM_Release. This function takes as parameters :
           (++) the semaphore ID from 0 to 31
           (++) the process ID from 0 to 255:
           (++) Note: If ProcessID and MasterID match, semaphore is freed, and an interrupt
         may be generated when enabled (notification activated). If ProcessID or MasterID does not match,
         semaphore remains taken (locked)

      (#)Release all semaphores at once taken by a given Master using function HAL_HSEM_Release_All
          This function takes as parameters :
           (++) the Release Key (value from 0 to 0xFFFF) can be Set or Get respectively by
              HAL_HSEM_SetClearKey() or HAL_HSEM_GetClearKey functions
           (++) the Master ID:
           (++) Note: If the Key and MasterID match, all semaphores taken by the given CPU that corresponds
           to MasterID  will be freed, and an interrupt may be generated when enabled (notification activated). If the
           Key or the MasterID doesn't match, semaphores remains taken (locked)

      (#)Semaphores Release all key functions:
         (++)  HAL_HSEM_SetClearKey() to set semaphore release all Key
         (++)  HAL_HSEM_GetClearKey() to get release all Key
      (#)Semaphores notification functions :
         (++)  HAL_HSEM_ActivateNotification to activate a notification callback on
               a given semaphores Mask (bitfield). When one or more semaphores defined by the mask are released
               the callback HAL_HSEM_FreeCallback will be asserted giving as parameters a mask of the released
               semaphores (bitfield).

         (++)  HAL_HSEM_DeactivateNotification to deactivate the notification of a given semaphores Mask (bitfield).
         (++) See the description of the macro __HAL_HSEM_SEMID_TO_MASK to check how to calculate a semaphore mask
                Used by the notification functions
     *** HSEM HAL driver macros list ***
     =============================================
     [..] Below the list of most used macros in HSEM HAL driver.

      (+) __HAL_HSEM_SEMID_TO_MASK: Helper macro to convert a Semaphore ID to a Mask.
      [..] Example of use :
      [..] mask = __HAL_HSEM_SEMID_TO_MASK(8)  |  __HAL_HSEM_SEMID_TO_MASK(21) | __HAL_HSEM_SEMID_TO_MASK(25).
      [..] All next macros take as parameter a semaphore Mask (bitfiled) that can be constructed using  __HAL_HSEM_SEMID_TO_MASK as the above example.
      (+) __HAL_HSEM_ENABLE_IT: Enable the specified semaphores Mask interrupts.
      (+) __HAL_HSEM_DISABLE_IT: Disable the specified semaphores Mask interrupts.
      (+) __HAL_HSEM_GET_IT: Checks whether the specified semaphore interrupt has occurred or not.
      (+) __HAL_HSEM_GET_FLAG: Get the semaphores status release flags.
      (+) __HAL_HSEM_CLEAR_FLAG: Clear the semaphores status release flags.

  

Definition in file stm32h7xx_hal_hsem.c.