RZ/A1H CMSIS-RTOS RTX BSP for GR-PEACH.

Dependents:   GR-PEACH_Azure_Speech ImageZoomInout_Sample ImageRotaion_Sample ImageScroll_Sample ... more

Fork of R_BSP by Daiki Kato

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bsp_util.c Source File

bsp_util.c

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * DISCLAIMER
00003 * This software is supplied by Renesas Electronics Corporation and is only
00004 * intended for use with Renesas products. No other uses are authorized. This
00005 * software is owned by Renesas Electronics Corporation and is protected under
00006 * all applicable laws, including copyright laws.
00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
00016 * Renesas reserves the right, without notice, to make changes to this software
00017 * and to discontinue the availability of this software. By using this software,
00018 * you agree to the additional terms and conditions found by accessing the
00019 * following link:
00020 * http://www.renesas.com/disclaimer*
00021 * Copyright (C) 2013 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 /**************************************************************************//**
00024 * @file         bsp_util.c
00025 * $Rev: 891 $
00026 * $Date:: 2014-06-27 10:40:52 +0900#$
00027 * @brief        BSP Utilities
00028 ******************************************************************************/
00029 /*----------------------------------------------------------------------------
00030  *      RL-ARM - RTX
00031  *----------------------------------------------------------------------------
00032  *      Name:    rt_CMSIS.c
00033  *      Purpose: CMSIS RTOS API
00034  *      Rev.:    V4.60
00035  *----------------------------------------------------------------------------
00036  *
00037  * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
00038  * All rights reserved.
00039  * Redistribution and use in source and binary forms, with or without
00040  * modification, are permitted provided that the following conditions are met:
00041  *  - Redistributions of source code must retain the above copyright
00042  *    notice, this list of conditions and the following disclaimer.
00043  *  - Redistributions in binary form must reproduce the above copyright
00044  *    notice, this list of conditions and the following disclaimer in the
00045  *    documentation and/or other materials provided with the distribution.
00046  *  - Neither the name of ARM  nor the names of its contributors may be used 
00047  *    to endorse or promote products derived from this software without 
00048  *    specific prior written permission.
00049  *
00050  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00051  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00052  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00053  * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
00054  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00055  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00056  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00057  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00058  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00059  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00060  * POSSIBILITY OF SUCH DAMAGE.
00061  *---------------------------------------------------------------------------*/
00062 
00063 
00064 /******************************************************************************
00065 Includes   <System Includes> , "Project Includes"
00066 ******************************************************************************/
00067 #include "cmsis_os.h"
00068 #include "Renesas_RZ_A1.h"
00069 #include "bsp_util.h"
00070 
00071 /******************************************************************************
00072 Typedef definitions
00073 ******************************************************************************/
00074 
00075 /******************************************************************************
00076 Macro definitions
00077 ******************************************************************************/
00078 
00079 /******************************************************************************
00080 Imported global variables and functions (from other files)
00081 ******************************************************************************/
00082 
00083 /******************************************************************************
00084 Exported global variables and functions (to be accessed by other files)
00085 ******************************************************************************/
00086 extern uint32_t IRQNestLevel; /* Indicates whether inside an ISR, and the depth of nesting.  0 = not in ISR. */
00087 
00088 /******************************************************************************
00089 Private global variables and functions
00090 ******************************************************************************/
00091 
00092 /**************************************************************************//**
00093 * Function Name: R_ExceptionalMode
00094 * @brief         Get current context
00095 *
00096 *                Description:<br>
00097 *                
00098 * @param         none
00099 * @retval 0      Current context is non-task
00100 * @retval 1      Current context is task
00101 ******************************************************************************/
00102 int32_t R_ExceptionalMode(void)
00103 {
00104     int32_t ret = 0;
00105 
00106     switch(__get_CPSR() & 0x1fu)
00107     {
00108     case MODE_USR:
00109         break;
00110     case MODE_SYS:
00111         break;
00112     case MODE_SVC:
00113         if (IRQNestLevel == 0)
00114         {
00115             /* handling a regular service call */
00116         }
00117         else
00118         {
00119             /* handling an ISR in SVC mode */
00120             ret = 1;
00121         }
00122         break;
00123     default:
00124         ret = 1;
00125         break;
00126     }
00127     return ret;
00128 }
00129 
00130 /******************************************************************************
00131 End of file
00132 ******************************************************************************/