RTEMS 6.1-rc4
|
HSEM HAL module driver. This file provides firmware functions to manage the following functionalities of the semaphore peripheral: More...
#include "stm32h7xx_hal.h"
HSEM HAL module driver. This file provides firmware functions to manage the following functionalities of the semaphore peripheral:
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.