locking.h 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /***********************************************************************************************************************
  2. * DISCLAIMER
  3. * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
  4. * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
  5. * applicable laws, including copyright laws.
  6. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
  7. * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
  8. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
  9. * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
  10. * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
  11. * SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  12. * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
  13. * this software. By using this software, you agree to the additional terms and conditions found by accessing the
  14. * following link:
  15. * http://www.renesas.com/disclaimer
  16. *
  17. * Copyright (C) 2016 Renesas Electronics Corporation. All rights reserved.
  18. ***********************************************************************************************************************/
  19. /***********************************************************************************************************************
  20. * File Name : locking.h
  21. * Description : This implements a locking mechanism that can be used by all code. The locking is done atomically so
  22. * common resources can be accessed safely.
  23. ***********************************************************************************************************************/
  24. /**********************************************************************************************************************
  25. * History : DD.MM.YYYY Version Description
  26. * : 01.10.2016 1.00 First Release
  27. ***********************************************************************************************************************/
  28. #ifndef LOCKING_H
  29. #define LOCKING_H
  30. /***********************************************************************************************************************
  31. Includes <System Includes> , "Project Includes"
  32. ***********************************************************************************************************************/
  33. /* Lock types. */
  34. #include "mcu_locks.h"
  35. /***********************************************************************************************************************
  36. Macro definitions
  37. ***********************************************************************************************************************/
  38. /***********************************************************************************************************************
  39. Typedef definitions
  40. ***********************************************************************************************************************/
  41. /***********************************************************************************************************************
  42. Exported global variables
  43. ***********************************************************************************************************************/
  44. /***********************************************************************************************************************
  45. Exported global functions (to be accessed by other files)
  46. ***********************************************************************************************************************/
  47. bool R_BSP_SoftwareLock(BSP_CFG_USER_LOCKING_TYPE * const plock);
  48. bool R_BSP_SoftwareUnlock(BSP_CFG_USER_LOCKING_TYPE * const plock);
  49. bool R_BSP_HardwareLock(mcu_lock_t const hw_index);
  50. bool R_BSP_HardwareUnlock(mcu_lock_t const hw_index);
  51. #if BSP_CFG_USER_LOCKING_ENABLED != 0
  52. /* Is user is using their own lock functions then these are the prototypes. */
  53. bool BSP_CFG_USER_LOCKING_SW_LOCK_FUNCTION(BSP_CFG_USER_LOCKING_TYPE * const plock);
  54. bool BSP_CFG_USER_LOCKING_SW_UNLOCK_FUNCTION(BSP_CFG_USER_LOCKING_TYPE * const plock);
  55. bool BSP_CFG_USER_LOCKING_HW_LOCK_FUNCTION(mcu_lock_t const hw_index);
  56. bool BSP_CFG_USER_LOCKING_HW_UNLOCK_FUNCTION(mcu_lock_t const hw_index);
  57. #endif
  58. #endif /* LOCKING_H */