/*********************************************************************************************************************** | |
* DISCLAIMER | |
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No | |
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all | |
* applicable laws, including copyright laws. | |
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING | |
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM | |
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES | |
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS | |
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of | |
* this software. By using this software, you agree to the additional terms and conditions found by accessing the | |
* following link: | |
* http://www.renesas.com/disclaimer | |
* | |
* Copyright (C) 2011 Renesas Electronics Corporation. All rights reserved. | |
***********************************************************************************************************************/ | |
/*********************************************************************************************************************** | |
* File Name : locking.h | |
* Description : This implements a locking mechanism that can be used by all code. The locking is done atomically so | |
* common resources can be accessed safely. | |
***********************************************************************************************************************/ | |
/********************************************************************************************************************** | |
* History : DD.MM.YYYY Version Description | |
* : 07.03.2012 1.00 First Release | |
***********************************************************************************************************************/ | |
/*********************************************************************************************************************** | |
Includes <System Includes> , "Project Includes" | |
***********************************************************************************************************************/ | |
/* Fixed-size integer typedefs. */ | |
#include <stdint.h> | |
/* bool support. */ | |
#include <stdbool.h> | |
/*********************************************************************************************************************** | |
Macro definitions | |
***********************************************************************************************************************/ | |
/*********************************************************************************************************************** | |
Typedef definitions | |
***********************************************************************************************************************/ | |
typedef struct | |
{ | |
/* The actual lock. int32_t is used because this is what the xchg() instruction takes as parameters. */ | |
int32_t lock; | |
/* Could add a ID for locking and unlocking. In this could protect against any function being able to unlock. */ | |
} bsp_lock_t; | |
/*********************************************************************************************************************** | |
Exported global variables | |
***********************************************************************************************************************/ | |
/*********************************************************************************************************************** | |
Exported global functions (to be accessed by other files) | |
***********************************************************************************************************************/ | |
bool R_BSP_Lock(bsp_lock_t * plock); | |
bool R_BSP_Unlock(bsp_lock_t * plock); | |