Graphics framework for GR-PEACH. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
Dependents: ImageZoomInout_Sample ImageRotaion_Sample ImageScroll_Sample GR-PEACH_LCD_4_3inch_Save_to_USB ... more
License
When you use this library, we judge you have agreed to the following contents.
https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
Note
If you import the GraphicsFramework library, please import GR-PEACH_video library and R_BSP library together.
JPEG Converter
The JPEG Converter driver implements encode and decode functionality which uses the JCU of the RZ/A Series.
Hello World!
Import programJCU_HelloWorld
Hello World for JCU(JPEG Codec Unit). JCU is JPEG codec unit of RZ/A1. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
API
Import library
Data Structures |
|
| struct | bitmap_buff_info_t |
|
Bitmap data setting struct.
More...
|
|
| struct | encode_options_t |
|
Encode option setting.
More...
|
|
Public Types |
|
| enum |
jpeg_conv_error_t
{
JPEG_CONV_OK = 0, JPEG_CONV_JCU_ERR = -1, JPEG_CONV_FORMA_ERR = -2, JPEG_CONV_PARAM_ERR = -3, JPEG_CONV_BUSY = -4, JPEG_CONV_PARAM_RANGE_ERR = -7 } |
|
Error codes. More... |
|
| enum |
wr_rd_swa_t
{
WR_RD_WRSWA_NON = 0, WR_RD_WRSWA_8BIT = 1, WR_RD_WRSWA_16BIT = 2, WR_RD_WRSWA_16_8BIT = 3, WR_RD_WRSWA_32BIT = 4, WR_RD_WRSWA_32_8BIT = 5, WR_RD_WRSWA_32_16BIT = 6, WR_RD_WRSWA_32_16_8BIT = 7 } |
|
Write/Read image pixcel frame buffer swap setting. More... |
|
| enum | wr_rd_format_t { WR_RD_YCbCr422 = 0x00, WR_RD_ARGB8888 = 0x01, WR_RD_RGB565 = 0x02 } |
|
Write/Read image pixcel format selects. More... |
|
| enum | sub_sampling_t { SUB_SAMPLING_1_1 = 0x00, SUB_SAMPLING_1_2 = 0x01, SUB_SAMPLING_1_4 = 0x02, SUB_SAMPLING_1_8 = 0x03 } |
|
Thinning output image selects. More... |
|
| enum | cbcr_offset_t { CBCR_OFFSET_0 = 0x00, CBCR_OFFSET_128 = 0x01 } |
|
Cb/Cr range selects for decode. More... |
|
Public Member Functions |
|
| JPEG_Converter () | |
|
Constructor method of JPEG converter(encode/decode)
|
|
| virtual | ~JPEG_Converter () |
|
Destructor method of JPEG converter(encode/decode)
|
|
| JPEG_Converter::jpeg_conv_error_t | decode (void *pJpegBuff, bitmap_buff_info_t *psOutputBuff) |
|
Decode JPEG to rinear data.
|
|
| JPEG_Converter::jpeg_conv_error_t | decode (void *pJpegBuff, bitmap_buff_info_t *psOutputBuff, decode_options_t *pOptions) |
|
JPEG data decode to bitmap.
|
|
| JPEG_Converter::jpeg_conv_error_t | encode ( bitmap_buff_info_t *psInputBuff, void *pJpegBuff, size_t *pEncodeSize) |
|
Encode rinear data to JPEG.
|
|
| JPEG_Converter::jpeg_conv_error_t | encode ( bitmap_buff_info_t *psInputBuff, void *pJpegBuff, size_t *pEncodeSize, encode_options_t *pOptions) |
|
Bitmap data encode to JPEG.
|
|
| JPEG_Converter::jpeg_conv_error_t | SetQuality (const uint8_t qual) |
|
Set encode quality.
|
|
Correspondence file
A correspondence file of JPEG Converter is as the following table.
| JPEG | Correspondence |
| Width | >0(greater than 0) |
| Height | >0(greater than 0) |
| Color format | YCbCr444, YCbCr422, YCbCr420, YCbCr411 |
| Bitmap | Correspondence |
| Width | >0(greater than 0) |
| Height | >0(greater than 0) |
| Color format | YCbCr422 |
Notice
You run JPEG converter once destruction each time.
You set whether these JPEG files aren't input, or it check error setting decode(set in "flag" = true). The JPEG file which becomes correspondence outside will be the following condition.
- File besides the above-mentioned correspondence file.
- As information in the JPEG file, WIDTH or HEIGHT is larger than output buffer setting.
Buffer area is used encode/decode, set 8 bytes align and non-cash memory area. The output buffer when decoding, is made beyond the size decided in the size of the JPEG file, the format, setting of thinning out. You make output buffer for decode/encode to enough big size in order to stock this result. JPEG Converter, if you do not particularly perform specified, does not check size against the output data at the time of encoding and decoding. You set the output buffer so that there is no effect of corruption by the output data.
Color format
Color format in case to be converted from Bitmap to JPEG is either ARGB8888 or RGB555, YCbCr422.
Color format of the If you want to convert from JPEG file to Bitmap file is YCbCr422.
You correct "alpha(member of decode_options_t)" of setting and "output_cb_cr_offset(member of decode_options_t)" according to color format when decoding.
- example
decode to ARGB8888(WR_RD_ARGB8888 set in format member of bitmap_buff_info_t)
alpha = 0x01-0xFF
output_cb_cr_offset = CBCR_OFFSET_0
decode to YCbCr422(WR_RD_YCbCr422 set in format member of bitmap_buff_info_t)
alpha = 0
output_cb_cr_offset = CBCR_OFFSET_0 or CBCR_OFFSET_128
decode to RGB565(WR_RD_RGB565 set in format member of bitmap_buff_info_t)
alpha = 0
output_cb_cr_offset = CBCR_OFFSET_0
Decode/encode settings are optional
If omitted encode/decode settings, it will work with the following settings.
[Decode option setting (member of decode_options_t)]
- Vertical sub sampling is thinning output image to 1/1.
- Horizontal sub sampling is thinning output image to 1/1.
- Output data of Cb/Cr range is -128 to 127.
- Output data of swap in 8-bit units: 2-1-4-3-6-5-8-7.
- Alpha value of 0.
- JPEG format correspondence outside error check.
- It decode in a synchronous function.
[Encode option setting (member of encode_options_t)]
- DRI value is 0.
- Encoding JPEG file start width offset is 0.
- Encoding JPEG file start height offset is 0.
- Input data of Cb/Cr range of input data is -128 to 127.
- Input data swap in 8-bit units: 2-1-4-3-6-5-8-7.
- It don't check encode size.
- Quantization Y use default table(Quality75).
- Quantization C use default table(Quality75).
- Huffman Y DC use default table.
- Huffman C DC use default table.
- Huffman Y AC use default table.
- Huffman C AC use default table.
- It encode in a synchronous function.
Synchronous/asynchronous switching
Decoding and encoding setting to operate asynchronously by setting a callback function(decode_options_t and encode_options_t).
Quality
Quality changes are possible.
If you want to change the Quality, please specify the table made of Quality you want to change the address of the setting.
If you do not want to change the Quality, it will operate at Quality75.
RGA
The RGA library implements fast drawing functionality which uses the RGA of the RZ/A Series.
Supporting compiler is ARMCC, GCC ARM and IAR.
Hello World!
Import programRGA_HelloWorld
Hello World for RGA(Renesas Graphics Architecture). RGA is the Graphics Library of RZ/A1. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
Revision 0:37e1e6a45ced, committed 2015-08-19
- Comitter:
- dkato
- Date:
- Wed Aug 19 08:58:26 2015 +0000
- Child:
- 1:7b90e31adc5b
- Commit message:
- first comit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/inc/clib_drivers.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,519 @@
+/*******************************************************************************
+* 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) 2013 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file clib_drivers.h
+* @brief $Module: CLibCommon $ $PublicVersion: 0.90 $ (=CLIB_VERSION)
+* $Rev: 30 $
+* $Date:: 2014-02-13 21:21:47 +0900#$
+* - Description: Common code for drivers and more.
+*/
+
+#ifndef CLIB_DRIVERS_H
+#define CLIB_DRIVERS_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl_typedef.h"
+#include "clib_drivers_typedef.h"
+
+/* for Inline Functions */
+#include "r_multi_compiler.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+/* in clib_drivers_typedef.h */
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/* in clib_drivers_typedef.h */
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+/* in clib_drivers_typedef.h */
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+errnum_t R_int32_t_to_int8_t( int32_t input, int8_t *output );
+
+
+
+/*-------------------------------------------------------------------------*/
+/* <<<< ### Inline Functions >>>> */
+/*-------------------------------------------------------------------------*/
+
+/**
+* @brief Cast with range check
+*
+* @param input Input value
+* @param output Output value
+* @return Error Code. 0=No Error.
+*/
+INLINE errnum_t R_int_t_to_int8_t( int_t input, int8_t *output )
+{
+ return R_int32_t_to_int8_t( input, output );
+}
+
+
+/**
+* @brief Fast mod operation
+*
+* @param value Left operand
+* @return value % N
+*
+* @par Description
+* - This is shared description of
+* R_Mod_2s, R_Mod_4s, R_Mod_8s, R_Mod_16s, R_Mod_32s, R_Mod_64s,
+* R_Mod_2u, R_Mod_4u, R_Mod_8u, R_Mod_16u, R_Mod_32u, R_Mod_64u.
+* - Porting layer of fast % operator.
+* - MISRA & IPA SEC confirmed version.
+* - Minus value is expected 2's complement.
+* - Not same C99 % operator.
+* - Sample: R_Mod_4s( - 7 ) == +1. Sample: -7 % 4 == -3
+*/
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Mod_2s( int_fast32_t const value )
+{
+ enum { mask = 1 };
+ return ((int_fast32_t)((uint_fast32_t)(value) & mask));
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Mod_4s( int_fast32_t const value )
+{
+ enum { mask = 3 };
+ return ((int_fast32_t)((uint_fast32_t)(value) & mask));
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Mod_8s( int_fast32_t const value )
+{
+ enum { mask = 7 };
+ return ((int_fast32_t)((uint_fast32_t)(value) & mask));
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Mod_16s( int_fast32_t const value )
+{
+ enum { mask = 15 };
+ return ((int_fast32_t)((uint_fast32_t)(value) & mask));
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Mod_32s( int_fast32_t const value )
+{
+ enum { mask = 31 };
+ return ((int_fast32_t)((uint_fast32_t)(value) & mask));
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Mod_64s( int_fast32_t const value )
+{
+ enum { mask = 63 };
+ return ((int_fast32_t)((uint_fast32_t)(value) & mask));
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Mod_2u( uint_fast32_t const value )
+{
+ return ((value) & 1u);
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Mod_4u( uint_fast32_t const value )
+{
+ return ((value) & 3u);
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Mod_8u( uint_fast32_t const value )
+{
+ return ((value) & 7u);
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Mod_16u( uint_fast32_t const value )
+{
+ return ((value) & 15u);
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Mod_32u( uint_fast32_t const value )
+{
+ return ((value) & 31u);
+}
+
+
+/**
+* @brief Fast mod operation. See <R_Mod_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Mod_64u( uint_fast32_t const value )
+{
+ return ((value) & 63u);
+}
+
+
+/**
+* @brief Fast ceil operation
+*
+* @param value Left operand
+* @return Ceil( value / N )
+*
+* @par Description
+* - This is shared description of
+* R_Ceil_2s, R_Ceil_4s, R_Ceil_8s, R_Ceil_16s, R_Ceil_32s, R_Ceil_64s,
+* R_Ceil_2u, R_Ceil_4u, R_Ceil_8u, R_Ceil_16u, R_Ceil_32u, R_Ceil_64u.
+* - Porting layer of fast ceil operation.
+* - Function version is confirmed with MISRA & IPA SEC.
+*/
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Ceil_2s( int_fast32_t const value )
+{
+ static const uint_fast32_t mask = 1;
+ return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask));
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Ceil_4s( int_fast32_t const value )
+{
+ static const uint_fast32_t mask = 3;
+ return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask));
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Ceil_8s( int_fast32_t const value )
+{
+ static const uint_fast32_t mask = 7;
+ return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask));
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Ceil_16s( int_fast32_t const value )
+{
+ static const uint_fast32_t mask = 15;
+ return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask));
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Ceil_32s( int_fast32_t const value )
+{
+ static const uint_fast32_t mask = 31;
+ return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask));
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE int_fast32_t R_Ceil_64s( int_fast32_t const value )
+{
+ static const uint_fast32_t mask = 63;
+ return ((int_fast32_t)((uint_fast32_t)((value)+mask)&~mask));
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Ceil_2u( uint_fast32_t const value )
+{
+ static const uint_fast32_t mask = 1;
+ return (((value)+mask)&~mask);
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Ceil_4u( uint_fast32_t const value )
+{
+ static const uint_fast32_t mask = 3;
+ return (((value)+mask)&~mask);
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Ceil_8u( uint_fast32_t const value )
+{
+ static const uint_fast32_t mask = 7;
+ return (((value)+mask)&~mask);
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Ceil_16u( uint_fast32_t const value )
+{
+ static const uint_fast32_t mask = 15;
+ return (((value)+mask)&~mask);
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Ceil_32u( uint_fast32_t const value )
+{
+ static const uint_fast32_t mask = 31;
+ return (((value)+mask)&~mask);
+}
+
+
+/**
+* @brief Fast ceil operation. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+INLINE uint_fast32_t R_Ceil_64u( uint_fast32_t const value )
+{
+ static const uint_fast32_t mask = 63;
+ return (((value)+mask)&~mask);
+}
+
+
+/**
+* @brief Fast ceil operation. Macro version. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#define R_CEIL_2U( value ) (((value)+1)&~1)
+
+
+/**
+* @brief Fast ceil operation. Macro version. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#define R_CEIL_4U( value ) (((value)+3)&~3)
+
+
+/**
+* @brief Fast ceil operation. Macro version. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#define R_CEIL_8U( value ) (((value)+7)&~7)
+
+
+/**
+* @brief Fast ceil operation. Macro version. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#define R_CEIL_16U( value ) (((value)+15)&~15)
+
+
+/**
+* @brief Fast ceil operation. Macro version. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#define R_CEIL_32U( value ) (((value)+31)&~31)
+
+
+/**
+* @brief Fast ceil operation. Macro version. See <R_Ceil_N>.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#define R_CEIL_64U( value ) (((value)+63)&~63)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CLIB_DRIVERS_H */
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/inc/clib_drivers_config.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,127 @@
+/*******************************************************************************
+* 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) 2013 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file clib_drivers_config.h
+* @brief $Module: CLibCommon $ $PublicVersion: 0.90 $ (=CLIB_VERSION)
+* $Rev: 30 $
+* $Date:: 2014-02-13 21:21:47 +0900#$
+* - Description: Common code for drivers and more.
+*/
+
+#ifndef CLIB_DRIVERS_CONFIG_H
+#define CLIB_DRIVERS_CONFIG_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def IS_SUPPORT_SAME_TYPEDEF
+* @brief Whether compiler suppots duplicated same typedef.
+* @par Parameters
+* None
+* @return None.
+*/
+#define IS_SUPPORT_SAME_TYPEDEF 1
+
+
+/**
+* @def lib_static
+* @brief Public library is complied by set "lib_static" static.
+* @par Parameters
+* None
+* @return None.
+*/
+#ifndef lib_static
+#define lib_static
+#endif
+
+
+/**
+* @def static_release
+* @brief Hide if release version.
+* @par Parameters
+* None
+* @return None.
+*/
+#ifndef R_OSPL_NDEBUG
+#define static_release static
+#else
+#define static_release
+#endif
+
+
+/***********************************************************************
+* Macros: BYTE_ENDIAN
+* BYTE_ENDIAN
+*
+* : BYTE_LITTLE_ENDIAN - 1
+* : BYTE_BIG_ENDIAN - 2
+************************************************************************/
+#define BYTE_ENDIAN BYTE_LITTLE_ENDIAN
+#define BYTE_LITTLE_ENDIAN 1
+#define BYTE_BIG_ENDIAN 2
+
+
+/***********************************************************************
+* Macros: BIT_FIELD_ENDIAN
+* BIT_FIELD_ENDIAN
+*
+* : BIT_FIELD_LITTLE_ENDIAN - 1
+* : BIT_FIELD_BIG_ENDIAN - 2
+************************************************************************/
+#define BIT_FIELD_ENDIAN BIT_FIELD_LITTLE_ENDIAN
+#define BIT_FIELD_LITTLE_ENDIAN 1
+#define BIT_FIELD_BIG_ENDIAN 2
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CLIB_DRIVERS_CONFIG_H */
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/inc/clib_drivers_typedef.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,133 @@
+/*******************************************************************************
+* 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) 2013 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file clib_drivers_typedef.h
+* @brief $Module: CLibCommon $ $PublicVersion: 0.90 $ (=CLIB_VERSION)
+* $Rev: 30 $
+* $Date:: 2014-02-13 21:21:47 +0900#$
+* - Description: Common code for drivers and more.
+*/
+
+#ifndef CLIB_DRIVERS_TYPEDEF_H
+#define CLIB_DRIVERS_TYPEDEF_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "Project_Config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @typedef bool32_t
+* @brief Boolean type in 32 bit variable. This is not C99.
+*/
+typedef unsigned int bool32_t;
+
+
+/**
+* @typedef bool16_t
+* @brief Boolean type in 16 bit variable. This is not C99.
+*/
+typedef unsigned short bool16_t;
+
+
+/**
+* @typedef bool8_t
+* @brief Boolean type in 8 bit variable. This is not C99.
+*/
+typedef unsigned char bool8_t;
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def DUMMY_INITIAL_VALUE
+* @brief Avoids not right warning of not initialized.
+*
+* @par Description
+* - 0xDEDEDEDE means "not initialized".
+* - Disable VC++ warning C4701 : local variable may be used without having
+* been initialized
+* - See @ref DUMMY_INITIAL_VALUE_8BIT, @ref DUMMY_INITIAL_VALUE_16BIT
+*/
+#ifndef R_OSPL_NDEBUG
+#define DUMMY_INITIAL_VALUE 0xDEDEDEDE
+#else
+enum { DUMMY_INITIAL_VALUE = 0 };
+#endif
+
+
+/**
+* @def DUMMY_INITIAL_VALUE_8BIT
+* @brief <DUMMY_INITIAL_VALUE> for 8 bit integer.
+*/
+#ifndef R_OSPL_NDEBUG
+enum { DUMMY_INITIAL_VALUE_8BIT = 0xDE };
+#else
+enum { DUMMY_INITIAL_VALUE_8BIT = 0 };
+#endif
+
+
+/**
+* @def DUMMY_INITIAL_VALUE_16BIT
+* @brief <DUMMY_INITIAL_VALUE> for 16 bit integer.
+*/
+#ifndef R_OSPL_NDEBUG
+enum { DUMMY_INITIAL_VALUE_16BIT = 0xDEDE };
+#else
+enum { DUMMY_INITIAL_VALUE_16BIT = 0 };
+#endif
+
+
+/**
+* @def U8_255
+* @brief Magic number of generally well known used.
+* unsigned 8bit max value = UINT8_MAX
+*/
+#define U8_255 255
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CLIB_DRIVERS_TYPEDEF_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/inc/clib_registers.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,321 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file clib_registers.h
+* @brief $Module: CLibCommon $ $PublicVersion: 0.90 $ (=CLIB_VERSION)
+* $Rev: 30 $
+* $Date:: 2014-02-13 21:21:47 +0900#$
+* - Description: Common code for drivers and more.
+*/
+
+#ifndef CLIB_REGISTERS_H
+#define CLIB_REGISTERS_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_typedefs.h"
+#include "r_ospl.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/******************************************************************************
+Inline Functions
+******************************************************************************/
+
+
+/**
+* @brief CPG unit of RZ/A1H.
+*
+* @par Parameters
+* None
+* @return Pointer to CPG structure.
+*/
+INLINE struct st_cpg *R_Get_CPG_Base(void) {
+ /* ->QAC 0306 */
+#if IODEFINE_H_VERSION >= 100
+ return &CPG;
+#else
+ return (struct st_cpg *) &CPG;
+#endif
+ /* <-QAC 0306 */
+}
+
+
+/***********************************************************************
+* Group: Register_Access
+************************************************************************/
+
+/**
+* @brief Set a value to register bit field.
+*
+* @param in_out_Register Address of register or variable
+* @param RegisterName Name of register
+* @param BitName Name of bit
+* @param Value Writing value
+* @return None.
+*
+* @par Description
+* Bit width is got from "RegisterName".
+*/
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+#define R_DRV_SET_REGISTER_BIT_FIELD( \
+ in_out_Register, RegisterName, BitName, Value ) \
+ R_DRV_SET_REGISTER_BIT_FIELD_WITH_REG_WIDTH( \
+ in_out_Register, RegisterName, BitName, Value, \
+ DRV__BIT_WIDTH__##RegisterName )
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+
+/**
+* @brief Set a value to register bit field with width parameter.
+*
+* @param in_out_Register Address of register or variable
+* @param RegisterName Name of register
+* @param BitName Name of bit
+* @param Value Writing value
+* @param BitWidth BitWidth
+* @return None.
+*/
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+/* ->MISRA 19.7 : Expand "DRV__BIT_WIDTH__##RegisterName" macro */
+/* ->SEC M5.1.3 */
+#define R_DRV_SET_REGISTER_BIT_FIELD_WITH_REG_WIDTH( \
+ in_out_Register, RegisterName, BitName, Value, BitWidth ) \
+ R_DRV_SET_REGISTER_BIT_FIELD_SUB0( \
+ in_out_Register, RegisterName##__##BitName, Value, BitWidth )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+/* Sub macro */
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+/* ->MISRA 19.7 : Expand "RegisterName##__##BitName" macro */
+/* ->SEC M5.1.3 */
+#define R_DRV_SET_REGISTER_BIT_FIELD_SUB0( \
+ in_out_Register, RegisterBitName, Value, BitWidth ) \
+ R_DRV_SET_REGISTER_BIT_FIELD_SUB( \
+ in_out_Register, RegisterBitName, Value, BitWidth )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+/* Sub macro */
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+#define R_DRV_SET_REGISTER_BIT_FIELD_SUB( \
+ in_out_Register, RegisterBitName, Value, BitWidth ) \
+ R_OSPL_SET_TO_##BitWidth##_BIT_REGISTER( \
+ (volatile uint##BitWidth##_t*)(in_out_Register), \
+ DRV__MASK##BitWidth##__##RegisterBitName, \
+ DRV__SHIFT__##RegisterBitName, \
+ (uint##BitWidth##_t)(Value) )
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+
+/**
+* @brief Get a value from register bit field.
+*
+* @param RegisterValue Value of register or variable
+* @param RegisterName Name of register
+* @param BitName Name of bit
+* @return Value of shifted bit field.
+*
+* @par Description
+* Bit width is got from "RegisterName".
+*/
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+#define R_DRV_GET_REGISTER_BIT_FIELD( \
+ RegisterValue, RegisterName, BitName ) \
+ R_DRV_GET_REGISTER_BIT_FIELD_WITH_REG_WIDTH( \
+ RegisterValue, RegisterName, BitName, \
+ DRV__BIT_WIDTH__##RegisterName )
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+
+/**
+* @brief Get a value from register bit field with width parameter.
+*
+* @param RegisterValue Value of register or variable
+* @param RegisterName Name of register
+* @param BitName Name of bit
+* @param BitWidth BitWidth
+* @return Value of shifted bit field.
+*/
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+/* ->MISRA 19.7 : Expand "DRV__BIT_WIDTH__##RegisterName" macro */
+/* ->SEC M5.1.3 */
+#define R_DRV_GET_REGISTER_BIT_FIELD_WITH_REG_WIDTH( \
+ RegisterValue, RegisterName, BitName, BitWidth ) \
+ R_DRV_GET_REGISTER_BIT_FIELD_SUB0( \
+ RegisterValue, RegisterName##__##BitName, BitWidth )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+/* Sub macro */
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+/* ->MISRA 19.7 : Expand "RegisterName##__##BitName" macro */
+/* ->SEC M5.1.3 */
+#define R_DRV_GET_REGISTER_BIT_FIELD_SUB0( \
+ RegisterValue, RegisterBitName, BitWidth ) \
+ R_DRV_GET_REGISTER_BIT_FIELD_SUB( \
+ RegisterValue, RegisterBitName, BitWidth )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+/* Sub macro */
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+#define R_DRV_GET_REGISTER_BIT_FIELD_SUB( \
+ RegisterValue, RegisterBitName, BitWidth ) \
+ R_OSPL_GET_FROM_##BitWidth##_BIT_REGISTER( \
+ (volatile const uint##BitWidth##_t*) &(RegisterValue), \
+ DRV__MASK##BitWidth##__##RegisterBitName, \
+ DRV__SHIFT__##RegisterBitName )
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+
+/**
+* @brief Returns whether specified value is overflowed from the bit field.
+*
+* @param RegisterName Name of register
+* @param BitName Name of bit
+* @param Value Checking value
+* @return Whether specified value is overflowed.
+*/
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+#define R_DRV_IS_OVERFLOW_BIT_FIELD( \
+ RegisterName, BitName, Value ) \
+ R_DRV_IS_OVERFLOW_BIT_FIELD_WITH_REG_WIDTH( \
+ RegisterName, BitName, Value, DRV__BIT_WIDTH__##RegisterName )
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+
+/**
+* @brief Returns whether specified value is overflowed from the bit field.
+*
+* @param RegisterName Name of register
+* @param BitName Name of bit
+* @param Value Checking value
+* @param BitWidth BitWidth
+* @return Whether specified value is overflowed.
+*/
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+/* ->MISRA 19.7 : Expand "DRV__BIT_WIDTH__##RegisterName" macro */
+/* ->SEC M5.1.3 */
+#define R_DRV_IS_OVERFLOW_BIT_FIELD_WITH_REG_WIDTH( \
+ RegisterName, BitName, Value, BitWidth ) \
+ R_DRV_IS_OVERFLOW_BIT_FIELD_SUB0( \
+ RegisterName##__##BitName, Value, BitWidth )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+/* Sub macro */
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+/* ->MISRA 19.7 : Expand "RegisterName##__##BitName" macro */
+/* ->SEC M5.1.3 */
+#define R_DRV_IS_OVERFLOW_BIT_FIELD_SUB0( \
+ RegisterBitName, Value, BitWidth ) \
+ R_DRV_IS_OVERFLOW_BIT_FIELD_SUB( \
+ RegisterBitName, Value, BitWidth )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+/* Sub macro */
+/* ->MISRA 19.12 */ /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+#define R_DRV_IS_OVERFLOW_BIT_FIELD_SUB( \
+ RegisterBitName, Value, BitWidth ) \
+ R_DRV_IsOverflowBitField##BitWidth##_Sub( \
+ DRV__MASK##BitWidth##__##RegisterBitName, \
+ DRV__SHIFT__##RegisterBitName, \
+ Value )
+/* <-MISRA 19.12 */ /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+
+/* Sub function */
+/* : R_DRV_IsOverflowBitField32_Sub */
+/* : R_DRV_IsOverflowBitField16_Sub */
+/* : R_DRV_IsOverflowBitField8_Sub */
+INLINE bool_t R_DRV_IsOverflowBitField32_Sub( uint32_t const Mask,
+ int_fast32_t const Shift, uint32_t const Value )
+{
+ return ( ( (uint32_t)(Value) &
+ ~( (uint32_t)(Mask) >> (Shift) ) )
+ != 0u );
+}
+
+INLINE bool_t R_DRV_IsOverflowBitField16_Sub( uint16_t const Mask,
+ int_fast32_t const Shift, uint16_t const Value )
+{
+ return ( ( (uint_fast16_t)(Value) &
+ ~( (uint_fast16_t)(Mask) >> (Shift) ) )
+ != 0u );
+}
+
+INLINE bool_t R_DRV_IsOverflowBitField8_Sub( uint8_t const Mask,
+ int_fast32_t const Shift, uint8_t const Value )
+{
+ return ( ( (uint_fast8_t)(Value) &
+ ~( (uint_fast8_t)(Mask) >> (Shift) ) )
+ != 0u );
+}
+
+
+/**
+* @def CPG
+* @brief CPG
+*/
+/* 0xFCFE0438 */
+
+#define DRV__BIT_WIDTH__STBCR9 8
+
+enum { /*uint8_t */ DRV__MASK8__STBCR9__MSTP91 = 0x02 }; /* VDC5-0, LVDS */
+enum { /*uint8_t */ DRV__MASK8__STBCR9__MSTP90 = 0x01 }; /* VDC5-1 */
+
+enum { /* int_fast32_t */ DRV__SHIFT__STBCR9__MSTP91 = 1 };
+enum { /* int_fast32_t */ DRV__SHIFT__STBCR9__MSTP90 = 0 };
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CLIB_REGISTERS_H */
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/src/clib_drivers.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,86 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file clib_drivers.c
+* @brief $Module: CLibCommon $ $PublicVersion: 0.90 $ (=CLIB_VERSION)
+* $Rev: 30 $
+* $Date:: 2014-02-13 21:21:47 +0900#$
+* - Description: Common code.
+*/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#include "clib_drivers.h"
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+/**
+* @brief Cast with range check
+*
+* @param input Input value
+* @param output Output value
+* @return Error Code. 0=No Error.
+*/
+errnum_t R_int32_t_to_int8_t( int32_t const input, int8_t *const output )
+{
+ errnum_t e;
+
+ IF ( (input < INT8_MIN) || (input > INT8_MAX) ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ IF_DQ( output == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ *output = (int8_t) input;
+
+ e=0;
+fin:
+ return e;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config/Project_Config.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,70 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/******************************************************************************
+* $FileName: Project_Config.h $
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+* Description : This file is for drivers and applications
+******************************************************************************/
+
+#ifndef PROJECT_CONFIG_H
+#define PROJECT_CONFIG_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+/* This file must be included at first of source file */
+/* Include configuration header files of drivers and applications */
+#include "Project_Config_Sub.h"
+#include "../ospl/inc/r_ospl_config.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_OSPL_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config/Project_Config_Sub.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,114 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/******************************************************************************
+* $FileName: Project_Config.h $
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+* Description : This file is for drivers and applications
+******************************************************************************/
+
+#ifndef PROJECT_CONFIG_SUB_H
+#define PROJECT_CONFIG_SUB_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def IS_RZ_A1_BSP_USED
+* @brief 0 or 1
+* @par Parameters
+* None
+* @return None.
+*/
+#define IS_RZ_A1_BSP_USED 1
+
+
+/**
+* @def IS_CMSIS_USED
+* @brief 0 or 1
+* @par Parameters
+* None
+* @return None.
+*/
+#define IS_CMSIS_USED 1
+
+
+/**
+* @def IS_RTX_USED
+* @brief 0 or 1. Not CMSIS API.
+* @par Parameters
+* None
+* @return None.
+*/
+#define IS_RTX_USED 1
+
+
+/**
+* @def IS_MBED_USED
+* @brief 0 or 1
+* @par Parameters
+* None
+* @return None.
+*/
+#define IS_MBED_USED 1
+
+
+/**
+* @def IS_VDC_SAMPLE_VRAM_USED
+* @brief 0 or 1
+* @par Parameters
+* None
+* @return None.
+*/
+#define IS_VDC_SAMPLE_VRAM_USED 0
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* PROJECT_CONFIG_SUB_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iobitmasks/cpg_iobitmask.h Wed Aug 19 08:58:26 2015 +0000 @@ -0,0 +1,461 @@ +/******************************************************************************* +* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved. +*******************************************************************************/ +/******************************************************************************* +* File Name : cpg_iobitmask.h +* $Rev: 809 $ +* $Date:: 2014-04-09 15:06:36 +0900#$ +* Description : CPG register define header +*******************************************************************************/ +#ifndef CPG_IOBITMASK_H +#define CPG_IOBITMASK_H + + +/* ==== Mask values for IO registers ==== */ +#define CPG_FRQCR_IFC (0x0300u) +#define CPG_FRQCR_CKOEN (0x3000u) +#define CPG_FRQCR_CKOEN2 (0x4000u) + +#define CPG_FRQCR2_GFC (0x0003u) + +#define CPG_CPUSTS_ISBUSY (0x10u) + +#define CPG_STBCR1_DEEP (0x40u) +#define CPG_STBCR1_STBY (0x80u) + +#define CPG_STBCR2_MSTP20 (0x01u) +#define CPG_STBCR2_HIZ (0x80u) + +#define CPG_STBREQ1_STBRQ10 (0x01u) +#define CPG_STBREQ1_STBRQ12 (0x04u) +#define CPG_STBREQ1_STBRQ13 (0x08u) +#define CPG_STBREQ1_STBRQ15 (0x20u) + +#define CPG_STBREQ2_STBRQ20 (0x01u) +#define CPG_STBREQ2_STBRQ21 (0x02u) +#define CPG_STBREQ2_STBRQ22 (0x04u) +#define CPG_STBREQ2_STBRQ23 (0x08u) +#define CPG_STBREQ2_STBRQ24 (0x10u) +#define CPG_STBREQ2_STBRQ25 (0x20u) +#define CPG_STBREQ2_STBRQ26 (0x40u) +#define CPG_STBREQ2_STBRQ27 (0x80u) + +#define CPG_STBACK1_STBAK10 (0x01u) +#define CPG_STBACK1_STBAK12 (0x04u) +#define CPG_STBACK1_STBAK13 (0x08u) +#define CPG_STBACK1_STBAK15 (0x20u) + +#define CPG_STBACK2_STBAK20 (0x01u) +#define CPG_STBACK2_STBAK21 (0x02u) +#define CPG_STBACK2_STBAK22 (0x04u) +#define CPG_STBACK2_STBAK23 (0x08u) +#define CPG_STBACK2_STBAK24 (0x10u) +#define CPG_STBACK2_STBAK25 (0x20u) +#define CPG_STBACK2_STBAK26 (0x40u) +#define CPG_STBACK2_STBAK27 (0x80u) + +#define CPG_SYSCR1_VRAME0 (0x01u) +#define CPG_SYSCR1_VRAME1 (0x02u) +#define CPG_SYSCR1_VRAME2 (0x04u) +#define CPG_SYSCR1_VRAME3 (0x08u) +#define CPG_SYSCR1_VRAME4 (0x10u) + +#define CPG_SYSCR2_VRAMWE0 (0x01u) +#define CPG_SYSCR2_VRAMWE1 (0x02u) +#define CPG_SYSCR2_VRAMWE2 (0x04u) +#define CPG_SYSCR2_VRAMWE3 (0x08u) +#define CPG_SYSCR2_VRAMWE4 (0x10u) + +#define CPG_SYSCR3_RRAMWE0 (0x01u) +#define CPG_SYSCR3_RRAMWE1 (0x02u) +#define CPG_SYSCR3_RRAMWE2 (0x04u) +#define CPG_SYSCR3_RRAMWE3 (0x08u) + +#define CPG_STBCR3_MSTP30 (0x01u) +#define CPG_STBCR3_MSTP31 (0x02u) +#define CPG_STBCR3_MSTP32 (0x04u) +#define CPG_STBCR3_MSTP33 (0x08u) +#define CPG_STBCR3_MSTP34 (0x10u) +#define CPG_STBCR3_MSTP35 (0x20u) +#define CPG_STBCR3_MSTP36 (0x40u) +#define CPG_STBCR3_MSTP37 (0x80u) + +#define CPG_STBCR4_MSTP40 (0x01u) +#define CPG_STBCR4_MSTP41 (0x02u) +#define CPG_STBCR4_MSTP42 (0x04u) +#define CPG_STBCR4_MSTP43 (0x08u) +#define CPG_STBCR4_MSTP44 (0x10u) +#define CPG_STBCR4_MSTP45 (0x20u) +#define CPG_STBCR4_MSTP46 (0x40u) +#define CPG_STBCR4_MSTP47 (0x80u) + +#define CPG_STBCR5_MSTP50 (0x01u) +#define CPG_STBCR5_MSTP51 (0x02u) +#define CPG_STBCR5_MSTP52 (0x04u) +#define CPG_STBCR5_MSTP53 (0x08u) +#define CPG_STBCR5_MSTP54 (0x10u) +#define CPG_STBCR5_MSTP55 (0x20u) +#define CPG_STBCR5_MSTP56 (0x40u) +#define CPG_STBCR5_MSTP57 (0x80u) + +#define CPG_STBCR6_MSTP60 (0x01u) +#define CPG_STBCR6_MSTP61 (0x02u) +#define CPG_STBCR6_MSTP62 (0x04u) +#define CPG_STBCR6_MSTP63 (0x08u) +#define CPG_STBCR6_MSTP64 (0x10u) +#define CPG_STBCR6_MSTP65 (0x20u) +#define CPG_STBCR6_MSTP66 (0x40u) +#define CPG_STBCR6_MSTP67 (0x80u) + +#define CPG_STBCR7_MSTP70 (0x01u) +#define CPG_STBCR7_MSTP71 (0x02u) +#define CPG_STBCR7_MSTP73 (0x08u) +#define CPG_STBCR7_MSTP74 (0x10u) +#define CPG_STBCR7_MSTP76 (0x40u) +#define CPG_STBCR7_MSTP77 (0x80u) + +#define CPG_STBCR8_MSTP81 (0x02u) +#define CPG_STBCR8_MSTP82 (0x04u) +#define CPG_STBCR8_MSTP83 (0x08u) +#define CPG_STBCR8_MSTP84 (0x10u) +#define CPG_STBCR8_MSTP85 (0x20u) +#define CPG_STBCR8_MSTP86 (0x40u) +#define CPG_STBCR8_MSTP87 (0x80u) + +#define CPG_STBCR9_MSTP90 (0x01u) +#define CPG_STBCR9_MSTP91 (0x02u) +#define CPG_STBCR9_MSTP92 (0x04u) +#define CPG_STBCR9_MSTP93 (0x08u) +#define CPG_STBCR9_MSTP94 (0x10u) +#define CPG_STBCR9_MSTP95 (0x20u) +#define CPG_STBCR9_MSTP96 (0x40u) +#define CPG_STBCR9_MSTP97 (0x80u) + +#define CPG_STBCR10_MSTP100 (0x01u) +#define CPG_STBCR10_MSTP101 (0x02u) +#define CPG_STBCR10_MSTP102 (0x04u) +#define CPG_STBCR10_MSTP103 (0x08u) +#define CPG_STBCR10_MSTP104 (0x10u) +#define CPG_STBCR10_MSTP105 (0x20u) +#define CPG_STBCR10_MSTP106 (0x40u) +#define CPG_STBCR10_MSTP107 (0x80u) + +#define CPG_STBCR11_MSTP110 (0x01u) +#define CPG_STBCR11_MSTP111 (0x02u) +#define CPG_STBCR11_MSTP112 (0x04u) +#define CPG_STBCR11_MSTP113 (0x08u) +#define CPG_STBCR11_MSTP114 (0x10u) +#define CPG_STBCR11_MSTP115 (0x20u) + +#define CPG_STBCR12_MSTP120 (0x01u) +#define CPG_STBCR12_MSTP121 (0x02u) +#define CPG_STBCR12_MSTP122 (0x04u) +#define CPG_STBCR12_MSTP123 (0x08u) + +#define CPG_STBCR13_MSTP131 (0x02u) +#define CPG_STBCR13_MSTP132 (0x04u) + +#define CPG_SWRSTCR1_SRST11 (0x02u) +#define CPG_SWRSTCR1_SRST12 (0x04u) +#define CPG_SWRSTCR1_SRST13 (0x08u) +#define CPG_SWRSTCR1_SRST14 (0x10u) +#define CPG_SWRSTCR1_SRST15 (0x20u) +#define CPG_SWRSTCR1_SRST16 (0x40u) +#define CPG_SWRSTCR1_AXTALE (0x80u) + +#define CPG_SWRSTCR2_SRST21 (0x02u) + +#define CPG_SWRSTCR3_SRST32 (0x04u) + +#define CPG_RRAMKP_RRAMKP0 (0x01u) +#define CPG_RRAMKP_RRAMKP1 (0x02u) +#define CPG_RRAMKP_RRAMKP2 (0x04u) +#define CPG_RRAMKP_RRAMKP3 (0x08u) + +#define CPG_DSCTR_RAMBOOT (0x40u) +#define CPG_DSCTR_EBUSKEEPE (0x80u) + +#define CPG_DSSSR_P8_2 (0x0001u) +#define CPG_DSSSR_P9_1 (0x0002u) +#define CPG_DSSSR_P2_15 (0x0004u) +#define CPG_DSSSR_P7_8 (0x0008u) +#define CPG_DSSSR_P5_9 (0x0010u) +#define CPG_DSSSR_P6_4 (0x0020u) +#define CPG_DSSSR_RTCAR (0x0040u) +#define CPG_DSSSR_NMI (0x0100u) +#define CPG_DSSSR_P3_3 (0x0200u) +#define CPG_DSSSR_P8_7 (0x0400u) +#define CPG_DSSSR_P2_12 (0x0800u) +#define CPG_DSSSR_P3_1 (0x1000u) +#define CPG_DSSSR_P3_9 (0x2000u) +#define CPG_DSSSR_P6_2 (0x4000u) + +#define CPG_DSESR_P8_2E (0x0001u) +#define CPG_DSESR_P9_1E (0x0002u) +#define CPG_DSESR_P2_15E (0x0004u) +#define CPG_DSESR_P7_8E (0x0008u) +#define CPG_DSESR_P5_9E (0x0010u) +#define CPG_DSESR_P6_4E (0x0020u) +#define CPG_DSESR_NMIE (0x0100u) +#define CPG_DSESR_P3_3E (0x0200u) +#define CPG_DSESR_P8_7E (0x0400u) +#define CPG_DSESR_P2_12E (0x0800u) +#define CPG_DSESR_P3_1E (0x1000u) +#define CPG_DSESR_P3_9E (0x2000u) +#define CPG_DSESR_P6_2E (0x4000u) + +#define CPG_DSFR_P8_2F (0x0001u) +#define CPG_DSFR_P9_1F (0x0002u) +#define CPG_DSFR_P2_15F (0x0004u) +#define CPG_DSFR_P7_8F (0x0008u) +#define CPG_DSFR_P5_9F (0x0010u) +#define CPG_DSFR_P6_4F (0x0020u) +#define CPG_DSFR_RTCARF (0x0040u) +#define CPG_DSFR_NMIF (0x0100u) +#define CPG_DSFR_P3_3F (0x0200u) +#define CPG_DSFR_P8_7F (0x0400u) +#define CPG_DSFR_P2_12F (0x0800u) +#define CPG_DSFR_P3_1F (0x1000u) +#define CPG_DSFR_P3_9F (0x2000u) +#define CPG_DSFR_P6_2F (0x4000u) +#define CPG_DSFR_IOKEEP (0x8000u) + +#define CPG_XTALCTR_GAIN0 (0x01u) +#define CPG_XTALCTR_GAIN1 (0x02u) + + +/* ==== Shift values for IO registers ==== */ +#define CPG_FRQCR_IFC_SHIFT (8u) +#define CPG_FRQCR_CKOEN_SHIFT (12u) +#define CPG_FRQCR_CKOEN2_SHIFT (14u) + +#define CPG_FRQCR2_GFC_SHIFT (0u) + +#define CPG_CPUSTS_ISBUSY_SHIFT (4u) + +#define CPG_STBCR1_DEEP_SHIFT (6u) +#define CPG_STBCR1_STBY_SHIFT (7u) + +#define CPG_STBCR2_MSTP20_SHIFT (0u) +#define CPG_STBCR2_HIZ_SHIFT (7u) + +#define CPG_STBREQ1_STBRQ10_SHIFT (0u) +#define CPG_STBREQ1_STBRQ12_SHIFT (2u) +#define CPG_STBREQ1_STBRQ13_SHIFT (3u) +#define CPG_STBREQ1_STBRQ15_SHIFT (5u) + +#define CPG_STBREQ2_STBRQ20_SHIFT (0u) +#define CPG_STBREQ2_STBRQ21_SHIFT (1u) +#define CPG_STBREQ2_STBRQ22_SHIFT (2u) +#define CPG_STBREQ2_STBRQ23_SHIFT (3u) +#define CPG_STBREQ2_STBRQ24_SHIFT (4u) +#define CPG_STBREQ2_STBRQ25_SHIFT (5u) +#define CPG_STBREQ2_STBRQ26_SHIFT (6u) +#define CPG_STBREQ2_STBRQ27_SHIFT (7u) + +#define CPG_STBACK1_STBAK10_SHIFT (0u) +#define CPG_STBACK1_STBAK12_SHIFT (2u) +#define CPG_STBACK1_STBAK13_SHIFT (3u) +#define CPG_STBACK1_STBAK15_SHIFT (5u) + +#define CPG_STBACK2_STBAK20_SHIFT (0u) +#define CPG_STBACK2_STBAK21_SHIFT (1u) +#define CPG_STBACK2_STBAK22_SHIFT (2u) +#define CPG_STBACK2_STBAK23_SHIFT (3u) +#define CPG_STBACK2_STBAK24_SHIFT (4u) +#define CPG_STBACK2_STBAK25_SHIFT (5u) +#define CPG_STBACK2_STBAK26_SHIFT (6u) +#define CPG_STBACK2_STBAK27_SHIFT (7u) + +#define CPG_SYSCR1_VRAME0_SHIFT (0u) +#define CPG_SYSCR1_VRAME1_SHIFT (1u) +#define CPG_SYSCR1_VRAME2_SHIFT (2u) +#define CPG_SYSCR1_VRAME3_SHIFT (3u) +#define CPG_SYSCR1_VRAME4_SHIFT (4u) + +#define CPG_SYSCR2_VRAMWE0_SHIFT (0u) +#define CPG_SYSCR2_VRAMWE1_SHIFT (1u) +#define CPG_SYSCR2_VRAMWE2_SHIFT (2u) +#define CPG_SYSCR2_VRAMWE3_SHIFT (3u) +#define CPG_SYSCR2_VRAMWE4_SHIFT (4u) + +#define CPG_SYSCR3_RRAMWE0_SHIFT (0u) +#define CPG_SYSCR3_RRAMWE1_SHIFT (1u) +#define CPG_SYSCR3_RRAMWE2_SHIFT (2u) +#define CPG_SYSCR3_RRAMWE3_SHIFT (3u) + +#define CPG_STBCR3_MSTP30_SHIFT (0u) +#define CPG_STBCR3_MSTP31_SHIFT (1u) +#define CPG_STBCR3_MSTP32_SHIFT (2u) +#define CPG_STBCR3_MSTP33_SHIFT (3u) +#define CPG_STBCR3_MSTP34_SHIFT (4u) +#define CPG_STBCR3_MSTP35_SHIFT (5u) +#define CPG_STBCR3_MSTP36_SHIFT (6u) +#define CPG_STBCR3_MSTP37_SHIFT (7u) + +#define CPG_STBCR4_MSTP40_SHIFT (0u) +#define CPG_STBCR4_MSTP41_SHIFT (1u) +#define CPG_STBCR4_MSTP42_SHIFT (2u) +#define CPG_STBCR4_MSTP43_SHIFT (3u) +#define CPG_STBCR4_MSTP44_SHIFT (4u) +#define CPG_STBCR4_MSTP45_SHIFT (5u) +#define CPG_STBCR4_MSTP46_SHIFT (6u) +#define CPG_STBCR4_MSTP47_SHIFT (7u) + +#define CPG_STBCR5_MSTP50_SHIFT (0u) +#define CPG_STBCR5_MSTP51_SHIFT (1u) +#define CPG_STBCR5_MSTP52_SHIFT (2u) +#define CPG_STBCR5_MSTP53_SHIFT (3u) +#define CPG_STBCR5_MSTP54_SHIFT (4u) +#define CPG_STBCR5_MSTP55_SHIFT (5u) +#define CPG_STBCR5_MSTP56_SHIFT (6u) +#define CPG_STBCR5_MSTP57_SHIFT (7u) + +#define CPG_STBCR6_MSTP60_SHIFT (0u) +#define CPG_STBCR6_MSTP61_SHIFT (1u) +#define CPG_STBCR6_MSTP62_SHIFT (2u) +#define CPG_STBCR6_MSTP63_SHIFT (3u) +#define CPG_STBCR6_MSTP64_SHIFT (4u) +#define CPG_STBCR6_MSTP65_SHIFT (5u) +#define CPG_STBCR6_MSTP66_SHIFT (6u) +#define CPG_STBCR6_MSTP67_SHIFT (7u) + +#define CPG_STBCR7_MSTP70_SHIFT (0u) +#define CPG_STBCR7_MSTP71_SHIFT (1u) +#define CPG_STBCR7_MSTP73_SHIFT (3u) +#define CPG_STBCR7_MSTP74_SHIFT (4u) +#define CPG_STBCR7_MSTP76_SHIFT (6u) +#define CPG_STBCR7_MSTP77_SHIFT (7u) + +#define CPG_STBCR8_MSTP81_SHIFT (1u) +#define CPG_STBCR8_MSTP82_SHIFT (2u) +#define CPG_STBCR8_MSTP83_SHIFT (3u) +#define CPG_STBCR8_MSTP84_SHIFT (4u) +#define CPG_STBCR8_MSTP85_SHIFT (5u) +#define CPG_STBCR8_MSTP86_SHIFT (6u) +#define CPG_STBCR8_MSTP87_SHIFT (7u) + +#define CPG_STBCR9_MSTP90_SHIFT (0u) +#define CPG_STBCR9_MSTP91_SHIFT (1u) +#define CPG_STBCR9_MSTP92_SHIFT (2u) +#define CPG_STBCR9_MSTP93_SHIFT (3u) +#define CPG_STBCR9_MSTP94_SHIFT (4u) +#define CPG_STBCR9_MSTP95_SHIFT (5u) +#define CPG_STBCR9_MSTP96_SHIFT (6u) +#define CPG_STBCR9_MSTP97_SHIFT (7u) + +#define CPG_STBCR10_MSTP100_SHIFT (0u) +#define CPG_STBCR10_MSTP101_SHIFT (1u) +#define CPG_STBCR10_MSTP102_SHIFT (2u) +#define CPG_STBCR10_MSTP103_SHIFT (3u) +#define CPG_STBCR10_MSTP104_SHIFT (4u) +#define CPG_STBCR10_MSTP105_SHIFT (5u) +#define CPG_STBCR10_MSTP106_SHIFT (6u) +#define CPG_STBCR10_MSTP107_SHIFT (7u) + +#define CPG_STBCR11_MSTP110_SHIFT (0u) +#define CPG_STBCR11_MSTP111_SHIFT (1u) +#define CPG_STBCR11_MSTP112_SHIFT (2u) +#define CPG_STBCR11_MSTP113_SHIFT (3u) +#define CPG_STBCR11_MSTP114_SHIFT (4u) +#define CPG_STBCR11_MSTP115_SHIFT (5u) + +#define CPG_STBCR12_MSTP120_SHIFT (0u) +#define CPG_STBCR12_MSTP121_SHIFT (1u) +#define CPG_STBCR12_MSTP122_SHIFT (2u) +#define CPG_STBCR12_MSTP123_SHIFT (3u) + +#define CPG_STBCR13_MSTP131_SHIFT (1u) +#define CPG_STBCR13_MSTP132_SHIFT (2u) + +#define CPG_SWRSTCR1_SRST11_SHIFT (1u) +#define CPG_SWRSTCR1_SRST12_SHIFT (2u) +#define CPG_SWRSTCR1_SRST13_SHIFT (3u) +#define CPG_SWRSTCR1_SRST14_SHIFT (4u) +#define CPG_SWRSTCR1_SRST15_SHIFT (5u) +#define CPG_SWRSTCR1_SRST16_SHIFT (6u) +#define CPG_SWRSTCR1_AXTALE_SHIFT (7u) + +#define CPG_SWRSTCR2_SRST21_SHIFT (1u) + +#define CPG_SWRSTCR3_SRST32_SHIFT (2u) + +#define CPG_RRAMKP_RRAMKP0_SHIFT (0u) +#define CPG_RRAMKP_RRAMKP1_SHIFT (1u) +#define CPG_RRAMKP_RRAMKP2_SHIFT (2u) +#define CPG_RRAMKP_RRAMKP3_SHIFT (3u) + +#define CPG_DSCTR_RAMBOOT_SHIFT (6u) +#define CPG_DSCTR_EBUSKEEPE_SHIFT (7u) + +#define CPG_DSSSR_P8_2_SHIFT (0u) +#define CPG_DSSSR_P9_1_SHIFT (1u) +#define CPG_DSSSR_P2_15_SHIFT (2u) +#define CPG_DSSSR_P7_8_SHIFT (3u) +#define CPG_DSSSR_P5_9_SHIFT (4u) +#define CPG_DSSSR_P6_4_SHIFT (5u) +#define CPG_DSSSR_RTCAR_SHIFT (6u) +#define CPG_DSSSR_NMI_SHIFT (8u) +#define CPG_DSSSR_P3_3_SHIFT (9u) +#define CPG_DSSSR_P8_7_SHIFT (10u) +#define CPG_DSSSR_P2_12_SHIFT (11u) +#define CPG_DSSSR_P3_1_SHIFT (12u) +#define CPG_DSSSR_P3_9_SHIFT (13u) +#define CPG_DSSSR_P6_2_SHIFT (14u) + +#define CPG_DSESR_P8_2E_SHIFT (0u) +#define CPG_DSESR_P9_1E_SHIFT (1u) +#define CPG_DSESR_P2_15E_SHIFT (2u) +#define CPG_DSESR_P7_8E_SHIFT (3u) +#define CPG_DSESR_P5_9E_SHIFT (4u) +#define CPG_DSESR_P6_4E_SHIFT (5u) +#define CPG_DSESR_NMIE_SHIFT (8u) +#define CPG_DSESR_P3_3E_SHIFT (9u) +#define CPG_DSESR_P8_7E_SHIFT (10u) +#define CPG_DSESR_P2_12E_SHIFT (11u) +#define CPG_DSESR_P3_1E_SHIFT (12u) +#define CPG_DSESR_P3_9E_SHIFT (13u) +#define CPG_DSESR_P6_2E_SHIFT (14u) + +#define CPG_DSFR_P8_2F_SHIFT (0u) +#define CPG_DSFR_P9_1F_SHIFT (1u) +#define CPG_DSFR_P2_15F_SHIFT (2u) +#define CPG_DSFR_P7_8F_SHIFT (3u) +#define CPG_DSFR_P5_9F_SHIFT (4u) +#define CPG_DSFR_P6_4F_SHIFT (5u) +#define CPG_DSFR_RTCARF_SHIFT (6u) +#define CPG_DSFR_NMIF_SHIFT (8u) +#define CPG_DSFR_P3_3F_SHIFT (9u) +#define CPG_DSFR_P8_7F_SHIFT (10u) +#define CPG_DSFR_P2_12F_SHIFT (11u) +#define CPG_DSFR_P3_1F_SHIFT (12u) +#define CPG_DSFR_P3_9F_SHIFT (13u) +#define CPG_DSFR_P6_2F_SHIFT (14u) +#define CPG_DSFR_IOKEEP_SHIFT (15u) + +#define CPG_XTALCTR_GAIN0_SHIFT (0u) +#define CPG_XTALCTR_GAIN1_SHIFT (1u) + + +#endif /* CPG_IOBITMASK_H */ + +/* End of File */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/inc/JPEG_Converter.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,208 @@
+/*******************************************************************************
+* 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) 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**************************************************************************//**
+* @file JPEG_Converter.h
+* @brief JCU API
+******************************************************************************/
+
+#ifndef JPEG_CONVERTER_H
+#define JPEG_CONVERTER_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/** A class to communicate a JCU
+ *
+ */
+class JPEG_Converter {
+
+public:
+ /*! @enum jpeg_conv_error_t
+ @brief Error codes
+ */
+ typedef enum {
+ JPEG_CONV_OK = 0, /*!< Normal termination */
+ JPEG_CONV_JCU_ERR = -1, /*!< JCU driver error */
+ JPEG_CONV_FORMA_ERR = -2, /*!< Not support format */
+ JPEG_CONV_PARAM_ERR = -3, /*!< Parameter error */
+ JPEG_CONV_PARAM_RANGE_ERR = -7, /*!< Parameter range error */
+ } jpeg_conv_error_t;
+
+ /*! @enum wr_rd_swa_t
+ @brief Write/Read image pixcel frame buffer swap setting
+ */
+ typedef enum {
+ WR_RD_WRSWA_NON = 0, /*!< Not swapped: 1-2-3-4-5-6-7-8 */
+ WR_RD_WRSWA_8BIT = 1, /*!< Swapped in 8-bit units: 2-1-4-3-6-5-8-7 */
+ WR_RD_WRSWA_16BIT = 2, /*!< Swapped in 16-bit units: 3-4-1-2-7-8-5-6 */
+ WR_RD_WRSWA_16_8BIT = 3, /*!< Swapped in 16-bit units + 8-bit units: 4-3-2-1-8-7-6-5 */
+ WR_RD_WRSWA_32BIT = 4, /*!< Swapped in 32-bit units: 5-6-7-8-1-2-3-4 */
+ WR_RD_WRSWA_32_8BIT = 5, /*!< Swapped in 32-bit units + 8-bit units: 6-5-8-7-2-1-4-3 */
+ WR_RD_WRSWA_32_16BIT = 6, /*!< Swapped in 32-bit units + 16-bit units: 7-8-5-6-3-4-1-2 */
+ WR_RD_WRSWA_32_16_8BIT = 7, /*!< Swapped in 32-bit units + 16-bit units + 8-bit units: 8-7-6-5-4-3-2-1 */
+ } wr_rd_swa_t;
+
+ /*! @enum wr_rd_format_t
+ @brief Write/Read image pixcel format selects
+ */
+ typedef enum {
+ WR_RD_YCbCr422 = 0x00, /*!< YCbCr422 (2byte / px) */
+ WR_RD_ARGB8888 = 0x01, /*!< ARGB8888 (4byte / px) */
+ WR_RD_RGB565 = 0x02, /*!< RGB565 (2byte / px) */
+ } wr_rd_format_t;
+
+ /*! @enum sub_sampling_t
+ @brief Thinning output image selects
+ */
+ typedef enum {
+ SUB_SAMPLING_1_1 = 0x00, /*!< Thinning output image to 1/1 */
+ SUB_SAMPLING_1_2 = 0x01, /*!< Thinning output image to 1/2 */
+ SUB_SAMPLING_1_4 = 0x02, /*!< Thinning output image to 1/4 */
+ SUB_SAMPLING_1_8 = 0x03 /*!< Thinning output image to 1/8 */
+ } sub_sampling_t;
+
+ /*! @enum cbcr_offset_t
+ @brief Cb/Cr range selects for decode
+ */
+ typedef enum {
+ CBCR_OFFSET_0 = 0x00, /*!< Cb/Cr range -128 to 127 (Default and all format used) */
+ CBCR_OFFSET_128 = 0x01, /*!< Cb/Cr range 0 to 255 (YCbCr format only used) */
+ } cbcr_offset_t;
+
+ /*! @struct bitmap_buff_info_t
+ @brief Bitmap data setting struct
+ */
+ typedef struct {
+ int32_t width; /*!< width width of bitmap data */
+ int32_t height; /*!< height height of bitmap data */
+ JPEG_Converter::wr_rd_format_t format; /*!< format format of bitmap data */
+ void* buffer_address; /*!< buffer_address address of bitmap data */
+ } bitmap_buff_info_t;
+
+ /** Constructor method of JPEG converter(encode/decode)
+ */
+ JPEG_Converter();
+
+ /** Destructor method of JPEG converter(encode/decode)
+ */
+ virtual ~JPEG_Converter();
+
+ /*! @struct DecodeOptions_t
+ @brief Decode option setting
+ */
+ struct decode_options_t {
+ sub_sampling_t vertical_sub_sampling; /*!< Vertical sampling setting */
+ sub_sampling_t horizontal_sub_sampling; /*!< Horizontal sampling setting */
+ cbcr_offset_t output_cb_cr_offset; /*!< Output data Cb/Cr range setting */
+ wr_rd_swa_t output_swapsetting; /*!< Output data swap setteing */
+ int32_t alpha; /*!< alpha setting for ARGB8888 */
+ bool check_jpeg_format; /*!< Flag check JPEG data format : Setting NULL does not check JPEG format when decoding */
+ void (* p_DecodeCallBackFunc)(jpeg_conv_error_t err_code); /*!< Callback function address */
+
+ decode_options_t() {
+ vertical_sub_sampling = SUB_SAMPLING_1_1;
+ horizontal_sub_sampling = SUB_SAMPLING_1_1;
+ output_cb_cr_offset = CBCR_OFFSET_128;
+ output_swapsetting = WR_RD_WRSWA_8BIT;
+ alpha = 0;
+ check_jpeg_format = false;
+ p_DecodeCallBackFunc = NULL;
+ }
+ };
+
+ /*! @struct encode_options_t
+ @brief Encode option setting
+ */
+ struct encode_options_t {
+ int32_t DRI_value; /*!< DRI setting */
+ int32_t width; /*!< Encode width */
+ int32_t height; /*!< Encode height */
+ cbcr_offset_t input_cb_cr_offset; /*!< Input data Cb/Cr range setting */
+ wr_rd_swa_t input_swapsetting; /*!< Input data swap setteing */
+ size_t encode_buff_size; /*!< Encode buffer size : Setting 0 does not the buffer size confirmation of when encoding */
+ void* quantization_table_Y; /*!< Quantization table address(Y) */
+ void* quantization_table_C; /*!< Quantization table address(C) */
+ void* huffman_table_Y_DC; /*!< Huffman Table address(Y DC) */
+ void* huffman_table_C_DC; /*!< Huffman Table address(C DC) */
+ void* huffman_table_Y_AC; /*!< Huffman Table address(Y AC) */
+ void* huffman_table_C_AC; /*!< Huffman Table address(C AC) */
+ void (* p_EncodeCallBackFunc)(jpeg_conv_error_t err_code); /*!< Callback function address */
+
+ encode_options_t() {
+ DRI_value = 0;
+ width = 0;
+ height = 0;
+ input_cb_cr_offset = CBCR_OFFSET_128;
+ input_swapsetting = WR_RD_WRSWA_8BIT;
+ encode_buff_size = 0;
+ quantization_table_Y = NULL;
+ quantization_table_C = NULL;
+ huffman_table_Y_DC = NULL;
+ huffman_table_C_DC = NULL;
+ huffman_table_Y_AC = NULL;
+ huffman_table_C_AC = NULL;
+ p_EncodeCallBackFunc = NULL;
+ }
+ };
+
+ /** Decode JPEG to rinear data
+ *
+ * @param[in] void* pJpegBuff : Input JPEG data address
+ * @param[in/out] bitmap_buff_info_t* psOutputBuff : Output bitmap data address
+ * @param[in] decode_options_t* pOptions : Decode option(Optional)
+ * @return JPEG_CONV_OK = success
+ * JPEG_CONV_JCU_ERR = failure (JCU error)
+ * JPEG_CONV_FORMA_ERR = failure (data format error)
+ * JPEG_CONV_PARAM_ERR = failure (input parameter error)
+ * JPEG_CONV_PARAM_RANGE_ERR = failure (input parameter range error)
+ */
+ JPEG_Converter::jpeg_conv_error_t decode(void* pJpegBuff, bitmap_buff_info_t* psOutputBuff );
+ JPEG_Converter::jpeg_conv_error_t decode(void* pJpegBuff, bitmap_buff_info_t* psOutputBuff, decode_options_t* pOptions );
+
+ /** Encode rinear data to JPEG
+ *
+ * @param[in] bitmap_buff_info_t* psInputBuff : Input bitmap data address
+ * @param[out] void* pJpegBuff : Output JPEG data address
+ * @param[out] size_t* pEncodeSize : Encode size address
+ * @param[in] encode_options_t* pOptions[IN] : Encode option(Optional)
+ * @return JPEG_CONV_OK = success
+ * JPEG_CONV_JCU_ERR = failure (JCU error)
+ * JPEG_CONV_FORMA_ERR = failure (data format error)
+ * JPEG_CONV_PARAM_ERR = failure (input parameter error)
+ * JPEG_CONV_PARAM_RANGE_ERR = failure (input parameter range error)
+ */
+ JPEG_Converter::jpeg_conv_error_t encode(bitmap_buff_info_t* psInputBuff, void* pJpegBuff, size_t* pEncodeSize );
+ JPEG_Converter::jpeg_conv_error_t encode(bitmap_buff_info_t* psInputBuff, void* pJpegBuff, size_t* pEncodeSize, encode_options_t* pOptions );
+
+private:
+ bool is_JCU_initialized; /*!< Flag of JCU initialized */
+
+};
+
+#endif /* JPEG_CONVERTER_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/inc/converter_wrapper.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,101 @@
+/*******************************************************************************
+* 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) 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**************************************************************************//**
+* @file converter_wrapper.h
+* @version 1.00
+* $Rev: 1 $
+* $Date:: 2015-08-06 16:33:52 +0900#$
+* @brief Graphics driver wrapper function definitions in C
+******************************************************************************/
+
+#ifndef CONVERTER_WRAPPER_H
+#define CONVERTER_WRAPPER_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl_typedef.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*! @enum mbed_jcu_err_t
+ @brief Error codes
+ */
+typedef enum {
+ MBED_JCU_E_OK = 0, /*!< Normal termination */
+ MBED_JCU_E_JCU_ERR = -1, /*!< JCU driver error */
+ MBED_JCU_E_FORMA_ERR = -2, /*!< Not support format */
+ MBED_JCU_E_PARAM_ERR = -3, /*!< Parameter error */
+ MBED_JCU_E_PARAM_RANGE_ERR = -7, /*!< Parameter range error */
+ } mbed_jcu_err_t;
+
+
+/** Callback function format
+ */
+typedef void (mbed_CallbackFunc_t)(mbed_jcu_err_t err_code);
+
+
+/**************************************************************************//**
+ * @brief Set callback function address for decode
+ * @param[in] pSetCallbackAdr Callback function address
+ * @param[in] p_async ospl async data address
+ * @param[in] width Decode data width
+ * @param[in] height Decode data height
+ * @retval error code
+******************************************************************************/
+errnum_t R_wrpper_set_decode_callback( mbed_CallbackFunc_t* pSetCallbackAdr, r_ospl_async_t* p_async, size_t width, size_t height );
+
+/**************************************************************************//**
+ * @brief Set callback function address for encode
+ * @param[in] InterruptSource Interrput source data struct address
+ * @param[in] Caller ospl caller data address
+ * @retval error code
+******************************************************************************/
+errnum_t R_wrpper_LocalDecodeCallback( const r_ospl_interrupt_t *InterruptSource, const r_ospl_caller_t *Caller );
+
+/**************************************************************************//**
+ * @brief Set callback function address for encode
+ * @param[in] pSetCallbackAdr Callback function address
+ * @param[in] p_async ospl async data address
+ * @param[in] pSize Encode size input address
+ * @param[in] count_max Encode count max num
+ * @retval error code
+******************************************************************************/
+errnum_t R_wrpper_set_encode_callback( mbed_CallbackFunc_t* pSetCallbackAdr, r_ospl_async_t* p_async, size_t* pSize, int32_t count_max );
+
+/**************************************************************************//**
+ * @brief Set callback function address for encode
+ * @param[in] InterruptSource Interrput source data struct address
+ * @param[in] Caller ospl caller data address
+ * @retval error code
+******************************************************************************/
+errnum_t R_wrpper_LocalEncodeCallback( const r_ospl_interrupt_t *InterruptSource, const r_ospl_caller_t *Caller );
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CONVERTER_WRAPPER_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/inc/r_jcu_api.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,577 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_jcu_api.h
+* @brief JCU (JPEG hardware) driver API. Main Header.
+*
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 38 $
+* $Date:: 2014-03-18 16:14:45 +0900#$
+*/
+
+#ifndef JCU_API_H_
+#define JCU_API_H_
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include <stddef.h>
+#include "r_jcu_user.h"
+#include "r_ospl.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @enum jcu_status_information_t
+* @brief Status
+*
+* - JCU_STATUS_UNDEF - 0x00, Undefined
+* - JCU_STATUS_INIT - 0x01, Initialized
+* - JCU_STATUS_SELECTED - 0x02, Codec is selected
+* - JCU_STATUS_READY - 0x08, Ready
+* - JCU_STATUS_RUN - 0x10, Run
+* - JCU_STATUS_INTERRUPTING - 0x40, Interrupting
+* - JCU_STATUS_INTERRUPTED - 0x80, Interrupted
+*/
+typedef enum {
+ JCU_STATUS_UNDEF = 0x00,
+ JCU_STATUS_INIT = 0x01,
+ JCU_STATUS_SELECTED = 0x02,
+ JCU_STATUS_READY = 0x08,
+ JCU_STATUS_RUN = 0x10,
+ JCU_STATUS_INTERRUPTING = 0x40,
+ JCU_STATUS_INTERRUPTED = 0x80
+} jcu_status_information_t;
+
+
+/**
+* @struct jcu_async_status_t
+* @brief Status of asynchronize
+*/
+typedef struct st_jcu_async_status_t jcu_async_status_t;
+struct st_jcu_async_status_t {
+ jcu_status_information_t Status;
+ bit_flags_fast32_t SubStatusFlags;
+ bool_t IsPaused;
+ bool_t IsEnabledInterrupt;
+ r_ospl_flag32_t InterruptEnables;
+ r_ospl_flag32_t InterruptFlags;
+ r_ospl_flag32_t CancelFlags; /*<r_ospl_cancel_flag_t>*/
+};
+
+
+/* Section: Global */
+/**
+* @enum SubStatusFlags
+* @brief Sub Status
+*
+* - JCU_SUB_INFOMATION_READY - 0x00000008
+* - JCU_SUB_DECODE_OUTPUT_PAUSE - 0x00000100
+* - JCU_SUB_DECODE_INPUT_PAUSE - 0x00000200
+* - JCU_SUB_ENCODE_OUTPUT_PAUSE - 0x00001000
+* - JCU_SUB_ENCODE_INPUT_PAUSE - 0x00002000
+*/
+#define JCU_SUB_INFOMATION_READY 0x00000008
+#define JCU_SUB_DECODE_OUTPUT_PAUSE 0x00000100
+#define JCU_SUB_DECODE_INPUT_PAUSE 0x00000200
+#define JCU_SUB_ENCODE_OUTPUT_PAUSE 0x00001000
+#define JCU_SUB_ENCODE_INPUT_PAUSE 0x00002000
+
+
+/**
+* @def jcu_interrupt_line_t
+* @brief Interrupt Lines
+*
+* - JCU_INTERRUPT_LINE_JEDI - 1
+* - JCU_INTERRUPT_LINE_JDTI - 2
+* - JCU_INTERRUPT_LINE_ALL - 1 | 2
+*/
+typedef uint_fast32_t jcu_interrupt_line_t;
+#define JCU_INTERRUPT_LINE_JEDI 0x00000001u
+#define JCU_INTERRUPT_LINE_JDTI 0x00000002u
+#define JCU_INTERRUPT_LINE_ALL \
+ ( JCU_INTERRUPT_LINE_JEDI | JCU_INTERRUPT_LINE_JDTI )
+
+
+/**
+* @typedef jcu_interrupt_lines_t
+* @brief Bit flags of <jcu_interrupt_line_t>
+*/
+typedef bit_flags_fast32_t /*<jcu_interrupt_line_t>*/ jcu_interrupt_lines_t;
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+
+/**
+* @def JCU_VERSION
+* @brief VERSION
+* @par Parameters
+* None
+* @return None.
+*/
+#define JCU_VERSION 100
+
+
+/**
+* @def JCU_VERSION_STRING
+* @brief String of <JCU_VERSION>
+* @par Parameters
+* None
+* @return None.
+*/
+#define JCU_VERSION_STRING "1.00"
+
+
+/**
+* @def JCU_INT_TYPE_NUM
+* @brief The number of the interrupt source
+* @par Parameters
+* None
+* @return None.
+*/
+#define JCU_INT_TYPE_NUM 0x0009
+
+
+/**
+* @def JCU_COLOR_ELEMENT_NUM
+* @brief Y,Cb and Cr
+* @par Parameters
+* None
+* @return None.
+*/
+#define JCU_COLOR_ELEMENT_NUM 3
+
+
+/******************************************************************************
+Struct & Enum definitions
+******************************************************************************/
+
+/**
+* @enum jcu_errorcode_t
+* @brief Error code of JCU driver
+*
+* - JCU_ERROR_OK - 0
+* - JCU_ERROR_PARAM - 0x4501
+* - JCU_ERROR_STATUS - 0x4502
+* - JCU_ERROR_CODEC_TYPE - 0x4503
+* - JCU_ERROR_LIMITATION - 0x4504
+*/
+enum { E_CATEGORY_JCU_ERR = 0x4500 }; /* Offset of JCU error code */
+typedef errnum_t jcu_errorcode_t;
+enum {
+ JCU_ERROR_OK = 0x0000,
+ JCU_ERROR_PARAM = 0x4501,
+ JCU_ERROR_STATUS = 0x4502,
+ JCU_ERROR_CODEC_TYPE = 0x4503,
+ JCU_ERROR_LIMITATION = 0x4504
+};
+
+
+/**
+* @enum jcu_detail_error_t
+* @brief Kind of detailed error for decoding
+*
+* - JCU_JCDERR_OK - 0x0000
+* - JCU_JCDERR_SOI_NOT_FOUND - 0x4521
+* - JCU_JCDERR_INVALID_SOF - 0x4522
+* - JCU_JCDERR_UNPROVIDED_SOF - 0x4523
+* - JCU_JCDERR_SOF_ACCURACY - 0x4524
+* - JCU_JCDERR_DQT_ACCURACY - 0x4525
+* - JCU_JCDERR_COMPONENT_1 - 0x4526
+* - JCU_JCDERR_COMPONENT_2 - 0x4527
+* - JCU_JCDERR_NO_SOF0_DQT_DHT - 0x4528
+* - JCU_JCDERR_SOS_NOT_FOUND - 0x4529
+* - JCU_JCDERR_EOI_NOT_FOUND - 0x452A
+* - JCU_JCDERR_RESTART_INTERVAL - 0x452B
+* - JCU_JCDERR_IMAGE_SIZE - 0x452C
+* - JCU_JCDERR_LAST_MCU_DATA - 0x452D
+* - JCU_JCDERR_BLOCK_DATA - 0x452E
+*/
+enum { E_CATEGORY_JCU_JCDERR = 0x4520 }; /* Offset of JCU detail error code */
+typedef errnum_t jcu_detail_error_t;
+enum {
+ JCU_JCDERR_OK = 0x0000,
+ JCU_JCDERR_SOI_NOT_FOUND = 0x4521,
+ JCU_JCDERR_INVALID_SOF = 0x4522,
+ JCU_JCDERR_UNPROVIDED_SOF = 0x4523,
+ JCU_JCDERR_SOF_ACCURACY = 0x4524,
+ JCU_JCDERR_DQT_ACCURACY = 0x4525,
+ JCU_JCDERR_COMPONENT_1 = 0x4526,
+ JCU_JCDERR_COMPONENT_2 = 0x4527,
+ JCU_JCDERR_NO_SOF0_DQT_DHT = 0x4528,
+ JCU_JCDERR_SOS_NOT_FOUND = 0x4529,
+ JCU_JCDERR_EOI_NOT_FOUND = 0x452A,
+ JCU_JCDERR_RESTART_INTERVAL = 0x452B,
+ JCU_JCDERR_IMAGE_SIZE = 0x452C,
+ JCU_JCDERR_LAST_MCU_DATA = 0x452D,
+ JCU_JCDERR_BLOCK_DATA = 0x452E
+};
+
+
+/**
+* @enum jcu_codec_t
+* @brief The type of codec
+*
+* - JCU_ENCODE - 0
+* - JCU_DECODE - 1
+*/
+typedef enum {
+ JCU_ENCODE = 0,
+ JCU_DECODE = 1
+} jcu_codec_t;
+
+
+/**
+* @struct jcu_count_mode_param_t
+* @brief Buffer settings for separating decode or encode
+*/
+typedef struct {
+ struct {
+ /** true: It uses the count mode process. */
+ bool_t isEnable;
+
+ /** Address is changed when processing is stopped. */
+ bool_t isInitAddress;
+
+ /** This is enable when isInitAddrss is true. */
+ uint32_t *restartAddress;
+
+ /** Encode:8line Decode:8byte. */
+ uint32_t dataCount;
+
+ } inputBuffer;
+
+ struct {
+ /** true: It uses the count mode process. */
+ bool_t isEnable;
+
+ /** Address is changed when processing is stopped. */
+ bool_t isInitAddress; /* */
+
+ /** This is enable when isInitAddress is true. */
+ uint32_t *restartAddress; /* */
+
+ /** Encode:8byte Decode:8line. */
+ uint32_t dataCount;
+
+ } outputBuffer;
+} jcu_count_mode_param_t;
+
+
+/* Section: Global */
+/**
+* @enum jcu_continue_type_t
+* @brief Type of continue buffer
+*
+* - JCU_INPUT_BUFFER - 0
+* - JCU_OUTPUT_BUFFER - 1
+* - JCU_IMAGE_INFO - 2
+*/
+typedef enum {
+ JCU_INPUT_BUFFER,
+ JCU_OUTPUT_BUFFER,
+ JCU_IMAGE_INFO
+} jcu_continue_type_t;
+
+
+/**
+* @def jcu_int_detail_error_t
+* @brief Bit flags of detail error
+*
+* - JCU_INT_ERROR_RESTART_INTERVAL_DATA - INT7_MASK
+* - JCU_INT_ERROR_SEGMENT_TOTAL_DATA - INT6_MASK
+* - JCU_INT_ERROR_MCU_BLOCK_DATA - INT5_MASK
+* - JCU_INT_ERROR_ALL - e.g. for mask
+*/
+typedef uint_fast32_t jcu_int_detail_error_t;
+#define JCU_INT_ERROR_RESTART_INTERVAL_DATA (0x80u)
+#define JCU_INT_ERROR_SEGMENT_TOTAL_DATA (0x40u)
+#define JCU_INT_ERROR_MCU_BLOCK_DATA (0x20u)
+#define JCU_INT_ERROR_ALL \
+ ( JCU_INT_ERROR_RESTART_INTERVAL_DATA | JCU_INT_ERROR_SEGMENT_TOTAL_DATA | \
+ JCU_INT_ERROR_MCU_BLOCK_DATA )
+
+
+/**
+* @typedef jcu_int_detail_errors_t
+* @brief Bit flags of detail error
+*/
+typedef bit_flags_fast32_t /*<jcu_int_detail_error_t>*/ jcu_int_detail_errors_t;
+
+
+/**
+* @enum jcu_swap_t
+* @brief SampleEnum
+*
+* - SymbolA - 0, NULL
+* - SymbolB - 1
+*/
+typedef int_t jcu_swap_t;
+#define JCU_SWAP_NONE (0x00)
+#define JCU_SWAP_BYTE (0x01)
+#define JCU_SWAP_WORD (0x02)
+#define JCU_SWAP_WORD_AND_BYTE (0x03)
+#define JCU_SWAP_LONG_WORD (0x04)
+#define JCU_SWAP_LONG_WORD_AND_BYTE (0x05)
+#define JCU_SWAP_LONG_WORD_AND_WORD (0x06)
+#define JCU_SWAP_LONG_WORD_AND_WORD_AND_BYTE (0x07)
+
+
+/**
+* @struct jcu_buffer_t
+* @brief Buffer settings
+*/
+typedef struct {
+ jcu_swap_t swapSetting;
+ uint32_t *address;
+} jcu_buffer_t;
+
+
+/**
+* @struct jcu_buffer_param_t
+* @brief Buffer parameter for input and output
+*/
+typedef struct {
+ jcu_buffer_t source;
+ jcu_buffer_t destination;
+ int16_t lineOffset;
+} jcu_buffer_param_t;
+
+
+/* Section: Global */
+/**
+* @enum jcu_sub_sampling_t
+* @brief Sub sampling settings for decoding
+*
+* - JCU_SUB_SAMPLING_1_1 - 0x00 = 1/1
+* - JCU_SUB_SAMPLING_1_2 - 0x01 = 1/2
+* - JCU_SUB_SAMPLING_1_4 - 0x02 = 1/4
+* - JCU_SUB_SAMPLING_1_8 - 0x03 = 1/8
+*/
+typedef enum {
+ JCU_SUB_SAMPLING_1_1 = 0x00,
+ JCU_SUB_SAMPLING_1_2 = 0x01,
+ JCU_SUB_SAMPLING_1_4 = 0x02,
+ JCU_SUB_SAMPLING_1_8 = 0x03
+} jcu_sub_sampling_t;
+
+
+/**
+* @enum jcu_decode_format_t
+* @brief Kind of pixel format can process the decoding
+*
+* - JCU_OUTPUT_YCbCr422 - 0x00
+* - JCU_OUTPUT_ARGB8888 - 0x01
+* - JCU_OUTPUT_RGB565 - 0x02
+*/
+typedef enum {
+ JCU_OUTPUT_YCbCr422 = 0x00,
+ JCU_OUTPUT_ARGB8888 = 0x01,
+ JCU_OUTPUT_RGB565 = 0x02
+} jcu_decode_format_t;
+
+
+/**
+* @enum jcu_cbcr_offset_t
+* @brief Cb/Cr offset
+*
+* - JCU_CBCR_OFFSET_0 - 0 = No offset
+* - JCU_CBCR_OFFSET_128 - 1 = +128 offset
+*/
+typedef enum {
+ JCU_CBCR_OFFSET_0 = 0,
+ JCU_CBCR_OFFSET_128 = 1
+} jcu_cbcr_offset_t;
+
+
+/**
+* @enum jcu_jpeg_format_t
+* @brief Kind of pixel format for the jpeg file format when decoding
+*
+* - JCU_JPEG_YCbCr444 - 0
+* - JCU_JPEG_YCbCr422 - 1
+* - JCU_JPEG_YCbCr420 - 2
+* - JCU_JPEG_YCbCr411 - 6
+*/
+typedef enum {
+ JCU_JPEG_YCbCr444 = 0x00,
+ JCU_JPEG_YCbCr422 = 0x01,
+ JCU_JPEG_YCbCr420 = 0x02,
+ JCU_JPEG_YCbCr411 = 0x06
+} jcu_jpeg_format_t;
+
+
+/**
+* @struct jcu_image_info_t
+* @brief Image information data store variable
+*/
+typedef struct {
+ uint32_t width;
+ uint32_t height;
+ jcu_jpeg_format_t encodedFormat;
+} jcu_image_info_t;
+
+
+/* Section: Global */
+/**
+* @enum jcu_table_no_t
+* @brief The index of the table
+*
+* - JCU_TABLE_NO_0 - 0
+* - JCU_TABLE_NO_1 - 1
+* - JCU_TABLE_NO_2 - 2
+* - JCU_TABLE_NO_3 - 3
+*/
+typedef enum {
+ JCU_TABLE_NO_0 = 0,
+ JCU_TABLE_NO_1 = 1,
+ JCU_TABLE_NO_2 = 2,
+ JCU_TABLE_NO_3 = 3
+} jcu_table_no_t;
+
+
+/**
+* @enum jcu_huff_t
+* @brief Kind of Huffman table
+*
+* - JCU_HUFFMAN_AC - 0
+* - JCU_HUFFMAN_DC - 1
+*/
+typedef enum {
+ JCU_HUFFMAN_AC,
+ JCU_HUFFMAN_DC
+} jcu_huff_t;
+
+
+/**
+* @enum jcu_color_element_t
+* @brief Kind of color data for using the encoder parameter
+*
+* - JCU_ELEMENT_Y - 0
+* - JCU_ELEMENT_Cb - 1
+* - JCU_ELEMENT_Cr - 2
+*/
+typedef enum {
+ JCU_ELEMENT_Y,
+ JCU_ELEMENT_Cb,
+ JCU_ELEMENT_Cr
+} jcu_color_element_t;
+
+
+/**
+* @struct jcu_decode_param_t
+* @brief Setting parameter for the Decoding
+*/
+typedef struct {
+ jcu_sub_sampling_t verticalSubSampling;
+ jcu_sub_sampling_t horizontalSubSampling;
+ jcu_decode_format_t decodeFormat;
+ jcu_cbcr_offset_t outputCbCrOffset;
+ uint8_t alpha;
+} jcu_decode_param_t;
+
+
+/**
+* @struct jcu_encode_param_t
+* @brief Setting parameter for the Encoding
+*/
+typedef struct {
+ jcu_jpeg_format_t encodeFormat;
+ int32_t QuantizationTable[JCU_COLOR_ELEMENT_NUM];
+ int32_t HuffmanTable[JCU_COLOR_ELEMENT_NUM];
+ uint32_t DRI_value;
+ uint32_t width;
+ uint32_t height;
+ jcu_cbcr_offset_t inputCbCrOffset;
+} jcu_encode_param_t;
+
+
+/* Section: Global */
+/**
+* @enum jcu_codec_status_t
+* @brief Codec type
+*
+* - JCU_CODEC_NOT_SELECTED - -1
+* - JCU_STATUS_ENCODE - 0
+* - JCU_STATUS_DECODE - 1
+*/
+typedef enum {
+ JCU_CODEC_NOT_SELECTED = -1,
+ JCU_STATUS_ENCODE = 0,
+ JCU_STATUS_DECODE = 1
+} jcu_codec_status_t;
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+jcu_errorcode_t R_JCU_Initialize( void *const NullConfig );
+jcu_errorcode_t R_JCU_Terminate(void);
+jcu_errorcode_t R_JCU_TerminateAsync( r_ospl_async_t *const async );
+jcu_errorcode_t R_JCU_SelectCodec(const jcu_codec_t codec);
+jcu_errorcode_t R_JCU_Start(void);
+jcu_errorcode_t R_JCU_StartAsync( r_ospl_async_t *const async );
+jcu_errorcode_t R_JCU_SetCountMode(const jcu_count_mode_param_t *const buffer);
+jcu_errorcode_t R_JCU_Continue(const jcu_continue_type_t type);
+jcu_errorcode_t R_JCU_ContinueAsync(const jcu_continue_type_t type, r_ospl_async_t *const async);
+void R_JCU_GetAsyncStatus(const jcu_async_status_t **const out_Status);
+jcu_errorcode_t R_JCU_SetDecodeParam(const jcu_decode_param_t *const decode, const jcu_buffer_param_t *const buffer);
+jcu_errorcode_t R_JCU_SetPauseForImageInfo(const bool_t is_pause);
+jcu_errorcode_t R_JCU_GetImageInfo(jcu_image_info_t *const buffer);
+jcu_errorcode_t R_JCU_SetErrorFilter(jcu_int_detail_errors_t filter);
+jcu_errorcode_t R_JCU_SetQuantizationTable(const jcu_table_no_t tableNo, const uint8_t *const table);
+jcu_errorcode_t R_JCU_SetHuffmanTable(const jcu_table_no_t tableNo, const jcu_huff_t type, const uint8_t *const table);
+jcu_errorcode_t R_JCU_SetEncodeParam(const jcu_encode_param_t *const encode, const jcu_buffer_param_t *const buffer);
+jcu_errorcode_t R_JCU_GetEncodedSize(size_t *const out_Size);
+jcu_errorcode_t R_JCU_Set2ndCacheAttribute( r_ospl_axi_cache_attribute_t const read_cache_attribute,
+ r_ospl_axi_cache_attribute_t const write_cache_attribute );
+
+#ifndef R_OSPL_NDEBUG
+void R_JCU_PrintRegisters(void);
+#endif
+
+/* For interrupt callback */
+errnum_t R_JCU_OnInterrupting( const r_ospl_interrupt_t *const InterruptSource );
+errnum_t R_JCU_OnInterrupted(void);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* #define JCU_API_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/inc/r_jcu_local.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,480 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/******************************************************************************
+* $FileName: jcu_local.h $
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-02-26 13:18:53 +0900#$
+* Description : JCU driver local parameter
+******************************************************************************/
+
+#ifndef JCU_LOCAL_H
+#define JCU_LOCAL_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_jcu_api.h"
+#include "r_jcu_user.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+typedef struct st_jcu_i_lock_t jcu_i_lock_t; /*[jcu_i_lock_t]*/
+
+/*! [jcu_internal_information_t] Internal Information for this driver */
+typedef struct {
+ jcu_codec_status_t Codec;
+ bool_t IsCountMode;
+ jcu_int_detail_errors_t ErrorFilter; /* 1=Enable */
+
+ jcu_async_status_t AsyncStatus;
+ r_ospl_caller_t InterruptCallbackCaller;
+ jcu_i_lock_t *I_Lock;
+ const r_ospl_i_lock_vtable_t *I_LockVTable;
+ bool_t Is_I_LockMaster;
+ r_ospl_async_t *AsyncForFinalize;
+} jcu_internal_information_t;
+
+/*[jcu_i_lock_t]*/
+struct st_jcu_i_lock_t {
+ bool_t IsLock;
+ bool_t IsRequestedFinalize;
+};
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+jcu_internal_information_t *R_JCU_GetInternalInformation(void);
+jcu_i_lock_t *R_JCU_GetILockObject(void);
+void R_JCU_I_LOCK_Finalize(void);
+jcu_errorcode_t R_JCU_TerminateStep2(void);
+
+#ifdef JCU_PARAMETER_CHECK
+jcu_errorcode_t JCU_ParaCheckStart(void);
+jcu_errorcode_t JCU_ParaCheckSetCountMode(const jcu_count_mode_param_t *const buffer);
+jcu_errorcode_t JCU_ParaCheckSelectCodec(const jcu_codec_t codec);
+jcu_errorcode_t JCU_ParaCheckSetCallbackFunc(const uintptr_t type);
+jcu_errorcode_t JCU_ParaCheckSetDecodeParam(const jcu_decode_param_t *const decode, const jcu_buffer_param_t *const buffer);
+jcu_errorcode_t JCU_ParaCheckGetImageInfo(const jcu_image_info_t *const buffer);
+jcu_errorcode_t JCU_ParaCheckGetErrorInfo(const jcu_detail_error_t *const errorCode);
+jcu_errorcode_t JCU_ParaCheckSetQuantizationTbl(const jcu_table_no_t tableNo);
+jcu_errorcode_t JCU_ParaCheckSetHuffmanTable(const jcu_table_no_t tableNo, const jcu_huff_t type);
+jcu_errorcode_t JCU_ParaCheckEncodeParam(const jcu_encode_param_t *const encode, const jcu_buffer_param_t *const buffer);
+jcu_errorcode_t JCU_CheckInterruptSource(const uint32_t interruptKind);
+#endif /* JCU_PARAMETER_CHECK */
+
+jcu_errorcode_t JCU_SetRegisterForInitialize(void);
+void JCU_SetRegisterForCodec(const jcu_codec_t codec);
+void JCU_SetRegisterForStart(const jcu_int_detail_error_t error_filter);
+void JCU_SetRegisterForReset(void);
+void JCU_SetRegisterForSetCountMode(const jcu_count_mode_param_t *const buffer);
+void JCU_SetRegisterForContinue(const jcu_continue_type_t type);
+void JCU_SetRegisterForSetDecodePrm(const jcu_decode_param_t *const decode, const jcu_buffer_param_t *const buffer);
+void JCU_SetRegisterForSetQtTable(const jcu_table_no_t tableNo, const uint8_t *const table);
+void JCU_SetRegisterForSetHuffTbl(const jcu_table_no_t tableNo, const jcu_huff_t type, const uint8_t *const table);
+void JCU_SetRegisterForSetEncodePrm(const jcu_encode_param_t *const encode, const jcu_buffer_param_t *const buffer);
+void JCU_SetRegisterForSetPause(const bool_t is_pause, const jcu_int_detail_errors_t filter);
+void JCU_GetRegisterForGetImageInfo(jcu_image_info_t *const buffer);
+void JCU_GetEncodedSize(size_t *const out_Size);
+void JCU_ClearInterruptFlag(void);
+
+
+/* ->SEC M1.2.2(QAC-1259) */
+/* If "Value" is signed, this is depend on CPU bit width. */
+/* But driver code is no problem. */
+/* This expects 32bit CPU. */
+/* ->SEC R3.6.2(QAC-3345) */
+/* Volatile access at left of "=" and right of "=". */
+/* But this is not depend on compiler spcifications. */
+/* ->MISRA 19.12 ->MISRA 19.13 ->SEC M5.1.2 (1) */
+#define R_SET_REG_BIT_FIELD( Register, BitName, Value ) \
+ ( (Register) = (BitName##_TYPE)( ( (uint32_t)(Register) & (uint32_t)(~(BitName##_MASK) ) ) |\
+ ( (uint32_t)( (uint32_t)(Value) << (BitName##_SHIFT) ) & (uint32_t)(BitName##_MASK) ) ) )
+#define R_GET_REG_BIT_FIELD( Register, BitName ) \
+ ( (BitName##_TYPE)( ( ((uint32_t)(Register)) & (uint32_t)(BitName##_MASK) ) >> (BitName##_SHIFT) ) )
+/* <-SEC M1.2.3(QAC-1259) */
+/* <-SEC R3.6.2(QAC-3345) */
+/* <-MISRA 19.12 <-MISRA 19.13 <-SEC M5.1.2 (1) */
+
+/* Value of register */
+/* 1bit(Flag) */
+#define REG_F_CLR (0u)
+#define REG_F_SET (1u)
+
+/* Bit field name (Register name) */
+
+/* SRST(CPG.SWRSTCR2) */
+#define SRST_MASK (0x00000002u)
+#define SRST_SHIFT (1u)
+#define SRST_TYPE uint8_t
+
+
+/*DSP(JCU.JCMOD) */
+#define DSP_MASK (0x00000008u)
+#define DSP_SHIFT (3u)
+#define DSP_TYPE uint8_t
+
+/*REDU(JCU.JCMOD) */
+#define REDU_MASK (0x00000007u)
+#define REDU_SHIFT (0u)
+#define REDU_TYPE uint8_t
+
+
+/*BRST(JCU.JCCMD) */
+#define BRST_MASK (0x00000080u)
+#define BRST_SHIFT (7u)
+#define BRST_TYPE uint8_t
+
+/*JEND(JCU.JCCMD) */
+#define JEND_MASK (0x00000004u)
+#define JEND_SHIFT (2u)
+#define JEND_TYPE uint8_t
+
+/*JRST(JCU.JCCMD) */
+#define JRST_MASK (0x00000002u)
+#define JRST_SHIFT (1u)
+#define JRST_TYPE uint8_t
+
+/*JSRT(JCU.JCCMD) */
+#define JSRT_MASK (0x00000001u)
+#define JSRT_SHIFT (0u)
+#define JSRT_TYPE uint8_t
+
+
+/*QT3(JCU.JCQTN) */
+#define QT3_MASK (0x00000030u)
+#define QT3_SHIFT (4u)
+#define QT3_TYPE uint8_t
+
+/*QT2(JCU.JCQTN) */
+#define QT2_MASK (0x0000000Cu)
+#define QT2_SHIFT (2u)
+#define QT2_TYPE uint8_t
+
+/*QT1(JCU.JCQTN) */
+#define QT1_MASK (0x00000003u)
+#define QT1_SHIFT (0u)
+#define QT1_TYPE uint8_t
+
+
+/*HTA3(JCU.JCHTN) */
+#define HTA3_MASK (0x00000020u)
+#define HTA3_SHIFT (5u)
+#define HTA3_TYPE uint8_t
+
+/*HTD3(JCU.JCHTN) */
+#define HTD3_MASK (0x00000010u)
+#define HTD3_SHIFT (4u)
+#define HTD3_TYPE uint8_t
+
+/*HTA2(JCU.JCHTN) */
+#define HTA2_MASK (0x00000008u)
+#define HTA2_SHIFT (3u)
+#define HTA2_TYPE uint8_t
+
+/*HTD2(JCU.JCHTN) */
+#define HTD2_MASK (0x00000004u)
+#define HTD2_SHIFT (2u)
+#define HTD2_TYPE uint8_t
+
+/*HTA1(JCU.JCHTN) */
+#define HTA1_MASK (0x00000002u)
+#define HTA1_SHIFT (1u)
+#define HTA1_TYPE uint8_t
+
+/*HTD1(JCU.JCHTN) */
+#define HTD1_MASK (0x00000001u)
+#define HTD1_SHIFT (0u)
+#define HTD1_TYPE uint8_t
+
+
+/*INT7(JCU.JINTE0) Error of restart interval data. JINTE0.INT7 -> JINTS0.INS5 */
+#define INT7_MASK (0x00000080u)
+#define INT7_SHIFT (7u)
+#define INT7_TYPE uint8_t
+
+/*INT6(JCU.JINTE0) Error of Segment total data. JINTE0.INT6 -> JINTS0.INS5 */
+#define INT6_MASK (0x00000040u)
+#define INT6_SHIFT (6u)
+#define INT6_TYPE uint8_t
+
+/*INT5(JCU.JINTE0) Error of MCU block data. JINTE0.INT5 -> JINTS0.INS5 */
+#define INT5_MASK (0x00000020u)
+#define INT5_SHIFT (5u)
+#define INT5_TYPE uint8_t
+
+/*INT3(JCU.JINTE0) */
+#define INT3_MASK (0x00000008u)
+#define INT3_SHIFT (3u)
+#define INT3_TYPE uint8_t
+
+
+/*INS6(JCU.JINTS0) End Core Only */
+#define INS6_MASK (0x00000040u)
+#define INS6_SHIFT (6u)
+#define INS6_TYPE uint8_t
+
+/*INS5(JCU.JINTS0) Decode Error */
+#define INS5_MASK (0x00000020u)
+#define INS5_SHIFT (5u)
+#define INS5_TYPE uint8_t
+
+/*INS3(JCU.JINTS0) Get Image Information */
+#define INS3_MASK (0x00000008u)
+#define INS3_SHIFT (3u)
+#define INS3_TYPE uint8_t
+
+
+/*ERR(JCU.JCDERR) */
+#define ERR_MASK (0x0000000Fu)
+#define ERR_SHIFT (0u)
+#define ERR_TYPE uint8_t
+
+
+/*JOUTRINI(JCU.JIFECNT) */
+#define JOUTRINI_MASK (0x00004000u)
+#define JOUTRINI_SHIFT (14u)
+#define JOUTRINI_TYPE uint32_t
+
+/*JOUTRCMD(JCU.JIFECNT) */
+#define JOUTRCMD_MASK (0x00002000u)
+#define JOUTRCMD_SHIFT (13u)
+#define JOUTRCMD_TYPE uint32_t
+
+/*JOUTC(JCU.JIFECNT) */
+#define JOUTC_MASK (0x00001000u)
+#define JOUTC_SHIFT (12u)
+#define JOUTC_TYPE uint32_t
+
+/*JOUTSWAP(JCU.JIFECNT) */
+#define JOUTSWAP_MASK (0x00000700u)
+#define JOUTSWAP_SHIFT (8u)
+#define JOUTSWAP_TYPE uint32_t
+
+/*DINRINI(JCU.JIFECNT) */
+#define DINRINI_MASK (0x00000040u)
+#define DINRINI_SHIFT (6u)
+#define DINRINI_TYPE uint32_t
+
+/*DINRCMD(JCU.JIFECNT) */
+#define DINRCMD_MASK (0x00000020u)
+#define DINRCMD_SHIFT (5u)
+#define DINRCMD_TYPE uint32_t
+
+/*DINLC(JCU.JIFECNT) */
+#define DINLC_MASK (0x00000010u)
+#define DINLC_SHIFT (4u)
+#define DINLC_TYPE uint32_t
+
+/*DINSWAP(JCU.JIFECNT) */
+#define DINSWAP_MASK (0x00000007u)
+#define DINSWAP_SHIFT (0u)
+#define DINSWAP_TYPE uint32_t
+
+
+/*ESMW(JCU.JIFESOFST) */
+#define ESMW_MASK (0x00007FFFu)
+#define ESMW_SHIFT (0u)
+#define ESMW_TYPE uint32_t
+
+
+/*LINES(JCU.JIFESLC, JCU.JIFDDLC) */
+#define LINES_MASK (0x0000FFFFu)
+#define LINES_SHIFT (0u)
+#define LINES_TYPE uint32_t
+#define LINES_CLEAR (0u)
+
+
+/*JDATAS(JCU.JIFESLC, JCU.JIFDSDC, JCU.JIFEDDC) */
+#define JDATAS_MASK (0x0000FFFFu)
+#define JDATAS_SHIFT (0u)
+#define JDATAS_TYPE uint32_t
+#define JDATAS_CLEAR (0u)
+
+
+/*VINTER(JCU.JIFDCNT) */
+#define VINTER_MASK (0x3C000000u)
+#define VINTER_SHIFT (28u)
+#define VINTER_TYPE uint32_t
+
+/*HINTER(JCU.JIFDCNT) */
+#define HINTER_MASK (0x0C000000u)
+#define HINTER_SHIFT (26u)
+#define HINTER_TYPE uint32_t
+
+/*OPF(JCU.JIFDCNT) */
+#define OPF_MASK (0x03000000u)
+#define OPF_SHIFT (24u)
+#define OPF_TYPE uint32_t
+
+/*JINRINI(JCU.JIFDCNT) */
+#define JINRINI_MASK (0x00004000u)
+#define JINRINI_SHIFT (14u)
+#define JINRINI_TYPE uint32_t
+
+/*JINRCMD(JCU.JIFDCNT) */
+#define JINRCMD_MASK (0x00002000u)
+#define JINRCMD_SHIFT (13u)
+#define JINRCMD_TYPE uint32_t
+
+/*JINC(JCU.JIFDCNT) */
+#define JINC_MASK (0x00001000u)
+#define JINC_SHIFT (12u)
+#define JINC_TYPE uint32_t
+
+/*JINSWAP(JCU.JIFDCNT) */
+#define JINSWAP_MASK (0x00000700u)
+#define JINSWAP_SHIFT (8u)
+#define JINSWAP_TYPE uint32_t
+
+/*DOUTRINI(JCU.JIFDCNT) */
+#define DOUTRINI_MASK (0x00000040u)
+#define DOUTRINI_SHIFT (6u)
+#define DOUTRINI_TYPE uint32_t
+
+/*DOUTRCMD(JCU.JIFDCNT) */
+#define DOUTRCMD_MASK (0x00000020u)
+#define DOUTRCMD_SHIFT (5u)
+#define DOUTRCMD_TYPE uint32_t
+
+/*DOUTLC(JCU.JIFDCNT) */
+#define DOUTLC_MASK (0x00000010u)
+#define DOUTLC_SHIFT (4u)
+#define DOUTLC_TYPE uint32_t
+
+/*DOUTSWAP(JCU.JIFDCNT) */
+#define DOUTSWAP_MASK (0x00000007u)
+#define DOUTSWAP_SHIFT (0u)
+#define DOUTSWAP_TYPE uint32_t
+
+
+/*DDMW(JCU.JIFDDOFST) */
+#define DDMW_MASK (0x00007FFFu)
+#define DDMW_SHIFT (0u)
+#define DDMW_TYPE uint32_t
+
+
+/*ALPHA(JCU.JIFDADT) */
+#define ALPHA_MASK (0x000000FFu)
+#define ALPHA_SHIFT (0u)
+#define ALPHA_TYPE uint32_t
+
+
+/*CBTEN(JCU.JINTE1) */
+#define CBTEN_MASK (0x00000040u)
+#define CBTEN_SHIFT (6u)
+#define CBTEN_TYPE uint32_t
+
+/*DINLEN(JCU.JINTE1) */
+#define DINLEN_MASK (0x00000020u)
+#define DINLEN_SHIFT (5u)
+#define DINLEN_TYPE uint32_t
+
+/*JOUTEN(JCU.JINTE1) */
+#define JOUTEN_MASK (0x00000010u)
+#define JOUTEN_SHIFT (4u)
+#define JOUTEN_TYPE uint32_t
+
+/*DBTEN(JCU.JINTE1) */
+#define DBTEN_MASK (0x00000004u)
+#define DBTEN_SHIFT (2u)
+#define DBTEN_TYPE uint32_t
+
+/*JINEN(JCU.JINTE1) */
+#define JINEN_MASK (0x00000002u)
+#define JINEN_SHIFT (1u)
+#define JINEN_TYPE uint32_t
+
+/*DOUTLEN(JCU.JINTE1) */
+#define DOUTLEN_MASK (0x00000001u)
+#define DOUTLEN_SHIFT (0u)
+#define DOUTLEN_TYPE uint32_t
+
+
+/*CBTF(JCU.JINTS1) JINTE1.CBTEN -> JINTS1.CBTF */
+#define CBTF_MASK (0x00000040u)
+#define CBTF_SHIFT (6u)
+#define CBTF_TYPE uint32_t
+
+/*DINLF(JCU.JINTS1) Input Data for Encoding */
+#define DINLF_MASK (0x00000020u)
+#define DINLF_SHIFT (5u)
+#define DINLF_TYPE uint32_t
+
+/*JOUTF(JCU.JINTS1) Output Data for Encoding */
+#define JOUTF_MASK (0x00000010u)
+#define JOUTF_SHIFT (4u)
+#define JOUTF_TYPE uint32_t
+
+/*DBTF(JCU.JINTS1) JINTE1.DBTEN -> JINTS1.DBTF */
+#define DBTF_MASK (0x00000004u)
+#define DBTF_SHIFT (2u)
+#define DBTF_TYPE uint32_t
+
+/*JINF(JCU.JINTS1) Input Data for Decoding */
+#define JINF_MASK (0x00000002u)
+#define JINF_SHIFT (1u)
+#define JINF_TYPE uint32_t
+
+/*DOUTLF(JCU.JINTS1) Output Data for Decoding */
+#define DOUTLF_MASK (0x00000001u)
+#define DOUTLF_SHIFT (0u)
+#define DOUTLF_TYPE uint32_t
+
+
+/*DINYCHG(JCU.JIFESVSZ) */
+#define DINYCHG_MASK (0x00008000u)
+#define DINYCHG_SHIFT (15u)
+#define DINYCHG_TYPE uint32_t
+
+/*DOUTYCHG(JCU.JIFESHSZ) */
+#define DOUTYCHG_MASK (0x00008000u)
+#define DOUTYCHG_SHIFT (15u)
+#define DOUTYCHG_TYPE uint32_t
+
+/* Others */
+#define JCU_JINTS1_ALL ( CBTF_MASK | DINLF_MASK | JOUTF_MASK | DBTF_MASK | JINF_MASK | DOUTLF_MASK )
+#define SHIFT_16BITS (16u) /* 16bit-SHIFT */
+#define SHIFT_8BITS (8u) /* 8bit-SHIFT */
+#define JCU_SHIFT_JINTS1 (8)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* JCU_LOCAL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/inc/r_jcu_pl.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,77 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/******************************************************************************
+* $FileName: jcu_pl.h $
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-02-26 13:18:53 +0900#$
+* Description : Sample Data
+******************************************************************************/
+
+#ifndef JCU_PL_H
+#define JCU_PL_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_jcu_api.h"
+#include "r_ospl.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+void R_JCU_SetDefaultAsync( r_ospl_async_t *const Async, r_ospl_async_type_t AsyncType );
+errnum_t R_JCU_OnInitialize(void);
+errnum_t R_JCU_OnFinalize( errnum_t e );
+errnum_t R_JCU_SetInterruptCallbackCaller( const r_ospl_caller_t *const Caller );
+void R_JCU_OnEnableInterrupt( jcu_interrupt_lines_t const Enables );
+void R_JCU_OnDisableInterrupt( jcu_interrupt_lines_t const Disables1 );
+errnum_t R_JCU_OnInterruptDefault( const r_ospl_interrupt_t *const InterruptSource,
+ const r_ospl_caller_t *const Caller );
+
+/* For integrating driver */
+bool_t R_JCU_I_LOCK_Replace( void *const I_Lock, const r_ospl_i_lock_vtable_t *const I_LockVTable );
+bool_t R_JCU_DisableInterrupt(void);
+void R_JCU_EnableInterrupt(void);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _JCU_PL_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/inc/r_jcu_user.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,66 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/******************************************************************************
+* $FileName: jcu_user.h $
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 32 $
+* $Date:: 2014-02-21 20:21:46 +0900#$
+* Description : JCU driver User Configuration
+******************************************************************************/
+
+
+/* This file is included from "r_jcu_api.h" */
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+#ifndef JCU_USER_H
+#define JCU_USER_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/*! Parameter check */
+#define JCU_PARAMETER_CHECK
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* JCU_USER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/jcu_driver/JPEG_Coverter.cpp Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,704 @@
+/*******************************************************************************
+* 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) 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+
+/**************************************************************************//**
+* @file jpeg_coverter.cpp
+* @version 1.00
+* $Rev: 1 $
+* $Date:: 2015-08-06 16:33:52 +0900#$
+* @brief Decodes JPEG data and encodes to JPEG data
+******************************************************************************/
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include <string.h>
+#include <stdio.h>
+#include "r_typedefs.h"
+#include "r_jcu_api.h"
+#include "JPEG_Converter.h"
+#include "converter_wrapper.h"
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+#define QUANTIZATION_TABLE_SIZE (64u)
+#define HUFFMAN_TABLE_DC_SIZE (28u)
+#define HUFFMAN_TABLE_AC_SIZE (178u)
+#define JPEG_HEADER_LETTER_1 (0xFFu)
+#define JPEG_HEADER_LETTER_2 (0xD8u)
+#define ALPHA_VAL_MAX (0xFF)
+#define LOC_KIND_COLOR_FORMAT (3u)
+
+#define ENC_SIZE_MAX (1024 * 30)
+#define MASK_8BYTE (0xFFFFFFF8)
+
+ /*[QuantizationTable_Y]*/
+ /* Quality is IJG75 */
+ static const uint8_t csaDefaultQuantizationTable_Y[QUANTIZATION_TABLE_SIZE] = {
+ 8, 6, 5, 8, 12, 20, 26, 31,
+ 6, 6, 7, 10, 13, 29, 30, 28,
+ 7, 7, 8, 12, 20, 29, 35, 28,
+ 7, 9, 11, 15, 26, 44, 40, 31,
+ 9, 11, 19, 28, 34, 55, 52, 39,
+ 12, 18, 28, 32, 41, 52, 57, 46,
+ 25, 32, 39, 44, 52, 61, 60, 51,
+ 36, 46, 48, 49, 56, 50, 52, 50
+ };
+
+ /*[QuantizationTable_C]*/
+ /* Quality is IJG75 */
+ static const uint8_t csaDefaultQuantizationTable_C[QUANTIZATION_TABLE_SIZE] = {
+ 9, 9, 12, 24, 50, 50, 50, 50,
+ 9, 11, 13, 33, 50, 50, 50, 50,
+ 12, 13, 28, 50, 50, 50, 50, 50,
+ 24, 33, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50
+ };
+
+ /*[HuffmanTable_Y_DC]*/
+ /* Example written in ITU-T T81 specification */
+ static const uint8_t csaDefaultHuffmanTable_Y_DC[HUFFMAN_TABLE_DC_SIZE] = {
+ 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B
+ };
+
+ /*[HuffmanTable_C_DC]*/
+ /* Example written in ITU-T T81 specification */
+ static const uint8_t csaDefaultHuffmanTable_C_DC[HUFFMAN_TABLE_DC_SIZE] = {
+ 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B
+ };
+
+ /*[HuffmanTable_Y_AC]*/
+ /* Example written in ITU-T T81 specification */
+ static const uint8_t csaDefaultHuffmanTable_Y_AC[HUFFMAN_TABLE_AC_SIZE] = {
+ 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7D,
+ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+ 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08, 0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0,
+ 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+ 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+ 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
+ 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5,
+ 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2,
+ 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8,
+ 0xF9, 0xFA
+ };
+
+ /*[HuffmanTable_C_AC]*/
+ /* Example written in ITU-T T81 specification */
+ static const uint8_t csaDefaultHuffmanTable_C_AC[HUFFMAN_TABLE_AC_SIZE] = {
+ 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77,
+ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+ 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0,
+ 0x15, 0x62, 0x72, 0xD1, 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26,
+ 0x27, 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5,
+ 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3,
+ 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
+ 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8,
+ 0xF9, 0xFA
+ };
+
+static r_ospl_async_t async;
+
+/**************************************************************************//**
+ * @brief Constructor of the JPEG_Converter class
+ * @param[in] None
+ * @retval None
+******************************************************************************/
+JPEG_Converter::JPEG_Converter( void )
+{
+ jcu_errorcode_t jcu_error;
+
+ jcu_error = R_JCU_Initialize( NULL );
+ if ( jcu_error == JCU_ERROR_OK ) {
+ is_JCU_initialized = true;
+ }
+} /* End of constructor method () */
+
+/**************************************************************************//**
+ * @brief Destructor of the JPEG_Converter class
+ * @param[in] None
+ * @retval None
+******************************************************************************/
+JPEG_Converter::~JPEG_Converter( void )
+{
+ if ( is_JCU_initialized != false ) {
+ is_JCU_initialized = false;
+ (void)R_JCU_Terminate();
+ }
+} /* End of destructor method () */
+
+/**************************************************************************//**
+ * @brief JPEG data decode to bitmap
+ * @param[in] void* pJpegBuff : Input JPEG data address
+ * @param[in/out] bitmap_buff_info_t* psOutputBuff : Output bitmap data address
+ * @retval error code
+******************************************************************************/
+JPEG_Converter::jpeg_conv_error_t
+JPEG_Converter::decode(void* pJpegBuff, bitmap_buff_info_t* psOutputBuff ) {
+ jpeg_conv_error_t e;
+ jcu_errorcode_t jcu_error;
+ jcu_decode_param_t decode;
+ jcu_buffer_param_t buffer;
+ std::uint8_t* pBuff = (std::uint8_t *)pJpegBuff;
+
+ // Check JCU initialized
+ if ( is_JCU_initialized != false ) {
+ // Check input address
+ if ((pJpegBuff == NULL) || (psOutputBuff == NULL)) {
+ e = JPEG_CONV_PARAM_ERR; // Input address error
+ goto fin;
+ }
+ // Check JPEG header
+ if ( ((std::uint32_t)(pBuff[0]) != JPEG_HEADER_LETTER_1 ) ||
+ ((std::uint32_t)(pBuff[1]) != JPEG_HEADER_LETTER_2) ) {
+ e = JPEG_CONV_FORMA_ERR; // JPEG data is not in ROM
+ goto fin;
+ }
+
+ jcu_error = R_JCU_SelectCodec( JCU_DECODE );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_FORMA_ERR;
+ goto fin;
+ }
+
+ buffer.source.swapSetting = JCU_SWAP_LONG_WORD_AND_WORD_AND_BYTE;
+ buffer.source.address = (uint32_t *)pBuff;
+ buffer.lineOffset = (int16_t)psOutputBuff->width;
+ buffer.destination.address = (uint32_t *)psOutputBuff->buffer_address;
+ decode.decodeFormat = (jcu_decode_format_t)psOutputBuff->format; // JCU_OUTPUT_YCbCr422;
+ buffer.destination.swapSetting = (jcu_swap_t)WR_RD_WRSWA_8BIT;
+ decode.outputCbCrOffset = (jcu_cbcr_offset_t)1;
+ decode.alpha = 0;
+ decode.horizontalSubSampling = (jcu_sub_sampling_t)SUB_SAMPLING_1_1;
+ decode.verticalSubSampling = (jcu_sub_sampling_t)SUB_SAMPLING_1_1;
+
+ jcu_error = R_JCU_SetDecodeParam( &decode, &buffer );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+
+ jcu_error = R_JCU_Start();
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ e = JPEG_CONV_OK;
+ }
+ else
+ {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ }
+fin:
+ return e;
+} /* End of method decode() */
+
+/**************************************************************************//**
+ * @brief JPEG data decode to bitmap
+ * @param[in] void* pJpegBuff : Input JPEG data address
+ * @param[in/out] bitmap_buff_info_t* psOutputBuff : Output bitmap data address
+ * @param[in] decode_options_t* pOptions : Decode option(Optional)
+ * @retval error code
+******************************************************************************/
+JPEG_Converter::jpeg_conv_error_t
+JPEG_Converter::decode(void* pJpegBuff, bitmap_buff_info_t* psOutputBuff, decode_options_t* pOptions ) {
+ jpeg_conv_error_t e;
+ jcu_errorcode_t jcu_error;
+ jcu_decode_param_t decode;
+ jcu_buffer_param_t buffer;
+ std::uint8_t* pBuff = (std::uint8_t *)pJpegBuff;
+ const jcu_async_status_t* status;
+ jcu_image_info_t image_info;
+
+ // Check JCU initialized
+ if ( is_JCU_initialized != false ) {
+ std::size_t calc_height;
+ std::size_t calc_width;
+
+ calc_height = psOutputBuff->height * (2 ^ pOptions->vertical_sub_sampling);
+ calc_width = psOutputBuff->width * (2 ^ pOptions->horizontal_sub_sampling);
+
+ // Check input address
+ if ((pJpegBuff == NULL) || (psOutputBuff == NULL) || (pOptions == NULL)) {
+ e = JPEG_CONV_PARAM_ERR; // Input address error
+ goto fin;
+ }
+ // Check JPEG header
+ if ( ((std::uint32_t)(pBuff[0]) != JPEG_HEADER_LETTER_1 ) ||
+ ((std::uint32_t)(pBuff[1]) != JPEG_HEADER_LETTER_2) ) {
+ e = JPEG_CONV_FORMA_ERR; // JPEG data is not in ROM
+ goto fin;
+ }
+
+ jcu_error = R_JCU_SelectCodec( JCU_DECODE );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_FORMA_ERR;
+ goto fin;
+ }
+
+ buffer.source.swapSetting = JCU_SWAP_LONG_WORD_AND_WORD_AND_BYTE;
+ buffer.source.address = (uint32_t *)pBuff;
+ buffer.lineOffset = (int16_t)psOutputBuff->width;
+ buffer.destination.address = (uint32_t *)psOutputBuff->buffer_address;
+ decode.decodeFormat = (jcu_decode_format_t)psOutputBuff->format;
+ buffer.destination.swapSetting = (jcu_swap_t)pOptions->output_swapsetting;
+ decode.outputCbCrOffset = (jcu_cbcr_offset_t)pOptions->output_cb_cr_offset;
+ decode.alpha = pOptions->alpha;
+ decode.horizontalSubSampling = (jcu_sub_sampling_t)pOptions->horizontal_sub_sampling;
+ decode.verticalSubSampling = (jcu_sub_sampling_t)pOptions->vertical_sub_sampling;
+
+ jcu_error = R_JCU_SetDecodeParam( &decode, &buffer );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_FORMA_ERR;
+ goto fin;
+ }
+
+ if (pOptions->check_jpeg_format != false) {
+ jcu_error = R_JCU_SetPauseForImageInfo( true );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ }
+ if ( pOptions->p_DecodeCallBackFunc == NULL ) {
+ jcu_error = R_JCU_Start();
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ R_JCU_GetAsyncStatus( &status );
+ if (status -> IsPaused == false) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ if ((status->SubStatusFlags & JCU_SUB_INFOMATION_READY) == 0) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ jcu_error = R_JCU_GetImageInfo( &image_info );
+ if (jcu_error != JCU_ERROR_OK) goto fin;
+
+ if ((image_info.width == 0u) || (image_info.height == 0u) ||
+ (image_info.width > calc_width) ||
+ (image_info.height > calc_height)) {
+ e = JPEG_CONV_FORMA_ERR;
+ goto fin;
+ }
+ if ((image_info.encodedFormat != JCU_JPEG_YCbCr444) &&
+ (image_info.encodedFormat != JCU_JPEG_YCbCr422) &&
+ (image_info.encodedFormat != JCU_JPEG_YCbCr420) &&
+ (image_info.encodedFormat != JCU_JPEG_YCbCr411)) {
+ e = JPEG_CONV_FORMA_ERR;
+ goto fin;
+ }
+ jcu_error = R_JCU_Continue(JCU_IMAGE_INFO);
+ if (jcu_error != JCU_ERROR_OK) goto fin;
+ } else {
+ async.Flags = R_F_OSPL_InterruptCallback;
+ async.A_Thread = R_OSPL_THREAD_GetCurrentId();
+ (void)R_wrpper_set_decode_callback((mbed_CallbackFunc_t*)pOptions->p_DecodeCallBackFunc, &async, (size_t)calc_width, calc_height);
+ jcu_error = R_JCU_StartAsync( &async );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ }
+ e = JPEG_CONV_OK;
+ }
+ else
+ {
+ e = JPEG_CONV_JCU_ERR;
+ }
+fin:
+ return e;
+} /* End of method decode() */
+
+
+/**************************************************************************//**
+ * @brief Bitmap data encode to JPEG
+ * @param[in] bitmap_buff_info_t* psInputBuff : Input bitmap data address
+ * @param[out] void* pJpegBuff : Output JPEG data address
+ * @param[out] size_t* pEncodeSize : Encode size address
+ * @retval error code
+******************************************************************************/
+JPEG_Converter::jpeg_conv_error_t
+JPEG_Converter::encode(bitmap_buff_info_t* psInputBuff, void* pJpegBuff, size_t* pEncodeSize ) {
+
+ jpeg_conv_error_t e;
+ jcu_errorcode_t jcu_error;
+ jcu_buffer_param_t buffer;
+ uint8_t* TableAddress;
+ jcu_encode_param_t encode;
+
+ // Check JCU initialized
+ if ( is_JCU_initialized != false ) {
+ // Check input address
+ if ((pJpegBuff == NULL) || (psInputBuff == NULL) || (pEncodeSize == NULL)) {
+ e = JPEG_CONV_PARAM_ERR; // Input address error
+ goto fin;
+ }
+ // Select Encode
+ jcu_error = R_JCU_SelectCodec( JCU_ENCODE );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+
+ // Set tables
+ TableAddress = (uint8_t*)csaDefaultQuantizationTable_Y;
+ jcu_error = R_JCU_SetQuantizationTable( JCU_TABLE_NO_0, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ TableAddress = (uint8_t*)csaDefaultQuantizationTable_C;
+ jcu_error = R_JCU_SetQuantizationTable( JCU_TABLE_NO_1, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ TableAddress = (uint8_t*)csaDefaultHuffmanTable_Y_DC;
+ jcu_error = R_JCU_SetHuffmanTable( JCU_TABLE_NO_0, JCU_HUFFMAN_DC, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ TableAddress = (uint8_t*)csaDefaultHuffmanTable_C_DC;
+ jcu_error = R_JCU_SetHuffmanTable( JCU_TABLE_NO_1, JCU_HUFFMAN_DC, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ TableAddress = (uint8_t*)csaDefaultHuffmanTable_Y_AC;
+ jcu_error = R_JCU_SetHuffmanTable( JCU_TABLE_NO_0, JCU_HUFFMAN_AC, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ TableAddress = (uint8_t*)csaDefaultHuffmanTable_C_AC;
+ jcu_error = R_JCU_SetHuffmanTable( JCU_TABLE_NO_1, JCU_HUFFMAN_AC, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+
+ // JPEG encode
+ buffer.source.swapSetting = (jcu_swap_t)WR_RD_WRSWA_8BIT;
+ buffer.source.address = (uint32_t *)psInputBuff->buffer_address;
+ buffer.destination.swapSetting = JCU_SWAP_LONG_WORD_AND_WORD_AND_BYTE;
+ buffer.destination.address = (uint32_t *)pJpegBuff;
+ buffer.lineOffset = psInputBuff->width;
+ encode.encodeFormat = (jcu_jpeg_format_t)JCU_JPEG_YCbCr422;
+ encode.QuantizationTable[ JCU_ELEMENT_Y ] = JCU_TABLE_NO_0;
+ encode.QuantizationTable[ JCU_ELEMENT_Cb ] = JCU_TABLE_NO_1;
+ encode.QuantizationTable[ JCU_ELEMENT_Cr ] = JCU_TABLE_NO_1;
+ encode.HuffmanTable[ JCU_ELEMENT_Y ] = JCU_TABLE_NO_0;
+ encode.HuffmanTable[ JCU_ELEMENT_Cb ] = JCU_TABLE_NO_1;
+ encode.HuffmanTable[ JCU_ELEMENT_Cr ] = JCU_TABLE_NO_1;
+ encode.DRI_value = 0;
+ encode.width = psInputBuff->width;
+ encode.height = psInputBuff->height;
+ encode.inputCbCrOffset = (jcu_cbcr_offset_t)1;
+ jcu_error = R_JCU_SetEncodeParam( &encode, &buffer );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+
+ jcu_error = R_JCU_Start();
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+
+ jcu_error = R_JCU_GetEncodedSize( pEncodeSize );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+
+ e = JPEG_CONV_OK;
+ }
+ else
+ {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ }
+fin:
+
+ return e;
+} /* End of method encode() */
+
+
+/**************************************************************************//**
+ * @brief Bitmap data encode to JPEG
+ * @param[in] bitmap_buff_info_t* psInputBuff : Input bitmap data address
+ * @param[out] void* pJpegBuff : Output JPEG data address
+ * @param[out] size_t* pEncodeSize : Encode size address
+ * @param[in] encode_options_t* pOptions[IN] : Encode option(Optional)
+ * @retval error code
+******************************************************************************/
+JPEG_Converter::jpeg_conv_error_t
+JPEG_Converter::encode(bitmap_buff_info_t* psInputBuff, void* pJpegBuff, size_t* pEncodeSize, encode_options_t* pOptions ) {
+
+ jpeg_conv_error_t e;
+ jcu_errorcode_t jcu_error;
+ jcu_buffer_param_t buffer;
+ uint8_t* TableAddress;
+ jcu_encode_param_t encode;
+
+ // Check JCU initialized
+ if ( is_JCU_initialized != false ) {
+ // Check input address
+ if ((pJpegBuff == NULL) || (psInputBuff == NULL) || (pEncodeSize == NULL)) {
+ e = JPEG_CONV_PARAM_ERR; // Input address error
+ goto fin;
+ }
+ // Select Encode
+ jcu_error = R_JCU_SelectCodec( JCU_ENCODE );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+
+ /* Set tables */
+ if ( pOptions->quantization_table_Y != NULL ) {
+ TableAddress = (uint8_t*)pOptions->quantization_table_Y;
+ } else {
+ TableAddress = (uint8_t*)csaDefaultQuantizationTable_Y;
+ }
+ jcu_error = R_JCU_SetQuantizationTable( JCU_TABLE_NO_0, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ if ( pOptions->quantization_table_C != NULL ) {
+ TableAddress = (uint8_t*)pOptions->quantization_table_C;
+ } else {
+ TableAddress = (uint8_t*)csaDefaultQuantizationTable_C;
+ }
+ jcu_error = R_JCU_SetQuantizationTable( JCU_TABLE_NO_1, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ if ( pOptions->huffman_table_Y_DC != NULL ) {
+ TableAddress = (uint8_t*)pOptions->huffman_table_Y_DC;
+ } else {
+ TableAddress = (uint8_t*)csaDefaultHuffmanTable_Y_DC;
+ }
+ jcu_error = R_JCU_SetHuffmanTable( JCU_TABLE_NO_0, JCU_HUFFMAN_DC, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ if ( pOptions->huffman_table_C_DC != NULL ) {
+ TableAddress = (uint8_t*)pOptions->huffman_table_C_DC;
+ } else {
+ TableAddress = (uint8_t*)csaDefaultHuffmanTable_C_DC;
+ }
+ jcu_error = R_JCU_SetHuffmanTable( JCU_TABLE_NO_1, JCU_HUFFMAN_DC, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ if ( pOptions->huffman_table_Y_AC != NULL ) {
+ TableAddress = (uint8_t*)pOptions->huffman_table_Y_AC;
+ } else {
+ TableAddress = (uint8_t*)csaDefaultHuffmanTable_Y_AC;
+ }
+ jcu_error = R_JCU_SetHuffmanTable( JCU_TABLE_NO_0, JCU_HUFFMAN_AC, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ if ( pOptions->huffman_table_C_AC != NULL ) {
+ TableAddress = (uint8_t*)pOptions->huffman_table_C_AC;
+ } else {
+ TableAddress = (uint8_t*)csaDefaultHuffmanTable_C_AC;
+ }
+ jcu_error = R_JCU_SetHuffmanTable( JCU_TABLE_NO_1, JCU_HUFFMAN_AC, (uint8_t*)TableAddress );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+
+ // JPEG encode
+ buffer.source.swapSetting = (jcu_swap_t)pOptions->input_swapsetting;
+ buffer.source.address = (uint32_t *)psInputBuff->buffer_address;
+ buffer.destination.swapSetting = JCU_SWAP_LONG_WORD_AND_WORD_AND_BYTE;
+ buffer.destination.address = (uint32_t *)pJpegBuff;
+ buffer.lineOffset = psInputBuff->width;
+ encode.encodeFormat = (jcu_jpeg_format_t)JCU_JPEG_YCbCr422;
+ encode.QuantizationTable[ JCU_ELEMENT_Y ] = JCU_TABLE_NO_0;
+ encode.QuantizationTable[ JCU_ELEMENT_Cb ] = JCU_TABLE_NO_1;
+ encode.QuantizationTable[ JCU_ELEMENT_Cr ] = JCU_TABLE_NO_1;
+ encode.HuffmanTable[ JCU_ELEMENT_Y ] = JCU_TABLE_NO_0;
+ encode.HuffmanTable[ JCU_ELEMENT_Cb ] = JCU_TABLE_NO_1;
+ encode.HuffmanTable[ JCU_ELEMENT_Cr ] = JCU_TABLE_NO_1;
+ encode.DRI_value = pOptions->DRI_value;
+ if ( pOptions->width != 0 ) {
+ encode.width = pOptions->width;
+ } else {
+ encode.width = psInputBuff->width;
+ }
+ if ( pOptions->height != 0 ) {
+ encode.height = pOptions->height;
+ } else {
+ encode.height = psInputBuff->height;
+ }
+ encode.inputCbCrOffset = (jcu_cbcr_offset_t)pOptions->input_cb_cr_offset;
+ jcu_error = R_JCU_SetEncodeParam( &encode, &buffer );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+
+ if ( pOptions->p_EncodeCallBackFunc == NULL ) {
+ if (pOptions->encode_buff_size == 0) {
+ jcu_error = R_JCU_Start();
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ } else {
+ jcu_count_mode_param_t count_para;
+ int32_t encode_count;
+ int32_t size_max_count = 1;
+ size_t BufferSize = pOptions->encode_buff_size;
+ const jcu_async_status_t* status;
+
+ while(BufferSize > ENC_SIZE_MAX) {
+ size_max_count *= 2;
+ BufferSize /= 2;
+ }
+ BufferSize = BufferSize & MASK_8BYTE;
+
+ count_para.inputBuffer.isEnable = false;
+ count_para.inputBuffer.isInitAddress = false;
+ count_para.inputBuffer.restartAddress = NULL;
+ count_para.inputBuffer.dataCount = 0;
+ count_para.outputBuffer.isEnable = true;
+ count_para.outputBuffer.isInitAddress = false;
+ count_para.outputBuffer.restartAddress = NULL;
+ count_para.outputBuffer.dataCount = BufferSize;
+
+ R_JCU_SetCountMode(&count_para);
+
+ jcu_error = R_JCU_Start();
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ // Check Pause flag
+ R_JCU_GetAsyncStatus( &status );
+ for ( encode_count = 1; (encode_count < size_max_count) && (status->IsPaused != false); encode_count++) {
+ if (status->SubStatusFlags & JCU_SUB_DECODE_INPUT_PAUSE == 0) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ jcu_error = R_JCU_Continue( JCU_OUTPUT_BUFFER );
+ if (jcu_error != JCU_ERROR_OK) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ R_JCU_GetAsyncStatus( &status );
+ }
+ if (status->IsPaused != false) {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ goto fin;
+ }
+ }
+ jcu_error = R_JCU_GetEncodedSize( pEncodeSize );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ } else {
+ async.Flags = R_F_OSPL_InterruptCallback;
+ async.A_Thread = R_OSPL_THREAD_GetCurrentId();
+ if (pOptions->encode_buff_size == 0) {
+ (void)R_wrpper_set_encode_callback((mbed_CallbackFunc_t*)pOptions->p_EncodeCallBackFunc, &async, pEncodeSize, 0);
+ jcu_error = R_JCU_StartAsync( &async );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ } else {
+ jcu_count_mode_param_t count_para;
+ int32_t size_max_count = 1;
+ size_t BufferSize = pOptions->encode_buff_size;
+
+ while(BufferSize > ENC_SIZE_MAX) {
+ size_max_count *= 2;
+ BufferSize /= 2;
+ }
+ BufferSize = BufferSize & MASK_8BYTE;
+
+ (void)R_wrpper_set_encode_callback((mbed_CallbackFunc_t*)pOptions->p_EncodeCallBackFunc, &async, pEncodeSize, size_max_count);
+
+ count_para.inputBuffer.isEnable = false;
+ count_para.inputBuffer.isInitAddress = false;
+ count_para.inputBuffer.restartAddress = NULL;
+ count_para.inputBuffer.dataCount = 0;
+ count_para.outputBuffer.isEnable = true;
+ count_para.outputBuffer.isInitAddress = false;
+ count_para.outputBuffer.restartAddress = NULL;
+ count_para.outputBuffer.dataCount = BufferSize;
+
+ R_JCU_SetCountMode(&count_para);
+
+ jcu_error = R_JCU_StartAsync( &async );
+ if ( jcu_error != JCU_ERROR_OK ) {
+ e = JPEG_CONV_JCU_ERR;
+ goto fin;
+ }
+ }
+ }
+
+ e = JPEG_CONV_OK;
+ }
+ else
+ {
+ e = JPEG_CONV_PARAM_RANGE_ERR;
+ }
+fin:
+
+ return e;
+} /* End of method encode() */
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/jcu_driver/coverter_wrapper.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,198 @@
+/*******************************************************************************
+* 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) 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**************************************************************************//**
+* @file converter_wrapper.c
+* @version 1.00
+* $Rev: 1 $
+* $Date:: 2015-08-06 16:33:52 +0900#$
+* @brief Graphics driver wrapper function definitions in C
+******************************************************************************/
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "converter_wrapper.h"
+#include "r_ospl.h"
+#include "r_jcu_api.h"
+#include "r_jcu_pl.h"
+
+
+
+static r_ospl_async_t* pAsync;
+static mbed_CallbackFunc_t* SetCallback;
+static size_t* pDecodeSize;
+static size_t decode_width;
+static size_t decode_height;
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+/**************************************************************************//**
+ * @brief Set callback function address for decode
+ * @param[in] pSetCallbackAdr Callback function address
+ * @param[in] p_async ospl async data address
+ * @param[in] width Decode data width
+ * @param[in] height Decode data height
+ * @retval error code
+******************************************************************************/
+errnum_t R_wrpper_set_decode_callback( mbed_CallbackFunc_t* pSetCallbackAdr, r_ospl_async_t* p_async, size_t width, size_t height )
+{
+ errnum_t e;
+
+ pAsync = p_async;
+ SetCallback = pSetCallbackAdr;
+ p_async->InterruptCallback = &R_wrpper_LocalDecodeCallback;
+ decode_width = width;
+ decode_height = height;
+
+ return e;
+}
+
+/**************************************************************************//**
+ * @brief Set callback function address for encode
+ * @param[in] InterruptSource Interrput source data struct address
+ * @param[in] Caller ospl caller data address
+ * @retval error code
+******************************************************************************/
+errnum_t R_wrpper_LocalDecodeCallback( const r_ospl_interrupt_t *InterruptSource, const r_ospl_caller_t *Caller )
+{
+ errnum_t e;
+ mbed_jcu_err_t CallbackReturn = MBED_JCU_E_OK;
+ const jcu_async_status_t* status;
+ jcu_image_info_t image_info;
+ jcu_errorcode_t jcu_error;
+
+ e = E_OTHERS;
+
+ if (Caller == NULL) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ if (R_JCU_OnInterruptDefault(InterruptSource, Caller) != 0) {
+ e = E_OTHERS;
+ SetCallback(MBED_JCU_E_JCU_ERR);
+ goto fin;
+ }
+ R_JCU_GetAsyncStatus( &status );
+ if (status -> IsPaused == true) {
+ if ((status->SubStatusFlags & JCU_SUB_INFOMATION_READY) == 0) {
+ e = E_OTHERS;
+ goto fin;
+ }
+ R_JCU_GetImageInfo( &image_info );
+ if ((image_info.width == 0u) || (image_info.height == 0u) ||
+ (image_info.width > decode_width) ||
+ (image_info.height > decode_height)) {
+ e = E_OTHERS;
+ SetCallback(MBED_JCU_E_FORMA_ERR);
+ goto fin;
+ }
+ if ((image_info.encodedFormat != JCU_JPEG_YCbCr444) &&
+ (image_info.encodedFormat != JCU_JPEG_YCbCr422) &&
+ (image_info.encodedFormat != JCU_JPEG_YCbCr420) &&
+ (image_info.encodedFormat != JCU_JPEG_YCbCr411)) {
+ e = E_OTHERS;
+ SetCallback(MBED_JCU_E_FORMA_ERR);
+ goto fin;
+ }
+ jcu_error = R_JCU_ContinueAsync(JCU_IMAGE_INFO, pAsync);
+ if (jcu_error != JCU_ERROR_OK) {
+ e = E_OTHERS;
+ SetCallback(MBED_JCU_E_JCU_ERR);
+ goto fin;
+ }
+ } else {
+ SetCallback( CallbackReturn );
+ }
+
+fin:
+ return e;
+
+}
+
+/**************************************************************************//**
+ * @brief Set callback function address for encode
+ * @param[in] pSetCallbackAdr Callback function address
+ * @param[in] p_async ospl async data address
+ * @param[in] pSize Encode size input address
+ * @param[in] count_max Encode count max num
+ * @retval error code
+******************************************************************************/
+errnum_t R_wrpper_set_encode_callback( mbed_CallbackFunc_t* pSetCallbackAdr, r_ospl_async_t* p_async, size_t* pSize, int32_t count_max )
+{
+ errnum_t e;
+
+ pAsync = p_async;
+ SetCallback = pSetCallbackAdr;
+ p_async->InterruptCallback = &R_wrpper_LocalEncodeCallback;
+ pDecodeSize = pSize;
+
+ return e;
+}
+
+/**************************************************************************//**
+ * @brief Set callback function address for encode
+ * @param[in] InterruptSource Interrput source data struct address
+ * @param[in] Caller ospl caller data address
+ * @retval error code
+******************************************************************************/
+errnum_t R_wrpper_LocalEncodeCallback( const r_ospl_interrupt_t *InterruptSource, const r_ospl_caller_t *Caller )
+{
+ errnum_t e;
+ mbed_jcu_err_t CallbackReturn = MBED_JCU_E_OK;
+ const jcu_async_status_t* status;
+ jcu_errorcode_t jcu_error;
+
+ e = E_OTHERS;
+
+ if (Caller == NULL) {
+ e = E_OTHERS;
+ goto fin;
+ }
+ if (R_JCU_OnInterruptDefault(InterruptSource, Caller) != 0) {
+ e = E_OTHERS;
+ SetCallback(MBED_JCU_E_JCU_ERR);
+ goto fin;
+ }
+ R_JCU_GetAsyncStatus(&status);
+ if (status -> IsPaused == true) {
+ if (status->SubStatusFlags & JCU_SUB_DECODE_INPUT_PAUSE == 0) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ jcu_error = R_JCU_ContinueAsync(JCU_OUTPUT_BUFFER, pAsync);
+ if (jcu_error != JCU_ERROR_OK) {
+ e = E_OTHERS;
+ goto fin;
+ }
+ } else {
+ SetCallback( CallbackReturn );
+ e = R_JCU_GetEncodedSize( pDecodeSize );
+ }
+
+fin:
+ return e;
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/jcu_driver/jcu_api.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,1339 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/*******************************************************************************
+* $FileName: jcu_api.c $
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-02-26 13:18:53 +0900#$
+* Description : JCU driver API
+******************************************************************************/
+/**
+* @file jcu_api.c
+* @brief JCU (JPEG hardware) driver API. Main Code.
+*
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 38 $
+* $Date:: 2014-03-18 16:14:45 +0900#$
+*/
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include <string.h>
+#include "r_typedefs.h"
+#include "iodefine.h"
+#include "r_ospl.h"
+#include "r_jcu_api.h"
+#include "r_jcu_local.h"
+#include "r_jcu_pl.h"
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+/* Section: Internal Global */
+
+/** gs_jcu_internal_information */
+static jcu_internal_information_t gs_jcu_internal_information;
+
+
+/** gs_jcu_i_lock */
+static jcu_i_lock_t gs_jcu_i_lock;
+
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+/***********************************************************************
+* Class: jcu_i_lock_t
+************************************************************************/
+static void R_JCU_I_LOCK_Reset( jcu_i_lock_t *const self );
+static bool_t R_JCU_I_LOCK_Lock( void *const self_ );
+static void R_JCU_I_LOCK_Unlock( void *const self_ );
+static void R_JCU_I_LOCK_RequestFinalize( void *const self_ );
+static int_fast32_t R_JCU_I_LOCK_GetRootChannelNum( const void *const self_ );
+
+
+/* Section: Global */
+/**
+* @brief Initialize the driver
+*
+* @param NullConfig (in) NULL
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_Initialize( void *const NullConfig )
+/* <-SEC M1.1.1 */
+{
+ errnum_t e;
+ jcu_errorcode_t returnValue;
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ static const r_ospl_i_lock_vtable_t gs_I_LockVTable = {
+ &( R_JCU_I_LOCK_Lock ), /* MISRA 16.9 */
+ &( R_JCU_I_LOCK_Unlock ),
+ &( R_JCU_I_LOCK_RequestFinalize ),
+ &( R_JCU_I_LOCK_GetRootChannelNum )
+ };
+
+ R_UNREFERENCED_VARIABLE( NullConfig );
+ R_IT_WILL_BE_NOT_CONST( NullConfig );
+
+ if ( self->I_Lock == NULL ) {
+ jcu_i_lock_t *const i_lock = &gs_jcu_i_lock;
+
+ self->Is_I_LockMaster = R_JCU_I_LOCK_Replace(
+ i_lock, &gs_I_LockVTable );
+ }
+
+ if ( IS( self->Is_I_LockMaster ) ) {
+ R_JCU_I_LOCK_Reset( self->I_Lock );
+ }
+ R_OSPL_FLAG32_InitConst( &self->AsyncStatus.InterruptFlags );
+ R_OSPL_FLAG32_InitConst( &self->AsyncStatus.InterruptEnables );
+ R_OSPL_FLAG32_InitConst( &self->AsyncStatus.CancelFlags );
+ self->AsyncStatus.IsEnabledInterrupt = false;
+
+ /* Error check */
+ if (self->AsyncStatus.Status != JCU_STATUS_UNDEF) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ /* Run the User-defined function if user set the function */
+ e= R_JCU_OnInitialize();
+ IF ( e != 0 ) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ }
+
+ /* Initialize the variable */
+ self->AsyncStatus.IsPaused = false;
+ self->AsyncStatus.SubStatusFlags = 0;
+ self->IsCountMode = false;
+ self->ErrorFilter = JCU_INT_ERROR_ALL;
+ self->AsyncForFinalize = NULL;
+
+ /* Set the register */
+ returnValue = JCU_SetRegisterForInitialize();
+
+ if (returnValue == JCU_ERROR_OK) {
+ /* Set the updated status */
+ self->AsyncStatus.Status = JCU_STATUS_INIT;
+
+ /* Initialize the status for the encode */
+ self->Codec = JCU_CODEC_NOT_SELECTED;
+ } /* end if */
+
+fin:
+ return returnValue;
+}
+
+
+/**
+* @brief Terminate the driver function
+*
+* @par Parameters
+* None
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_Terminate(void)
+/* <-SEC M1.1.1 */
+{
+ errnum_t e;
+ jcu_errorcode_t ej;
+ r_ospl_async_t async;
+ bit_flags32_t got_flags;
+
+ async.Flags = R_F_OSPL_A_Thread;
+ async.A_Thread = R_OSPL_THREAD_GetCurrentId();
+
+ ej= R_JCU_TerminateAsync( &async );
+ IF( ej != JCU_ERROR_OK ) {
+ goto fin;
+ }
+
+ e= R_OSPL_EVENT_Wait( async.A_EventValue, &got_flags, R_OSPL_INFINITE );
+ IF(e!=0) {
+ ej=JCU_ERROR_PARAM;
+ goto fin;
+ }
+
+ e= async.ReturnValue;
+ IF(e!=0) {
+ ej=JCU_ERROR_PARAM;
+ goto fin;
+ }
+
+fin:
+ return ej;
+}
+
+
+/**
+* @brief Terminate the driver function
+*
+* @param async <r_ospl_async_t>
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_TerminateAsync( r_ospl_async_t *const async )
+/* <-SEC M1.1.1 */
+{
+ jcu_errorcode_t returnValue = JCU_ERROR_OK;
+ bool_t was_enabled = false;
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ IF_DQ( async == NULL ) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ }
+
+ R_JCU_SetDefaultAsync( async, R_OSPL_ASYNC_TYPE_FINALIZE );
+ async->ReturnValue = 0;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+ /* Check the status */
+ if ( self->AsyncStatus.Status == JCU_STATUS_UNDEF ) {
+ returnValue = JCU_ERROR_OK;
+ goto fin;
+ } /* end if */
+
+ if ( self->AsyncStatus.Status == JCU_STATUS_RUN ) {
+ self->AsyncForFinalize = async;
+
+ R_OSPL_FLAG32_Set( &self->AsyncStatus.CancelFlags, R_OSPL_FINALIZE_REQUEST );
+
+ /* "R_JCU_OnInterrupted" will be called */
+ } else {
+ returnValue = R_JCU_TerminateStep2();
+ R_OSPL_EVENT_Set( async->A_Thread, async->A_EventValue );
+ } /* end if */
+
+fin:
+ /* Finalize I-Lock */
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+
+ if ( IS( self->Is_I_LockMaster ) ) {
+ if ( IS( gs_jcu_i_lock.IsRequestedFinalize ) ) {
+ R_JCU_I_LOCK_Finalize();
+ }
+ }
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief Terminate the driver function
+*
+* @par Parameters
+* None
+* @return <jcu_errorcode_t> type.
+*/
+jcu_errorcode_t R_JCU_TerminateStep2(void)
+{
+ errnum_t ee;
+ jcu_errorcode_t returnValue = JCU_ERROR_OK;
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ R_AVOID_UNSAFE_ALWAYS_WARNING( returnValue );
+
+
+ /* Set the updated status */
+ R_OSPL_FLAG32_Clear( &self->AsyncStatus.CancelFlags, R_OSPL_FLAG32_ALL_BITS );
+ self->AsyncStatus.Status = JCU_STATUS_UNDEF;
+ self->I_LockVTable->RequestFinalize( self->I_Lock );
+
+
+ /* Run the additional function selected by parameter */
+ ee= R_JCU_OnFinalize( returnValue );
+ IF ( (ee != 0) && (returnValue == JCU_ERROR_OK) ) {
+ returnValue = JCU_ERROR_PARAM;
+ }
+
+ return returnValue;
+}
+
+
+/**
+* @brief Select Codec Type
+*
+* @param codec <jcu_codec_t>
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_SelectCodec(
+ const jcu_codec_t codec)
+/* <-SEC M1.1.1 */
+{
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF ((self->AsyncStatus.Status == JCU_STATUS_UNDEF)
+ || (self->AsyncStatus.Status == JCU_STATUS_RUN)) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ returnValue = JCU_ParaCheckSelectCodec(codec);
+ IF (returnValue != JCU_ERROR_OK) {
+ goto fin;
+ }
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Clear the count mode flag */
+ self->IsCountMode = false;
+
+ /* Register set */
+ JCU_SetRegisterForCodec(codec);
+
+ /* Set the updated status */
+ self->AsyncStatus.Status = JCU_STATUS_SELECTED;
+
+ /* Set codec type to internal information variable */
+ switch (codec) {
+ case JCU_ENCODE:
+ self->Codec = JCU_STATUS_ENCODE;
+ break;
+ case JCU_DECODE:
+ self->Codec = JCU_STATUS_DECODE;
+ break;
+ /* ->QAC 2018 : For MISRA 15.3, SEC R3.5.2 */
+ default:
+ /* <-QAC 2018 */
+ R_NOOP(); /* NOT REACHED */
+ break;
+ } /* end switch */
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief Start decoding or encoding. Synchronized.
+*
+* @par Parameters
+* None
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_Start(
+ void)
+/* <-SEC M1.1.1 */
+{
+ errnum_t e;
+ jcu_errorcode_t ej;
+ r_ospl_async_t async;
+ bit_flags32_t got_flags;
+
+ async.Flags = R_F_OSPL_A_Thread;
+ async.A_Thread = R_OSPL_THREAD_GetCurrentId();
+
+ ej= R_JCU_StartAsync( &async );
+ IF( ej != JCU_ERROR_OK ) {
+ goto fin;
+ }
+
+ e= R_OSPL_EVENT_Wait( async.A_EventValue, &got_flags, R_OSPL_INFINITE );
+ IF(e!=0) {
+ ej=e;
+ goto fin;
+ }
+
+ e= async.ReturnValue;
+ IF(e!=0) {
+ ej=e;
+ goto fin;
+ }
+
+fin:
+ return ej;
+}
+
+
+/**
+* @brief Start decoding or encoding. Asynchronized.
+*
+* @par Parameters
+* None
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_StartAsync(
+ r_ospl_async_t *const async)
+/* <-SEC M1.1.1 */
+{
+ errnum_t e;
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (self->AsyncStatus.Status != JCU_STATUS_READY) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ returnValue = JCU_ParaCheckStart();
+ IF(returnValue != JCU_ERROR_OK) {
+ goto fin;
+ } /* end if */
+
+ IF ( async == NULL ) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ R_JCU_SetDefaultAsync( async, R_OSPL_ASYNC_TYPE_NORMAL );
+ async->ReturnValue = 0;
+
+ /* Attach "Async" to interrupt */
+ /* ->MISRA 11.4 : Not too big "enum" is same bit count as "int" */ /* ->SEC R2.7.1 */
+ R_OSPL_CALLER_Initialize( &self->InterruptCallbackCaller,
+ async, (int_fast32_t *)&self->AsyncStatus.Status, JCU_STATUS_INTERRUPTING,
+ self->I_Lock, self->I_LockVTable );
+ /* <-MISRA 11.4 */ /* <-SEC R2.7.1 */
+ e= R_JCU_SetInterruptCallbackCaller( &self->InterruptCallbackCaller );
+ IF ( e != 0 ) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ }
+ R_OSPL_FLAG32_Set( &self->AsyncStatus.InterruptEnables, JCU_INTERRUPT_LINE_ALL );
+
+ /* Clear event flags */
+ R_OSPL_EVENT_Clear( async->A_Thread, async->A_EventValue );
+ R_OSPL_EVENT_Clear( async->I_Thread, async->I_EventValue );
+
+ /* Set the updated status when register update is finished */
+ /* Change the status */
+ self->AsyncStatus.Status = JCU_STATUS_RUN;
+
+ /* Register set */
+ JCU_SetRegisterForStart( self->ErrorFilter );
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief Set the count mode (separate operating) parameter
+*
+* @param buffer <jcu_count_mode_param_t>
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_SetCountMode(
+ const jcu_count_mode_param_t *const buffer)
+/* <-SEC M1.1.1 */
+{
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (!((self->AsyncStatus.Status == JCU_STATUS_SELECTED)
+ || (self->AsyncStatus.Status == JCU_STATUS_READY))) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF(buffer == NULL) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ returnValue = JCU_ParaCheckSetCountMode(buffer);
+ IF(returnValue != JCU_ERROR_OK) {
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Set the count mode flag */
+ if ((buffer->inputBuffer.isEnable != false) || (buffer->outputBuffer.isEnable != false)) {
+ self->IsCountMode = true;
+ } else {
+ self->IsCountMode = false;
+ } /* end if */
+
+ /* Register set */
+ JCU_SetRegisterForSetCountMode(buffer);
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief Restart the processing caused by count mode. Synchronized.
+*
+* @param type The target to continue
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_Continue(
+ const jcu_continue_type_t type)
+/* <-SEC M1.1.1 */
+{
+ errnum_t e;
+ jcu_errorcode_t ej;
+ r_ospl_async_t async;
+ bit_flags32_t got_flags;
+
+ async.Flags = R_F_OSPL_A_Thread;
+ async.A_Thread = R_OSPL_THREAD_GetCurrentId();
+
+ ej= R_JCU_ContinueAsync( type, &async );
+ IF( ej != JCU_ERROR_OK ) {
+ goto fin;
+ }
+
+ e= R_OSPL_EVENT_Wait( async.A_EventValue, &got_flags, R_OSPL_INFINITE );
+ IF(e!=0) {
+ ej=JCU_ERROR_PARAM;
+ goto fin;
+ }
+
+ e= async.ReturnValue;
+ IF(e!=0) {
+ ej=JCU_ERROR_PARAM;
+ goto fin;
+ }
+
+fin:
+ return ej;
+}
+
+
+/**
+* @brief Restart the processing caused by count mode. Asynchronized.
+*
+* @param type The target to continue
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_ContinueAsync(
+ const jcu_continue_type_t type,
+ r_ospl_async_t *const async)
+/* <-SEC M1.1.1 */
+{
+ errnum_t e;
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ bit_flags32_t mask;
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (self->AsyncStatus.Status != JCU_STATUS_READY) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF (self->AsyncStatus.IsPaused == false) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ IF ( async == NULL ) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Clear the sub status flag */
+ switch ( type ) {
+ case JCU_INPUT_BUFFER:
+ mask = ( ( JINF_MASK | DINLF_MASK ) << JCU_SHIFT_JINTS1 );
+ break;
+ case JCU_OUTPUT_BUFFER:
+ mask = ( ( DOUTLF_MASK | JOUTF_MASK ) << JCU_SHIFT_JINTS1 );
+ break;
+ default:
+ ASSERT_R( type == JCU_IMAGE_INFO, returnValue=E_OTHERS; goto fin );
+ mask = INS3_MASK;
+ break;
+ }
+ ASSERT_R( IS_ANY_BITS_SET( self->AsyncStatus.SubStatusFlags, mask ), returnValue=E_OTHERS; goto fin );
+ self->AsyncStatus.SubStatusFlags &= ~mask;
+
+
+ R_JCU_SetDefaultAsync( async, R_OSPL_ASYNC_TYPE_NORMAL );
+ async->ReturnValue = 0;
+
+ /* Clear event flags */
+ R_OSPL_EVENT_Clear( async->A_Thread, async->A_EventValue );
+ R_OSPL_EVENT_Clear( async->I_Thread, async->I_EventValue );
+
+ /* JCU will restart */
+ if( self->AsyncStatus.SubStatusFlags == 0 ) {
+ /* Attach "Async" to interrupt */
+ /* ->MISRA 11.4 : Not too big "enum" is same bit count as "int" */ /* ->SEC R2.7.1 */
+ R_OSPL_CALLER_Initialize( &self->InterruptCallbackCaller,
+ async, (int_fast32_t *)&self->AsyncStatus.Status, JCU_STATUS_INTERRUPTING,
+ self->I_Lock, self->I_LockVTable );
+ /* <-MISRA 11.4 */ /* <-SEC R2.7.1 */
+ e= R_JCU_SetInterruptCallbackCaller( &self->InterruptCallbackCaller );
+ IF ( e != 0 ) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ }
+ R_OSPL_FLAG32_Set( &self->AsyncStatus.InterruptEnables, JCU_INTERRUPT_LINE_ALL );
+
+ /* Change the status */
+ self->AsyncStatus.Status = JCU_STATUS_RUN;
+ self->AsyncStatus.IsPaused = false;
+
+ /* Register set */
+ JCU_SetRegisterForContinue( type );
+ }
+
+ /* JCU will not restart */
+ else {
+ /* Register set */
+ JCU_SetRegisterForContinue( type );
+
+ /* Change the status */
+ self->AsyncStatus.Status = JCU_STATUS_READY;
+
+ /* Set event flags */
+ R_OSPL_EVENT_Set( async->A_Thread, async->A_EventValue );
+ R_OSPL_EVENT_Set( async->I_Thread, async->I_EventValue );
+ }
+
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief R_JCU_GetAsyncStatus.
+*
+* @par Parameters
+* None
+* @return None
+*/
+void R_JCU_GetAsyncStatus( const jcu_async_status_t **const out_Status )
+{
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ IF_DQ( out_Status == NULL ) {
+ goto fin;
+ }
+
+ *out_Status = &self->AsyncStatus;
+
+fin:
+ return;
+}
+
+
+/**
+* @brief Set parameter for decode.
+*
+* @param decode Select the encode parameter for decoding. <jcu_decode_param_t>
+* @param buffer Buffer settings for decode. <jcu_buffer_param_t>
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_SetDecodeParam(
+ const jcu_decode_param_t *const decode,
+ const jcu_buffer_param_t *const buffer)
+/* <-SEC M1.1.1 */
+{
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (!((self->AsyncStatus.Status == JCU_STATUS_READY)
+ || (self->AsyncStatus.Status == JCU_STATUS_SELECTED))) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF(self->Codec != JCU_STATUS_DECODE) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF((decode == NULL) || (buffer == NULL)) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ returnValue = JCU_ParaCheckSetDecodeParam(decode, buffer);
+ IF(returnValue != JCU_ERROR_OK) {
+ goto fin;
+ } /* end if */
+
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Register set */
+ JCU_SetRegisterForSetDecodePrm(decode, buffer);
+
+ /* Set the updated status */
+ self->AsyncStatus.Status = JCU_STATUS_READY;
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief Whether stop or not stop for R_JCU_GetImageInfo()
+*
+* @param is_pause Whether stop or not stop
+* @return <jcu_errorcode_t> type.
+*/
+jcu_errorcode_t R_JCU_SetPauseForImageInfo( const bool_t is_pause )
+{
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (!((self->AsyncStatus.Status == JCU_STATUS_READY)
+ || (self->AsyncStatus.Status == JCU_STATUS_SELECTED))) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF(self->Codec != JCU_STATUS_DECODE) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Register set */
+ JCU_SetRegisterForSetPause( is_pause, self->ErrorFilter );
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief GetImageInfo
+*
+* @param buffer Image information. <jcu_image_info_t>
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_GetImageInfo(
+ jcu_image_info_t *const buffer)
+/* <-SEC M1.1.1 */
+{
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (self->AsyncStatus.Status != JCU_STATUS_READY) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF (self->Codec != JCU_STATUS_DECODE) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF (buffer == NULL) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ returnValue = JCU_ParaCheckGetImageInfo(buffer);
+ if(returnValue != JCU_ERROR_OK) {
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Register set */
+ JCU_GetRegisterForGetImageInfo(buffer);
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief SetErrorFilter
+*
+* @param filter enable bit of error. <jcu_int_detail_errors_t>
+* @return <jcu_errorcode_t> type.
+*/
+jcu_errorcode_t R_JCU_SetErrorFilter(jcu_int_detail_errors_t filter)
+{
+ jcu_errorcode_t returnValue;
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (!((self->AsyncStatus.Status == JCU_STATUS_INIT)
+ || (self->AsyncStatus.Status == JCU_STATUS_READY)
+ || (self->AsyncStatus.Status == JCU_STATUS_SELECTED))) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ IF ( IS_ANY_BITS_SET( filter, ~JCU_INT_ERROR_ALL ) ) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ self->ErrorFilter = filter;
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ return returnValue;
+}
+
+
+/**
+* @brief SetQuantizationTable
+*
+* @param tableNo The table number to set the value. <jcu_table_no_t>
+* @param table The body of the table to set.
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_SetQuantizationTable(
+ const jcu_table_no_t tableNo,
+ const uint8_t *const table)
+/* <-SEC M1.1.1 */
+{
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (!((self->AsyncStatus.Status == JCU_STATUS_READY)
+ || (self->AsyncStatus.Status == JCU_STATUS_SELECTED))) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF (self->Codec != JCU_STATUS_ENCODE) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF (table == NULL) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ returnValue = JCU_ParaCheckSetQuantizationTbl(tableNo);
+ IF (returnValue != JCU_ERROR_OK) {
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Register set */
+ JCU_SetRegisterForSetQtTable(tableNo, table);
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief Set the Huffman table
+*
+* @param tableNo The table number to set the value. <jcu_table_no_t>
+* @param type The type of Huffman table type (AC or DC). <jcu_huff_t>
+* @param table The body of the table to set
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_SetHuffmanTable(
+ const jcu_table_no_t tableNo,
+ const jcu_huff_t type,
+ const uint8_t *const table)
+/* <-SEC M1.1.1 */
+{
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (!((self->AsyncStatus.Status == JCU_STATUS_READY)
+ || (self->AsyncStatus.Status == JCU_STATUS_SELECTED))) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF (self->Codec != JCU_STATUS_ENCODE) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF (table == NULL) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ returnValue = JCU_ParaCheckSetHuffmanTable(tableNo, type);
+ IF (returnValue != JCU_ERROR_OK) {
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Register set */
+ JCU_SetRegisterForSetHuffTbl(tableNo, type, table);
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief Set the parameter fo encoding
+*
+* @param encode Select the encode parameter for encoding. <jcu_encode_param_t>
+* @param buffer Select the buffer settings for encoding. <jcu_buffer_param_t>
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_SetEncodeParam(
+ const jcu_encode_param_t *const encode,
+ const jcu_buffer_param_t *const buffer)
+/* <-SEC M1.1.1 */
+{
+ jcu_errorcode_t returnValue;
+ bool_t was_enabled; /* = false; */ /* QAC 3197 */
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (!((self->AsyncStatus.Status == JCU_STATUS_READY)
+ || (self->AsyncStatus.Status == JCU_STATUS_SELECTED))) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF (self->Codec != JCU_STATUS_ENCODE) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+
+ IF ((encode == NULL) || (buffer == NULL)) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ returnValue = JCU_ParaCheckEncodeParam(encode, buffer);
+ IF (returnValue != JCU_ERROR_OK) {
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+ /* Register set */
+ JCU_SetRegisterForSetEncodePrm(encode, buffer);
+
+ /* Set the updated status */
+ self->AsyncStatus.Status = JCU_STATUS_READY;
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( IS( was_enabled ) ) {
+ self->I_LockVTable->Unlock( self->I_Lock );
+ }
+ return returnValue;
+}
+
+
+/**
+* @brief GetEncodedSize
+*
+* @param out_Size EncodedSize
+* @return <jcu_errorcode_t> type.
+*/
+/* ->SEC M1.1.1 API Function */
+jcu_errorcode_t R_JCU_GetEncodedSize(
+ size_t *const out_Size)
+/* <-SEC M1.1.1 */
+{
+ JCU_GetEncodedSize(out_Size);
+ return JCU_ERROR_OK;
+}
+
+
+/**
+* @brief Set AXI bus A*CACHE bits for 2nd cache to JCU.
+*
+* @param read_cache_attribute <r_ospl_axi_cache_attribute_t>
+* @param write_cache_attribute <r_ospl_axi_cache_attribute_t>
+* @return <jcu_errorcode_t> type.
+*/
+jcu_errorcode_t R_JCU_Set2ndCacheAttribute(
+ r_ospl_axi_cache_attribute_t const read_cache_attribute,
+ r_ospl_axi_cache_attribute_t const write_cache_attribute )
+{
+ static const uint32_t mask_JCU = 0xFFFF0000u;
+ jcu_errorcode_t returnValue;
+ bool_t was_all_enabled = false;
+ uint32_t new_value;
+ volatile uint32_t value;
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+#ifdef JCU_PARAMETER_CHECK
+ IF (!((self->AsyncStatus.Status == JCU_STATUS_READY)
+ || (self->AsyncStatus.Status == JCU_STATUS_SELECTED))) {
+ returnValue = JCU_ERROR_STATUS;
+ goto fin;
+ } /* end if */
+#endif /* #Ifdef JCU_PARAMETER_CHECK_ */
+
+
+ new_value = ( read_cache_attribute << 24 ) | ( write_cache_attribute << 16 );
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+
+ value = INB.AXIBUSCTL0;
+ value = new_value | ( value & ~mask_JCU ); /* Mutual Exclusion from Ether */
+ INB.AXIBUSCTL0 = value;
+
+ returnValue = JCU_ERROR_OK;
+fin:
+ if ( was_all_enabled ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+
+ return returnValue;
+}
+
+
+/**
+* @brief EnableInterrupt
+*
+* @par Parameters
+* None
+* @return None
+*/
+void R_JCU_EnableInterrupt(void)
+{
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ self->AsyncStatus.IsEnabledInterrupt = true;
+ R_JCU_OnEnableInterrupt( self->AsyncStatus.InterruptEnables.Flags );
+}
+
+
+/**
+* @brief DisableInterrupt
+*
+* @par Parameters
+* None
+* @return Was interrupt enabled
+*/
+bool_t R_JCU_DisableInterrupt(void)
+{
+ bool_t was_interrupted;
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+
+ was_interrupted = self->AsyncStatus.IsEnabledInterrupt;
+
+ R_JCU_OnDisableInterrupt( self->AsyncStatus.InterruptEnables.Flags );
+ self->AsyncStatus.IsEnabledInterrupt = false;
+
+ return was_interrupted;
+}
+
+
+/**
+* @brief R_JCU_GetInternalInformation
+*
+* @par Parameters
+* None
+* @return <jcu_internal_information_t> type.
+*/
+jcu_internal_information_t *R_JCU_GetInternalInformation(void)
+{
+ return &gs_jcu_internal_information;
+}
+
+
+/**
+* @brief R_JCU_GetILockObject
+*
+* @par Parameters
+* None
+* @return <jcu_i_lock_t> type.
+*/
+jcu_i_lock_t *R_JCU_GetILockObject(void)
+{
+ return &gs_jcu_i_lock;
+}
+
+
+/**
+* @brief Replace associated I-Lock object
+*
+* @param I_Lock I-Lock object
+* @param I_LockVTable V-Table
+* @return Whether success to replace
+*/
+bool_t R_JCU_I_LOCK_Replace( void *const I_Lock, const r_ospl_i_lock_vtable_t *const I_LockVTable )
+{
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+ bool_t ret = false;
+
+ ASSERT_R( self->AsyncStatus.Status == JCU_STATUS_UNDEF, ret = false; goto fin );
+
+ if ( I_Lock != NULL ) {
+ if ( self->I_Lock == NULL ) {
+ self->I_Lock = I_Lock;
+ self->I_LockVTable = I_LockVTable;
+ ret = true;
+ }
+ } else {
+ self->I_Lock = NULL;
+ }
+
+fin:
+ return ret;
+}
+
+
+/**
+* @brief Finalize the I-Lock object
+*
+* @par Parameters
+* None
+* @return None
+*/
+void R_JCU_I_LOCK_Finalize(void)
+{
+ jcu_internal_information_t *const self = &gs_jcu_internal_information;
+ bool_t b;
+
+ ASSERT_D( self->Is_I_LockMaster, R_NOOP() );
+
+ R_JCU_I_LOCK_Reset( self->I_Lock );
+ b= R_JCU_I_LOCK_Replace( NULL, NULL );
+ R_UNREFERENCED_VARIABLE( b ); /* QAC 3200 : This is not error information */
+ self->Is_I_LockMaster = false;
+}
+
+
+/**
+* @brief Reset the I-Lock object
+*
+* @param self I-Lock object
+* @return None
+*/
+static void R_JCU_I_LOCK_Reset( jcu_i_lock_t *const self )
+{
+ IF_DQ( self == NULL ) {
+ goto fin;
+ }
+
+ self->IsLock = false;
+ R_JCU_OnDisableInterrupt( JCU_INTERRUPT_LINE_ALL );
+ JCU_ClearInterruptFlag();
+ self->IsRequestedFinalize = false;
+
+fin:
+ return;
+}
+
+
+/**
+* @brief Lock the I-Lock object
+*
+* @param self_ I-Lock object
+* @return Was interrupt enabled
+*/
+static bool_t R_JCU_I_LOCK_Lock( void *const self_ )
+{
+ bool_t is_locked;
+ bool_t was_all_enabled; /* = false; */ /* QAC 3197 */
+ bool_t b;
+ jcu_i_lock_t *const self = (jcu_i_lock_t *) self_;
+
+ IF_DQ( self == NULL ) {
+ is_locked = true;
+ goto fin;
+ }
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+
+ is_locked = self->IsLock;
+ if ( ! is_locked ) {
+ b= R_JCU_DisableInterrupt();
+ R_UNREFERENCED_VARIABLE( b ); /* QAC 3200 : This is not error information */
+ self->IsLock = true;
+ }
+
+ if ( IS( was_all_enabled ) ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+
+fin:
+ return ! is_locked;
+}
+
+
+/**
+* @brief Unlock the I-Lock object
+*
+* @param self_ I-Lock object
+* @return None
+*/
+static void R_JCU_I_LOCK_Unlock( void *const self_ )
+{
+ bool_t was_all_enabled; /* = false; */ /* QAC 3197 */
+ jcu_i_lock_t *const self = (jcu_i_lock_t *) self_;
+
+ IF_DQ( self == NULL ) {
+ goto fin;
+ }
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+
+ R_JCU_EnableInterrupt();
+ self->IsLock = false;
+
+ if ( IS( was_all_enabled ) ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+
+fin:
+ return;
+}
+
+
+/**
+* @brief Request to finalize the I-Lock object
+*
+* @param self_ I-Lock object
+* @return None
+*/
+static void R_JCU_I_LOCK_RequestFinalize( void *const self_ )
+{
+ jcu_i_lock_t *const self = (jcu_i_lock_t *) self_;
+
+ IF_DQ( self == NULL ) {
+ goto fin;
+ }
+
+ self->IsRequestedFinalize = true;
+
+fin:
+ return;
+}
+
+
+/**
+* @brief Get root channel number of I-Lock object
+*
+* @param self_ I-Lock object
+* @return A channel number
+*/
+static int_fast32_t R_JCU_I_LOCK_GetRootChannelNum( const void *const self_ )
+{
+ R_UNREFERENCED_VARIABLE( self_ );
+
+ return 0;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/jcu_driver/jcu_para.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,356 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/*******************************************************************************
+* $FileName: jcu_para.c $
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 38 $
+* $Date:: 2014-03-18 16:14:45 +0900#$
+* Description : JCU driver checking parameter
+******************************************************************************/
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include <string.h>
+#include "r_typedefs.h"
+#include "r_ospl.h"
+#include "r_jcu_api.h"
+#include "r_jcu_local.h"
+#include "r_jcu_user.h"
+#include "iodefine.h"
+
+#ifdef JCU_PARAMETER_CHECK
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+#define MASK_LOW_3BIT (0x7u)
+#define MOD_8 (0x8u)
+#define MOD_16 (0x10u)
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+/**************************************************************************//**
+ * Function Name : [JCU_ParaCheckSelectCodec]
+ * @brief SelectCodec api's parameter checking
+ * @param [in] codec codec type
+ * @retval jcu_errorcode_t
+ *****************************************************************************/
+jcu_errorcode_t JCU_ParaCheckSelectCodec(
+ const jcu_codec_t codec)
+{
+ jcu_errorcode_t returnValue;
+
+ IF_DS ((codec != JCU_ENCODE)
+ && (codec != JCU_DECODE)) {
+ returnValue = JCU_ERROR_PARAM;
+ }
+ else {
+ returnValue = JCU_ERROR_OK;
+ } /* end if */
+
+ return (returnValue);
+}
+
+/**************************************************************************//**
+ * Function Name : [JCU_ParaCheckStart]
+ * @brief Start api's parameter checking
+ * @param [in] codec codec type
+ * @retval jcu_errorcode_t
+ *****************************************************************************/
+jcu_errorcode_t JCU_ParaCheckStart(
+ void)
+{
+ jcu_errorcode_t returnValue;
+
+ /* If jcu already start, it cannot update this bit (this is limitation of hardware) */
+ IF ( (uint32_t)R_GET_REG_BIT_FIELD( JCU.JCCMD, JSRT ) == REG_F_SET ) {
+ returnValue = JCU_ERROR_STATUS;
+ }
+ else {
+ returnValue = JCU_ERROR_OK;
+ } /* end if */
+
+ return (returnValue);
+}
+
+/**************************************************************************//**
+ * Function Name : [JCU_ParaCheckSetCountMode]
+ * @brief parameter check for the SetCountMode
+ * @param [in] buffer the parameter for the Count Mode
+ * @retval jcu_errorcode_t
+ *****************************************************************************/
+jcu_errorcode_t JCU_ParaCheckSetCountMode(
+ const jcu_count_mode_param_t *const buffer)
+{
+ jcu_errorcode_t returnValue = JCU_ERROR_OK;
+
+ IF (buffer == NULL) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ IF ((buffer->inputBuffer.isEnable != false) && (buffer->outputBuffer.isEnable != false)) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ }
+
+ if (buffer->inputBuffer.isEnable != false) {
+ /* When initAddress is true, restartAddress has to set the address */
+ if (buffer->inputBuffer.isInitAddress != false) {
+ IF (buffer->inputBuffer.restartAddress == NULL) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+ } /* end if */
+
+ /* Datasize(JDATAS/LINES bit) have to 8byte alignment */
+ IF ((buffer->inputBuffer.dataCount & MASK_LOW_3BIT) != 0u) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ /* Datasize have to bigger than 0 */
+ IF (buffer->inputBuffer.dataCount == 0u) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ } /* end if */
+
+ if (buffer->outputBuffer.isEnable != false) {
+ /* When initAddress is true, restartAddress has to set the address */
+ if (buffer->outputBuffer.isInitAddress != false) {
+ IF (buffer->outputBuffer.restartAddress == NULL) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+ } /* end if */
+
+ /* Datasize(JDATAS/LINES bit) have to 8byte alignment */
+ IF ((buffer->outputBuffer.dataCount & MASK_LOW_3BIT) != 0u) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ /* Datasize have to bigger than 0 */
+ IF (buffer->outputBuffer.dataCount == 0u) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ } /* end if */
+fin:
+ return (returnValue);
+}
+
+/**************************************************************************//**
+ * Function Name : [JCU_ParaCheckSetDecodeParam]
+ * @brief SetDecodeParam api's parameter checking
+ * @param [in] buffer input and output buffer settings
+ * @param [in] interruptKind tye type of interrupt that use in this system
+ * @retval jcu_errorcode_t
+ *****************************************************************************/
+jcu_errorcode_t JCU_ParaCheckSetDecodeParam(
+ const jcu_decode_param_t *const decode,
+ const jcu_buffer_param_t *const buffer)
+{
+ jcu_errorcode_t returnValue = JCU_ERROR_OK;
+
+ IF ((decode == NULL) || (buffer == NULL)) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ /* NULL check for the address data */
+ IF ((buffer->source.address == NULL)
+ || (buffer->destination.address == NULL)) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ /* Check for the address alignment */
+ /* ->MISRA 11.3 */ /* ->SEC R2.7.1 */
+ IF ((((uint32_t) (buffer->source.address) % MOD_8) != 0u) ||
+ (((uint32_t) (buffer->destination.address) % MOD_8) != 0u))
+ /* <-MISRA 11.3 */ { /* <-SEC R2.7.1 */
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ /*Check for Cb/Cr offset */
+ if(decode->decodeFormat == JCU_OUTPUT_YCbCr422) {
+ IF (((decode->outputCbCrOffset) != JCU_CBCR_OFFSET_0) && ((decode->outputCbCrOffset) != JCU_CBCR_OFFSET_128)) {
+ returnValue = JCU_ERROR_PARAM;
+ } /* end if */
+ } else {
+ IF ((decode->outputCbCrOffset) != JCU_CBCR_OFFSET_0) {
+ returnValue = JCU_ERROR_PARAM;
+ } /* end if */
+ } /* end if */
+fin:
+ return (returnValue);
+}
+
+/**************************************************************************//**
+ * Function Name : [JCU_ParaCheckGetImageInfo]
+ * @brief GetImageInfo api's parameter checking
+ * @param [in] buffer buffer address that set the image information
+ * @retval jcu_errorcode_t
+ *****************************************************************************/
+jcu_errorcode_t JCU_ParaCheckGetImageInfo(
+ const jcu_image_info_t *const buffer)
+{
+ jcu_errorcode_t returnValue = JCU_ERROR_OK;
+
+ IF (buffer == NULL) {
+ returnValue = JCU_ERROR_PARAM;
+ } /* end if */
+
+ return (returnValue);
+}
+
+/**************************************************************************//**
+ * Function Name : [JCU_ParaCheckSetQuantizationTbl]
+ * @brief SetQuantizationTable api's parameter checking
+ * @param [in] tableNo the table number that set the parameter
+ * @retval jcu_errorcode_t
+ *****************************************************************************/
+jcu_errorcode_t JCU_ParaCheckSetQuantizationTbl(
+ const jcu_table_no_t tableNo)
+{
+ jcu_errorcode_t returnValue = JCU_ERROR_OK;
+
+ /* ->MISRA 13.7 : For fail safe. */
+ IF_DS (tableNo > JCU_TABLE_NO_3)
+ /* <-MISRA 13.7 */
+ /* ->MISRA 14.1 ->QAC 3201 : For fail safe. */
+ {
+ returnValue = JCU_ERROR_PARAM;
+ } /* end if */
+ /* <-MISRA 14.1 <-QAC 3201 */
+
+ return (returnValue);
+}
+
+/**************************************************************************//**
+ * Function Name : [JCU_ParaCheckSetHuffmanTable]
+ * @brief SetHuffmanTable api's parameter checking
+ * @param [in] tableNo the table number that set the parameter
+ * @param [in] type the type which table is set(AC or DC)
+ * @retval jcu_errorcode_t
+ *****************************************************************************/
+jcu_errorcode_t JCU_ParaCheckSetHuffmanTable(
+ const jcu_table_no_t tableNo,
+ const jcu_huff_t type)
+{
+ jcu_errorcode_t returnValue = JCU_ERROR_OK;
+
+ /* ->MISRA 13.7 : For fail safe. */
+ IF (tableNo > JCU_TABLE_NO_1)
+ /* <-MISRA 13.7 */
+ {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ /* ->MISRA 13.7 : For fail safe. */
+ IF_DS ((type != JCU_HUFFMAN_AC)
+ && (type != JCU_HUFFMAN_DC))
+ /* <-MISRA 13.7 */
+ /* ->MISRA 14.1 ->QAC 3201 : For fail safe. */
+ {
+ returnValue = JCU_ERROR_PARAM;
+ } /* end if */
+ /* <-MISRA 14.1 <-QAC 3201 */
+fin:
+ return (returnValue);
+}
+
+/**************************************************************************//**
+ * Function Name : [JCU_ParaCheckEncodeParam]
+ * @brief api's parameter checking
+ * @param [in]
+ * @retval jcu_errorcode_t
+ *****************************************************************************/
+jcu_errorcode_t JCU_ParaCheckEncodeParam(
+ const jcu_encode_param_t *const encode,
+ const jcu_buffer_param_t *const buffer)
+{
+ jcu_errorcode_t returnValue = JCU_ERROR_OK;
+
+ IF ((encode == NULL) || (buffer == NULL)) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ /* NULL check for the address data */
+ IF ((buffer->source.address == NULL)
+ || (buffer->destination.address == NULL)) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+
+ if (encode->encodeFormat == JCU_JPEG_YCbCr422) {
+ /* Check the width of the image data */
+ IF ((encode->width % MOD_16) != 0u) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+
+ /* Check the height of the image data */
+ IF ((encode->height % MOD_8) != 0u) {
+ returnValue = JCU_ERROR_PARAM;
+ goto fin;
+ } /* end if */
+ } else {
+ returnValue = JCU_ERROR_PARAM;
+ ASSERT_D( false, R_NOOP() );
+ goto fin;
+ } /* end if */
+
+ /*Check for Cb/Cr offset */
+ IF (((encode->inputCbCrOffset) != JCU_CBCR_OFFSET_0) && ((encode->inputCbCrOffset) != JCU_CBCR_OFFSET_128)) {
+ returnValue = JCU_ERROR_PARAM;
+ } /* end if */
+
+fin:
+ return (returnValue);
+}
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/jcu_driver/jcu_reg.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,804 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/*******************************************************************************
+* $FileName: jcu_reg.c $
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-02-26 13:18:53 +0900#$
+* Description : JCU driver setting register
+******************************************************************************/
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include <r_typedefs.h>
+#include <iodefine.h>
+#include <r_jcu_api.h>
+#include <r_jcu_local.h>
+#include <r_jcu_user.h>
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+#define NUMBER_OF_QUANTIZATION_TABLE_DATA (64)
+#define NUMBER_OF_HUFFMAN_TABLE_DATA_DC (28)
+#define NUMBER_OF_HUFFMAN_TABLE_DATA_AC (178)
+
+#define CBCR_OFFSET_NUM (2u)
+
+#define SWAP_NORMAL (0u)
+#define SWAP_16BIT_OUTPUT (1u)
+#define SWAP_32BIT_OUTPUT (2u)
+
+#define KIND_COLOR_FORMAT (3u)
+#define KIND_LINEOFFSET (2u)
+#define KIND_TABLE (4u)
+
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+STATIC_INLINE uint8_t GET_UPPER_BYTE( uint32_t const value );
+STATIC_INLINE uint8_t GET_LOWER_BYTE( uint32_t const value );
+static void JCU_GetRegisterForGetErrorInfo(jcu_detail_error_t *const errorCode);
+
+
+/**************************************************************************//**
+* Function Name: [GET_UPPER_BYTE]
+* @brief GET_UPPER_BYTE
+* @retval Byte
+******************************************************************************/
+STATIC_INLINE uint8_t GET_UPPER_BYTE( uint32_t const value )
+{
+ enum { num_8 = 8 }; /* SEC M1.10.1, QAC-3132 */
+ return (uint8_t)( value >> num_8 );
+}
+
+/**************************************************************************//**
+* Function Name: [GET_LOWER_BYTE]
+* @brief GET_LOWER_BYTE
+* @retval Byte
+******************************************************************************/
+STATIC_INLINE uint8_t GET_LOWER_BYTE( uint32_t const value )
+{
+ return (uint8_t)( value );
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForInitialize]
+* @brief SetRegisterForInitialize
+* @retval jcu_errorcode_t
+******************************************************************************/
+jcu_errorcode_t JCU_SetRegisterForInitialize(
+ void)
+{
+ return JCU_ERROR_OK;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForCodec]
+* @brief SetRegisterForCodec
+* @param[out] codec
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForCodec(
+ const jcu_codec_t codec)
+{
+ volatile uint8_t DummyRead;
+
+ /* Reset this IP */
+ R_SET_REG_BIT_FIELD( CPG.SWRSTCR2, SRST, REG_F_SET );
+ DummyRead = R_GET_REG_BIT_FIELD( CPG.SWRSTCR2, SRST );
+ R_UNREFERENCED_VARIABLE( DummyRead );
+
+ R_SET_REG_BIT_FIELD( CPG.SWRSTCR2, SRST, REG_F_CLR );
+ DummyRead = R_GET_REG_BIT_FIELD( CPG.SWRSTCR2, SRST );
+ R_UNREFERENCED_VARIABLE( DummyRead );
+
+ R_SET_REG_BIT_FIELD( JCU.JCCMD, BRST, REG_F_SET);
+
+ /* Enable interrupts in registers (Interrupt lines in INTC are still disabled) */
+ /* This registers are set to 0 by reset this IP */
+ /* ->QAC 0306 */
+
+ JCU.JINTE1 = JCU_JINTS1_ALL;
+ /* <-QAC 0306 */
+
+ /* Clear the all of count mode settings */
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, DINLC, REG_F_CLR );
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, DINRINI, REG_F_CLR );
+ /* ->QAC 0306 */
+ JCU.JIFESLC = LINES_CLEAR;
+ /* <-QAC 0306 */
+
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, JOUTC, REG_F_CLR );
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, JOUTRINI, REG_F_CLR );
+ /* ->QAC 0306 */
+ JCU.JIFEDDC = JDATAS_CLEAR;
+ /* <-QAC 0306 */
+
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, JINC, REG_F_CLR );
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, JINRINI, REG_F_CLR );
+ /* ->QAC 0306 */
+ JCU.JIFDSDC = JDATAS_CLEAR;
+ /* <-QAC 0306 */
+
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, DOUTLC, REG_F_CLR );
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, DOUTRINI, REG_F_CLR );
+ /* ->QAC 0306 */
+ JCU.JIFDDLC = LINES_CLEAR;
+ /* <-QAC 0306 */
+
+ /* Set the which process is select */
+ R_SET_REG_BIT_FIELD( JCU.JCMOD, DSP, codec );
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_ClearInterruptFlag]
+* @brief ClearInterruptFlag
+* @retval None
+******************************************************************************/
+void JCU_ClearInterruptFlag(
+ void)
+{
+ /* Interrupt request clear */
+ R_SET_REG_BIT_FIELD( JCU.JCCMD, JEND, REG_F_SET);
+
+ /* Clear the JEDI interrupt source flag */
+ /* ->QAC 0306 */
+ JCU.JINTS0 = (uint8_t) 0u; /* Write 0 only */
+ /* <-QAC 0306 */
+
+ /* Clear the JDTI interrupt source flag */
+ /* ->QAC 0306 */
+ JCU.JINTS1 &= ~JCU_JINTS1_ALL;
+ /* <-QAC 0306 */
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForStart]
+* @brief SetRegisterForStart
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForStart(
+ const jcu_int_detail_error_t error_filter)
+{
+ uint32_t reg_jinte0;
+ reg_jinte0 = (uint32_t)JCU.JINTE0 & (uint32_t)(~JCU_INT_ERROR_ALL);
+ JCU.JINTE0 = (uint8_t)( reg_jinte0 | (uint32_t)error_filter );
+ R_SET_REG_BIT_FIELD( JCU.JCCMD, JSRT, REG_F_SET );
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForSetCountMode]
+* @brief SetRegisterForSetCountMode
+* @param[in] buffer
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForSetCountMode(
+ const jcu_count_mode_param_t *const buffer)
+{
+ jcu_internal_information_t *const self = R_JCU_GetInternalInformation();
+
+ IF (buffer == NULL) {
+ goto fin;
+ } /* end if */
+
+ IF_DQ ( self == NULL ) {
+ goto fin;
+ } /* end if */
+
+ switch(self->Codec) {
+ case JCU_STATUS_ENCODE:
+ /* ->QAC 0306 */
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, DINRINI, buffer->inputBuffer.isInitAddress );
+ if ((buffer->inputBuffer.isEnable != false) && (buffer->inputBuffer.isInitAddress != false)) {
+ JCU.JIFESA = (uint32_t)(buffer->inputBuffer.restartAddress);
+ } /* end if */
+ JCU.JIFESLC = ( LINES_MASK & (buffer->inputBuffer.dataCount) );
+
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, JOUTRINI ,buffer->outputBuffer.isInitAddress );
+ if ((buffer->outputBuffer.isEnable != false) && (buffer->outputBuffer.isInitAddress != false)) {
+ JCU.JIFEDA = (uint32_t)(buffer->outputBuffer.restartAddress);
+ } /* end if */
+ JCU.JIFEDDC = ( JDATAS_MASK & ( buffer->outputBuffer.dataCount ) );
+ /* <-QAC 0306 */
+
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, DINLC ,buffer->inputBuffer.isEnable );
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, JOUTC ,buffer->outputBuffer.isEnable );
+ break;
+
+ case JCU_STATUS_DECODE:
+ /* ->QAC 0306 */
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, JINRINI ,buffer->inputBuffer.isInitAddress );
+ if ((buffer->inputBuffer.isEnable != false) && (buffer->inputBuffer.isInitAddress != false)) {
+ JCU.JIFDSA = (uint32_t)(buffer->inputBuffer.restartAddress);
+ } /* end if */
+ JCU.JIFDSDC = ( JDATAS_MASK & (buffer->inputBuffer.dataCount ) );
+
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, DOUTRINI, buffer->outputBuffer.isInitAddress );
+ if ((buffer->outputBuffer.isEnable != false) && (buffer->outputBuffer.isInitAddress != false)) {
+ JCU.JIFDDA = (uint32_t)(buffer->outputBuffer.restartAddress);
+ } /* end if */
+ JCU.JIFDDLC = ( LINES_MASK & ( buffer->outputBuffer.dataCount ) );
+ /* <-QAC 0306 */
+
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, JINC, buffer->inputBuffer.isEnable );
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, DOUTLC, buffer->outputBuffer.isEnable );
+ break;
+
+ case JCU_CODEC_NOT_SELECTED:
+ /* ->QAC 2018 : For MISRA 15.3, SEC R3.5.2 */
+ default:
+ /* <-QAC 2018 */
+ R_NOOP(); /* NOT REACHED */
+ break;
+ } /* end switch */
+fin:
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForContinue]
+* @brief SetRegisterForContinue
+* @param[in] type
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForContinue(
+ const jcu_continue_type_t type)
+{
+ jcu_internal_information_t *const self = R_JCU_GetInternalInformation();
+
+ IF_DQ ( self == NULL ) {
+ goto fin;
+ } /* end if */
+
+ /* Restart register setting */
+ switch (type) {
+ case JCU_INPUT_BUFFER:
+ if (self->Codec == JCU_STATUS_DECODE) {
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, JINRCMD, REG_F_SET );
+ } else {
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, DINRCMD, REG_F_SET );
+ } /* end if */
+ break;
+
+ case JCU_OUTPUT_BUFFER:
+ if (self->Codec == JCU_STATUS_DECODE) {
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, DOUTRCMD, REG_F_SET );
+ } else {
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, JOUTRCMD, REG_F_SET );
+ } /* end if */
+ break;
+
+ case JCU_IMAGE_INFO:
+ R_SET_REG_BIT_FIELD( JCU.JCCMD, JRST, REG_F_SET );
+ break;
+
+ /* ->QAC 2018 : For MISRA 15.3, SEC R3.5.2 */
+ default:
+ /* <-QAC 2018 */
+ R_NOOP(); /* NOT REACHED */
+ break;
+ } /* end switch */
+
+fin:
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForSetDecodePrm]
+* @brief SetRegisterForSetDecod
+* @param[in] decode
+* @param[in] buffer
+* @param[in] interruptKind
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForSetDecodePrm(
+ const jcu_decode_param_t *const decode,
+ const jcu_buffer_param_t *const buffer)
+{
+ const uint32_t byteSize[KIND_COLOR_FORMAT] =
+ /* ->SEC M1.10.1 Table data. */
+ {
+ 2u, /* JCU_OUTPUT_YCbCr422 */
+ 4u, /* JCU_OUTPUT_ARGB8888 */
+ 2u /* JCU_OUTPUT_RGB565 */
+ };
+ /* <-SEC M1.10.1 */
+
+ if ((decode == NULL) || (buffer == NULL)) {
+ goto fin;
+ } /* end if */
+
+ /* Settings for the cull */
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, VINTER, decode->verticalSubSampling );
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, HINTER, decode->horizontalSubSampling );
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, OPF, decode->decodeFormat );
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, JINSWAP, buffer->source.swapSetting );
+ R_SET_REG_BIT_FIELD( JCU.JIFDCNT, DOUTSWAP, buffer->destination.swapSetting );
+
+ /* Settings for input jpeg file information */
+ /* ->QAC 0306 */
+ JCU.JIFDSA = (uint32_t)(buffer->source.address);
+ /* <-QAC 0306 */
+ /* Settings for output image data information */
+ /* ->QAC 0306 */
+ JCU.JIFDDA = (uint32_t)(buffer->destination.address);
+ /* <-QAC 0306 */
+ R_SET_REG_BIT_FIELD( JCU.JIFDDOFST, DDMW, ((uint32_t)buffer->lineOffset * (uint32_t)(byteSize[decode->decodeFormat])) );
+ R_SET_REG_BIT_FIELD( JCU.JIFDADT, ALPHA, (uint32_t)(decode->alpha) );
+
+
+ /* Setting for Cb/Cr offset */
+ R_SET_REG_BIT_FIELD( JCU.JIFESHSZ, DOUTYCHG, decode->outputCbCrOffset );
+fin:
+ return;
+
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForSetQtTable]
+* @brief SetRegisterForSetQtTable
+* @param[in] tableNo
+* @param[in] table
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForSetQtTable(
+ const jcu_table_no_t tableNo,
+ const uint8_t *const table)
+{
+ volatile uint8_t *tableAtRegister;
+ int_fast32_t counter;
+
+ /* Select the destination of the Quantization table */
+ switch (tableNo) {
+ /* ->QAC 0306 */
+ case JCU_TABLE_NO_0:
+ tableAtRegister = (volatile uint8_t *)&JCU.JCQTBL0;
+ break;
+ case JCU_TABLE_NO_1:
+ tableAtRegister = (volatile uint8_t *)&JCU.JCQTBL1;
+ break;
+ case JCU_TABLE_NO_2:
+ tableAtRegister = (volatile uint8_t *)&JCU.JCQTBL2;
+ break;
+ case JCU_TABLE_NO_3:
+ tableAtRegister = (volatile uint8_t *)&JCU.JCQTBL3;
+ break;
+ /* ->QAC 2018 : For MISRA 15.3, SEC R3.5.2 */
+ default:
+ /* <-QAC 2018 */
+ /* NOT REACHED */
+ return;
+ /* <-QAC 0306 */
+ } /* end switch */
+
+ IF ((tableAtRegister == NULL) || (table == NULL)) {
+ goto fin;
+ } /* end if */
+
+ /* Update the quantization table data */
+ for (counter = 0; counter < NUMBER_OF_QUANTIZATION_TABLE_DATA; counter++) {
+ tableAtRegister[ counter ] = table[ counter ];
+ } /* end for */
+fin:
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForSetHuffTbl]
+* @brief SetRegisterForSetHuffTbl
+* @param[in] tableNo
+* @param[in] type
+* @param[in] table
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForSetHuffTbl(
+ const jcu_table_no_t tableNo,
+ const jcu_huff_t type,
+ const uint8_t *table)
+{
+ volatile uint8_t *tableAtRegister;
+ int_fast32_t copyCount;
+ int_fast32_t counter;
+
+ /* Select the destination Huffman table and the size of copy data */
+ if (tableNo == JCU_TABLE_NO_0) {
+ /* ->QAC 0306 */
+ if (type == JCU_HUFFMAN_DC) {
+ tableAtRegister = (volatile uint8_t *)&JCU.JCHTBD0;
+ copyCount = NUMBER_OF_HUFFMAN_TABLE_DATA_DC;
+ } else {
+ tableAtRegister = (volatile uint8_t *)&JCU.JCHTBA0;
+ copyCount = NUMBER_OF_HUFFMAN_TABLE_DATA_AC;
+ } /* end if */
+ /* <-QAC 0306 */
+ } else {
+ /* ->QAC 0306 */
+ if (type == JCU_HUFFMAN_DC) {
+ tableAtRegister = (volatile uint8_t *)&JCU.JCHTBD1;
+ copyCount = NUMBER_OF_HUFFMAN_TABLE_DATA_DC;
+ } else {
+ tableAtRegister = (volatile uint8_t *)&JCU.JCHTBA1;
+ copyCount = NUMBER_OF_HUFFMAN_TABLE_DATA_AC;
+ } /* end if */
+ /* <-QAC 0306 */
+ } /* end if */
+
+ IF(table == NULL) {
+ goto fin;
+ } /* end if */
+
+ /* Update the Huffman table */
+ for (counter = 0; counter < copyCount; counter++) {
+ tableAtRegister[ counter ] = table[ counter ];
+ } /* end for */
+fin:
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForSetEncodePrm]
+* @brief SetRegisterForSetEncode
+* @param[in] encode
+* @param[in] buffer
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForSetEncodePrm(
+ const jcu_encode_param_t *const encode,
+ const jcu_buffer_param_t *const buffer)
+{
+ jcu_jpeg_format_t encodeFormatTemp;
+ const uint32_t byteSize[KIND_LINEOFFSET] =
+ /* ->SEC M1.10.1 Table data. */
+ {
+ 0u, /* Reserved */
+ 2u /* JCU_JPEG_YCbCr422 */
+ };
+ /* <-SEC M1.10.1 */
+
+ IF ((encode == NULL) || (buffer == NULL)) {
+ goto fin;
+ } /* end if */
+
+ /* Settings for the input image format */
+ R_SET_REG_BIT_FIELD( JCU.JCMOD, REDU, encode->encodeFormat );
+
+ /* Settings for the quantization table */
+ R_SET_REG_BIT_FIELD( JCU.JCQTN, QT1, encode->QuantizationTable[JCU_ELEMENT_Y] );
+ R_SET_REG_BIT_FIELD( JCU.JCQTN, QT2, encode->QuantizationTable[JCU_ELEMENT_Cb] );
+ R_SET_REG_BIT_FIELD( JCU.JCQTN, QT3, encode->QuantizationTable[JCU_ELEMENT_Cr] );
+
+ /* Settings for the Huffman table */
+ R_SET_REG_BIT_FIELD( JCU.JCHTN, HTA1, (uint32_t)(encode->HuffmanTable[JCU_ELEMENT_Y]) );
+ R_SET_REG_BIT_FIELD( JCU.JCHTN, HTD1, (uint32_t)(encode->HuffmanTable[JCU_ELEMENT_Y]) );
+ R_SET_REG_BIT_FIELD( JCU.JCHTN, HTA2, (uint32_t)(encode->HuffmanTable[JCU_ELEMENT_Cb]) );
+ R_SET_REG_BIT_FIELD( JCU.JCHTN, HTD2, (uint32_t)(encode->HuffmanTable[JCU_ELEMENT_Cb]) );
+ R_SET_REG_BIT_FIELD( JCU.JCHTN, HTA3, (uint32_t)(encode->HuffmanTable[JCU_ELEMENT_Cr]) );
+ R_SET_REG_BIT_FIELD( JCU.JCHTN, HTD3, (uint32_t)(encode->HuffmanTable[JCU_ELEMENT_Cr]) );
+
+ /* ->QAC 0306 */
+ JCU.JCDRIU = GET_UPPER_BYTE(encode->DRI_value);
+ JCU.JCDRID = GET_LOWER_BYTE(encode->DRI_value);
+ /* Settings for the image size */
+ /* width setting */
+ JCU.JCHSZU = GET_UPPER_BYTE(encode->width);
+ JCU.JCHSZD = GET_LOWER_BYTE(encode->width);
+ /* height setting */
+ JCU.JCVSZU = GET_UPPER_BYTE(encode->height);
+ JCU.JCVSZD = GET_LOWER_BYTE(encode->height);
+ /* <-QAC 0306 */
+
+
+ /* Settings for input jpeg file information */
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, DINSWAP, buffer->source.swapSetting );
+
+ /* ->QAC 0306 */
+ JCU.JIFESA = (uint32_t)(buffer->source.address);
+ /* <-QAC 0306 */
+
+ /* Settings for output image data information */
+ R_SET_REG_BIT_FIELD( JCU.JIFECNT, JOUTSWAP, buffer->destination.swapSetting );
+
+ /* ->QAC 0306 */
+ JCU.JIFEDA = (uint32_t)(buffer->destination.address);
+ /* <-QAC 0306 */
+
+ encodeFormatTemp = encode->encodeFormat;
+ if((encodeFormatTemp != JCU_JPEG_YCbCr444) && (encodeFormatTemp != JCU_JPEG_YCbCr422)) {
+ encodeFormatTemp = JCU_JPEG_YCbCr444;
+ } /* end if */
+
+ R_SET_REG_BIT_FIELD( JCU.JIFESOFST, ESMW, ((uint32_t)buffer->lineOffset * (uint32_t)(byteSize[encodeFormatTemp])) );
+
+ /* Setting for Cb/Cr offset */
+ R_SET_REG_BIT_FIELD( JCU.JIFESVSZ, DINYCHG, encode->inputCbCrOffset );
+fin:
+ return;
+
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_SetRegisterForSetPause]
+* @brief
+* @param[out] is_stop
+* @retval None
+******************************************************************************/
+void JCU_SetRegisterForSetPause( const bool_t is_pause, const jcu_int_detail_errors_t filter )
+{
+ /* ->QAC 0306 */
+ if ( IS( is_pause ) ) {
+ JCU.JINTE0 = filter | INT3_MASK;
+ } else {
+ JCU.JINTE0 = filter;
+ }
+ /* <-QAC 0306 */
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_GetRegisterForGetImageInfo]
+* @brief Get "jcu_image_info_t" type value
+* @param[out] buffer :jcu_image_info_t
+* @retval None
+******************************************************************************/
+void JCU_GetRegisterForGetImageInfo(
+ jcu_image_info_t *const buffer)
+{
+ if (buffer == NULL) {
+ goto fin;
+ } /* end if */
+
+ /* Set the register value to the variables */
+ /* ->QAC 0306 */
+ buffer->width = ((uint32_t)JCU.JCHSZU << SHIFT_8BITS);
+ buffer->width |= (uint32_t)JCU.JCHSZD;
+ buffer->height = ((uint32_t)JCU.JCVSZU << SHIFT_8BITS);
+ buffer->height |= (uint32_t)JCU.JCVSZD;
+ buffer->encodedFormat = (jcu_jpeg_format_t)R_GET_REG_BIT_FIELD( JCU.JCMOD, REDU );
+ /* <-QAC 0306 */
+
+fin:
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_GetRegisterForGetErrorInfo]
+* @brief Get "jcu_detail_error_t" type value
+* @param[out] errorCode
+* @retval None
+******************************************************************************/
+static void JCU_GetRegisterForGetErrorInfo(
+ jcu_detail_error_t *const errorCode)
+{
+ if (errorCode != NULL) {
+ /* ->QAC 0306 */
+ uint8_t const code = R_GET_REG_BIT_FIELD( JCU.JCDERR, ERR );
+ /* <-QAC 0306 */
+
+ if ( (uint_fast8_t) code == 0u ) {
+ *errorCode = JCU_JCDERR_OK;
+ } else {
+ *errorCode = (jcu_detail_error_t)( (int_t) code + E_CATEGORY_JCU_JCDERR );
+ }
+ } /* end if */
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [JCU_GetEncodedSize]
+* @brief GetEncodedSize
+* @param[out] out_Size
+* @retval None
+******************************************************************************/
+void JCU_GetEncodedSize(
+ size_t *const out_Size)
+{
+ if (out_Size != NULL) {
+ /* ->QAC 0306 */
+ *out_Size = (((uint32_t)JCU.JCDTCU) << SHIFT_16BITS);
+ *out_Size |= (((uint32_t)JCU.JCDTCM) << SHIFT_8BITS);
+ *out_Size |= ((uint32_t)JCU.JCDTCD);
+ /* <-QAC 0306 */
+ } /* end if */
+ return;
+}
+
+/**************************************************************************//**
+* Function Name: [R_JCU_OnInterrupting]
+* @brief Operations on interrupting
+* @retval Error code, 0=No error
+******************************************************************************/
+errnum_t R_JCU_OnInterrupting( const r_ospl_interrupt_t *const InterruptSource )
+{
+ errnum_t e;
+ uint32_t flags0;
+ uint32_t flags1;
+ jcu_internal_information_t *const self = R_JCU_GetInternalInformation();
+
+ R_UNREFERENCED_VARIABLE( InterruptSource );
+ IF_DQ( self == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ ASSERT_R( self->AsyncStatus.Status == JCU_STATUS_INTERRUPTING, e=E_STATE; goto fin );
+
+ /* Get interrupt status */
+ /* ->QAC 0306 */
+ flags0 = JCU.JINTS0;
+ flags1 = JCU.JINTS1;
+ R_OSPL_FLAG32_Set( &self->AsyncStatus.InterruptFlags, flags0 );
+ R_OSPL_FLAG32_Set( &self->AsyncStatus.InterruptFlags, flags1 << JCU_SHIFT_JINTS1 );
+
+ /* Clear interrupt status "JINTS0" */
+ if ( flags0 != 0u ) {
+ R_SET_REG_BIT_FIELD( JCU.JCCMD, JEND, 1u );
+ JCU.JINTS0 = (uint8_t) 0u; /* Write 0 only */
+ }
+
+ /* Clear interrupt status "JINTS1" */
+ JCU.JINTS1 = ~flags1 & JCU_JINTS1_ALL;
+ /* <-QAC 0306 */
+
+ /* Set state */
+ self->AsyncStatus.Status = JCU_STATUS_INTERRUPTED;
+
+ e=0;
+fin:
+ return e;
+}
+
+/**************************************************************************//**
+* Function Name: [R_JCU_OnInterrupted]
+* @brief Bottom half operations on interrupting
+* @retval Error code, 0=No error
+******************************************************************************/
+errnum_t R_JCU_OnInterrupted(void)
+{
+ bit_flags32_t const sub_status_bits =
+ ( INS3_MASK ) |
+ ( JINF_MASK << JCU_SHIFT_JINTS1 ) |
+ ( DOUTLF_MASK << JCU_SHIFT_JINTS1 ) |
+ ( DINLF_MASK << JCU_SHIFT_JINTS1 ) |
+ ( JOUTF_MASK << JCU_SHIFT_JINTS1 );
+
+ errnum_t e;
+ uint32_t cancel_flag;
+ uint32_t interrupt_flags;
+ bool_t was_enabled = false;
+ bool_t is_end;
+ bool_t or;
+ jcu_errorcode_t ej;
+ r_ospl_async_t *notify_async_1 = NULL;
+ r_ospl_async_t *notify_async_2 = NULL;
+ jcu_i_lock_t *const i_lock = R_JCU_GetILockObject();
+ jcu_internal_information_t *const self = R_JCU_GetInternalInformation();
+
+ IF_DQ( self == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ was_enabled = self->I_LockVTable->Lock( self->I_Lock );
+
+ ASSERT_R( self->AsyncStatus.Status != JCU_STATUS_UNDEF, e=E_STATE; goto fin );
+
+ interrupt_flags = R_OSPL_FLAG32_GetAndClear( &self->AsyncStatus.InterruptFlags );
+
+
+ if ( IS_ANY_BITS_SET( interrupt_flags, sub_status_bits ) ) {
+ if ( IS_BIT_NOT_SET( interrupt_flags, INS6_MASK ) ) {
+ self->AsyncStatus.IsPaused = true;
+ self->AsyncStatus.SubStatusFlags = interrupt_flags & sub_status_bits;
+ }
+ }
+
+
+ if ( IS_ANY_BITS_SET( interrupt_flags, INS6_MASK ) ) {
+ is_end = true;
+ } else {
+ is_end = false;
+ }
+
+
+ or = ( (is_end) || (self->AsyncStatus.IsPaused) );
+ if (!or) {
+ or = IS_BIT_SET( interrupt_flags, INS5_MASK );
+ }
+ if (IS( or )) {
+ /* Set "AsyncStatus" */
+ R_OSPL_FLAG32_Clear( &self->AsyncStatus.InterruptEnables, JCU_INTERRUPT_LINE_ALL );
+ self->AsyncStatus.Status = JCU_STATUS_READY;
+ notify_async_1 = self->InterruptCallbackCaller.Async;
+ } else {
+ self->AsyncStatus.Status = JCU_STATUS_RUN;
+ }
+
+
+ IF ( IS_BIT_SET( interrupt_flags, INS5_MASK ) ) {
+ jcu_detail_error_t ed;
+
+ JCU_GetRegisterForGetErrorInfo( &ed );
+ e = ed;
+ goto fin;
+ }
+
+
+ if ( notify_async_1 != NULL ) {
+ cancel_flag = R_OSPL_FLAG32_Get( &self->AsyncStatus.CancelFlags );
+ if ( IS_BIT_SET( cancel_flag, R_OSPL_FINALIZE_REQUEST ) ) {
+ notify_async_2 = self->AsyncForFinalize;
+ ej= R_JCU_TerminateStep2();
+ IF ( ej != JCU_ERROR_OK ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ }
+ }
+
+ e=0;
+fin:
+ if ( IS( was_enabled ) ) {
+ /* ->QAC 3353 : "self" is always assigned, if "was_enabled" is true */
+ IF_DQ( self == NULL ) {} /* QAC 3353 raises SEC R3.2.2 */
+ else {
+ self->I_LockVTable->Unlock( self->I_Lock );
+
+ if ( IS( self->Is_I_LockMaster ) ) {
+ IF_DQ( i_lock == NULL ) {}
+ else {
+ if ( IS( i_lock->IsRequestedFinalize ) ) {
+ R_JCU_I_LOCK_Finalize();
+ }
+ }
+ }
+ }
+ /* <-QAC 3353 */
+ }
+
+ if ( notify_async_1 != NULL ) {
+ R_OSPL_EVENT_Set( notify_async_1->A_Thread, notify_async_1->A_EventValue );
+ }
+ if ( notify_async_2 != NULL ) {
+ R_OSPL_EVENT_Set( notify_async_2->A_Thread, notify_async_2->A_EventValue );
+ }
+
+ return e;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/porting/jcu_pl.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,335 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/*******************************************************************************
+* $FileName: jcu_pl.c $
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-02-26 13:18:53 +0900#$
+* Description : JCU driver porting layer
+******************************************************************************/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#include "iodefine.h"
+#include "r_jcu_api.h"
+#include "r_jcu_pl.h"
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+typedef struct st_jcu_pl_t jcu_pl_t;
+
+/*[jcu_pl_t]*/
+struct st_jcu_pl_t {
+ const r_ospl_caller_t *InterruptCallbackCaller;
+ const jcu_async_status_t *Status;
+};
+
+/*[gs_jcu_pl]*/
+static jcu_pl_t gs_jcu_pl
+;
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+enum { JCU_INT_PRI = 2 };
+#define CPG_JCU_CLOCK_POWER_OFF 0x00000002u
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+static void JCU_IRQ_JEDI_Handler(void);
+static void JCU_IRQ_JDTI_Handler(void);
+
+/*[gs_jedi_interrupt_context] JEDI interrupt context */
+/*[gs_jdti_interrupt_context] JDTI interrupt context */
+static const r_ospl_interrupt_t gs_jedi_interrupt_context = { BSP_INT_SRC_JEDI, 0 };
+static const r_ospl_interrupt_t gs_jdti_interrupt_context = { BSP_INT_SRC_JDTI, 0 };
+
+
+/**************************************************************************//**
+* Function Name: [R_JCU_SetDefaultAsync]
+* @retval None
+******************************************************************************/
+void R_JCU_SetDefaultAsync( r_ospl_async_t *const Async, r_ospl_async_type_t AsyncType )
+{
+ IF_DQ( Async == NULL ) {
+ goto fin;
+ }
+
+ if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_A_Thread ) ) {
+ Async->A_Thread = NULL;
+ }
+
+ if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_A_EventValue ) ) {
+ if ( AsyncType == R_OSPL_ASYNC_TYPE_NORMAL ) {
+ Async->A_EventValue = R_OSPL_A_FLAG;
+ } else {
+ Async->A_EventValue = R_OSPL_FINAL_A_FLAG;
+ }
+ } else {
+ ASSERT_D( IS_BIT_SET( Async->Flags, R_F_OSPL_A_Thread ), R_NOOP() );
+ }
+
+ if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_I_Thread ) ) {
+ Async->I_Thread = NULL;
+ }
+
+ if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_I_EventValue ) ) {
+ Async->I_EventValue = R_OSPL_I_FLAG;
+ } else {
+ ASSERT_D( IS_BIT_SET( Async->Flags, R_F_OSPL_I_Thread ), R_NOOP() );
+ }
+
+ if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_InterruptCallback ) ) {
+ Async->InterruptCallback = &( R_JCU_OnInterruptDefault ); /* MISRA 16.9 */
+ }
+
+ Async->Flags = R_F_OSPL_A_Thread | R_F_OSPL_A_EventValue |
+ R_F_OSPL_I_Thread | R_F_OSPL_I_EventValue |
+ R_F_OSPL_InterruptCallback | R_F_OSPL_Delegate;
+fin:
+ return;
+}
+
+
+/**************************************************************************//**
+* Function Name: [R_JCU_OnInitialize]
+* @retval Error code, 0=No error
+******************************************************************************/
+errnum_t R_JCU_OnInitialize(void)
+{
+ errnum_t e;
+ bsp_int_err_t eb;
+ bsp_int_src_t const num_of_JEDI_IRQ = gs_jedi_interrupt_context.IRQ_Num;
+ bsp_int_src_t const num_of_JDTI_IRQ = gs_jdti_interrupt_context.IRQ_Num;
+ jcu_pl_t *const self = &gs_jcu_pl;
+
+ self->InterruptCallbackCaller = NULL;
+ self->Status = NULL;
+
+
+ /* Register "JEDI" */
+ eb= R_BSP_InterruptWrite( num_of_JEDI_IRQ, &( JCU_IRQ_JEDI_Handler ) ); /* MISRA 16.9 */
+ IF ( eb != 0 ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ e= R_OSPL_SetInterruptPriority( num_of_JEDI_IRQ, JCU_INT_PRI );
+ IF ( e != 0 ) {
+ goto fin;
+ }
+
+
+ /* Register "JDTI" */
+ eb= R_BSP_InterruptWrite( num_of_JDTI_IRQ, &( JCU_IRQ_JDTI_Handler ) ); /* MISRA 16.9 */
+ IF ( eb != 0 ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ e= R_OSPL_SetInterruptPriority( num_of_JDTI_IRQ, JCU_INT_PRI );
+ IF ( e != 0 ) {
+ goto fin;
+ }
+
+
+ /* start to suuply the clock for JCU */
+ { /* ->QAC 0306 */
+ uint32_t cpg_reg;
+ cpg_reg = (uint32_t)(CPG.STBCR6) & ~CPG_JCU_CLOCK_POWER_OFF;
+ CPG.STBCR6 =(uint8_t)cpg_reg;
+ } /* <-QAC 0306 */
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/**************************************************************************//**
+* Function Name: [R_JCU_OnFinalize]
+* @retval Error code, 0=No error and e=0
+******************************************************************************/
+/* ->QAC 3227 : "e" is usually changed in finalize function. */
+errnum_t R_JCU_OnFinalize( errnum_t e )
+/* <-QAC 3227 */
+{
+ /* stop to suuply the clock for JCU */
+ { /* ->QAC 0306 */
+ uint32_t cpg_reg;
+ cpg_reg = (uint32_t)(CPG.STBCR6) | CPG_JCU_CLOCK_POWER_OFF;
+ CPG.STBCR6 = (uint8_t)cpg_reg;
+ } /* <-QAC 0306 */
+
+ return e;
+}
+
+
+/******************************************************************************
+* Function Name: [R_JCU_SetInterruptCallbackCaller]
+* @retval Error code, 0=No error
+******************************************************************************/
+errnum_t R_JCU_SetInterruptCallbackCaller( const r_ospl_caller_t *const Caller )
+{
+ jcu_pl_t *const self = &gs_jcu_pl;
+
+ self->InterruptCallbackCaller = Caller;
+
+ return 0;
+}
+
+
+/******************************************************************************
+* Function Name: [R_JCU_OnEnableInterrupt]
+* @retval None
+******************************************************************************/
+void R_JCU_OnEnableInterrupt( jcu_interrupt_lines_t const Enables )
+{
+ bsp_int_err_t eb;
+
+ if ( IS_BIT_SET( Enables, JCU_INTERRUPT_LINE_JEDI ) ) {
+ bsp_int_src_t const num_of_IRQ = gs_jedi_interrupt_context.IRQ_Num;
+
+ eb= R_BSP_InterruptControl( num_of_IRQ, BSP_INT_CMD_INTERRUPT_ENABLE, FIT_NO_PTR );
+ ASSERT_D( eb == 0, R_NOOP() );
+ R_UNREFERENCED_VARIABLE( eb ); /* for Release configuration */
+ }
+
+ if ( IS_BIT_SET( Enables, JCU_INTERRUPT_LINE_JDTI ) ) {
+ bsp_int_src_t const num_of_IRQ = gs_jdti_interrupt_context.IRQ_Num;
+
+ eb= R_BSP_InterruptControl( num_of_IRQ, BSP_INT_CMD_INTERRUPT_ENABLE, FIT_NO_PTR );
+ ASSERT_D( eb == 0, R_NOOP() );
+ R_UNREFERENCED_VARIABLE( eb ); /* for Release configuration */
+ }
+}
+
+
+/******************************************************************************
+* Function Name: [R_JCU_OnDisableInterrupt]
+* @retval None
+******************************************************************************/
+void R_JCU_OnDisableInterrupt( jcu_interrupt_lines_t const Disables1 )
+{
+ bsp_int_err_t eb;
+
+ if ( IS_BIT_SET( Disables1, JCU_INTERRUPT_LINE_JEDI ) ) {
+ bsp_int_src_t const num_of_IRQ = gs_jedi_interrupt_context.IRQ_Num;
+
+ eb= R_BSP_InterruptControl( num_of_IRQ, BSP_INT_CMD_INTERRUPT_DISABLE, FIT_NO_PTR );
+ ASSERT_D( eb == 0, R_NOOP() );
+ R_UNREFERENCED_VARIABLE( eb ); /* for Release configuration */
+ }
+
+ if ( IS_BIT_SET( Disables1, JCU_INTERRUPT_LINE_JDTI ) ) {
+ bsp_int_src_t const num_of_IRQ = gs_jdti_interrupt_context.IRQ_Num;
+
+ eb= R_BSP_InterruptControl( num_of_IRQ, BSP_INT_CMD_INTERRUPT_DISABLE, FIT_NO_PTR );
+ ASSERT_D( eb == 0, R_NOOP() );
+ R_UNREFERENCED_VARIABLE( eb ); /* for Release configuration */
+ }
+}
+
+
+/******************************************************************************
+* Function Name: [R_JCU_OnInterruptDefault]
+* @retval Error code, 0=No error
+******************************************************************************/
+errnum_t R_JCU_OnInterruptDefault( const r_ospl_interrupt_t *const InterruptSource,
+ const r_ospl_caller_t *const Caller )
+{
+ errnum_t e;
+ errnum_t ee;
+ r_ospl_async_t *async;
+
+ e = 0;
+ R_AVOID_UNSAFE_ALWAYS_WARNING( e );
+
+ IF_DQ( Caller == NULL ) {
+ goto fin;
+ }
+
+ ee= R_JCU_OnInterrupting( InterruptSource );
+ IF ( (ee != 0) && (e == 0) ) {
+ e = ee;
+ }
+
+ async = Caller->Async;
+
+ if ( async->I_Thread == NULL ) {
+ ee= R_JCU_OnInterrupted();
+ IF ( (ee != 0) && (e == 0) ) {
+ e = ee;
+ }
+ } else {
+ R_OSPL_EVENT_Set( async->I_Thread, async->I_EventValue );
+ }
+
+fin:
+ return e;
+}
+
+
+/**************************************************************************//**
+* Function Name: [JCU_IRQ_JEDI_Handler]
+* @brief JEDI (JCU Encode Decode Interrupt) interrupt handler
+* @retval None
+******************************************************************************/
+static void JCU_IRQ_JEDI_Handler(void)
+{
+ jcu_pl_t *const self = &gs_jcu_pl;
+ const r_ospl_interrupt_t *const i_context = &gs_jedi_interrupt_context;
+
+ R_OSPL_CallInterruptCallback( self->InterruptCallbackCaller, i_context );
+ GIC_EndInterrupt( BSP_INT_SRC_JEDI );
+}
+
+
+/**************************************************************************//**
+* Function Name: [JCU_IRQ_JDTI_Handler]
+* @brief JDTI (JCU Data Transfer Interrupt) interrupt handler
+* @retval None
+******************************************************************************/
+static void JCU_IRQ_JDTI_Handler(void)
+{
+ jcu_pl_t *const self = &gs_jcu_pl;
+ const r_ospl_interrupt_t *const i_context = &gs_jdti_interrupt_context;
+
+ R_OSPL_CallInterruptCallback( self->InterruptCallbackCaller, i_context );
+ GIC_EndInterrupt( BSP_INT_SRC_JDTI );
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jcu/userdef/jcu_user.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,118 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/*******************************************************************************
+* $FileName: jcu_user.c $
+* $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-02-26 13:18:53 +0900#$
+* Description : JCU driver porting layer
+******************************************************************************/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#include "iodefine.h"
+#include "r_jcu_api.h"
+#ifndef R_OSPL_NDEBUG
+#include <stdio.h>
+#endif
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+
+/**************************************************************************//**
+* Function Name: [R_JCU_PrintRegisters]
+* @brief
+* @retval None
+******************************************************************************/
+#ifndef R_OSPL_NDEBUG
+void R_JCU_PrintRegisters()
+{
+ printf( "\n" );
+ printf( "JCU Registers\n" );
+ printf( "JCMOD = 0x%02X\n", JCU.JCMOD );
+ printf( "JCCMD = 0x%02X\n", JCU.JCCMD );
+ printf( "JCQTN = 0x%02X\n", JCU.JCQTN );
+ printf( "JCHTN = 0x%02X\n", JCU.JCHTN );
+ printf( "JCDRIU = 0x%02X\n", JCU.JCDRIU );
+ printf( "JCDRID = 0x%02X\n", JCU.JCDRID );
+ printf( "JCVSZU = 0x%02X\n", JCU.JCVSZU );
+ printf( "JCVSZD = 0x%02X\n", JCU.JCVSZD );
+ printf( "JCHSZU = 0x%02X\n", JCU.JCHSZU );
+ printf( "JCHSZD = 0x%02X\n", JCU.JCHSZD );
+ printf( "JCDTCU = 0x%02X\n", JCU.JCDTCU );
+ printf( "JCDTCM = 0x%02X\n", JCU.JCDTCM );
+ printf( "JCDTCD = 0x%02X\n", JCU.JCDTCD );
+ printf( "JINTE0 = 0x%02X\n", JCU.JINTE0 );
+ printf( "JINTS0 = 0x%02X\n", JCU.JINTS0 );
+ printf( "JCDERR = 0x%02X\n", JCU.JCDERR );
+ printf( "JCRST = 0x%02X\n", JCU.JCRST );
+ printf( "JIFECNT = 0x%08X\n", (uint_fast32_t) JCU.JIFECNT );
+ /* Cast is for avoiding "format" warning of GCC_ARM */
+ printf( "JIFESA = 0x%08X\n", (uint_fast32_t) JCU.JIFESA );
+ printf( "JIFESOFST = 0x%08X\n", (uint_fast32_t) JCU.JIFESOFST );
+ printf( "JIFEDA = 0x%08X\n", (uint_fast32_t) JCU.JIFEDA );
+ printf( "JIFESLC = 0x%08X\n", (uint_fast32_t) JCU.JIFESLC );
+ printf( "JIFEDDC = 0x%08X\n", (uint_fast32_t) JCU.JIFEDDC );
+ printf( "JIFDCNT = 0x%08X\n", (uint_fast32_t) JCU.JIFDCNT );
+ printf( "JIFDSA = 0x%08X\n", (uint_fast32_t) JCU.JIFDSA );
+ printf( "JIFDDOFST = 0x%08X\n", (uint_fast32_t) JCU.JIFDDOFST );
+ printf( "JIFDDA = 0x%08X\n", (uint_fast32_t) JCU.JIFDDA );
+ printf( "JIFDSDC = 0x%08X\n", (uint_fast32_t) JCU.JIFDSDC );
+ printf( "JIFDDLC = 0x%08X\n", (uint_fast32_t) JCU.JIFDDLC );
+ printf( "JIFDADT = 0x%08X\n", (uint_fast32_t) JCU.JIFDADT );
+ printf( "JINTE1 = 0x%08X\n", (uint_fast32_t) JCU.JINTE1 );
+ printf( "JINTS1 = 0x%08X\n", (uint_fast32_t) JCU.JINTS1 );
+ printf( "JIFESVSZ = 0x%08X\n", (uint_fast32_t) JCU.JIFESVSZ );
+ printf( "JIFESHSZ = 0x%08X\n", (uint_fast32_t) JCU.JIFESHSZ );
+ printf( "JCQTBL0[0] = 0x%02X\n", (uint_fast32_t) JCU.JCQTBL0 );
+ printf( "JCQTBL1[0] = 0x%02X\n", (uint_fast32_t) JCU.JCQTBL1 );
+ printf( "JCQTBL2[0] = 0x%02X\n", (uint_fast32_t) JCU.JCQTBL2 );
+ printf( "JCQTBL3[0] = 0x%02X\n", (uint_fast32_t) JCU.JCQTBL3 );
+ printf( "JCHTBD0[0] = 0x%02X\n", (uint_fast32_t) JCU.JCHTBD0 );
+ printf( "JCHTBA0[0] = 0x%02X\n", (uint_fast32_t) JCU.JCHTBA0 );
+ printf( "JCHTBD1[0] = 0x%02X\n", (uint_fast32_t) JCU.JCHTBD1 );
+ printf( "JCHTBA1[0] = 0x%02X\n", (uint_fast32_t) JCU.JCHTBA1 );
+}
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/cpu.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,92 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file cpu.h
+* @brief CPU related FIT BSP.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef CPU_H
+#define CPU_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+/* In "cpu_typedef.h" */
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/* In "cpu_typedef.h" */
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+/* In "cpu_typedef.h" */
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/**
+* @brief Globally enables interrupts.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+void R_BSP_InterruptsEnable(void);
+
+
+/**
+* @brief Globally disables interrupts.
+*
+* @par Parameters
+* None
+* @return None.
+*/
+void R_BSP_InterruptsDisable(void);
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CPU_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/locking.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,115 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file locking.h
+* @brief Lock related FIT BSP. Functions.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef LOCKING_H
+#define LOCKING_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "Project_Config.h"
+#if BSP_CFG_USER_LOCKING_ENABLED
+#include "locking_user.h"
+#endif
+#include "r_typedefs.h"
+#include "locking_typedef.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+/* In "locking_typedef.h" */
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/* In "locking_typedef.h" */
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+/* In "locking_typedef.h" */
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+
+/**
+* @brief Attempts to reserve a hardware peripheral lock.
+*
+* @param HardwareIndex Index of lock to acquire from the hardware lock array.
+* @return true = Successful, false = Failure
+*/
+bool_t R_BSP_HardwareLock( mcu_lock_t const HardwareIndex );
+
+
+/**
+* @brief Releases a hardware peripheral lock.
+*
+* @param HardwareIndex Index of lock to release from the hardware lock array.
+* @return true = Successful, false = Failure
+*/
+bool_t R_BSP_HardwareUnlock( mcu_lock_t const HardwareIndex );
+
+
+/**
+* @brief Attempts to reserve a lock.
+*
+* @param LockObject Pointer to lock structure with lock to try and acquire.
+* @return true = Successful, false = Failure
+*/
+bool_t R_BSP_SoftwareLock( BSP_CFG_USER_LOCKING_TYPE *const LockObject );
+
+
+/**
+* @brief Releases a lock.
+*
+* @param LockObject Pointer to lock structure with lock to release.
+* @return true = Successful, false = Failure
+*/
+bool_t R_BSP_SoftwareUnlock( BSP_CFG_USER_LOCKING_TYPE *const LockObject );
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* LOCKING_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/locking_typedef.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,194 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file locking_typedef.h
+* @brief Lock related FIT BSP. Data types.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 38 $
+* $Date:: 2014-05-15 16:39:09 +0900#$
+*/
+
+#ifndef LOCKING_TYPEDEF_H
+#define LOCKING_TYPEDEF_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "Project_Config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @struct r_ospl_c_lock_t
+* @brief C-lock
+*/
+typedef struct st_r_ospl_c_lock_t r_ospl_c_lock_t;
+struct st_r_ospl_c_lock_t {
+
+ /** IsLocked */
+ volatile bool_t IsLocked;
+};
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def BSP_CFG_USER_LOCKING_TYPE
+* @brief C-lock (FIT BSP portable)
+* @par Parameters
+* None
+* @return None.
+*/
+#if ! BSP_CFG_USER_LOCKING_ENABLED
+#define BSP_CFG_USER_LOCKING_TYPE r_ospl_c_lock_t
+#endif
+
+
+/**
+* @enum mcu_lock_t
+* @brief Hardware channel number for locking
+*
+* : BSP_LOCK_ADC
+* @par :
+*/
+typedef enum {
+ BSP_LOCK_ADC,
+ BSP_LOCK_BSC,
+ BSP_LOCK_CEU,
+ BSP_LOCK_CPG,
+ BSP_LOCK_DISC0,
+ BSP_LOCK_DISC1,
+ BSP_LOCK_DMAC0,
+ BSP_LOCK_DMAC1,
+ BSP_LOCK_DMAC2,
+ BSP_LOCK_DMAC3,
+ BSP_LOCK_DMAC4,
+ BSP_LOCK_DMAC5,
+ BSP_LOCK_DMAC6,
+ BSP_LOCK_DMAC7,
+ BSP_LOCK_DMAC8,
+ BSP_LOCK_DMAC9,
+ BSP_LOCK_DMAC10,
+ BSP_LOCK_DMAC11,
+ BSP_LOCK_DMAC12,
+ BSP_LOCK_DMAC13,
+ BSP_LOCK_DMAC14,
+ BSP_LOCK_DMAC15,
+ BSP_LOCK_DVDEC0,
+ BSP_LOCK_DVDEC1,
+ BSP_LOCK_ETHER,
+ BSP_LOCK_FLCTL,
+ BSP_LOCK_GPIO,
+ BSP_LOCK_IEB,
+ BSP_LOCK_INB,
+ BSP_LOCK_INTC,
+ BSP_LOCK_IRDA,
+ BSP_LOCK_JCU,
+ BSP_LOCK_I2C,
+ BSP_LOCK_LIN0,
+ BSP_LOCK_LIN1,
+ BSP_LOCK_LVDS,
+ BSP_LOCK_MLB,
+ BSP_LOCK_MMC,
+ BSP_LOCK_MTU2,
+ BSP_LOCK_OSTM0,
+ BSP_LOCK_OSTM1,
+ BSP_LOCK_PFV0,
+ BSP_LOCK_PFV1,
+ BSP_LOCK_PWM,
+ BSP_LOCK_RIIC0,
+ BSP_LOCK_RIIC1,
+ BSP_LOCK_RIIC2,
+ BSP_LOCK_RIIC3,
+ BSP_LOCK_ROMDEC,
+ BSP_LOCK_RSCAN0,
+ BSP_LOCK_RSPI0,
+ BSP_LOCK_RSPI1,
+ BSP_LOCK_RSPI2,
+ BSP_LOCK_RSPI3,
+ BSP_LOCK_RSPI4,
+ BSP_LOCK_RTC,
+ BSP_LOCK_SCIF0,
+ BSP_LOCK_SCIF1,
+ BSP_LOCK_SCIF2,
+ BSP_LOCK_SCIF3,
+ BSP_LOCK_SCIF4,
+ BSP_LOCK_SCIF5,
+ BSP_LOCK_SCIF6,
+ BSP_LOCK_SCIF7,
+ BSP_LOCK_SCIM0,
+ BSP_LOCK_SCIM1,
+ BSP_LOCK_SCUX,
+ BSP_LOCK_SDG0,
+ BSP_LOCK_SDG1,
+ BSP_LOCK_SDG2,
+ BSP_LOCK_SDG3,
+ BSP_LOCK_SPDIF,
+ BSP_LOCK_SPIBSC0,
+ BSP_LOCK_SPIBSC1,
+ BSP_LOCK_SSIF0,
+ BSP_LOCK_SSIF1,
+ BSP_LOCK_SSIF2,
+ BSP_LOCK_SSIF3,
+ BSP_LOCK_SSIF4,
+ BSP_LOCK_SSIF5,
+ BSP_LOCK_USB200,
+ BSP_LOCK_USB201,
+ BSP_LOCK_VDC50,
+ BSP_LOCK_VDC51,
+ BSP_LOCK_WDT,
+ BSP_NUM_LOCKS /* This entry is not a valid lock. It is used for sizing
+ g_bsp_Locks[] array below. Do not touch! */
+} mcu_lock_t;
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+/* In "mcu_interrupts.h" */
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* LOCKING_TYPEDEF_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/locking_user.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,211 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file locking_user.h
+* @brief Lock related FIT BSP. User defined.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef LOCKING_USER_H
+#define LOCKING_USER_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_typedefs.h"
+#include "locking_typedef.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @struct r_ospl_user_lock_t
+* @brief Example of user defined lock type
+*/
+typedef struct st_r_ospl_user_lock_t r_ospl_user_lock_t;
+struct st_r_ospl_user_lock_t {
+ int UserLockMember;
+};
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def BSP_CFG_USER_LOCKING_TYPE
+* @brief C-lock (FIT BSP portable)
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* This is enabled, when "BSP_CFG_USER_LOCKING_ENABLED == 1".
+*/
+#define BSP_CFG_USER_LOCKING_TYPE r_ospl_user_lock_t
+
+
+/**
+* @def BSP_CFG_USER_LOCKING_SW_LOCK_FUNCTION
+* @brief Start C-lock for software module
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* This is enabled, when "BSP_CFG_USER_LOCKING_ENABLED == 1".
+*/
+#define BSP_CFG_USER_LOCKING_SW_LOCK_FUNCTION R_OSPL_USER_LOCK_SoftwareLock
+
+
+/**
+* @def BSP_CFG_USER_LOCKING_SW_UNLOCK_FUNCTION
+* @brief End C-lock for software module
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* This is enabled, when "BSP_CFG_USER_LOCKING_ENABLED == 1".
+*/
+#define BSP_CFG_USER_LOCKING_SW_UNLOCK_FUNCTION R_OSPL_USER_LOCK_SoftwareUnlock
+
+
+/**
+* @def BSP_CFG_USER_LOCKING_HW_LOCK_FUNCTION
+* @brief Start C-lock for hardware module
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* This is enabled, when "BSP_CFG_USER_LOCKING_ENABLED == 1".
+*/
+#define BSP_CFG_USER_LOCKING_HW_LOCK_FUNCTION R_OSPL_USER_LOCK_HardwareLock
+
+
+/**
+* @def BSP_CFG_USER_LOCKING_HW_UNLOCK_FUNCTION
+* @brief End C-lock for hardware module
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* This is enabled, when "BSP_CFG_USER_LOCKING_ENABLED == 1".
+*/
+#define BSP_CFG_USER_LOCKING_HW_UNLOCK_FUNCTION R_OSPL_USER_LOCK_HardwareUnlock
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/**
+* @brief Example of BSP_CFG_USER_LOCKING_SW_LOCK_FUNCTION
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#if BSP_CFG_USER_LOCKING_ENABLED == 1
+bool_t R_OSPL_USER_LOCK_SoftwareLock( r_ospl_user_lock_t *LockObject );
+#endif
+
+
+/**
+* @brief Example of BSP_CFG_USER_LOCKING_SW_UNLOCK_FUNCTION
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#if BSP_CFG_USER_LOCKING_ENABLED == 1
+bool_t R_OSPL_USER_LOCK_SoftwareUnlock( r_ospl_user_lock_t *LockObject );
+#endif
+
+
+/**
+* @brief Example of BSP_CFG_USER_LOCKING_HW_LOCK_FUNCTION
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#if BSP_CFG_USER_LOCKING_ENABLED == 1
+bool_t R_OSPL_USER_LOCK_HardwareLock( mcu_lock_t HardwareIndex );
+#endif
+
+
+/**
+* @brief Example of BSP_CFG_USER_LOCKING_HW_UNLOCK_FUNCTION
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#if BSP_CFG_USER_LOCKING_ENABLED == 1
+bool_t R_OSPL_USER_LOCK_HardwareUnlock( mcu_lock_t HardwareIndex );
+#endif
+
+
+/**
+* @brief For Test
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#if BSP_CFG_USER_LOCKING_ENABLED == 1
+r_ospl_user_lock_t *R_OSPL_GetHardwareLockObjectForTest( mcu_lock_t HardwareIndex );
+#endif
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* LOCKING_USER_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/mcu_interrupts.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,106 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file mcu_interrupts.h
+* @brief Interrupt related FIT BSP. Functions.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef MCU_INTERRUPTS_H
+#define MCU_INTERRUPTS_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "Project_Config.h"
+#include "mcu_interrupts_typedef.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+/* In "mcu_interrupts_typedef.h" */
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/* In "mcu_interrupts_typedef.h" */
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+/* In "mcu_interrupts_typedef.h" */
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/**
+* @brief Registers a interrupt handler
+*
+* @param IRQ_Num Interrupt request number
+* @param Callback The function as interrupt handler
+* @return Error code. If there is no error, the return value is BSP_INT_SUCCESS.
+*/
+bsp_int_err_t R_BSP_InterruptWrite( bsp_int_src_t const IRQ_Num, bsp_int_cb_t const Callback );
+
+
+/**
+* @brief Returns registered interrupt handler
+*
+* @param IRQ_Num Interrupt request number
+* @param out_Callback Output: the function as interrupt handler
+* @return Error code. If there is no error, the return value is BSP_INT_SUCCESS.
+*/
+bsp_int_err_t R_BSP_InterruptRead( bsp_int_src_t const IRQ_Num, bsp_int_cb_t *const out_Callback );
+
+
+/**
+* @brief Controls related to the interrupt
+*
+* @param IRQ_Num Interrupt request number
+* @param Command Control command. See <bsp_int_cmd_t>
+* @param NotUsed Depend on "Command" argument
+* @return Error code. If there is no error, the return value is BSP_INT_SUCCESS.
+*/
+bsp_int_err_t R_BSP_InterruptControl( bsp_int_src_t const IRQ_Num, bsp_int_cmd_t const Command,
+ void *const NotUsed );
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* MCU_INTERRUPTS_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/mcu_interrupts_typedef.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,657 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file mcu_interrupts_typedef.h
+* @brief Interrupt related FIT BSP. Data types.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef MCU_INTERRUPTS_TYPEDEF_H
+#define MCU_INTERRUPTS_TYPEDEF_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_typedefs.h"
+#include "r_multi_compiler_typedef.h"
+#if IS_MBED_USED
+#include "MBRZA1H.h"
+#else
+#include "Renesas_RZ_A1.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @enum bsp_int_err_t
+* @brief Error code defined by FIT BSP.
+*
+* - BSP_INT_SUCCESS - 0
+* - BSP_INT_ERR_NO_REGISTERED_CALLBACK - 0x2101
+* - BSP_INT_ERR_INVALID_ARG - 1
+* - BSP_INT_ERR_UNSUPPORTED - 15
+*/
+typedef enum {
+ BSP_INT_SUCCESS = 0,
+ BSP_INT_ERR_NO_REGISTERED_CALLBACK = 0x2101,
+ BSP_INT_ERR_INVALID_ARG = 1,
+ BSP_INT_ERR_UNSUPPORTED = 15
+}
+ bsp_int_err_t;
+
+
+/**
+* @brief Interrupt Handler
+*
+* @param int_sense uint32_t
+* @return None
+*/
+typedef void (* bsp_int_cb_t )(void);
+
+
+/**
+* @enum bsp_int_cmd_t
+* @brief Control command related to the interrupt.
+*
+* - BSP_INT_CMD_INTERRUPT_ENABLE - 0
+* - BSP_INT_CMD_INTERRUPT_DISABLE - 1
+*/
+typedef enum {
+ BSP_INT_CMD_INTERRUPT_ENABLE,
+ BSP_INT_CMD_INTERRUPT_DISABLE
+} bsp_int_cmd_t;
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def FIT_NO_PTR
+* @brief None as pointer type
+*/
+#define FIT_NO_PTR ( (void*) 0 )
+
+
+/**
+* @def FIT_NO_FUNC
+* @brief None as function pointer type
+*/
+#define FIT_NO_FUNC ( (void*) 0 )
+
+
+/**
+* @enum bsp_int_src_t
+* @brief Interrupt number.
+*/
+typedef IRQn_Type bsp_int_src_t;
+#define BSP_INT_SRC_SW0 ((IRQn_Type)(0)) /* GIC software interrupt */
+#define BSP_INT_SRC_SW1 ((IRQn_Type)(1)) /* */
+#define BSP_INT_SRC_SW2 ((IRQn_Type)(2)) /* */
+#define BSP_INT_SRC_SW3 ((IRQn_Type)(3)) /* */
+#define BSP_INT_SRC_SW4 ((IRQn_Type)(4)) /* */
+#define BSP_INT_SRC_SW5 ((IRQn_Type)(5)) /* */
+#define BSP_INT_SRC_SW6 ((IRQn_Type)(6)) /* */
+#define BSP_INT_SRC_SW7 ((IRQn_Type)(7)) /* */
+#define BSP_INT_SRC_SW8 ((IRQn_Type)(8)) /* */
+#define BSP_INT_SRC_SW9 ((IRQn_Type)(9)) /* */
+#define BSP_INT_SRC_SW10 ((IRQn_Type)(10)) /* */
+#define BSP_INT_SRC_SW11 ((IRQn_Type)(11)) /* */
+#define BSP_INT_SRC_SW12 ((IRQn_Type)(12)) /* */
+#define BSP_INT_SRC_SW13 ((IRQn_Type)(13)) /* */
+#define BSP_INT_SRC_SW14 ((IRQn_Type)(14)) /* */
+#define BSP_INT_SRC_SW15 ((IRQn_Type)(15)) /* */
+#define BSP_INT_SRC_PMUIRQ0 ((IRQn_Type)(16)) /* CPU */
+#define BSP_INT_SRC_COMMRX0 ((IRQn_Type)(17)) /* */
+#define BSP_INT_SRC_COMMTX0 ((IRQn_Type)(18)) /* */
+#define BSP_INT_SRC_CTIIRQ0 ((IRQn_Type)(19)) /* */
+#define BSP_INT_SRC_IRQ0 ((IRQn_Type)(32)) /* IRQ */
+#define BSP_INT_SRC_IRQ1 ((IRQn_Type)(33)) /* */
+#define BSP_INT_SRC_IRQ2 ((IRQn_Type)(34)) /* */
+#define BSP_INT_SRC_IRQ3 ((IRQn_Type)(35)) /* */
+#define BSP_INT_SRC_IRQ4 ((IRQn_Type)(36)) /* */
+#define BSP_INT_SRC_IRQ5 ((IRQn_Type)(37)) /* */
+#define BSP_INT_SRC_IRQ6 ((IRQn_Type)(38)) /* */
+#define BSP_INT_SRC_IRQ7 ((IRQn_Type)(39)) /* */
+#define BSP_INT_SRC_PL310ERR ((IRQn_Type)(40)) /* Level 2 cache */
+#define BSP_INT_SRC_DMAINT0 ((IRQn_Type)(41)) /* Direct memory access controller */
+#define BSP_INT_SRC_DMAINT1 ((IRQn_Type)(42)) /* */
+#define BSP_INT_SRC_DMAINT2 ((IRQn_Type)(43)) /* */
+#define BSP_INT_SRC_DMAINT3 ((IRQn_Type)(44)) /* */
+#define BSP_INT_SRC_DMAINT4 ((IRQn_Type)(45)) /* */
+#define BSP_INT_SRC_DMAINT5 ((IRQn_Type)(46)) /* */
+#define BSP_INT_SRC_DMAINT6 ((IRQn_Type)(47)) /* */
+#define BSP_INT_SRC_DMAINT7 ((IRQn_Type)(48)) /* */
+#define BSP_INT_SRC_DMAINT8 ((IRQn_Type)(49)) /* */
+#define BSP_INT_SRC_DMAINT9 ((IRQn_Type)(50)) /* */
+#define BSP_INT_SRC_DMAINT10 ((IRQn_Type)(51)) /* */
+#define BSP_INT_SRC_DMAINT11 ((IRQn_Type)(52)) /* */
+#define BSP_INT_SRC_DMAINT12 ((IRQn_Type)(53)) /* */
+#define BSP_INT_SRC_DMAINT13 ((IRQn_Type)(54)) /* */
+#define BSP_INT_SRC_DMAINT14 ((IRQn_Type)(55)) /* */
+#define BSP_INT_SRC_DMAINT15 ((IRQn_Type)(56)) /* */
+#define BSP_INT_SRC_DMAERR ((IRQn_Type)(57)) /* */
+#define BSP_INT_SRC_USBI0 ((IRQn_Type)(73)) /* USB 2.0 host/function module */
+#define BSP_INT_SRC_USBI1 ((IRQn_Type)(74)) /* */
+#define BSP_INT_SRC_S0_VI_VSYNC0 ((IRQn_Type)(75)) /* Video display controller 5 */
+#define BSP_INT_SRC_S0_LO_VSYNC0 ((IRQn_Type)(76)) /* */
+#define BSP_INT_SRC_S0_VSYNCERR0 ((IRQn_Type)(77)) /* */
+#define BSP_INT_SRC_GR3_VLINE0 ((IRQn_Type)(78)) /* */
+#define BSP_INT_SRC_S0_VFIELD0 ((IRQn_Type)(79)) /* */
+#define BSP_INT_SRC_IV1_VBUFERR0 ((IRQn_Type)(80)) /* */
+#define BSP_INT_SRC_IV3_VBUFERR0 ((IRQn_Type)(81)) /* */
+#define BSP_INT_SRC_IV5_VBUFERR0 ((IRQn_Type)(82)) /* */
+#define BSP_INT_SRC_IV6_VBUFERR0 ((IRQn_Type)(83)) /* */
+#define BSP_INT_SRC_S0_WLINE0 ((IRQn_Type)(84)) /* */
+#define BSP_INT_SRC_S1_VI_VSYNC0 ((IRQn_Type)(85)) /* */
+#define BSP_INT_SRC_S1_LO_VSYNC0 ((IRQn_Type)(86)) /* */
+#define BSP_INT_SRC_S1_VSYNCERR0 ((IRQn_Type)(87)) /* */
+#define BSP_INT_SRC_S1_VFIELD0 ((IRQn_Type)(88)) /* */
+#define BSP_INT_SRC_IV2_VBUFERR0 ((IRQn_Type)(89)) /* */
+#define BSP_INT_SRC_IV4_VBUFERR0 ((IRQn_Type)(90)) /* */
+#define BSP_INT_SRC_S1_WLINE0 ((IRQn_Type)(91)) /* */
+#define BSP_INT_SRC_OIR_VI_VSYNC0 ((IRQn_Type)(92)) /* */
+#define BSP_INT_SRC_OIR_LO_VSYNC0 ((IRQn_Type)(93)) /* */
+#define BSP_INT_SRC_OIR_VSYNCERR0 ((IRQn_Type)(94)) /* */
+#define BSP_INT_SRC_OIR_VFIELD0 ((IRQn_Type)(95)) /* */
+#define BSP_INT_SRC_IV7_VBUFERR0 ((IRQn_Type)(96)) /* */
+#define BSP_INT_SRC_IV8_VBUFERR0 ((IRQn_Type)(97)) /* */
+#define BSP_INT_SRC_OIR_WLINE0 ((IRQn_Type)(98)) /* */
+#define BSP_INT_SRC_S0_VI_VSYNC1 ((IRQn_Type)(99)) /* */
+#define BSP_INT_SRC_S0_LO_VSYNC1 ((IRQn_Type)(100)) /* */
+#define BSP_INT_SRC_S0_VSYNCERR1 ((IRQn_Type)(101)) /* */
+#define BSP_INT_SRC_GR3_VLINE1 ((IRQn_Type)(102)) /* */
+#define BSP_INT_SRC_S0_VFIELD1 ((IRQn_Type)(103)) /* */
+#define BSP_INT_SRC_IV1_VBUFERR1 ((IRQn_Type)(104)) /* */
+#define BSP_INT_SRC_IV3_VBUFERR1 ((IRQn_Type)(105)) /* */
+#define BSP_INT_SRC_IV5_VBUFERR1 ((IRQn_Type)(106)) /* */
+#define BSP_INT_SRC_IV6_VBUFERR1 ((IRQn_Type)(107)) /* */
+#define BSP_INT_SRC_S0_WLINE1 ((IRQn_Type)(108)) /* */
+#define BSP_INT_SRC_S1_VI_VSYNC1 ((IRQn_Type)(109)) /* */
+#define BSP_INT_SRC_S1_LO_VSYNC1 ((IRQn_Type)(110)) /* */
+#define BSP_INT_SRC_S1_VSYNCERR1 ((IRQn_Type)(111)) /* */
+#define BSP_INT_SRC_S1_VFIELD1 ((IRQn_Type)(112)) /* */
+#define BSP_INT_SRC_IV2_VBUFERR1 ((IRQn_Type)(113)) /* */
+#define BSP_INT_SRC_IV4_VBUFERR1 ((IRQn_Type)(114)) /* */
+#define BSP_INT_SRC_S1_WLINE1 ((IRQn_Type)(115)) /* */
+#define BSP_INT_SRC_OIR_VI_VSYNC1 ((IRQn_Type)(116)) /* */
+#define BSP_INT_SRC_OIR_LO_VSYNC1 ((IRQn_Type)(117)) /* */
+#define BSP_INT_SRC_OIR_VLINE1 ((IRQn_Type)(118)) /* */
+#define BSP_INT_SRC_OIR_VFIELD1 ((IRQn_Type)(119)) /* */
+#define BSP_INT_SRC_IV7_VBUFERR1 ((IRQn_Type)(120)) /* */
+#define BSP_INT_SRC_IV8_VBUFERR1 ((IRQn_Type)(121)) /* */
+#define BSP_INT_SRC_OIR_WLINE1 ((IRQn_Type)(122)) /* */
+#define BSP_INT_SRC_IMRDI ((IRQn_Type)(123)) /* Image renderer */
+#define BSP_INT_SRC_IMR2I0 ((IRQn_Type)(124)) /* */
+#define BSP_INT_SRC_IMR2I1 ((IRQn_Type)(125)) /* */
+#define BSP_INT_SRC_JEDI ((IRQn_Type)(126)) /* JPEG Codec unit */
+#define BSP_INT_SRC_JDTI ((IRQn_Type)(127)) /* */
+#define BSP_INT_SRC_CMP0 ((IRQn_Type)(128)) /* Display out comparison unit */
+#define BSP_INT_SRC_CMP1 ((IRQn_Type)(129)) /* */
+#define BSP_INT_SRC_INT0 ((IRQn_Type)(130)) /* OpenVG-Compliant Renesas graphics processor */
+#define BSP_INT_SRC_INT1 ((IRQn_Type)(131)) /* */
+#define BSP_INT_SRC_INT2 ((IRQn_Type)(132)) /* */
+#define BSP_INT_SRC_INT3 ((IRQn_Type)(133)) /* */
+#define BSP_INT_SRC_OSTM0TINT ((IRQn_Type)(134)) /* OS timer */
+#define BSP_INT_SRC_OSTM1TINT ((IRQn_Type)(135)) /* */
+#define BSP_INT_SRC_CMI ((IRQn_Type)(136)) /* Bus state controller */
+#define BSP_INT_SRC_WTOUT ((IRQn_Type)(137)) /* */
+#define BSP_INT_SRC_ITI ((IRQn_Type)(138)) /* Watchdog timer */
+#define BSP_INT_SRC_TGI0A ((IRQn_Type)(139)) /* Multi-function timer pulse unit 2 */
+#define BSP_INT_SRC_TGI0B ((IRQn_Type)(140)) /* */
+#define BSP_INT_SRC_TGI0C ((IRQn_Type)(141)) /* */
+#define BSP_INT_SRC_TGI0D ((IRQn_Type)(142)) /* */
+#define BSP_INT_SRC_TGI0V ((IRQn_Type)(143)) /* */
+#define BSP_INT_SRC_TGI0E ((IRQn_Type)(144)) /* */
+#define BSP_INT_SRC_TGI0F ((IRQn_Type)(145)) /* */
+#define BSP_INT_SRC_TGI1A ((IRQn_Type)(146)) /* */
+#define BSP_INT_SRC_TGI1B ((IRQn_Type)(147)) /* */
+#define BSP_INT_SRC_TGI1V ((IRQn_Type)(148)) /* */
+#define BSP_INT_SRC_TGI1U ((IRQn_Type)(149)) /* */
+#define BSP_INT_SRC_TGI2A ((IRQn_Type)(150)) /* */
+#define BSP_INT_SRC_TGI2B ((IRQn_Type)(151)) /* */
+#define BSP_INT_SRC_TGI2V ((IRQn_Type)(152)) /* */
+#define BSP_INT_SRC_TGI2U ((IRQn_Type)(153)) /* */
+#define BSP_INT_SRC_TGI3A ((IRQn_Type)(154)) /* */
+#define BSP_INT_SRC_TGI3B ((IRQn_Type)(155)) /* */
+#define BSP_INT_SRC_TGI3C ((IRQn_Type)(156)) /* */
+#define BSP_INT_SRC_TGI3D ((IRQn_Type)(157)) /* */
+#define BSP_INT_SRC_TGI3V ((IRQn_Type)(158)) /* */
+#define BSP_INT_SRC_TGI4A ((IRQn_Type)(159)) /* */
+#define BSP_INT_SRC_TGI4B ((IRQn_Type)(160)) /* */
+#define BSP_INT_SRC_TGI4C ((IRQn_Type)(161)) /* */
+#define BSP_INT_SRC_TGI4D ((IRQn_Type)(162)) /* */
+#define BSP_INT_SRC_TGI4V ((IRQn_Type)(163)) /* */
+#define BSP_INT_SRC_CMI1 ((IRQn_Type)(164)) /* Motor control PWM timer */
+#define BSP_INT_SRC_CMI2 ((IRQn_Type)(165)) /* */
+#define BSP_INT_SRC_SGDEI0 ((IRQn_Type)(166)) /* Sound generator */
+#define BSP_INT_SRC_SGDEI1 ((IRQn_Type)(167)) /* */
+#define BSP_INT_SRC_SGDEI2 ((IRQn_Type)(168)) /* */
+#define BSP_INT_SRC_SGDEI3 ((IRQn_Type)(169)) /* */
+#define BSP_INT_SRC_ADI ((IRQn_Type)(170)) /* 12bit A/D converter */
+#define BSP_INT_SRC_LMTI ((IRQn_Type)(171)) /* */
+#define BSP_INT_SRC_SSII0 ((IRQn_Type)(172)) /* Serial sound interface */
+#define BSP_INT_SRC_SSIRXI0 ((IRQn_Type)(173)) /* */
+#define BSP_INT_SRC_SSITXI0 ((IRQn_Type)(174)) /* */
+#define BSP_INT_SRC_SSII1 ((IRQn_Type)(175)) /* */
+#define BSP_INT_SRC_SSIRXI1 ((IRQn_Type)(176)) /* */
+#define BSP_INT_SRC_SSITXI1 ((IRQn_Type)(177)) /* */
+#define BSP_INT_SRC_SSII2 ((IRQn_Type)(178)) /* */
+#define BSP_INT_SRC_SSIRTI2 ((IRQn_Type)(179)) /* */
+#define BSP_INT_SRC_SSII3 ((IRQn_Type)(180)) /* */
+#define BSP_INT_SRC_SSIRXI3 ((IRQn_Type)(181)) /* */
+#define BSP_INT_SRC_SSITXI3 ((IRQn_Type)(182)) /* */
+#define BSP_INT_SRC_SSII4 ((IRQn_Type)(183)) /* */
+#define BSP_INT_SRC_SSIRTI4 ((IRQn_Type)(184)) /* */
+#define BSP_INT_SRC_SSII5 ((IRQn_Type)(185)) /* */
+#define BSP_INT_SRC_SSIRXI5 ((IRQn_Type)(186)) /* */
+#define BSP_INT_SRC_SSITXI5 ((IRQn_Type)(187)) /* */
+#define BSP_INT_SRC_SPDIFI ((IRQn_Type)(188)) /* Renesas SPDIF interface */
+#define BSP_INT_SRC_INTIICTEI0 ((IRQn_Type)(189)) /* I2C interface */
+#define BSP_INT_SRC_INTIICRI0 ((IRQn_Type)(190)) /* */
+#define BSP_INT_SRC_INTIICTI0 ((IRQn_Type)(191)) /* */
+#define BSP_INT_SRC_INTIICSPI0 ((IRQn_Type)(192)) /* */
+#define BSP_INT_SRC_INTIICSTI0 ((IRQn_Type)(193)) /* */
+#define BSP_INT_SRC_INTIICNAKI0 ((IRQn_Type)(194)) /* */
+#define BSP_INT_SRC_INTIICALI0 ((IRQn_Type)(195)) /* */
+#define BSP_INT_SRC_INTIICTMOI0 ((IRQn_Type)(196)) /* */
+#define BSP_INT_SRC_INTIICTEI1 ((IRQn_Type)(197)) /* */
+#define BSP_INT_SRC_INTIICRI1 ((IRQn_Type)(198)) /* */
+#define BSP_INT_SRC_INTIICTI1 ((IRQn_Type)(199)) /* */
+#define BSP_INT_SRC_INTIICSPI1 ((IRQn_Type)(200)) /* */
+#define BSP_INT_SRC_INTIICSTI1 ((IRQn_Type)(201)) /* */
+#define BSP_INT_SRC_INTIICNAKI1 ((IRQn_Type)(202)) /* */
+#define BSP_INT_SRC_INTIICALI1 ((IRQn_Type)(203)) /* */
+#define BSP_INT_SRC_INTIICTMOI1 ((IRQn_Type)(204)) /* */
+#define BSP_INT_SRC_INTIICTEI2 ((IRQn_Type)(205)) /* */
+#define BSP_INT_SRC_INTIICRI2 ((IRQn_Type)(206)) /* */
+#define BSP_INT_SRC_INTIICTI2 ((IRQn_Type)(207)) /* */
+#define BSP_INT_SRC_INTIICSPI2 ((IRQn_Type)(208)) /* */
+#define BSP_INT_SRC_INTIICSTI2 ((IRQn_Type)(209)) /* */
+#define BSP_INT_SRC_INTIICNAKI2 ((IRQn_Type)(210)) /* */
+#define BSP_INT_SRC_INTIICALI2 ((IRQn_Type)(211)) /* */
+#define BSP_INT_SRC_INTIICTMOI2 ((IRQn_Type)(212)) /* */
+#define BSP_INT_SRC_INTIICTEI3 ((IRQn_Type)(213)) /* */
+#define BSP_INT_SRC_INTIICRI3 ((IRQn_Type)(214)) /* */
+#define BSP_INT_SRC_INTIICTI3 ((IRQn_Type)(215)) /* */
+#define BSP_INT_SRC_INTIICSPI3 ((IRQn_Type)(216)) /* */
+#define BSP_INT_SRC_INTIICSTI3 ((IRQn_Type)(217)) /* */
+#define BSP_INT_SRC_INTIICNAKI3 ((IRQn_Type)(218)) /* */
+#define BSP_INT_SRC_INTIICALI3 ((IRQn_Type)(219)) /* */
+#define BSP_INT_SRC_INTIICTMOI3 ((IRQn_Type)(220)) /* */
+#define BSP_INT_SRC_BRI0 ((IRQn_Type)(221)) /* Serial Communication Interface with FIFO */
+#define BSP_INT_SRC_ERI0 ((IRQn_Type)(222)) /* */
+#define BSP_INT_SRC_RXI0 ((IRQn_Type)(223)) /* */
+#define BSP_INT_SRC_TXI0 ((IRQn_Type)(224)) /* */
+#define BSP_INT_SRC_BRI1 ((IRQn_Type)(225)) /* */
+#define BSP_INT_SRC_ERI1 ((IRQn_Type)(226)) /* */
+#define BSP_INT_SRC_RXI1 ((IRQn_Type)(227)) /* */
+#define BSP_INT_SRC_TXI1 ((IRQn_Type)(228)) /* */
+#define BSP_INT_SRC_BRI2 ((IRQn_Type)(229)) /* */
+#define BSP_INT_SRC_ERI2 ((IRQn_Type)(230)) /* */
+#define BSP_INT_SRC_RXI2 ((IRQn_Type)(231)) /* */
+#define BSP_INT_SRC_TXI2 ((IRQn_Type)(232)) /* */
+#define BSP_INT_SRC_BRI3 ((IRQn_Type)(233)) /* */
+#define BSP_INT_SRC_ERI3 ((IRQn_Type)(234)) /* */
+#define BSP_INT_SRC_RXI3 ((IRQn_Type)(235)) /* */
+#define BSP_INT_SRC_TXI3 ((IRQn_Type)(236)) /* */
+#define BSP_INT_SRC_BRI4 ((IRQn_Type)(237)) /* */
+#define BSP_INT_SRC_ERI4 ((IRQn_Type)(238)) /* */
+#define BSP_INT_SRC_RXI4 ((IRQn_Type)(239)) /* */
+#define BSP_INT_SRC_TXI4 ((IRQn_Type)(240)) /* */
+#define BSP_INT_SRC_BRI5 ((IRQn_Type)(241)) /* */
+#define BSP_INT_SRC_ERI5 ((IRQn_Type)(242)) /* */
+#define BSP_INT_SRC_RXI5 ((IRQn_Type)(243)) /* */
+#define BSP_INT_SRC_TXI5 ((IRQn_Type)(244)) /* */
+#define BSP_INT_SRC_BRI6 ((IRQn_Type)(245)) /* */
+#define BSP_INT_SRC_ERI6 ((IRQn_Type)(246)) /* */
+#define BSP_INT_SRC_RXI6 ((IRQn_Type)(247)) /* */
+#define BSP_INT_SRC_TXI6 ((IRQn_Type)(248)) /* */
+#define BSP_INT_SRC_BRI7 ((IRQn_Type)(249)) /* */
+#define BSP_INT_SRC_ERI7 ((IRQn_Type)(250)) /* */
+#define BSP_INT_SRC_RXI7 ((IRQn_Type)(251)) /* */
+#define BSP_INT_SRC_TXI7 ((IRQn_Type)(252)) /* */
+#define BSP_INT_SRC_INTRCANGERR ((IRQn_Type)(253)) /* CAN interface */
+#define BSP_INT_SRC_INTRCANGRECC ((IRQn_Type)(254)) /* */
+#define BSP_INT_SRC_INTRCAN0REC ((IRQn_Type)(255)) /* */
+#define BSP_INT_SRC_INTRCAN0ERR ((IRQn_Type)(256)) /* */
+#define BSP_INT_SRC_INTRCAN0TRX ((IRQn_Type)(257)) /* */
+#define BSP_INT_SRC_INTRCAN1REC ((IRQn_Type)(258)) /* */
+#define BSP_INT_SRC_INTRCAN1ERR ((IRQn_Type)(259)) /* */
+#define BSP_INT_SRC_INTRCAN1TRX ((IRQn_Type)(260)) /* */
+#define BSP_INT_SRC_INTRCAN2REC ((IRQn_Type)(261)) /* */
+#define BSP_INT_SRC_INTRCAN2ERR ((IRQn_Type)(262)) /* */
+#define BSP_INT_SRC_INTRCAN2TRX ((IRQn_Type)(263)) /* */
+#define BSP_INT_SRC_INTRCAN3REC ((IRQn_Type)(264)) /* */
+#define BSP_INT_SRC_INTRCAN3ERR ((IRQn_Type)(265)) /* */
+#define BSP_INT_SRC_INTRCAN3TRX ((IRQn_Type)(266)) /* */
+#define BSP_INT_SRC_INTRCAN4REC ((IRQn_Type)(267)) /* */
+#define BSP_INT_SRC_INTRCAN4ERR ((IRQn_Type)(268)) /* */
+#define BSP_INT_SRC_INTRCAN4TRX ((IRQn_Type)(269)) /* */
+#define BSP_INT_SRC_SPEI0 ((IRQn_Type)(270)) /* Renesas serial peripheral interface */
+#define BSP_INT_SRC_SPRI0 ((IRQn_Type)(271)) /* */
+#define BSP_INT_SRC_SPTI0 ((IRQn_Type)(272)) /* */
+#define BSP_INT_SRC_SPEI1 ((IRQn_Type)(273)) /* */
+#define BSP_INT_SRC_SPRI1 ((IRQn_Type)(274)) /* */
+#define BSP_INT_SRC_SPTI1 ((IRQn_Type)(275)) /* */
+#define BSP_INT_SRC_SPEI2 ((IRQn_Type)(276)) /* */
+#define BSP_INT_SRC_SPRI2 ((IRQn_Type)(277)) /* */
+#define BSP_INT_SRC_SPTI2 ((IRQn_Type)(278)) /* */
+#define BSP_INT_SRC_SPEI3 ((IRQn_Type)(279)) /* */
+#define BSP_INT_SRC_SPRI3 ((IRQn_Type)(280)) /* */
+#define BSP_INT_SRC_SPTI3 ((IRQn_Type)(281)) /* */
+#define BSP_INT_SRC_SPEI4 ((IRQn_Type)(282)) /* */
+#define BSP_INT_SRC_SPRI4 ((IRQn_Type)(283)) /* */
+#define BSP_INT_SRC_SPTI4 ((IRQn_Type)(284)) /* */
+#define BSP_INT_SRC_IEBBTD ((IRQn_Type)(285)) /* IEBusTM controller */
+#define BSP_INT_SRC_IEBBTERR ((IRQn_Type)(286)) /* */
+#define BSP_INT_SRC_IEBBTSTA ((IRQn_Type)(287)) /* */
+#define BSP_INT_SRC_IEBBTV ((IRQn_Type)(288)) /* */
+#define BSP_INT_SRC_ISY ((IRQn_Type)(289)) /* CD-ROM decoder */
+#define BSP_INT_SRC_IERR ((IRQn_Type)(290)) /* */
+#define BSP_INT_SRC_ITARG ((IRQn_Type)(291)) /* */
+#define BSP_INT_SRC_ISEC ((IRQn_Type)(292)) /* */
+#define BSP_INT_SRC_IBUF ((IRQn_Type)(293)) /* */
+#define BSP_INT_SRC_IREADY ((IRQn_Type)(294)) /* */
+#define BSP_INT_SRC_FLSTE ((IRQn_Type)(295)) /* NAND Flash memory controller */
+#define BSP_INT_SRC_FLTENDI ((IRQn_Type)(296)) /* */
+#define BSP_INT_SRC_FLTREQ0I ((IRQn_Type)(297)) /* */
+#define BSP_INT_SRC_FLTREQ1I ((IRQn_Type)(298)) /* */
+#define BSP_INT_SRC_MMC0 ((IRQn_Type)(299)) /* MMC Host interface */
+#define BSP_INT_SRC_MMC1 ((IRQn_Type)(300)) /* */
+#define BSP_INT_SRC_MMC2 ((IRQn_Type)(301)) /* */
+#define BSP_INT_SRC_SDHI0_3 ((IRQn_Type)(302)) /* SD Host interface */
+#define BSP_INT_SRC_SDHI0_0 ((IRQn_Type)(303)) /* */
+#define BSP_INT_SRC_SDHI0_1 ((IRQn_Type)(304)) /* */
+#define BSP_INT_SRC_SDHI1_3 ((IRQn_Type)(305)) /* */
+#define BSP_INT_SRC_SDHI1_0 ((IRQn_Type)(306)) /* */
+#define BSP_INT_SRC_SDHI1_1 ((IRQn_Type)(307)) /* */
+#define BSP_INT_SRC_ARM ((IRQn_Type)(308)) /* Real time clock */
+#define BSP_INT_SRC_PRD ((IRQn_Type)(309)) /* */
+#define BSP_INT_SRC_CUP ((IRQn_Type)(310)) /* */
+#define BSP_INT_SRC_SCUAI0 ((IRQn_Type)(311)) /* SCUX */
+#define BSP_INT_SRC_SCUAI1 ((IRQn_Type)(312)) /* */
+#define BSP_INT_SRC_SCUFDI0 ((IRQn_Type)(313)) /* */
+#define BSP_INT_SRC_SCUFDI1 ((IRQn_Type)(314)) /* */
+#define BSP_INT_SRC_SCUFDI2 ((IRQn_Type)(315)) /* */
+#define BSP_INT_SRC_SCUFDI3 ((IRQn_Type)(316)) /* */
+#define BSP_INT_SRC_SCUFUI0 ((IRQn_Type)(317)) /* */
+#define BSP_INT_SRC_SCUFUI1 ((IRQn_Type)(318)) /* */
+#define BSP_INT_SRC_SCUFUI2 ((IRQn_Type)(319)) /* */
+#define BSP_INT_SRC_SCUFUI3 ((IRQn_Type)(320)) /* */
+#define BSP_INT_SRC_SCUDVI0 ((IRQn_Type)(321)) /* */
+#define BSP_INT_SRC_SCUDVI1 ((IRQn_Type)(322)) /* */
+#define BSP_INT_SRC_SCUDVI2 ((IRQn_Type)(323)) /* */
+#define BSP_INT_SRC_SCUDVI3 ((IRQn_Type)(324)) /* */
+#define BSP_INT_SRC_MLB_CINT ((IRQn_Type)(325)) /* Media local bus */
+#define BSP_INT_SRC_MLB_SINT ((IRQn_Type)(326)) /* */
+#define BSP_INT_SRC_DRC0 ((IRQn_Type)(327)) /* Dynamic range compalator */
+#define BSP_INT_SRC_DRC1 ((IRQn_Type)(328)) /* */
+#define BSP_INT_SRC_LINI0_INT_T ((IRQn_Type)(331)) /* LIN/UART interface */
+#define BSP_INT_SRC_LINI0_INT_R ((IRQn_Type)(332)) /* */
+#define BSP_INT_SRC_LINI0_INT_S ((IRQn_Type)(333)) /* */
+#define BSP_INT_SRC_LINI0_INT_M ((IRQn_Type)(334)) /* */
+#define BSP_INT_SRC_LINI1_INT_T ((IRQn_Type)(335)) /* */
+#define BSP_INT_SRC_LINI1_INT_R ((IRQn_Type)(336)) /* */
+#define BSP_INT_SRC_LINI1_INT_S ((IRQn_Type)(337)) /* */
+#define BSP_INT_SRC_LINI1_INT_M ((IRQn_Type)(338)) /* */
+#define BSP_INT_SRC_SCI_ERI0 ((IRQn_Type)(347)) /* Serial communication interface */
+#define BSP_INT_SRC_SCI_RXI0 ((IRQn_Type)(348)) /* */
+#define BSP_INT_SRC_SCI_TXI0 ((IRQn_Type)(349)) /* */
+#define BSP_INT_SRC_SCI_TEI0 ((IRQn_Type)(350)) /* */
+#define BSP_INT_SRC_SCI_ERI1 ((IRQn_Type)(351)) /* */
+#define BSP_INT_SRC_SCI_RXI1 ((IRQn_Type)(352)) /* */
+#define BSP_INT_SRC_SCI_TXI1 ((IRQn_Type)(353)) /* */
+#define BSP_INT_SRC_SCI_TEI1 ((IRQn_Type)(354)) /* */
+#define BSP_INT_SRC_AVBI_DATA ((IRQn_Type)(355)) /* EthernetAVB */
+#define BSP_INT_SRC_AVBI_ERROR ((IRQn_Type)(356)) /* */
+#define BSP_INT_SRC_AVBI_MANAGE ((IRQn_Type)(357)) /* */
+#define BSP_INT_SRC_AVBI_MAC ((IRQn_Type)(358)) /* */
+#define BSP_INT_SRC_ETHERI ((IRQn_Type)(359)) /* Ethernet controller */
+#define BSP_INT_SRC_CEUI ((IRQn_Type)(364)) /* Capture engine unit */
+#define BSP_INT_SRC_H2XMLB_ERRINT ((IRQn_Type)(381)) /* Internal bus */
+#define BSP_INT_SRC_H2XIC1_ERRINT ((IRQn_Type)(382)) /* */
+#define BSP_INT_SRC_X2HPERI1_ERRINT ((IRQn_Type)(383)) /* */
+#define BSP_INT_SRC_X2HPERI2_ERRINT ((IRQn_Type)(384)) /* */
+#define BSP_INT_SRC_X2HPERI34_ERRINT ((IRQn_Type)(385)) /* */
+#define BSP_INT_SRC_X2HPERI5_ERRINT ((IRQn_Type)(386)) /* */
+#define BSP_INT_SRC_X2HPERI67_ERRINT ((IRQn_Type)(387)) /* */
+#define BSP_INT_SRC_X2HDBGR_ERRINT ((IRQn_Type)(388)) /* */
+#define BSP_INT_SRC_X2HBSC_ERRINT ((IRQn_Type)(389)) /* */
+#define BSP_INT_SRC_X2HSPI1_ERRINT ((IRQn_Type)(390)) /* */
+#define BSP_INT_SRC_X2HSPI2_ERRINT ((IRQn_Type)(391)) /* */
+#define BSP_INT_SRC_PRRI ((IRQn_Type)(392)) /* */
+#define BSP_INT_SRC_IFEI0 ((IRQn_Type)(393)) /* Pixel format converter */
+#define BSP_INT_SRC_OFFI0 ((IRQn_Type)(394)) /* */
+#define BSP_INT_SRC_PFVEI0 ((IRQn_Type)(395)) /* */
+#define BSP_INT_SRC_IFEI1 ((IRQn_Type)(396)) /* */
+#define BSP_INT_SRC_OFFI1 ((IRQn_Type)(397)) /* */
+#define BSP_INT_SRC_PFVEI1 ((IRQn_Type)(398)) /* */
+#define BSP_INT_SRC_TINT0 ((IRQn_Type)(416)) /* Terminal interrupts */
+#define BSP_INT_SRC_TINT1 ((IRQn_Type)(417)) /* */
+#define BSP_INT_SRC_TINT2 ((IRQn_Type)(418)) /* */
+#define BSP_INT_SRC_TINT3 ((IRQn_Type)(419)) /* */
+#define BSP_INT_SRC_TINT4 ((IRQn_Type)(420)) /* */
+#define BSP_INT_SRC_TINT5 ((IRQn_Type)(421)) /* */
+#define BSP_INT_SRC_TINT6 ((IRQn_Type)(422)) /* */
+#define BSP_INT_SRC_TINT7 ((IRQn_Type)(423)) /* */
+#define BSP_INT_SRC_TINT8 ((IRQn_Type)(424)) /* */
+#define BSP_INT_SRC_TINT9 ((IRQn_Type)(425)) /* */
+#define BSP_INT_SRC_TINT10 ((IRQn_Type)(426)) /* */
+#define BSP_INT_SRC_TINT11 ((IRQn_Type)(427)) /* */
+#define BSP_INT_SRC_TINT12 ((IRQn_Type)(428)) /* */
+#define BSP_INT_SRC_TINT13 ((IRQn_Type)(429)) /* */
+#define BSP_INT_SRC_TINT14 ((IRQn_Type)(430)) /* */
+#define BSP_INT_SRC_TINT15 ((IRQn_Type)(431)) /* */
+#define BSP_INT_SRC_TINT16 ((IRQn_Type)(432)) /* */
+#define BSP_INT_SRC_TINT17 ((IRQn_Type)(433)) /* */
+#define BSP_INT_SRC_TINT18 ((IRQn_Type)(434)) /* */
+#define BSP_INT_SRC_TINT19 ((IRQn_Type)(435)) /* */
+#define BSP_INT_SRC_TINT20 ((IRQn_Type)(436)) /* */
+#define BSP_INT_SRC_TINT21 ((IRQn_Type)(437)) /* */
+#define BSP_INT_SRC_TINT22 ((IRQn_Type)(438)) /* */
+#define BSP_INT_SRC_TINT23 ((IRQn_Type)(439)) /* */
+#define BSP_INT_SRC_TINT24 ((IRQn_Type)(440)) /* */
+#define BSP_INT_SRC_TINT25 ((IRQn_Type)(441)) /* */
+#define BSP_INT_SRC_TINT26 ((IRQn_Type)(442)) /* */
+#define BSP_INT_SRC_TINT27 ((IRQn_Type)(443)) /* */
+#define BSP_INT_SRC_TINT28 ((IRQn_Type)(444)) /* */
+#define BSP_INT_SRC_TINT29 ((IRQn_Type)(445)) /* */
+#define BSP_INT_SRC_TINT30 ((IRQn_Type)(446)) /* */
+#define BSP_INT_SRC_TINT31 ((IRQn_Type)(447)) /* */
+#define BSP_INT_SRC_TINT32 ((IRQn_Type)(448)) /* */
+#define BSP_INT_SRC_TINT33 ((IRQn_Type)(449)) /* */
+#define BSP_INT_SRC_TINT34 ((IRQn_Type)(450)) /* */
+#define BSP_INT_SRC_TINT35 ((IRQn_Type)(451)) /* */
+#define BSP_INT_SRC_TINT36 ((IRQn_Type)(452)) /* */
+#define BSP_INT_SRC_TINT37 ((IRQn_Type)(453)) /* */
+#define BSP_INT_SRC_TINT38 ((IRQn_Type)(454)) /* */
+#define BSP_INT_SRC_TINT39 ((IRQn_Type)(455)) /* */
+#define BSP_INT_SRC_TINT40 ((IRQn_Type)(456)) /* */
+#define BSP_INT_SRC_TINT41 ((IRQn_Type)(457)) /* */
+#define BSP_INT_SRC_TINT42 ((IRQn_Type)(458)) /* */
+#define BSP_INT_SRC_TINT43 ((IRQn_Type)(459)) /* */
+#define BSP_INT_SRC_TINT44 ((IRQn_Type)(460)) /* */
+#define BSP_INT_SRC_TINT45 ((IRQn_Type)(461)) /* */
+#define BSP_INT_SRC_TINT46 ((IRQn_Type)(462)) /* */
+#define BSP_INT_SRC_TINT47 ((IRQn_Type)(463)) /* */
+#define BSP_INT_SRC_TINT48 ((IRQn_Type)(464)) /* */
+#define BSP_INT_SRC_TINT49 ((IRQn_Type)(465)) /* */
+#define BSP_INT_SRC_TINT50 ((IRQn_Type)(466)) /* */
+#define BSP_INT_SRC_TINT51 ((IRQn_Type)(467)) /* */
+#define BSP_INT_SRC_TINT52 ((IRQn_Type)(468)) /* */
+#define BSP_INT_SRC_TINT53 ((IRQn_Type)(469)) /* */
+#define BSP_INT_SRC_TINT54 ((IRQn_Type)(470)) /* */
+#define BSP_INT_SRC_TINT55 ((IRQn_Type)(471)) /* */
+#define BSP_INT_SRC_TINT56 ((IRQn_Type)(472)) /* */
+#define BSP_INT_SRC_TINT57 ((IRQn_Type)(473)) /* */
+#define BSP_INT_SRC_TINT58 ((IRQn_Type)(474)) /* */
+#define BSP_INT_SRC_TINT59 ((IRQn_Type)(475)) /* */
+#define BSP_INT_SRC_TINT60 ((IRQn_Type)(476)) /* */
+#define BSP_INT_SRC_TINT61 ((IRQn_Type)(477)) /* */
+#define BSP_INT_SRC_TINT62 ((IRQn_Type)(478)) /* */
+#define BSP_INT_SRC_TINT63 ((IRQn_Type)(479)) /* */
+#define BSP_INT_SRC_TINT64 ((IRQn_Type)(480)) /* */
+#define BSP_INT_SRC_TINT65 ((IRQn_Type)(481)) /* */
+#define BSP_INT_SRC_TINT66 ((IRQn_Type)(482)) /* */
+#define BSP_INT_SRC_TINT67 ((IRQn_Type)(483)) /* */
+#define BSP_INT_SRC_TINT68 ((IRQn_Type)(484)) /* */
+#define BSP_INT_SRC_TINT69 ((IRQn_Type)(485)) /* */
+#define BSP_INT_SRC_TINT70 ((IRQn_Type)(486)) /* */
+#define BSP_INT_SRC_TINT71 ((IRQn_Type)(487)) /* */
+#define BSP_INT_SRC_TINT72 ((IRQn_Type)(488)) /* */
+#define BSP_INT_SRC_TINT73 ((IRQn_Type)(489)) /* */
+#define BSP_INT_SRC_TINT74 ((IRQn_Type)(490)) /* */
+#define BSP_INT_SRC_TINT75 ((IRQn_Type)(491)) /* */
+#define BSP_INT_SRC_TINT76 ((IRQn_Type)(492)) /* */
+#define BSP_INT_SRC_TINT77 ((IRQn_Type)(493)) /* */
+#define BSP_INT_SRC_TINT78 ((IRQn_Type)(494)) /* */
+#define BSP_INT_SRC_TINT79 ((IRQn_Type)(495)) /* */
+#define BSP_INT_SRC_TINT80 ((IRQn_Type)(496)) /* */
+#define BSP_INT_SRC_TINT81 ((IRQn_Type)(497)) /* */
+#define BSP_INT_SRC_TINT82 ((IRQn_Type)(498)) /* */
+#define BSP_INT_SRC_TINT83 ((IRQn_Type)(499)) /* */
+#define BSP_INT_SRC_TINT84 ((IRQn_Type)(500)) /* */
+#define BSP_INT_SRC_TINT85 ((IRQn_Type)(501)) /* */
+#define BSP_INT_SRC_TINT86 ((IRQn_Type)(502)) /* */
+#define BSP_INT_SRC_TINT87 ((IRQn_Type)(503)) /* */
+#define BSP_INT_SRC_TINT88 ((IRQn_Type)(504)) /* */
+#define BSP_INT_SRC_TINT89 ((IRQn_Type)(505)) /* */
+#define BSP_INT_SRC_TINT90 ((IRQn_Type)(506)) /* */
+#define BSP_INT_SRC_TINT91 ((IRQn_Type)(507)) /* */
+#define BSP_INT_SRC_TINT92 ((IRQn_Type)(508)) /* */
+#define BSP_INT_SRC_TINT93 ((IRQn_Type)(509)) /* */
+#define BSP_INT_SRC_TINT94 ((IRQn_Type)(510)) /* */
+#define BSP_INT_SRC_TINT95 ((IRQn_Type)(511)) /* */
+#define BSP_INT_SRC_TINT96 ((IRQn_Type)(512)) /* */
+#define BSP_INT_SRC_TINT97 ((IRQn_Type)(513)) /* */
+#define BSP_INT_SRC_TINT98 ((IRQn_Type)(514)) /* */
+#define BSP_INT_SRC_TINT99 ((IRQn_Type)(515)) /* */
+#define BSP_INT_SRC_TINT100 ((IRQn_Type)(516)) /* */
+#define BSP_INT_SRC_TINT101 ((IRQn_Type)(517)) /* */
+#define BSP_INT_SRC_TINT102 ((IRQn_Type)(518)) /* */
+#define BSP_INT_SRC_TINT103 ((IRQn_Type)(519)) /* */
+#define BSP_INT_SRC_TINT104 ((IRQn_Type)(520)) /* */
+#define BSP_INT_SRC_TINT105 ((IRQn_Type)(521)) /* */
+#define BSP_INT_SRC_TINT106 ((IRQn_Type)(522)) /* */
+#define BSP_INT_SRC_TINT107 ((IRQn_Type)(523)) /* */
+#define BSP_INT_SRC_TINT108 ((IRQn_Type)(524)) /* */
+#define BSP_INT_SRC_TINT109 ((IRQn_Type)(525)) /* */
+#define BSP_INT_SRC_TINT110 ((IRQn_Type)(526)) /* */
+#define BSP_INT_SRC_TINT111 ((IRQn_Type)(527)) /* */
+#define BSP_INT_SRC_TINT112 ((IRQn_Type)(528)) /* */
+#define BSP_INT_SRC_TINT113 ((IRQn_Type)(529)) /* */
+#define BSP_INT_SRC_TINT114 ((IRQn_Type)(530)) /* */
+#define BSP_INT_SRC_TINT115 ((IRQn_Type)(531)) /* */
+#define BSP_INT_SRC_TINT116 ((IRQn_Type)(532)) /* */
+#define BSP_INT_SRC_TINT117 ((IRQn_Type)(533)) /* */
+#define BSP_INT_SRC_TINT118 ((IRQn_Type)(534)) /* */
+#define BSP_INT_SRC_TINT119 ((IRQn_Type)(535)) /* */
+#define BSP_INT_SRC_TINT120 ((IRQn_Type)(536)) /* */
+#define BSP_INT_SRC_TINT121 ((IRQn_Type)(537)) /* */
+#define BSP_INT_SRC_TINT122 ((IRQn_Type)(538)) /* */
+#define BSP_INT_SRC_TINT123 ((IRQn_Type)(539)) /* */
+#define BSP_INT_SRC_TINT124 ((IRQn_Type)(540)) /* */
+#define BSP_INT_SRC_TINT125 ((IRQn_Type)(541)) /* */
+#define BSP_INT_SRC_TINT126 ((IRQn_Type)(542)) /* */
+#define BSP_INT_SRC_TINT127 ((IRQn_Type)(543)) /* */
+#define BSP_INT_SRC_TINT128 ((IRQn_Type)(544)) /* */
+#define BSP_INT_SRC_TINT129 ((IRQn_Type)(545)) /* */
+#define BSP_INT_SRC_TINT130 ((IRQn_Type)(546)) /* */
+#define BSP_INT_SRC_TINT131 ((IRQn_Type)(547)) /* */
+#define BSP_INT_SRC_TINT132 ((IRQn_Type)(548)) /* */
+#define BSP_INT_SRC_TINT133 ((IRQn_Type)(549)) /* */
+#define BSP_INT_SRC_TINT134 ((IRQn_Type)(550)) /* */
+#define BSP_INT_SRC_TINT135 ((IRQn_Type)(551)) /* */
+#define BSP_INT_SRC_TINT136 ((IRQn_Type)(552)) /* */
+#define BSP_INT_SRC_TINT137 ((IRQn_Type)(553)) /* */
+#define BSP_INT_SRC_TINT138 ((IRQn_Type)(554)) /* */
+#define BSP_INT_SRC_TINT139 ((IRQn_Type)(555)) /* */
+#define BSP_INT_SRC_TINT140 ((IRQn_Type)(556)) /* */
+#define BSP_INT_SRC_TINT141 ((IRQn_Type)(557)) /* */
+#define BSP_INT_SRC_TINT142 ((IRQn_Type)(558)) /* */
+#define BSP_INT_SRC_TINT143 ((IRQn_Type)(559)) /* */
+#define BSP_INT_SRC_TINT144 ((IRQn_Type)(560)) /* */
+#define BSP_INT_SRC_TINT145 ((IRQn_Type)(561)) /* */
+#define BSP_INT_SRC_TINT146 ((IRQn_Type)(562)) /* */
+#define BSP_INT_SRC_TINT147 ((IRQn_Type)(563)) /* */
+#define BSP_INT_SRC_TINT148 ((IRQn_Type)(564)) /* */
+#define BSP_INT_SRC_TINT149 ((IRQn_Type)(565)) /* */
+#define BSP_INT_SRC_TINT150 ((IRQn_Type)(566)) /* */
+#define BSP_INT_SRC_TINT151 ((IRQn_Type)(567)) /* */
+#define BSP_INT_SRC_TINT152 ((IRQn_Type)(568)) /* */
+#define BSP_INT_SRC_TINT153 ((IRQn_Type)(569)) /* */
+#define BSP_INT_SRC_TINT154 ((IRQn_Type)(570)) /* */
+#define BSP_INT_SRC_TINT155 ((IRQn_Type)(571)) /* */
+#define BSP_INT_SRC_TINT156 ((IRQn_Type)(572)) /* */
+#define BSP_INT_SRC_TINT157 ((IRQn_Type)(573)) /* */
+#define BSP_INT_SRC_TINT158 ((IRQn_Type)(574)) /* */
+#define BSP_INT_SRC_TINT159 ((IRQn_Type)(575)) /* */
+#define BSP_INT_SRC_TINT160 ((IRQn_Type)(576)) /* */
+#define BSP_INT_SRC_TINT161 ((IRQn_Type)(577)) /* */
+#define BSP_INT_SRC_TINT162 ((IRQn_Type)(578)) /* */
+#define BSP_INT_SRC_TINT163 ((IRQn_Type)(579)) /* */
+#define BSP_INT_SRC_TINT164 ((IRQn_Type)(580)) /* */
+#define BSP_INT_SRC_TINT165 ((IRQn_Type)(581)) /* */
+#define BSP_INT_SRC_TINT166 ((IRQn_Type)(582)) /* */
+#define BSP_INT_SRC_TINT167 ((IRQn_Type)(583)) /* */
+#define BSP_INT_SRC_TINT168 ((IRQn_Type)(584)) /* */
+#define BSP_INT_SRC_TINT169 ((IRQn_Type)(585)) /* */
+#define BSP_INT_SRC_TINT170 ((IRQn_Type)(586)) /* */
+
+INLINE IRQn_Type R_CAST_bsp_int_src_t_to_IRQn_Type( bsp_int_src_t const Value )
+{
+ return (IRQn_Type) Value;
+}
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+/* In "mcu_interrupts.h" */
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* MCU_INTERRUPTS_TYPEDEF_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/platform.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,77 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file platform.h
+* @brief Header files of FIT BSP.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "Project_Config.h"
+#include "cpu.h"
+#include "locking.h"
+#include "mcu_interrupts.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+/* In "mcu_interrupts_typedef.h" */
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/* In "mcu_interrupts_typedef.h" */
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+/* In "mcu_interrupts_typedef.h" */
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* PLATFORM_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/platform_config.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,116 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file platform_config.h
+* @brief Configuration of FIT BSP.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+
+
+/* This file is included from "Project_Config.h" */
+
+
+#ifndef PLATFORM_CONFIG_H
+#define PLATFORM_CONFIG_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def BSP_CFG_USER_LOCKING_ENABLED
+* @brief 0 or 1
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This value can be changed.
+* See locking_user.h file.
+*/
+#define BSP_CFG_USER_LOCKING_ENABLED 0
+
+
+/**
+* @def BSP_CFG_RTOS_USED
+* @brief 0 or 1
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This value cannot be changed.
+* This value is 1 in OSPL for RTOS.
+*/
+#define BSP_CFG_RTOS_USED 1
+
+
+/**
+* @def BSP_CFG_PARAM_CHECKING_ENABLE
+* @brief 0 or 1
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This value can be changed.
+*/
+#define BSP_CFG_PARAM_CHECKING_ENABLE 1
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* PLATFORM_CONFIG_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_multi_compiler.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,74 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_multi_compiler.h
+* @brief Compiler Porting Layer. Functions.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef R_MULTI_COMPILER_H
+#define R_MULTI_COMPILER_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_multi_compiler_typedef.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+/* In "r_multi_compiler_typedef.h" */
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/* In "r_multi_compiler_typedef.h" */
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+/* In "r_multi_compiler_typedef.h" */
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_MULTI_COMPILER_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_multi_compiler_typedef.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,391 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_multi_compiler_typedef.h
+* @brief Compiler Porting Layer. Data types.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 42 $
+* $Date:: 2014-06-03 16:54:02 +0900#$
+*/
+
+#ifndef R_MULTI_COMPILER_TYPEDEF_H
+#define R_MULTI_COMPILER_TYPEDEF_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def R_OSPL_SECTION_INLINE_VERSION
+* @brief R_OSPL_SECTION_INLINE_VERSION
+* @par Parameters
+* None
+* @return None.
+*/
+#define R_OSPL_SECTION_INLINE_VERSION 4
+
+
+/**
+* @def R_OSPL_LIST_UP_INLINE_BODY
+* @brief Define or not define
+* @par Parameters
+* None
+* @return None.
+*/
+/* #define R_OSPL_LIST_UP_INLINE_BODY */
+
+
+/**
+* @def R_OSPL_MAKE_INLINE_BODY
+* @brief Define or not define
+* @par Parameters
+* None
+* @return None.
+*/
+/* #define R_OSPL_MAKE_INLINE_BODY */
+
+
+/**
+* @def INLINE
+* @brief Inline function
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* "__INLINE" is reserved by compiler.
+*/
+/* ->QAC 1252 : QAC considers that && is not short-circuit evaluation */
+#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L && ! defined( __ICCARM__ ) /* For C99 */ \
+&& ! IS_MBED_USED || defined( __cplusplus )
+/* <-QAC 1252 */
+#if defined( R_OSPL_MAKE_INLINE_BODY ) && ! defined( R_OSPL_LIST_UP_INLINE_BODY )
+#define INLINE extern inline
+#else
+#define INLINE inline
+#endif
+
+/* ->QAC 1252 : QAC considers that && is not short-circuit evaluation */
+#elif defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L && defined( __ICCARM__ ) /* For IAR C99 */
+/* <-QAC 1252 */
+#if defined( R_OSPL_MAKE_INLINE_BODY )
+#define INLINE
+/* "extern inline" raises a error, if with "@" operator */
+#else
+#define INLINE inline /* Special inline */
+#endif
+
+#elif defined( __CC_ARM ) && ! defined( __GNUC__ ) /* For ARMCC not C99, not -gnu */
+#if defined( R_OSPL_MAKE_INLINE_BODY ) && ! defined( R_OSPL_LIST_UP_INLINE_BODY )
+#if R_OSPL_LIBRARY_MAKING
+#define INLINE static __inline
+#else
+#define INLINE extern __inline /* Special inline */
+#endif
+#else
+#if R_OSPL_LIBRARY_MAKING
+#define INLINE static __inline
+#else
+#define INLINE extern __inline /* Special inline */
+#endif
+#endif
+/* Function bodys are in shared "i.<FunctionName>" section */
+
+#elif defined( __GNUC__ ) /* For gcc */
+#if IS_MBED_USED
+#define INLINE static __inline
+#else
+#if defined( R_OSPL_MAKE_INLINE_BODY ) && ! defined( R_OSPL_LIST_UP_INLINE_BODY )
+#define INLINE __inline__ /* extern inline of C99 */
+#else
+#define INLINE extern __inline__ /* inline of C99 */
+#endif
+#endif
+
+#elif defined( _SH ) /* For SH compiler */
+#if defined( R_OSPL_MAKE_INLINE_BODY ) && ! defined( R_OSPL_LIST_UP_INLINE_BODY )
+#define INLINE
+#else
+#define INLINE static
+/* "extern" is ignored, if 'C1400 (W) Function "..." in #pragma inline is not expanded' */
+#endif
+/* No inline qualifier */
+/* #ifdef _SH */
+/* #pragma inline <function_name> */
+/* #endif */
+
+#else
+#error
+#endif
+
+
+/**
+* @def STATIC_INLINE
+* @brief Static inline in C source file
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* "__STATIC_INLINE" is reserved by compiler.
+*/
+
+#ifndef __cplusplus
+
+#ifdef __CC_ARM
+#define STATIC_INLINE static __inline
+#endif
+
+#ifdef __ICCARM__
+#define STATIC_INLINE static inline
+#endif
+
+#if defined( __GNUC__ ) && ! defined( __CC_ARM )
+#define STATIC_INLINE static inline
+#endif
+
+#else
+
+#define STATIC_INLINE static inline
+
+#endif /* __cplusplus */
+
+
+/**
+* @def R_OSPL_SECTION
+* @brief Names section name to function or varaible
+* @par Parameters
+* None
+* @return None.
+*/
+/**
+* @def R_OSPL_SECTION_FOR_ZERO_INIT
+* @brief Names section name to zero initialized varaible
+* @par Parameters
+* None
+* @return None.
+*/
+/* ->MISRA 19.10 : Cannot ( ) */ /* ->MISRA 19.7 : Cannot function */ /* ->SEC M5.1.3 */
+#if defined( __CC_ARM )
+#define R_OSPL_SECTION( SectionName, Declaration ) \
+ __attribute__ ((section (SectionName))) Declaration
+
+#define R_OSPL_SECTION_FOR_ZERO_INIT( SectionName, Declaration ) \
+ __attribute__ ((section (SectionName), zero_init)) Declaration
+
+#elif defined( __GNUC__ ) && ! defined( __CC_ARM )
+#define R_OSPL_SECTION( SectionName, Declaration ) \
+ __attribute__ ((section (SectionName))) Declaration
+
+#define R_OSPL_SECTION_FOR_ZERO_INIT( SectionName, Declaration ) \
+ __attribute__ ((section (SectionName))) Declaration
+
+#elif defined( __ICCARM__ )
+#define R_OSPL_SECTION( SectionName, Declaration ) \
+ Declaration @ SectionName
+
+#define R_OSPL_SECTION_FOR_ZERO_INIT( SectionName, Declaration ) \
+ Declaration @ SectionName
+
+#elif defined( _SH ) /* For SH compiler */
+#define R_OSPL_SECTION( SectionName, Declaration ) \
+ Declaration
+/* No section qualifier */
+/* #ifdef _SH */
+/* #pragma section <section_name> */
+/* #endif */
+/* : */
+/* <Not extern code> */
+/* : */
+/* #ifdef _SH */
+/* #pragma section */
+/* #endif */
+
+#define R_OSPL_SECTION_FOR_ZERO_INIT( SectionName, Declaration ) \
+ Declaration
+
+#else
+#error
+#endif
+/* <-MISRA 19.10 */ /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @def R_OSPL_SECTION_FOR_INLINE
+* @brief Names section name to inline function
+* @par Parameters
+* None
+* @return None.
+*/
+/* ->MISRA 19.10 : Cannot ( ) */ /* ->MISRA 19.7 : Cannot function */ /* ->SEC M5.1.3 */
+#if defined( __CC_ARM ) || defined( __GNUC__ )
+#if defined( R_OSPL_LIST_UP_INLINE_BODY )
+#define R_OSPL_SECTION_FOR_INLINE( SectionName, Declaration ) \
+ __attribute__ ((section ("INLINE_BODY"))) Declaration
+#else
+#define R_OSPL_SECTION_FOR_INLINE( SectionName, Declaration ) \
+ __attribute__ ((section (SectionName))) Declaration
+#endif
+
+#elif defined( __ICCARM__ )
+#if defined( R_OSPL_MAKE_INLINE_BODY )
+#if defined( R_OSPL_LIST_UP_INLINE_BODY )
+#define R_OSPL_SECTION_FOR_INLINE( SectionName, Declaration ) \
+ Declaration @ "INLINE_BODY"
+#else
+#define R_OSPL_SECTION_FOR_INLINE( SectionName, Declaration ) \
+ Declaration @ SectionName
+#endif
+#else
+#define R_OSPL_SECTION_FOR_INLINE( SectionName, Declaration ) \
+ Declaration
+#endif
+
+#elif defined( _SH ) /* For SH compiler */
+#define R_OSPL_SECTION_FOR_INLINE( SectionName, Declaration ) \
+ Declaration
+/* No section qualifier */
+/* #ifdef _SH */
+/* #pragma section <section_name> */
+/* #endif */
+/* : */
+/* <Not extern code> */
+/* : */
+/* #ifdef _SH */
+/* #pragma section */
+/* #endif */
+
+#else
+#error
+#endif
+/* <-MISRA 19.10 */ /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @def R_OSPL_ALIGNMENT
+* @brief Alignments first addres of global variable
+* @param ByteCount Value of alignment
+* @param Declaration_with_Semicolon Declaration of the variable
+* @return None.
+*/
+/* ->MISRA 19.10 : Cannot ( ) */ /* ->MISRA 19.7 : Cannot function */ /* ->SEC M5.1.3 */
+#if defined( __CC_ARM )
+#define R_OSPL_ALIGNMENT( ByteCount, Declaration_with_Semicolon ) \
+ __align( ByteCount ) Declaration_with_Semicolon
+
+#elif defined( __GNUC__ ) && ! defined( __CC_ARM )
+#define R_OSPL_ALIGNMENT( ByteCount, Declaration_with_Semicolon ) \
+ __attribute__((aligned( ByteCount ))) Declaration_with_Semicolon
+
+#elif defined( __ICCARM__ )
+#define R_OSPL_ALIGNMENT( ByteCount, Declaration_with_Semicolon ) \
+ R_OSPL_ALIGNMENT_SUB( ByteCount, Declaration_with_Semicolon )
+#define R_OSPL_ALIGNMENT_SUB( ByteCount, Declaration_with_Semicolon ) \
+ _Pragma( "diag_suppress=Pe606" ) \
+ _Pragma( "diag_suppress=Pa060" ) \
+ _Pragma( "diag_suppress=Pe609" ) \
+ R_OSPL_ALIGNMENT_##ByteCount() \
+ Declaration_with_Semicolon \
+ R_OSPL_ALIGNMENT_##0x4()
+/* align 0x4 must be written after ";" */
+
+#define R_OSPL_ALIGNMENT_0x4() _Pragma( "data_alignment=0x4" )
+#define R_OSPL_ALIGNMENT_0x8() _Pragma( "data_alignment=0x8" )
+#define R_OSPL_ALIGNMENT_0x10() _Pragma( "data_alignment=0x10" )
+#define R_OSPL_ALIGNMENT_0x20() _Pragma( "data_alignment=0x20" )
+#define R_OSPL_ALIGNMENT_0x40() _Pragma( "data_alignment=0x40" )
+#define R_OSPL_ALIGNMENT_0x80() _Pragma( "data_alignment=0x80" )
+#define R_OSPL_ALIGNMENT_0x100() _Pragma( "data_alignment=0x100" )
+#define R_OSPL_ALIGNMENT_0x200() _Pragma( "data_alignment=0x200" )
+#define R_OSPL_ALIGNMENT_0x400() _Pragma( "data_alignment=0x400" )
+#define R_OSPL_ALIGNMENT_0x800() _Pragma( "data_alignment=0x800" )
+#define R_OSPL_ALIGNMENT_0x1000() _Pragma( "data_alignment=0x1000" )
+#define R_OSPL_ALIGNMENT_0x2000() _Pragma( "data_alignment=0x2000" )
+#define R_OSPL_ALIGNMENT_0x4000() _Pragma( "data_alignment=0x4000" )
+#define R_OSPL_ALIGNMENT_0x8000() _Pragma( "data_alignment=0x8000" )
+#define R_OSPL_ALIGNMENT_0x10000() _Pragma( "data_alignment=0x10000" )
+#define R_OSPL_ALIGNMENT_0x20000() _Pragma( "data_alignment=0x20000" )
+#define R_OSPL_ALIGNMENT_0x40000() _Pragma( "data_alignment=0x40000" )
+#define R_OSPL_ALIGNMENT_0x80000() _Pragma( "data_alignment=0x80000" )
+#define R_OSPL_ALIGNMENT_0x100000() _Pragma( "data_alignment=0x100000" )
+
+#define R_OSPL_ALIGNMENT_4() _Pragma( "data_alignment=4" )
+#define R_OSPL_ALIGNMENT_8() _Pragma( "data_alignment=8" )
+#define R_OSPL_ALIGNMENT_16() _Pragma( "data_alignment=16" )
+#define R_OSPL_ALIGNMENT_32() _Pragma( "data_alignment=32" )
+#define R_OSPL_ALIGNMENT_64() _Pragma( "data_alignment=64" )
+#define R_OSPL_ALIGNMENT_128() _Pragma( "data_alignment=128" )
+#define R_OSPL_ALIGNMENT_256() _Pragma( "data_alignment=256" )
+#define R_OSPL_ALIGNMENT_512() _Pragma( "data_alignment=512" )
+#define R_OSPL_ALIGNMENT_1024() _Pragma( "data_alignment=1024" )
+#define R_OSPL_ALIGNMENT_2048() _Pragma( "data_alignment=2048" )
+#define R_OSPL_ALIGNMENT_4096() _Pragma( "data_alignment=4096" )
+#define R_OSPL_ALIGNMENT_8192() _Pragma( "data_alignment=8192" )
+#define R_OSPL_ALIGNMENT_16384() _Pragma( "data_alignment=16384" )
+#define R_OSPL_ALIGNMENT_32768() _Pragma( "data_alignment=32768" )
+#define R_OSPL_ALIGNMENT_65536() _Pragma( "data_alignment=65536" )
+
+#elif defined( _SH )
+#define R_OSPL_ALIGNMENT( ByteCount, Declaration_with_Semicolon ) \
+ Declaration_with_Semicolon
+/* No alignment qualifier */
+/* Set aligned address by "Map section information" */
+
+#else
+#error
+#endif
+/* <-MISRA 19.10 */ /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/* Form: C Language Header */
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+/* In "r_multi_compiler.h" */
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* End of extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_MULTI_COMPILER_TYPEDEF_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,2035 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl.h
+* @brief OS Porting Layer. Main Header. Functions.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef R_OSPL_H
+#define R_OSPL_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "Project_Config.h"
+#include "platform.h"
+#include "r_ospl_typedef.h"
+#include "r_multi_compiler_typedef.h"
+#include "locking.h"
+#include "r_static_an_tag.h"
+#include "r_ospl_debug.h"
+#if ! R_OSPL_IS_PREEMPTION
+#include "r_ospl_os_less.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+/* In "r_ospl_typedef.h" */
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/* In "r_ospl_typedef.h" */
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+/* In "r_ospl_typedef.h" */
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+
+/* Section: Version and initialize */
+/**
+* @brief Returns version number of OSPL
+*
+* @par Parameters
+* None
+* @return Version number of OSPL
+*
+* @par Description
+* Return value is same as "R_OSPL_VERSION" macro.
+*/
+int32_t R_OSPL_GetVersion(void);
+
+
+/**
+* @brief Returns whether the environment is supported preemption
+*
+* @par Parameters
+* None
+* @return Whether the environment is RTOS supported preemption
+*
+* @par Description
+* Return value is same as "R_OSPL_IS_PREEMPTION" macro.
+*/
+bool_t R_OSPL_IsPreemption(void);
+
+
+/**
+* @brief Initializes the internal of OSPL
+*
+* @param NullConfig Specify NULL
+* @return None
+*
+* @par Description
+* Initializes internal mutual exclusion objects.
+* However, "R_OSPL_Initialize" function does not have to be called for
+* OSPL of "R_OSPL_IS_PREEMPTION = 0".
+* "E_ACCESS_DENIED" error is raised, when the OSPL API that it is
+* necessary to call "R_OSPL_Initialize" before calling the API was called.
+*/
+errnum_t R_OSPL_Initialize( const void *const NullConfig );
+
+
+/* Section: Standard functions */
+/**
+* @brief No operation from C++ specification
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* Compatible with __noop (MS C++). But our naming rule is not match.
+*/
+INLINE void R_NOOP(void) {}
+
+
+/**
+* @brief Returns element count of the array
+*
+* @param Array An array
+* @return Count of specified array's element
+*
+* @par Description
+* Compatible with _countof (MS C++) and ARRAY_SIZE (Linux).
+* But our naming rule is not match.
+*
+* @par Example
+* @code
+* uint32_t array[10];
+* R_COUNT_OF( array ) // = 10
+* @endcode
+*
+* @par Example
+* Array argument must not be specified the pointer using like array.
+* @code
+* uint32_t array[10];
+* func( array );
+*
+* void func( uint32_t array[] ) // "array" is a pointer
+* {
+* R_COUNT_OF( array ) // NG
+* }
+* @endcode
+*/
+/* ->MISRA 19.7 : Cannot function */ /* ->SEC M5.1.3 */
+#define R_COUNT_OF( Array ) ( sizeof( Array ) / sizeof( *(Array) ) )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/* Section: Error handling and debugging (1) */
+
+
+/**
+* @def IF
+* @brief Breaks and transits to error state, if condition expression is not 0
+* @param Condition Condition expression
+* @return None
+*
+* @par Example
+* @code
+* e= TestFunction(); IF(e){goto fin;}
+* @endcode
+*
+* @par Description
+* "IF" is as same as general "if", if "R_OSPL_ERROR_BREAK" macro was
+* defined to be 0. The following descriptions are available,
+* if "R_OSPL_ERROR_BREAK" macro was defined to be 1.
+*
+* "IF" macro supports to find the code raising an error.
+*
+* If the "if statement" that is frequently seen in guard condition and
+* after calling functions was changed to "IF" macro, the CPU breaks
+* at raising an error. Then the status (values of variables) can be
+* looked immediately and the code (call stack) can be looked. Thus,
+* debug work grows in efficiency.
+*
+* "IF" macro promotes recognizing normal code and exceptional code.
+* Reading speed will grow up by skipping exceptional code.
+*
+* Call "R_OSPL_SET_BREAK_ERROR_ID" function, if set to break at the code
+* raising an error.
+*
+* Whether the state was error state or the error raised count is stored
+* in the thread local storage. In Release configuration, the variable
+* of error state and the error raised count is deleted. Manage the error
+* code using auto variable and so on at out of OSPL.
+*
+* The error state is resolved by calling "R_OSPL_CLEAR_ERROR" function.
+* If "R_DEBUG_BREAK_IF_ERROR" macro was called with any error state,
+* the process breaks at the macro.
+*/
+#if R_OSPL_ERROR_BREAK
+
+/* ->MISRA 19.4 : Abnormal termination. Compliant with C language syntax. */ /* ->SEC M1.8.2 */
+#define IF( Condition ) \
+ if ( IS( R_OSPL_OnRaisingErrorForMISRA( \
+ IS( (int_fast32_t)( Condition ) ), __FILE__, __LINE__ ) ) )
+/* (int_fast32_t) cast is for QAC warning of implicit cast unsigned to signed */
+/* != 0 is for QAC warning of MISRA 13.2 Advice */
+/* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
+
+#else /* ! R_OSPL_ERROR_BREAK */
+
+/* ->MISRA 19.4 : Abnormal termination. Compliant with C language syntax. */ /* ->SEC M1.8.2 */
+#define IF if
+/* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
+#endif
+
+
+/**
+* @def IF_D
+* @brief It is same as "IF" (for Debug configuration only)
+* @param Condition Condition expression
+* @return None
+*
+* @par Description
+* In Release configuration, the result of condition expression is always "false".
+* The release configuration is the configuration defined "R_OSPL_NDEBUG".
+*/
+/* ->MISRA 19.4 : Compliant with C language syntax. */ /* ->SEC M1.8.2 */
+/* ->MISRA 19.7 : Cannot function */ /* ->SEC M5.1.3 */
+#ifndef R_OSPL_NDEBUG
+#define IF_D( Condition ) IF ( Condition )
+#else
+#define IF_D( Condition ) if ( false )
+#endif
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
+
+
+/**
+* @def ASSERT_R
+* @brief Assertion (Programming By Contract)
+* @param Condition The condition expression expected true
+* @param goto_fin_Statement The operation doing at condition is false
+* @return None
+*
+* @par Description
+* It is possible to write complex sentence divided by ";" in
+* "goto_fin_Statement" argument.
+*
+* @par - Case of defined "R_OSPL_ERROR_BREAK" to be 0
+* If the result of condition expression is 0(false), do "StatementsForError".
+* If operations did nothing, write "R_NOOP()" at "StatementsForError" argument.
+*
+* @par - Case of defined "R_OSPL_ERROR_BREAK" to be 1
+* If the result of condition expression is 0(false), the error state
+* will become active and the operation of "StatementForError" argument
+* will be done.
+*/
+#ifndef __cplusplus
+#define ASSERT_R( Condition, goto_fin_Statement ) \
+ do{ IF(!(Condition)) { goto_fin_Statement; } } while(0) /* do-while is CERT standard PRE10-C */
+#else
+#define ASSERT_R( Condition, goto_fin_Statement ) \
+ { IF(!(Condition)) { goto_fin_Statement; } } /* no C5236(I) */
+#endif
+
+
+/**
+* @def ASSERT_D
+* @brief Assertion (Programming By Contract) (for Debug configuration only)
+* @param Condition The condition expression expected true
+* @param goto_fin_Statement The operation doing at condition is false
+* @return None
+*
+* @par Description
+* This does nothing in Release configuration.
+* Release configuration is the configuration defined "R_OSPL_NDEBUG"
+* as same as standard library.
+*/
+#ifndef R_OSPL_NDEBUG
+#define ASSERT_D ASSERT_R
+#else
+/* ->MISRA 19.7 : Function's argument can not get "goto_fin_Statement" */ /* ->SEC M5.1.3 */
+#define ASSERT_D( Condition, goto_fin_Statement ) R_NOOP()
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+#endif
+
+
+/**
+* @brief Sub routine of IF macro
+*
+* @param Condition Condition in IF macro
+* @param File File name
+* @param Line Line number
+* @return "Condition" argument
+*
+* @par Description
+* - This part is for compliant to MISRA 2004 - 19.7.
+*/
+bool_t R_OSPL_OnRaisingErrorForMISRA( bool_t const Condition, const char_t *const File,
+ int_t const Line );
+
+
+/***********************************************************************
+* Class: r_ospl_thread_id_t
+************************************************************************/
+
+/**
+* @brief Get running thread ID (for OS less and OS-using environment)
+*
+* @par Parameters
+* None
+* @return The current running thread ID
+*
+* @par Description
+* - It is possible to use this function for both OS less and OS - using environment.
+* For OS less, returns thread ID passed to "R_OSPL_THREAD_SetCurrentId" function.
+* "NULL" is returned, if in interrupt context.
+*/
+r_ospl_thread_id_t R_OSPL_THREAD_GetCurrentId(void);
+
+
+/**
+* @brief Set one or some bits to 1
+*
+* @param ThreadId The thread ID attached the target event
+* @param SetFlags The value of bit flags that target bit is 1
+* @return None
+*
+* @par Description
+* For OS less, there is the area disabled all interrupts.
+*
+* - For OS - using environment, the thread waiting in "R_OSPL_EVENT_Wait"
+* function might wake up soon.
+*
+* Do nothing, when "ThreadId" = "NULL"
+*/
+void R_OSPL_EVENT_Set( r_ospl_thread_id_t const ThreadId, bit_flags32_t const SetFlags );
+
+
+/**
+* @brief Set one or some bits to 0
+*
+* @param ThreadId The thread ID attached the target event
+* @param ClearFlags1 The value of bit flags that clearing bit is 1
+* @return None
+*
+* @par Description
+* It is not necessary to call this function after called "R_OSPL_EVENT_Wait"
+* function.
+*
+* The way that all bit flags is cleared is setting "R_OSPL_EVENT_ALL_BITS"
+* (=0x0000FFFF) at "ClearFlags1" argument.
+*
+* When other thread was nofied by calling "R_OSPL_EVENT_Set", "R_OSPL_EVENT_Clear"
+* must not be called from caller (notifier) thread.
+*
+* For OS less, there is the area disabled all interrupts.
+*
+* Do nothing, when "ThreadId" = "NULL"
+*/
+void R_OSPL_EVENT_Clear( r_ospl_thread_id_t const ThreadId, bit_flags32_t const ClearFlags1 );
+
+
+/**
+* @brief Get 16bit flags value
+*
+* @param ThreadId The thread ID attached the target event
+* @return The value of 16bit flags
+*
+* @par Description
+* This API cannot be used in newest specification.
+*
+* In receiving the event, call "R_OSPL_EVENT_Wait" function instead of
+* "R_OSPL_EVENT_Get" function or call "R_OSPL_EVENT_Clear" function
+* passed the NOT operated value of flags got by "R_OSPL_EVENT_Get" function.
+*/
+#if ( ! defined( osCMSIS ) || osCMSIS <= 0x10001 ) && R_OSPL_VERSION < 85
+bit_flags32_t R_OSPL_EVENT_Get( r_ospl_thread_id_t const ThreadId );
+#endif
+
+
+/**
+* @brief Waits for setting the flags in 16bit and clear received flags
+*
+* @param WaigingFlags The bit flags set to 1 waiting or "R_OSPL_ANY_FLAG"
+* @param out_GotFlags NULL is permitted. Output: 16 bit flags or "R_OSPL_TIMEOUT"
+* @param Timeout_msec Time out (millisecond) or "R_OSPL_INFINITE"
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* Waits in this function until the flags become passed flags pattern
+* by "R_OSPL_EVENT_Set" function.
+*
+* Check "r_ospl_async_t::ReturnValue", when the asynchronous operation
+* was ended.
+*/
+errnum_t R_OSPL_EVENT_Wait( bit_flags32_t const WaigingFlags, bit_flags32_t *const out_GotFlags,
+ uint32_t const Timeout_msec );
+/* Unsigned flag (bit_flags32_t) is for QAC 4130 */
+
+
+/***********************************************************************
+* Class: r_ospl_flag32_t
+************************************************************************/
+
+/**
+* @brief Clears all flags in 32bit to 0
+*
+* @param self The value of 32bit flags
+* @return None
+*
+* @par Description
+* Operates following operation.
+* @code
+* volatile bit_flags32_t self->flags;
+* self->flags = 0;
+* @endcode
+*/
+void R_OSPL_FLAG32_InitConst( volatile r_ospl_flag32_t *const self );
+
+
+/**
+* @brief Set one or some bits to 1
+*
+* @param self The value of 32bit flags
+* @param SetFlags The value of bit flags that target bit is 1
+* @return None
+*
+* @par Description
+* Operates following operation.
+* @code
+* volatile bit_flags32_t self->Flags;
+* bit_flags32_t SetFlags;
+* self->Flags |= SetFlags;
+* @endcode
+* This function is not atomic because "|=" operator is "Read Modify Write" operation.
+*/
+void R_OSPL_FLAG32_Set( volatile r_ospl_flag32_t *const self, bit_flags32_t const SetFlags );
+
+
+/**
+* @brief Set one or some bits to 0
+*
+* @param self The value of 32bit flags
+* @param ClearFlags1 The value of bit flags that clearing bit is 1
+* @return None
+*
+* @par Description
+* Operates following operation.
+* @code
+* volatile bit_flags32_t self->Flags;
+* bit_flags32_t ClearFlags1;
+*
+* self->Flags &= ~ClearFlags1;
+* @endcode
+*
+* Set "R_OSPL_FLAG32_ALL_BITS", if you wanted to clear all bits.
+*
+* This function is not atomic because "&=" operator is "Read Modify Write" operation.
+*/
+void R_OSPL_FLAG32_Clear( volatile r_ospl_flag32_t *const self, bit_flags32_t const ClearFlags1 );
+
+
+/**
+* @brief Get 32bit flags value
+*
+* @param self The value of 32bit flags
+* @return The value of 32bit flags
+*
+* @par Description
+* In receiving the event, call "R_OSPL_FLAG32_GetAndClear" function
+* instead of "R_OSPL_FLAG32_Get" function or call "R_OSPL_FLAG32_Clear"
+* function passed the NOT operated value of flags got by "R_OSPL_FLAG32_Get"
+* function.
+*
+* @code
+* Operates following operation.
+* volatile bit_flags32_t self->Flags;
+* bit_flags32_t return_flags;
+*
+* return_flags = self->Flags;
+*
+* return return_flags;
+* @endcode
+*/
+bit_flags32_t R_OSPL_FLAG32_Get( volatile const r_ospl_flag32_t *const self );
+
+
+/**
+* @brief Get 32bit flags value
+*
+* @param self The value of 32bit flags
+* @return The value of 32bit flags
+*
+* @par Description
+* Operates following operation.
+* @code
+* volatile bit_flags32_t self->Flags;
+* bit_flags32_t return_flags;
+*
+* return_flags = self->Flags;
+* self->Flags = 0;
+*
+* return return_flags;
+* @endcode
+*
+* This function is not atomic because the value might be set before clearing to 0.
+*/
+bit_flags32_t R_OSPL_FLAG32_GetAndClear( volatile r_ospl_flag32_t *const self );
+
+
+/***********************************************************************
+* Class: r_ospl_queue_t
+************************************************************************/
+
+/**
+* @brief Initializes a queue
+*
+* @param out_self Output: Address of initialized queue object
+* @param QueueDefine Initial attributes of queue and work area
+* @return Error code. If there is no error, the return value is 0
+*
+* @par Description
+* It is not possible to call this function from the library.
+* This function is called from porting layer of the driver and send
+* created queue to the driver.
+*
+* OSPL does not have finalizing function (portabled with CMSIS).
+* An object specified "QueueDefine" argument can be specified to the
+* create function 1 times only. Some OS does not have this limitation.
+*
+* The address of a variable as "r_ospl_queue_t*" type is set at
+* "out_self" argument.
+* Internal variables of the queue are stored in the variable specified
+* with "QueueDefine" argument.
+*/
+errnum_t R_OSPL_QUEUE_Create( r_ospl_queue_t **out_self, r_ospl_queue_def_t *QueueDefine );
+
+
+/**
+* @brief Gets status of the queue
+*
+* @param self A queue object
+* @param out_Status Output: Pointer to the status structure
+* @return Error code. If there is no error, the return value is 0
+*
+* @par Description
+* Got status are the information at calling moment.
+* If ohter threads were run, the status will be changed.
+* See "R_DRIVER_GetAsyncStatus" function about pointer type of
+* "out_Status" argument
+*/
+errnum_t R_OSPL_QUEUE_GetStatus( r_ospl_queue_t *self, const r_ospl_queue_status_t **out_Status );
+
+
+/**
+* @brief Allocates an element from the queue object
+*
+* @param self A queue object
+* @param out_Address Output: Address of allocated element
+* @param Timeout_msec Timeout (msec) or R_OSPL_INFINITE
+* @return Error code. If there is no error, the return value is 0
+*
+* @par Description
+* An error will be raised, if "Timeout_msec != 0" in interrupt context.
+* It becomes "*out_Address = NULL", when it was timeout and
+* "Timeout_msec = 0".
+* E_TIME_OUT error is raised, when it was timeout and "Timeout_msec != 0".
+*/
+errnum_t R_OSPL_QUEUE_Allocate( r_ospl_queue_t *self, void *out_Address, uint32_t Timeout_msec );
+
+
+/**
+* @brief Sends the element to the queue
+*
+* @param self A queue object
+* @param Address Address of element to put
+* @return Error code. If there is no error, the return value is 0
+*
+* @par Description
+* It is correct, even if other thread put to the queue or get from
+* the queue from calling "R_OSPL_QUEUE_Allocate" to calling
+* "R_OSPL_QUEUE_Put".
+*
+* The message put to the queue by this function receives the thread
+* calling "R_OSPL_QUEUE_Get" function.
+*/
+errnum_t R_OSPL_QUEUE_Put( r_ospl_queue_t *self, void *Address );
+
+
+/**
+* @brief Receives the element from the queue
+*
+* @param self A queue object
+* @param out_Address Output: Address of received element
+* @param Timeout_msec Timeout (msec) or R_OSPL_INFINITE
+* @return Error code. If there is no error, the return value is 0
+*
+* @par Description
+* Call "R_OSPL_QUEUE_Free" function after finishing to access to
+* the element. Don't access the memory area of the element after
+* calling "R_OSPL_QUEUE_Free".
+*
+* "E_NOT_THREAD" error is raised, if "Timeout_msec = 0" was specified
+* from interrupt context. It is not possible to wait for put data to
+* the queue in interrupt context.
+*
+* "*out_Address" is NULL and any errors are not raised, if it becomed
+* to timeout and "Timeout_msec = 0". "E_TIME_OUT" is raised,
+* if "Timeout_msec != 0".
+*
+* Specify "Timeout_msec = 0", call the following functions by the following
+* order and use an event for preventing to block to receive other events
+* by the thread having waited for the queue.
+*
+* Sending Side
+* - R_OSPL_QUEUE_Allocate
+* - R_OSPL_QUEUE_Put
+* - R_OSPL_EVENT_Set
+*
+* Receiving Side
+* - R_OSPL_EVENT_Wait
+* - R_OSPL_QUEUE_Get
+* - R_OSPL_QUEUE_Free
+*
+* In OS less environment, "R_OSPL_QUEUE_Get" supports pseudo multi
+* threading. See "R_OSPL_THREAD_GetIsWaiting" function.
+*/
+errnum_t R_OSPL_QUEUE_Get( r_ospl_queue_t *self, void *out_Address, uint32_t Timeout_msec );
+
+
+/**
+* @brief Releases the element to the queue object
+*
+* @param self A queue object
+* @param Address Address of received element
+* @return Error code. If there is no error, the return value is 0
+*
+* @par Description
+* It is correct, even if other thread put to the queue or get from
+* the queue from calling "R_OSPL_QUEUE_Get" to calling "R_OSPL_QUEUE_Free".
+*/
+errnum_t R_OSPL_QUEUE_Free( r_ospl_queue_t *self, void *Address );
+
+
+/**
+* @brief Print status of the queue object
+*
+* @param self A queue object
+* @return Error code. If there is no error, the return value is 0
+*/
+#ifndef R_OSPL_NDEBUG
+errnum_t R_OSPL_QUEUE_Print( r_ospl_queue_t *self );
+#endif
+
+
+/***********************************************************************
+* Class: r_ospl_async_t
+************************************************************************/
+
+/**
+* @brief CopyExceptAThread
+*
+* @param Source Source
+* @param Destination Destination
+* @return None
+*/
+void R_OSPL_ASYNC_CopyExceptAThread( const r_ospl_async_t *const Source,
+ r_ospl_async_t *const Destination );
+
+
+/***********************************************************************
+* Class: r_ospl_caller_t
+************************************************************************/
+
+/**
+* @brief Calls the interrupt callback function. It is called from OS porting layer in the driver
+*
+* @param self The internal parameters about interrupt operations
+* @param InterruptSource The source of the interrupt
+* @return None
+*/
+void R_OSPL_CallInterruptCallback( const r_ospl_caller_t *const self,
+ const r_ospl_interrupt_t *const InterruptSource );
+
+
+/**
+* @brief Initialize <r_ospl_caller_t>.
+*
+* @param self The internal parameters about interrupt operations
+* @param Async <r_ospl_async_t>
+* @return None
+*/
+void R_OSPL_CALLER_Initialize( r_ospl_caller_t *const self, r_ospl_async_t *const Async,
+ volatile void *const PointerToState, int_t const StateValueOfOnInterrupting,
+ void *const I_Lock, const r_ospl_i_lock_vtable_t *const I_LockVTable );
+
+
+/**
+* @brief GetRootChannelNum.
+*
+* @param self The internal parameters about interrupt operations
+* @return RootChannelNum
+*/
+INLINE int_fast32_t R_OSPL_CALLER_GetRootChannelNum( const r_ospl_caller_t *const self );
+
+
+/* Section: Interrupt */
+/**
+* @brief Interrupt callback function for unregisterd interrupt.
+*
+* @param int_sense (See INTC driver)
+* @return None
+*/
+void R_OSPL_OnInterruptForUnregistered( uint32_t const int_sense );
+
+
+/**
+* @brief Releases all disabled interrupts
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* Driver user should not call this function.
+* Call this function at the end of area of all interrupts disabled.
+* Do not release, if all interrupts was already disabled by caller function.
+* This function does not release disabled NMI.
+*/
+void R_OSPL_EnableAllInterrupt(void);
+
+
+/**
+* @brief Disables all interrupts
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* Driver user should not call this function.
+* Call this function at begin of area of all interrupts disabled.
+* This function does not disable NMI.
+*
+* @par Example
+* @code
+* void Func()
+* {
+* bool_t was_all_enabled = false;
+*
+* was_all_enabled = R_OSPL_DisableAllInterrupt();
+*
+* // All interrupt disabled
+*
+* if ( was_all_enabled )
+* { R_OSPL_EnableAllInterrupt(); }
+* }
+* @endcode
+*/
+bool_t R_OSPL_DisableAllInterrupt(void);
+
+
+/**
+* @brief Sets the priority of the interrupt line.
+*
+* @param IRQ_Num Interrupt request number
+* @param Priority Priority. The less the prior.
+* @return Error code. If there is no error, the return value is 0
+*/
+errnum_t R_OSPL_SetInterruptPriority( bsp_int_src_t const IRQ_Num, int_fast32_t const Priority );
+
+
+/* Section: Locking channel */
+/**
+* @brief Locks by channel number.
+*
+* @param ChannelNum Locking channel number or "R_OSPL_UNLOCKED_CHANNEL"
+* @param out_ChannelNum Output: Locked channel number, (in) NULL is permitted
+* @param HardwareIndexMin Hardware index of channel number = 0
+* @param HardwareIndexMax Hardware index of max channel number
+* @return Error code. If there is no error, the return value is 0
+*
+* @par Description
+* This function is called from the internal of "R_DRIVER_Initialize"
+* function or "R_DRIVER_LockChannel" function.
+* This function calls "R_BSP_HardwareLock".
+*/
+errnum_t R_OSPL_LockChannel( int_fast32_t ChannelNum, int_fast32_t *out_ChannelNum,
+ mcu_lock_t HardwareIndexMin, mcu_lock_t HardwareIndexMax );
+
+
+/**
+* @brief Unlocks by channel number.
+*
+* @param ChannelNum Channel number
+* @param e Raising error code, If there is no error, 0
+* @param HardwareIndexMin Hardware index of channel number = 0
+* @param HardwareIndexMax Hardware index of max channel number
+* @return Error code. If there is no error, the return value is 0
+*
+* @par Description
+* This function is called from the internal of "R_DRIVER_Finalize"
+* function or "R_DRIVER_UnlockChannel" function.
+* This function calls "R_BSP_HardwareUnlock".
+*/
+errnum_t R_OSPL_UnlockChannel( int_fast32_t ChannelNum, errnum_t e,
+ mcu_lock_t HardwareIndexMin, mcu_lock_t HardwareIndexMax );
+
+
+/***********************************************************************
+* Class: r_ospl_c_lock_t
+************************************************************************/
+
+/**
+* @brief Initializes the C-lock object
+*
+* @param self C-lock object
+* @return None
+*
+* @par Description
+* If *self is global variable or static variable initialized 0,
+* this function does not have to be called.
+*/
+void R_OSPL_C_LOCK_InitConst( r_ospl_c_lock_t *const self );
+
+
+/**
+* @brief Locks the target, if lockable state.
+*
+* @param self C-lock object
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* Even if lock owner called this function, if lock object was already
+* locked, E_ACCESS_DENIED error is raised.
+*
+* "R_OSPL_C_LOCK_Lock" does not do exclusive control.
+*/
+errnum_t R_OSPL_C_LOCK_Lock( r_ospl_c_lock_t *const self );
+
+
+/**
+* @brief Unlocks the target.
+*
+* @param self C-lock object
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* If this function was called with unlocked object, this function
+* does nothing and raises "E_ACCESS_DENIED" error.
+*
+* If self == NULL, this function does nothing and raises no error.
+* E_NOT_THREAD error is raised, if this function was called from the
+* interrupt context.
+*
+* - I - lock does not do in this function.
+*
+* "R_OSPL_C_LOCK_Unlock" does not do exclusive control.
+*/
+errnum_t R_OSPL_C_LOCK_Unlock( r_ospl_c_lock_t *const self );
+
+
+/***********************************************************************
+* Class: r_ospl_i_lock_vtable_t
+************************************************************************/
+
+/**
+* @brief Do nothing. This is registered to r_ospl_i_lock_vtable_t::Lock.
+*
+* @param self_ I-lock object
+* @return false
+*/
+bool_t R_OSPL_I_LOCK_LockStub( void *const self_ );
+
+
+/**
+* @brief Do nothing. This is registered to r_ospl_i_lock_vtable_t::Unlock.
+*
+* @param self_ I-lock object
+* @return None
+*/
+void R_OSPL_I_LOCK_UnlockStub( void *const self_ );
+
+
+/**
+* @brief Do nothing. This is registered to r_ospl_i_lock_vtable_t::RequestFinalize.
+*
+* @param self_ I-lock object
+* @return None
+*/
+void R_OSPL_I_LOCK_RequestFinalizeStub( void *const self_ );
+
+
+/**
+* @brief Get root channel number
+*
+* @param self <r_ospl_caller_t> object
+* @return Root channel number
+*/
+INLINE int_fast32_t R_OSPL_CALLER_GetRootChannelNum( const r_ospl_caller_t *const self )
+{
+ int_fast32_t root_channel_num;
+
+ IF_DQ( self == NULL ) {
+ root_channel_num = 0;
+ }
+ else {
+ root_channel_num = self->I_LockVTable->GetRootChannelNum( self->I_Lock );
+ }
+
+ return root_channel_num;
+}
+
+
+/* Section: Memory Operation */
+/**
+* @brief Flushes cache memory
+*
+* @param FlushType The operation of flush
+* @return None
+*
+* @par Description
+* Call the function of the driver after flushing input output buffer
+* in the cache memory, If the data area accessing by the hardware is
+* on cache and the driver did not manage the cache memory.
+* Whether the driver manages the cache memory is depend on the driver
+* specification.
+*/
+void R_OSPL_MEMORY_Flush( r_ospl_flush_t const FlushType );
+
+
+/**
+* @brief Flushes cache memory with the range of virtual address.
+*
+* @param FlushType The operation of flush
+* @return None
+*
+* @par Description
+* Align "StartAddress" argument and "Length" argument to cache line size.
+* If not aligned, E_OTHERS error is raised.
+* Refer to : R_OSPL_MEMORY_GetSpecification
+*
+* If the data area written by the hardware and read from CPU was in cache
+* rea, when the hardware started without invalidate
+* ("R_OSPL_FLUSH_WRITEBACK_INVALIDATE" or "R_OSPL_FLUSH_INVALIDATE"),
+* invalidate the data area and read it after finished to write by hardware.
+* (If the driver does not manage the cache memory.)
+*/
+errnum_t R_OSPL_MEMORY_RangeFlush( r_ospl_flush_t const FlushType,
+ const void *const StartAddress, size_t const Length );
+
+
+/**
+* @brief Gets the specification about memory and cache memory.
+*
+* @param out_MemorySpec The specification about memory and cache memory
+* @return None
+*/
+void R_OSPL_MEMORY_GetSpecification( r_ospl_memory_spec_t *const out_MemorySpec );
+
+
+/**
+* @brief Set a memory barrier.
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* In ARM, This function calls DSB assembler operation.
+* This effects to L1 cache only.
+*/
+void R_OSPL_MEMORY_Barrier(void);
+
+
+/**
+* @brief Set a instruction barrier.
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* In ARM, This function calls ISB assembler operation.
+*/
+void R_OSPL_InstructionSyncBarrier(void);
+
+
+/**
+* @brief Changes to physical address
+*
+* @param Address Virtual address
+* @param out_PhysicalAddress Output: Physical address
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* This function must be modified by MMU setting.
+*/
+errnum_t R_OSPL_ToPhysicalAddress( const volatile void *const Address, uintptr_t *const out_PhysicalAddress );
+
+
+/**
+* @brief Changes to the address in the L1 cache area
+*
+* @param Address Virtual address
+* @param out_CachedAddress Output: Virtual address for cached area
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* This function must be modified by MMU setting.
+*/
+errnum_t R_OSPL_ToCachedAddress( const volatile void *const Address, void *const out_CachedAddress );
+
+
+/**
+* @brief Changes to the address in the L1 uncached area
+*
+* @param Address Virtual address
+* @param out_UncachedAddress Output: Virtual address for uncached area
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* This function must be modified by MMU setting.
+*/
+errnum_t R_OSPL_ToUncachedAddress( const volatile void *const Address, void *const out_UncachedAddress );
+
+
+/**
+* @brief Gets the level of cache for flushing the memory indicated by the address.
+*
+* @param Address The address in flushing memory
+* @param out_Level Output: 0=Not need to flush, 1=L1 cache only, 2=both of L1 and L2 cache
+* @return Error code. If there is no error, the return value is 0.
+*/
+errnum_t R_OSPL_MEMORY_GetLevelOfFlush( const void *Address, int_fast32_t *out_Level );
+
+
+/**
+* @brief Get 2nd cache attribute of AXI bus for peripheral (not CPU) from physical address.
+*
+* @param PhysicalAddress The physical address in the memory area
+* @param out_CacheAttribute Output: Cache_attribute, AWCACHE[3:0], ARCACHE[3:0]
+* @return Error code. If there is no error, the return value is 0.
+*/
+errnum_t R_OSPL_AXI_Get2ndCacheAttribute( uintptr_t const PhysicalAddress,
+ r_ospl_axi_cache_attribute_t *const out_CacheAttribute );
+
+
+/**
+* @brief Gets protection attribute of AXI bus from the address
+*
+* @param PhysicalAddress The physical address in the memory area
+* @param out_CacheAttribute Output: The protection attribute of AXI bus AWPROT[2:0], ARPROT[2:0]
+* @return Error code. If there is no error, the return value is 0.
+*/
+errnum_t R_OSPL_AXI_GetProtection( uintptr_t const physical_address,
+ r_ospl_axi_protection_t *const out_protection );
+
+
+/* Section: Timer */
+/**
+* @brief Waits for a while until passed time
+*
+* @param DelayTime_msec Time of waiting (millisecond)
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* Maximum value is "R_OSPL_MAX_TIME_OUT" (=65533).
+*/
+errnum_t R_OSPL_Delay( uint32_t const DelayTime_msec );
+
+
+/**
+* @brief Set up the free running timer
+*
+* @param out_Specification NULL is permitted. Output: The precision of the free run timer
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* The free running timer does not stop.
+*
+* If the counter of the free running timer was overflow, the counter returns to 0.
+* Even in interrupt handler, the counter does count up.
+* OSPL free running timer does not use any interrupt.
+*
+* Using timer can be selected by "R_OSPL_FTIMER_IS" macro.
+*
+* If the free running timer was already set up, this function does not set up it,
+* outputs to "out_Specification" argument and does not raise any error.
+*
+* When OSPL API function with timeout or "R_OSPL_Delay" function was called,
+* "R_OSPL_FTIMER_InitializeIfNot" function is callbacked from these functions.
+*
+* There is all interrupt disabled area inside.
+*/
+errnum_t R_OSPL_FTIMER_InitializeIfNot( r_ospl_ftimer_spec_t *const out_Specification );
+
+
+/**
+* @brief Gets the specification of free running timer.
+*
+* @param out_Specification Output: The precision of the free run timer
+* @return None
+*/
+void R_OSPL_FTIMER_GetSpecification( r_ospl_ftimer_spec_t *const out_Specification );
+
+
+/**
+* @brief Get current time of free running timer.
+*
+* @par Parameters
+* None
+* @return The current clock count of free run timer
+*
+* @par Description
+* Call "R_OSPL_FTIMER_InitializeIfNot" function before calling this function.
+* Call "R_OSPL_FTIMER_IsPast" function, when it is determined whether time passed.
+*
+* @par Example
+* @code
+* errnum_t e;
+* r_ospl_ftimer_spec_t ts;
+* uint32_t start;
+* uint32_t end;
+*
+* e= R_OSPL_FTIMER_InitializeIfNot( &ts ); IF(e){goto fin;}
+* start = R_OSPL_FTIMER_Get();
+*
+* // The section of measuring
+*
+* end = R_OSPL_FTIMER_Get();
+* printf( "%d msec\n", R_OSPL_FTIMER_CountToTime(
+* &ts, end - start ) );
+* @endcode
+*/
+uint32_t R_OSPL_FTIMER_Get(void);
+
+
+/**
+* @brief Returns whether specified time was passed
+*
+* @param ts Precision of the free running timer
+* @param Now Count of current time
+* @param TargetTime Count of target time
+* @param out_IsPast Output: Whether the target time was past or not
+* @return Error code. If there is no error, the return value is 0.
+*/
+errnum_t R_OSPL_FTIMER_IsPast( const r_ospl_ftimer_spec_t *const ts,
+ uint32_t const Now, uint32_t const TargetTime, bool_t *const out_IsPast );
+
+
+/**
+* @brief Change from mili-second unit to free running timer unit
+*
+* @param ts Precision of the free running timer
+* @param msec The value of mili-second unit
+* @return The value of free running timer unit
+*
+* @par Description
+* The fractional part is been round up. (For waiting time must be more
+* than specified time.)
+*
+* This function calculates like the following formula.
+* @code
+* ( msec * ts->msec_Denominator + ts->msec_Numerator - 1 ) / ts->msec_Numerator
+* @endcode
+*
+* - Attention: If "ts - >msec_Denominator" was more than "ts->msec_Numerator",
+* take care of overflow.
+*/
+INLINE uint32_t R_OSPL_FTIMER_TimeToCount( const r_ospl_ftimer_spec_t *const ts,
+ uint32_t const msec )
+{
+ uint32_t count;
+
+ IF_DQ( ts == NULL ) {
+ count = 0;
+ }
+ else {
+ count = ( ((msec * ts->msec_Denominator) + ts->msec_Numerator) - 1u ) / ts->msec_Numerator;
+ }
+ return count;
+}
+
+
+/**
+* @brief Change from free running timer unit to mili-second unit
+*
+* @param ts Precision of the free running timer
+* @param Count The value of free running timer unit
+* @return The value of mili-second unit
+*
+* @par Description
+* The fractional part is been round down. (Because overflow does not
+* occur, when "Count = r_ospl_ftimer_spec_t::MaxCount" )
+*
+* This function calculates like the following formula.
+* @code
+* ( Count * ts->msec_Numerator ) / ts->msec_Denominator
+* @endcode
+*/
+INLINE uint32_t R_OSPL_FTIMER_CountToTime( const r_ospl_ftimer_spec_t *const ts,
+ uint32_t const Count )
+{
+ uint32_t time;
+
+ IF_DQ( ts == NULL ) {
+ time = 0;
+ }
+ else {
+ time = ( Count * ts->msec_Numerator ) / ts->msec_Denominator;
+ }
+ return time;
+}
+
+
+/***********************************************************************
+* Class: r_ospl_table_t
+************************************************************************/
+
+/**
+* @brief Initializes an index table
+*
+* @param self Index table object
+* @param Area First address of the index table
+* @param AreaByteSize Size of the index table. See <R_OSPL_TABLE_SIZE>
+* @param Is_T_Lock Whether to call <R_OSPL_Start_T_Lock>
+* @return None
+*/
+void R_OSPL_TABLE_InitConst( r_ospl_table_t *const self,
+ void *const Area, size_t const AreaByteSize, bool_t const Is_T_Lock );
+
+
+/**
+* @brief Returns index from related key
+*
+* @param self Index table object
+* @param Key Key number
+* @param out_Index Output: Related index
+* @param TypeOfIfNot Behavior when key was not registerd. See <r_ospl_if_not_t>
+* @return Error code. If there is no error, the return value is 0.
+*/
+errnum_t R_OSPL_TABLE_GetIndex( r_ospl_table_t *const self, const void *const Key,
+ int_fast32_t *const out_Index, r_ospl_if_not_t const TypeOfIfNot );
+
+
+/**
+* @brief Separates relationship of specified key and related index
+*
+* @param self Index table object
+* @param Key Key number
+* @return None
+*
+* @par Description
+* Error is not raised, even if specified key was already separated.
+*/
+void R_OSPL_TABLE_Free( r_ospl_table_t *const self, const void *const Key );
+
+
+/**
+* @brief Print status of specified index table object (for debug)
+*
+* @param self Index table object
+* @return None
+*/
+#if R_OSPL_DEBUG_TOOL
+void R_OSPL_TABLE_Print( r_ospl_table_t *const self );
+#endif
+
+
+/* Section: Bit flags */
+/**
+* @brief Evaluate whether any passed bits are 1 or not
+*
+* @param Variable The value of target bit flags
+* @param ConstValue The value that investigating bits are 1
+* @return Whether the any passed bit are 1
+*/
+/* ->MISRA 19.7 : For return _Bool type */ /* ->SEC M5.1.3 */
+#define IS_BIT_SET( Variable, ConstValue ) \
+ ( BIT_And_Sub( Variable, ConstValue ) != 0u )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @brief Evaluate whether any passed bits are 1 or not
+*
+* @param Variable The value of target bit flags
+* @param OrConstValue The value that investigating bits are 1
+* @return Whether the any passed bit are 1
+*/
+/* ->MISRA 19.7 : For return _Bool type */ /* ->SEC M5.1.3 */
+#define IS_ANY_BITS_SET( Variable, OrConstValue ) \
+ ( BIT_And_Sub( Variable, OrConstValue ) != 0u )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @brief Evaluate whether all passed bits are 1 or not
+*
+* @param Variable The value of target bit flags
+* @param OrConstValue The value that investigating bits are 1
+* @return Whether the all passed bit are 1
+*/
+/* ->MISRA 19.7 : For return _Bool type */ /* ->SEC M5.1.3 */
+#define IS_ALL_BITS_SET( Variable, OrConstValue ) \
+ ( BIT_And_Sub( Variable, OrConstValue ) == (OrConstValue) )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @brief Evaluate whether the passed bit is 0 or not
+*
+* @param Variable The value of target bit flags
+* @param ConstValue The value that investigating bit is 1
+* @return Whether the passed bit is 0
+*/
+/* ->MISRA 19.7 : For return _Bool type */ /* ->SEC M5.1.3 */
+#define IS_BIT_NOT_SET( Variable, ConstValue ) \
+ ( BIT_And_Sub( Variable, ConstValue ) == 0u )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @brief Evaluate whether any passed bits are 0 or not
+*
+* @param Variable The value of target bit flags
+* @param OrConstValue The value that investigating bits are 1
+* @return Whether the any passed bit are 0
+*/
+/* ->MISRA 19.7 : For return _Bool type */ /* ->SEC M5.1.3 */
+#define IS_ANY_BITS_NOT_SET( Variable, OrConstValue ) \
+ ( BIT_And_Sub( Variable, OrConstValue ) != (OrConstValue) )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @brief Evaluate whether all passed bits are 0 or not
+*
+* @param Variable The value of target bit flags
+* @param OrConstValue The value that investigating bits are 1
+* @return Whether the all passed bit are 0
+*/
+/* ->MISRA 19.7 : For return _Bool type */ /* ->SEC M5.1.3 */
+#define IS_ALL_BITS_NOT_SET( Variable, OrConstValue ) \
+ ( BIT_And_Sub( Variable, OrConstValue ) == 0u )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @brief Sub routine of bitwise operation
+*
+* @param Variable The value of target bit flags
+* @param ConstValue The value that investigating bits are 1
+* @return Whether the all passed bit are 0
+*
+* @par Description
+* - This part is for compliant to MISRA 2004 - 19.7.
+*/
+INLINE uint_fast32_t BIT_And_Sub( bit_flags_fast32_t const Variable,
+ bit_flags_fast32_t const ConstValue )
+{
+ return ((Variable) & (ConstValue));
+}
+
+
+/***********************************************************************
+* About: IS_BIT_SET__Warning
+*
+* - This is for QAC-3344 warning : MISRA 13.2 Advice : Tests of a value against
+* zero should be made explicit, unless the operand is effectively Boolean.
+* - This is for QAC-1253 warning : SEC M1.2.2 : A "U" suffix shall be applied
+* to all constants of unsigned type.
+************************************************************************/
+
+
+/* Section: Error handling and debugging (2) */
+/**
+* @brief Breaks here
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* Does break by calling "R_DebugBreak" function.
+* This macro is not influenced the setting of "R_OSPL_ERROR_BREAK" macro.
+*/
+#define R_DEBUG_BREAK() R_DebugBreak(__FILE__,__LINE__)
+
+
+/**
+* @brief The function callbacked from OSPL for breaking
+*
+* @param Variable The value of target bit flags
+* @param ConstValue The value that investigating bits are 1
+* @return Whether the all passed bit are 0
+*
+* @par Description
+* Set a break point at this function.
+* In Release configuration, "File = NULL, Line = 0".
+* If "File = NULL", "Line" argument is error code.
+* This function can be customized by application developer.
+*/
+void R_DebugBreak( const char_t *const File, int_fast32_t const Line );
+
+
+/**
+* @brief Breaks here, if it is error state
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* This function does nothing, if "R_OSPL_ERROR_BREAK" macro was defined
+* to be 0. The following descriptions are available, if "R_OSPL_ERROR_BREAK"
+* macro was defined to be 1.
+*
+* Checks the error state of the current thread.
+* Call this macro from the last of each thread.
+* Does break by calling "R_DebugBreak" function.
+*
+* If an error was raised, this function calls "printf" with following message.
+* Set "error_ID" to "R_OSPL_SET_BREAK_ERROR_ID"
+* @code
+* <ERROR error_ID="0x1" file="../src/api.c(336)"/>
+* @endcode
+*/
+#if R_OSPL_ERROR_BREAK
+#define R_DEBUG_BREAK_IF_ERROR() R_OSPL_DebugBreakIfError(__FILE__,__LINE__)
+void R_OSPL_DebugBreakIfError( const char_t *const File, int_fast32_t const Line );
+#else
+INLINE void R_DEBUG_BREAK_IF_ERROR(void) {}
+#endif
+
+
+/**
+* @brief Raises the error of system unrecoverable
+*
+* @param e Error code
+* @return None
+*
+* @par Description
+* The error of system unrecoverable is the error of impossible to
+* - self - recover by process or main system. Example, the heap area was
+* broken or there are not any responses from hardware. This error can
+* be recoverable by OS or the system controller(e.g. Software reset)
+*
+* Example, when an error of recovery process was raised,
+* "R_OSPL_RaiseUnrecoverable" function must be called.
+*
+* "R_OSPL_RaiseUnrecoverable" function can be customized by the
+* application. By default, it calls "R_DebugBreak" function and falls
+* into the infinite loop.
+*/
+void R_OSPL_RaiseUnrecoverable( errnum_t const e );
+
+
+/**
+* @brief Merge the error code raised in the finalizing operation
+*
+* @param CurrentError Current error code
+* @param AppendError New append error code
+* @return Merged error code
+*
+* @par Description
+* When the state was error state, if other new error was raised,
+* new error code is ignored.
+* - If "CurrentError != 0", this function returns "CurrentError" argument.
+* - If "CurrentError == 0", this function returns "AppendError" argument.
+*
+* This function can be modify by user.
+*
+* @par Example
+* @code
+* ee= Sample();
+* e= R_OSPL_MergeErrNum( e, ee );
+* return e;
+* @endcode
+*/
+INLINE errnum_t R_OSPL_MergeErrNum( errnum_t const CurrentError, errnum_t const AppendError )
+{
+ errnum_t e;
+
+ if ( CurrentError != 0 ) {
+ e = CurrentError;
+ } else {
+ e = AppendError;
+ }
+ return e;
+}
+
+
+/**
+* @brief Sets an error code to TLS (Thread Local Storage).
+*
+* @param e Raising error code
+* @return None
+*
+* @par Description
+* Usually error code is returned. If API function cannot return any
+* error code, API function can have the specification of setting error
+* code by "R_OSPL_SetErrNum".
+*
+* There is this function, if "R_OSPL_TLS_ERROR_CODE" macro was defined
+* to be 1.
+* This function does nothing, if any error code was stored already in TLS.
+* The state does not change to error state, if "R_OSPL_SetErrNum" function
+* was called only. See "R_OSPL_GET_ERROR_ID".
+*/
+#if R_OSPL_TLS_ERROR_CODE
+void R_OSPL_SetErrNum( errnum_t const e );
+#endif
+
+
+/**
+* @brief Returns the error code from TLS (Thread Local Storage).
+*
+* @par Parameters
+* None
+* @return Error code
+*
+* @par Description
+* Usually error code is returned. If API function cannot return any
+* error code, API function may have the specification of getting error
+* code by "R_OSPL_GetErrNum".
+*
+* There is this function, if "R_OSPL_TLS_ERROR_CODE" macro was defined
+* to be 1. This function returns 0 after called "R_OSPL_CLEAR_ERROR"
+* function.
+*/
+#if R_OSPL_TLS_ERROR_CODE
+errnum_t R_OSPL_GetErrNum(void);
+#endif
+
+
+/**
+* @brief Clears the error state
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* This function does nothing, if "R_OSPL_ERROR_BREAK" macro and
+* "R_OSPL_TLS_ERROR_CODE" macro were defined to be 0. The following
+* descriptions are available, if "R_OSPL_ERROR_BREAK" macro was
+* defined to be 1.
+*
+* Whether the state is the error state is stored in thread local
+* storage. "R_OSPL_GetErrNum" function returns 0 after called this
+* function.
+*
+* If the error state was not cleared, the following descriptions were caused.
+* - Breaks at "R_DEBUG_BREAK_IF_ERROR" macro
+* - "R_OSPL_SET_BREAK_ERROR_ID" function behaves not expected behavior
+* because the count of error is not counted up.
+*/
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+void R_OSPL_CLEAR_ERROR(void);
+#else
+INLINE void R_OSPL_CLEAR_ERROR(void) {} /* QAC 3138 */
+#endif
+
+
+/**
+* @brief Returns the number of current error
+*
+* @par Parameters
+* None
+* @return The number of current error
+*
+* @par Description
+* This function does nothing, if "R_OSPL_ERROR_BREAK" macro was defined
+* to be 0. The following descriptions are available, if "R_OSPL_ERROR_BREAK"
+* macro was defined to be 1.
+*
+* This function returns 0, if any errors were not raised.
+*
+* This function returns 1, if first error was raised.
+*
+* After that, this function returns 2, if second error was raised after
+* calling "R_OSPL_CLEAR_ERROR" function.
+* This function does not return 0 after that the error was cleared by
+* calling "R_OSPL_CLEAR_ERROR".
+* The number of current error is running number in the whole of system
+* (all threads).
+*
+* Error is raised by following macros.
+* @code
+* IF, IF_D, ASSERT_R, ASSERT_D
+* @endcode
+* The process breaks at a moment of error raised, if the number of current
+* error was set to "R_OSPL_SET_BREAK_ERROR_ID" macro.
+*/
+#if R_OSPL_ERROR_BREAK
+int_fast32_t R_OSPL_GET_ERROR_ID(void);
+#else
+INLINE int_fast32_t R_OSPL_GET_ERROR_ID(void)
+{
+ return -1;
+}
+#endif
+
+
+/**
+* @brief Register to break at raising error at the moment
+*
+* @param ID Breaking number of error
+* @return None
+*
+* @par Description
+* This function does nothing, if "R_OSPL_ERROR_BREAK" macro was defined
+* to be 0. The following descriptions are available, if "R_OSPL_ERROR_BREAK"
+* macro was defined to be 1.
+*
+* Set a break point at "R_DebugBreak" function, when the process breaks
+* at the error raised code.
+*
+* The number of "ErrorID" argument can be known by "R_DEBUG_BREAK_IF_ERROR"
+* macro or "R_OSPL_GET_ERROR_ID" macro.
+* - In multi - threading environment, the number of "ErrorID" argument is the
+* number of raised errors in all threads. But when "ErrorID" argument was
+* set to be over 2, call "R_OSPL_SET_DEBUG_WORK" function before calling
+* "R_OSPL_SET_BREAK_ERROR_ID" function.
+*
+* The following code breaks at first error.
+* @code
+* R_OSPL_SET_BREAK_ERROR_ID( 1 );
+* @endcode
+*
+* The following code breaks at next error after resuming from meny errors.
+* @code
+* R_OSPL_SET_BREAK_ERROR_ID( R_OSPL_GET_ERROR_ID() + 1 );
+* @endcode
+*/
+#if R_OSPL_ERROR_BREAK
+void R_OSPL_SET_BREAK_ERROR_ID( int_fast32_t ID );
+#else
+INLINE void R_OSPL_SET_BREAK_ERROR_ID( int_fast32_t const ID )
+{
+ R_UNREFERENCED_VARIABLE( ID );
+}
+#endif
+
+
+/**
+* @brief Set the debug work area
+*
+* @param WorkArea Start address of work area
+* @param WorkAreaSize Size of work area (byte). See. <R_OSPL_DEBUG_WORK_SIZE>
+* @return None
+*
+* @par Description
+* This function does nothing, if "R_OSPL_ERROR_BREAK" macro was defined
+* to be 0. The following descriptions are available, if "R_OSPL_ERROR_BREAK"
+* macro was defined to be 1.
+*
+* Set the debug work area, when "R_OSPL_SET_BREAK_ERROR_ID" function
+* supports multi thread. "E_NO_DEBUG_TLS" error is raised, if the debug
+* work area was not set, when errors was raised in 2 or more threads.
+* It is not necessary to call this function, if error handling did by one
+* thread only.
+*
+* @par Example
+* @code
+* #if R_OSPL_ERROR_BREAK
+* #define GS_MAX_THREAD 10
+* static uint8_t gs_DebugWorkArea[ R_OSPL_DEBUG_WORK_SIZE( GS_MAX_THREAD ) ];
+* #endif
+*
+* R_OSPL_SET_DEBUG_WORK( gs_DebugWorkArea, sizeof(gs_DebugWorkArea) );
+* @endcode
+*/
+#if R_OSPL_ERROR_BREAK
+void R_OSPL_SET_DEBUG_WORK( void *WorkArea, uint32_t WorkAreaSize );
+#else
+INLINE void R_OSPL_SET_DEBUG_WORK( const void *const WorkArea, uint32_t const WorkAreaSize )
+{
+ R_UNREFERENCED_VARIABLE_2( WorkArea, WorkAreaSize );
+}
+#endif
+
+
+/**
+* @brief Returns debbug information of current thread.
+*
+* @par Parameters
+* None
+* @return Debbug information of current thread.
+*/
+#if R_OSPL_ERROR_BREAK
+r_ospl_error_t *R_OSPL_GetCurrentThreadError(void);
+#endif
+
+
+/**
+* @brief Modifies count of objects that current thread has locked.
+*
+* @param Plus The value of adding to the counter.
+* @return None
+*
+* @par Description
+* The counter is subtracted, if this argument was minus.
+*
+* Drivers calls this function.
+* This function is not called from OSPL.
+* This function does nothing, if "R_OSPL_ERROR_BREAK" macro is 0.
+*/
+#if R_OSPL_ERROR_BREAK
+#if R_OSPL_IS_PREEMPTION
+void R_OSPL_MODIFY_THREAD_LOCKED_COUNT( int_fast32_t Plus );
+#else
+INLINE void R_OSPL_MODIFY_THREAD_LOCKED_COUNT( int_fast32_t Plus ) {}
+#endif
+#else
+INLINE void R_OSPL_MODIFY_THREAD_LOCKED_COUNT( int_fast32_t Plus ) {}
+#endif
+
+
+/**
+* @brief Returns count of objects that current thread has locked.
+*
+* @par Parameters
+* None
+* @return Count of objects that current thread has locked
+*
+* @par Description
+* This function returns 0, if "R_OSPL_ERROR_BREAK" macro is 0.
+*/
+#if R_OSPL_ERROR_BREAK
+#if R_OSPL_IS_PREEMPTION
+int_fast32_t R_OSPL_GET_THREAD_LOCKED_COUNT(void);
+#else
+INLINE int_fast32_t R_OSPL_GET_THREAD_LOCKED_COUNT(void)
+{
+ return 0;
+}
+#endif
+#else
+INLINE int_fast32_t R_OSPL_GET_THREAD_LOCKED_COUNT(void)
+{
+ return 0;
+}
+#endif
+
+
+/* Section: Accessing to register bit field */
+/**
+* @brief Reads modifies writes for bit field of 32bit register.
+*
+* @param in_out_Register Address of accessing register
+* @param Mask Mask of accessing bit field
+* @param Shift Shift count. Lowest bit number
+* @param Value Writing value before shift to the bit field
+* @return None
+*/
+#if R_OSPL_BIT_FIELD_ACCESS_MACRO
+
+/* ->SEC R3.6.2(QAC-3345) */
+/* Volatile access at left of "=" and right of "=". But this is not depend on compiler spcifications. */
+/* ->SEC M1.2.2(QAC-1259) */
+/* If "Value" is signed, this is depend on CPU bit width. This expects 32bit CPU. But driver code is no problem. */
+
+#define R_OSPL_SET_TO_32_BIT_REGISTER( in_out_Register, Mask, Shift, Value ) \
+ ( *(volatile uint32_t*)(in_out_Register) = (uint32_t)( \
+ ( ((uint32_t) *(volatile uint32_t*)(in_out_Register)) & \
+ ~(Mask) ) | ( (Mask) & ( ( (uint_fast32_t)(Value) << (Shift) ) & (Mask) ) ) ) )
+/* This code is optimized well. */
+
+/* <-SEC M1.2.2(QAC-1259) */
+/* <-SEC R3.6.2(QAC-3345) */
+
+#else
+
+INLINE void R_OSPL_SET_TO_32_BIT_REGISTER( volatile uint32_t *const Register,
+ uint32_t const Mask, int_fast32_t const Shift, uint32_t const Value )
+{
+ uint32_t reg_value;
+
+ IF_DQ ( Register == NULL ) {}
+ else {
+ reg_value = *Register;
+ reg_value = ( reg_value & ~Mask ) | ( ( Value << Shift ) & Mask );
+ *Register = reg_value;
+ }
+}
+
+#endif
+
+
+/**
+* @brief Reads modifies writes for bit field of 16bit register.
+*
+* @param in_out_Register Address of accessing register
+* @param Mask Mask of accessing bit field
+* @param Shift Shift count. Lowest bit number
+* @param Value Writing value before shift to the bit field
+* @return None
+*/
+#if R_OSPL_BIT_FIELD_ACCESS_MACRO
+
+/* ->SEC R3.6.2(QAC-3345) */
+/* Volatile access at left of "=" and right of "=". But this is not depend on compiler spcifications. */
+/* ->SEC M1.2.2(QAC-1259) */
+/* If "Value" is signed, this is depend on CPU bit width. This expects 32bit CPU. But driver code is no problem. */
+
+#define R_OSPL_SET_TO_16_BIT_REGISTER( in_out_Register, Mask, Shift, Value ) \
+ ( *(volatile uint16_t*)(in_out_Register) = (uint16_t)( \
+ ( ((uint16_t) *(volatile uint16_t*)(in_out_Register)) & \
+ ~(Mask) ) | ( (Mask) & ( ( (uint_fast16_t)(Value) << (Shift) ) & (Mask) ) ) ) )
+/* This code is optimized well. */
+
+
+/* <-SEC M1.2.2(QAC-1259) */
+/* <-SEC R3.6.2(QAC-3345) */
+
+#else
+
+INLINE void R_OSPL_SET_TO_16_BIT_REGISTER( volatile uint16_t *const Register,
+ uint16_t const Mask, int_fast32_t const Shift, uint16_t const Value )
+{
+ uint16_t reg_value;
+
+ IF_DQ ( Register == NULL ) {}
+ else {
+ reg_value = *Register;
+ reg_value = (uint16_t)( ( (uint_fast32_t) reg_value & ~(uint_fast32_t) Mask ) |
+ ( ( (uint_fast32_t) Value << Shift ) & (uint_fast32_t) Mask ) );
+ /* Cast is for SEC R2.4.2 */
+ *Register = reg_value;
+ }
+}
+
+#endif
+
+
+/**
+* @brief Reads modifies writes for bit field of 8bit register.
+*
+* @param in_out_Register Address of accessing register
+* @param Mask Mask of accessing bit field
+* @param Shift Shift count. Lowest bit number
+* @param Value Writing value before shift to the bit field
+* @return None
+*/
+#if R_OSPL_BIT_FIELD_ACCESS_MACRO
+
+/* ->SEC R3.6.2(QAC-3345) */
+/* Volatile access at left of "=" and right of "=". But this is not depend on compiler spcifications. */
+/* ->SEC M1.2.2(QAC-1259) */
+/* If "Value" is signed, this is depend on CPU bit width. This expects 32bit CPU. But driver code is no problem. */
+
+
+#define R_OSPL_SET_TO_8_BIT_REGISTER( in_out_Register, Mask, Shift, Value ) \
+ ( *(volatile uint8_t*)(in_out_Register) = (uint8_t)( \
+ ( ((uint8_t) *(volatile uint8_t*)(in_out_Register)) & \
+ ~(Mask) ) | ( (Mask) & ( ( (uint_fast8_t)(Value) << (Shift) ) & (Mask) ) ) ) )
+/* This code is optimized well. */
+
+/* <-SEC M1.2.2(QAC-1259) */
+/* <-SEC R3.6.2(QAC-3345) */
+
+#else
+
+INLINE void R_OSPL_SET_TO_8_BIT_REGISTER( volatile uint8_t *const Register,
+ uint8_t const Mask, int_fast32_t const Shift, uint8_t const Value )
+{
+ uint8_t reg_value;
+
+ IF_DQ ( Register == NULL ) {}
+ else {
+ reg_value = *Register;
+ reg_value = (uint8_t)( ( (uint_fast32_t) reg_value & ~(uint_fast32_t) Mask ) |
+ ( ( (uint_fast32_t) Value << Shift ) & (uint_fast32_t) Mask ) );
+ /* Cast is for SEC R2.4.2 */
+ *Register = reg_value;
+ }
+}
+
+#endif
+
+
+/**
+* @brief Reads for bit field of 32bit register.
+*
+* @param RegisterValueAddress Address of accessing register
+* @param Mask Mask of accessing bit field
+* @param Shift Shift count. Lowest bit number
+* @return Read value after shift
+*/
+#if R_OSPL_BIT_FIELD_ACCESS_MACRO
+
+/* ->SEC R3.6.2(QAC-3345) */
+/* Volatile access at &(get address), cast and *(memory load). But this is not double volatile access. */
+/* RegisterValueAddress is for avoid QAC-0310,QAC-3345 by cast code at caller. */
+
+#define R_OSPL_GET_FROM_32_BIT_REGISTER( RegisterValueAddress, Mask, Shift ) \
+ ( (uint32_t)( ( (uint32_t)*(volatile const uint32_t*) (RegisterValueAddress) \
+ & (uint_fast32_t)(Mask) ) >> (Shift) ) )
+/* This code is optimized well. */
+
+/* <-SEC R3.6.2(QAC-3345) */
+
+#else /* __QAC_ARM_H__ */ /* This code must be tested defined "__QAC_ARM_H__" */
+
+
+/* This inline functions is not expanded on __CC_ARM 5.15 */
+INLINE uint32_t R_OSPL_GET_FROM_32_BIT_REGISTER( volatile const uint32_t *const RegisterAddress,
+ uint32_t const Mask, int_fast32_t const Shift )
+{
+ uint32_t reg_value;
+
+ IF_DQ ( RegisterAddress == NULL ) {
+ enum { num = 0x0EDEDEDE }; /* SEC M1.10.1 */
+ reg_value = num;
+ }
+ else {
+ reg_value = *RegisterAddress;
+ reg_value = ( reg_value & Mask ) >> Shift;
+ }
+ return reg_value;
+}
+
+#endif
+
+
+/**
+* @brief Reads for bit field of 16bit register.
+*
+* @param RegisterValueAddress Address of accessing register
+* @param Mask Mask of accessing bit field
+* @param Shift Shift count. Lowest bit number
+* @return Read value after shift
+*/
+#if R_OSPL_BIT_FIELD_ACCESS_MACRO
+
+/* ->SEC R3.6.2(QAC-3345) */
+/* Volatile access at &(get address), cast and *(memory load). But this is not double volatile access. */
+/* RegisterValueAddress is for avoid QAC-0310,QAC-3345 by cast code at caller. */
+
+#define R_OSPL_GET_FROM_16_BIT_REGISTER( RegisterValueAddress, Mask, Shift ) \
+ ( (uint16_t)( ( (uint_fast32_t)*(volatile const uint16_t*) (RegisterValueAddress) \
+ & (uint_fast16_t)(Mask) ) >> (Shift) ) )
+/* This code is optimized well. */
+
+/* <-SEC R3.6.2(QAC-3345) */
+
+#else /* __QAC_ARM_H__ */ /* This code must be tested defined "__QAC_ARM_H__" */
+
+/* This inline functions is not expanded on __CC_ARM 5.15 */
+INLINE uint16_t R_OSPL_GET_FROM_16_BIT_REGISTER( volatile const uint16_t *const RegisterAddress,
+ uint16_t const Mask, int_fast32_t const Shift )
+{
+ uint16_t reg_value;
+
+ IF_DQ ( RegisterAddress == NULL ) {
+ enum { num = 0xDEDE }; /* SEC M1.10.1 */
+ reg_value = num;
+ }
+ else {
+ reg_value = *RegisterAddress;
+ reg_value = (uint16_t)( ( (uint_fast32_t) reg_value & (uint_fast32_t) Mask ) >> Shift );
+ /* Cast is for SEC R2.4.2 */
+ }
+ return reg_value;
+}
+
+#endif
+
+
+/**
+* @brief Reads for bit field of 8bit register.
+*
+* @param RegisterValueAddress Address of accessing register
+* @param Mask Mask of accessing bit field
+* @param Shift Shift count. Lowest bit number
+* @return Read value after shift
+*/
+#if R_OSPL_BIT_FIELD_ACCESS_MACRO
+
+/* ->SEC R3.6.2(QAC-3345) */
+/* Volatile access at &(get address), cast and *(memory load). But this is not double volatile access. */
+/* RegisterValueAddress is for avoid QAC-0310,QAC-3345 by cast code at caller. */
+
+#define R_OSPL_GET_FROM_8_BIT_REGISTER( RegisterValueAddress, Mask, Shift ) \
+ ( (uint8_t)( ( (uint_fast32_t)*(volatile const uint8_t*) (RegisterValueAddress) \
+ & (uint_fast8_t)(Mask) ) >> (Shift) ) )
+/* This code is optimized well. */
+
+/* <-SEC R3.6.2(QAC-3345) */
+
+#else /* __QAC_ARM_H__ */ /* This code must be tested defined "__QAC_ARM_H__" */
+
+/* This inline functions is not expanded on __CC_ARM 5.15 */
+INLINE uint8_t R_OSPL_GET_FROM_8_BIT_REGISTER( volatile const uint8_t *const RegisterAddress,
+ uint8_t const Mask, int_fast32_t const Shift )
+{
+ uint8_t reg_value;
+
+ IF_DQ ( RegisterAddress == NULL ) {
+ enum { num = 0xDE }; /* SEC M1.10.1 */
+ reg_value = num;
+ }
+ else {
+ reg_value = *RegisterAddress;
+ reg_value = (uint8_t)( ( (uint_fast32_t) reg_value & (uint_fast32_t) Mask ) >> Shift );
+ /* Cast is for SEC R2.4.2 */
+ }
+ return reg_value;
+}
+
+#endif
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_OSPL_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_RTX_private.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,86 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_RTX_private.h
+* @brief OS Porting Layer API for RTX
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef OSPL_RTX_PRIVATE_H
+#define OSPL_RTX_PRIVATE_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl_typedef.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/**
+* @brief Starts T-Lock. It is mutual exclusion of threads.
+*
+* @par Parameters
+* None
+* @return Error Code. 0=No Error.
+*/
+errnum_t R_OSPL_Start_T_Lock(void);
+
+
+/**
+* @brief Ends T-Lock. It is mutual exclusion of threads.
+*
+* @par Parameters
+* None
+* @return None
+*/
+void R_OSPL_End_T_Lock(void);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* OSPL_RTX_PRIVATE_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_config.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,243 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_config.h
+* @brief Configuration of OSPL.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+
+
+/* This file is included from "Project_Config.h" */
+
+
+#ifndef R_OSPL_CONFIG_H
+#define R_OSPL_CONFIG_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "platform_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def R_OSPL_VERSION
+* @brief Version number of OSPL
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can not be changed.
+* 101 = version 1.01.
+* Hundreds place is version number of OSPL specification.
+* Tens place and one's place are minor version number in specified OS and board.
+*/
+#define R_OSPL_VERSION 90
+
+
+/**
+* @def R_OSPL_VERSION_STRING
+* @brief String of version number of OSPL.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can not be changed.
+*/
+#define R_OSPL_VERSION_STRING "0.90"
+
+
+/**
+* @def R_OSPL_IS_PREEMPTION
+* @brief Whether preemptive RTOS or not.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can not be changed.
+* The value is 1 or 0.
+* This value is 0, if the environment was OS less.
+* It is necessary to configure to pseudo multithreading, if this value was 0.
+*/
+#define R_OSPL_IS_PREEMPTION BSP_CFG_RTOS_USED
+
+
+/**
+* @def R_OSPL_NDEBUG
+* @brief Debug configuration or Release configuration.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* Define (=Release) or not define (=Debug).
+* This is same as "NDEBUG" of standard library.
+* The system can run with the debug configuration OSPL and the release
+* configuration application.
+* If the library (compiled binary) called the debug configuration OSPL,
+* compile the OSPL source with debug configuration.
+*/
+#ifndef R_OSPL_NDEBUG
+#define R_OSPL_NDEBUG
+#endif
+
+
+/**
+* @def R_OSPL_ERROR_BREAK
+* @brief Whether it is supported to break, when error was raised.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* The value is 1 or 0.
+*/
+#ifndef R_OSPL_ERROR_BREAK
+#ifdef R_OSPL_NDEBUG
+#define R_OSPL_ERROR_BREAK 0
+#else
+#define R_OSPL_ERROR_BREAK 1
+#endif
+#endif
+
+
+/**
+* @def R_OSPL_TLS_ERROR_CODE
+* @brief Whether it is supported that error code is stored in thread local storage
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* The value is 1 or 0.
+* This value must be 1 by some application or some library with OSPL.
+*/
+#ifndef R_OSPL_TLS_ERROR_CODE
+#define R_OSPL_TLS_ERROR_CODE 1
+#endif
+
+
+/**
+* @def R_OSPL_LIBRARY_MAKING
+* @brief Whether current project makes library.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* The value is 1 or 0.
+*/
+#ifndef R_OSPL_LIBRARY_MAKING
+#define R_OSPL_LIBRARY_MAKING 0
+#endif
+
+
+/**
+* @def R_BOOL_IS_SIGNED
+* @brief Whether compiler defines that bool_t type is signed.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* The value is 1 or 0.
+*/
+#define R_BOOL_IS_SIGNED 1
+
+
+/**
+* @def R_OSPL_BIT_FIELD_ACCESS_MACRO
+* @brief Whether bit field access function is provided as macro or function.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* The value is 1 (=macro) or 0 (=function).
+*/
+#define R_OSPL_BIT_FIELD_ACCESS_MACRO 1
+
+
+/***********************************************************************
+* Macros: R_OSPL_FTIMER_IS
+* Which channel of timer to use.
+*
+* : R_OSPL_FTIMER_IS_OSTM0 - OSTM0
+* : R_OSPL_FTIMER_IS_OSTM1 - OSTM1
+* : R_OSPL_FTIMER_IS_MTU2_1_2 - MTU2 ch1 and ch2
+*
+* Description:
+* The value can be changed.
+************************************************************************/
+#define R_OSPL_FTIMER_IS R_OSPL_FTIMER_IS_MTU2_1_2
+#define R_OSPL_FTIMER_IS_OSTM0 0
+#define R_OSPL_FTIMER_IS_OSTM1 1
+#define R_OSPL_FTIMER_IS_MTU2_1_2 2
+
+#if R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_OSTM0
+#error OSTM0 is used by RTX
+#endif
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_OSPL_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_debug.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,250 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_debug.h
+* @brief Debug tools provided by OSPL.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef OSPL_DEBUG_H
+#define OSPL_DEBUG_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_typedefs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def R_OSPL_DEBUG_TOOL
+* @brief Whether debug tools function is defined
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value can be changed.
+* The value is 1 or 0.
+*/
+#ifndef R_OSPL_DEBUG_TOOL
+#ifndef R_OSPL_NDEBUG
+#define R_OSPL_DEBUG_TOOL 1
+#else
+#define R_OSPL_DEBUG_TOOL 0
+#endif
+#endif
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/* Group: Watch */
+
+/**
+* @brief Registers watching integer variable or pointer variable
+*
+* @param IndexNum Watch Number, 0 or more
+* @param Address Address of watching integer variable or pointer variable
+* @param BreakValue Breaking value of variable when "R_D_Watch" was called
+* @param IsPrintf Whether "printf" is called, when "R_D_Watch" was called
+* @return None
+*
+* @par Description
+* @ref R_D_Add and @ref R_D_Watch are APIs related to watch function.
+* This debug tool is available, if @ref R_OSPL_DEBUG_TOOL was set to 1.
+*
+* There is not this function, if @ref R_OSPL_DEBUG_TOOL macro was defined
+* to be 0. This function is available, if @ref R_OSPL_DEBUG_TOOL macro was
+* defined to be 1.
+*
+* @par Example
+* @code
+* R_D_Add( 0, &var, 0xB0, true ); // 0xB0 may be not hit
+* @endcode
+*/
+#if R_OSPL_DEBUG_TOOL
+void R_D_Add( int_fast32_t IndexNum, volatile const void *Address, uint32_t BreakValue, bool_t IsPrintf );
+#endif
+
+
+/**
+* @brief Show and Check watching variable's value
+*
+* @param IndexNum Watch Number, 0 or more
+* @return None
+*
+* @par Description
+* @ref R_D_Add and @ref R_D_Watch are APIs related to watch function.
+* This debug tool is available, if "R_OSPL_DEBUG_TOOL" was set to 1.
+* This function calls "printf" with the value of variable registered
+* by "R_D_Add" and breaks when watching variable becomes registered value.
+* This function can be called from out of scope of registered variable.
+* Then this function can be written at many places without care of the scope.
+*
+* There is not this function, if @ref R_OSPL_DEBUG_TOOL macro was defined
+* to be 0. This function is available, if @ref R_OSPL_DEBUG_TOOL macro was
+* defined to be 1.
+*
+* If internal data of the debug tool was broken, the global variable in
+* "r_ospl_debug.o" file should be move to safe address (memory map).
+*
+* @par Example
+* @code
+* printf( 41 ); // Show the value indicated this place
+* R_D_Watch( 0 );
+* @endcode
+*/
+#if R_OSPL_DEBUG_TOOL
+void R_D_Watch( int_fast32_t IndexNum );
+#endif
+
+
+/* Group: Int Log */
+
+/**
+* @brief Records to the log fast
+*
+* @param Value Recording value
+* @return None
+*
+* @par Description
+* @ref R_D_AddToIntLog, @ref g_IntLog and @ref g_IntLogLength are APIs related
+* to Int Log function.
+* This debug tool is available, if @ref R_OSPL_DEBUG_TOOL was set to 1.
+* This function overwrites from the first of the log, if max element
+* value of "g_IntLog" was over.
+* It is recommended to record not only the showing value of variable,
+* but also the value of the identifier of the place and the value of
+* current time.
+*
+* There is not this function, if @ref R_OSPL_DEBUG_TOOL macro was defined
+* to be 0. This function is available, if @ref R_OSPL_DEBUG_TOOL macro was
+* defined to be 1.
+*
+* If internal data of the debug tool was broken, the global variable in
+* "r_ospl_debug.o" file should be move to safe address (memory map).
+*/
+#if R_OSPL_DEBUG_TOOL
+void R_D_AddToIntLog( int_fast32_t Value );
+#endif
+
+
+/**
+* @def g_IntLogCount
+* @brief Max count of int log
+*/
+#if R_OSPL_DEBUG_TOOL
+enum { g_IntLogCount = 100 };
+#endif
+
+
+/** Memory area of int log */
+#if R_OSPL_DEBUG_TOOL
+extern volatile int_fast32_t g_IntLog[ g_IntLogCount ];
+#endif
+
+
+/** Length of recorded in <g_IntLog> */
+#if R_OSPL_DEBUG_TOOL
+extern volatile int_fast32_t g_IntLogLength;
+#endif
+
+
+/* Group: Debug Variable */
+
+/**
+* @def g_DebugVarCount
+* @brief Count of debug variable.
+*/
+#if R_OSPL_DEBUG_TOOL
+enum { g_DebugVarCount = 10 };
+#endif
+
+
+/** Debug variables. */
+#if R_OSPL_DEBUG_TOOL
+extern volatile uint_fast32_t g_DebugVar[ g_DebugVarCount ];
+#endif
+
+
+/* Group: Through Counter */
+
+/**
+* @brief Count the through count
+*
+* @param in_out_Counter Input/Output: The through counter
+* @param TargetCount The value comparing with the through counter
+* @param Label The label for "printf", NULL=printf : no output
+* @return None
+*
+* @par Description
+* This debug tool is available, if @ref R_OSPL_DEBUG_TOOL was set to 1.
+* If this function was called with "TargetCount = 0", the count of
+* through is output by "printf" for each calling. If "TargetCount"
+* argument was set to the through count and restart the program,
+* when the counter was counted up to "TargetCount", this function
+* returns "true". If there were many "printf" output, set "Label = NULL".
+* At first calling, the address of the counter is output by "printf".
+* The counter can be look by the debugger.
+*
+* @par Example
+* @code
+* { static int tc; if ( R_D_Counter( &tc, 0, "A" ) ) {
+* R_DEBUG_BREAK(); }}
+* @endcode
+*/
+#if R_OSPL_DEBUG_TOOL
+bool_t R_D_Counter( int_fast32_t *in_out_Counter, int_fast32_t TargetCount, char_t *Label );
+#endif
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _OSPL_DEBUG_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_os_less.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,197 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_os_less.h
+* @brief OS Porting Layer API for OS less Compatibility
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef OSPL_OS_LESS_H
+#define OSPL_OS_LESS_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl_os_less_typedef.h"
+#include "./r_ospl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+/* In "ospl_os_less_typedef.h" */
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+/* In "ospl_os_less_typedef.h" */
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+/* In "ospl_os_less_typedef.h" */
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/**
+* @brief Set waiting behavior of current thread.
+*
+* @param OnWait Behavior on waiting
+* @return Error code. If there is no error, the return value is 0.
+*
+* @par Description
+* @par - Case of <R_OSPL_IS_PREEMPTION> = 0
+*
+* Initial value is @ref R_OSPL_WAIT_POLLING.
+* If this function was called from the interrupt context, E_STATE error is raised.
+*
+* @par - Case of <R_OSPL_IS_PREEMPTION> = 1
+*
+* This function is for compatibility only.
+* Arguments are ignored.
+* This function returns 0.
+*
+* Refer to: @ref R_OSPL_THREAD_GetIsWaiting
+*/
+INLINE errnum_t R_OSPL_THREAD_SetOnWait( r_ospl_wait_t const OnWait )
+{
+ return 0;
+}
+
+
+/**
+* @brief Get waiting behavior of current thread.
+*
+* @par Parameters
+* None
+* @return Behavior on waiting
+*
+* @par Description
+* @par - Case of <R_OSPL_IS_PREEMPTION> = 0
+*
+* Initial value is @ref R_OSPL_WAIT_POLLING.
+* If this function was called from the interrupt context,
+* this function returns @ref R_OSPL_WAIT_POLLING.
+*
+* @par - Case of <R_OSPL_IS_PREEMPTION> = 1
+*
+* This function is for compatibility only.
+* This function returns R_OSPL_WAIT_POLLING.
+* But it does not polling on waiting
+*
+* Refer to: @ref R_OSPL_THREAD_SetOnWait
+*/
+INLINE r_ospl_wait_t R_OSPL_THREAD_GetOnWait(void)
+{
+ return R_OSPL_WAIT_POLLING;
+}
+
+
+/**
+* @brief Get whether the current thread is waiting or not.
+*
+* @par Parameters
+* None
+* @return Whether the current thread is waiting or not
+*
+* @par Description
+* @par - Case of <R_OSPL_IS_PREEMPTION> = 0
+*
+* If @ref R_OSPL_WAIT_PM_THREAD was set by @ref R_OSPL_THREAD_SetOnWait function,
+* some waiting functions return soon even if the state is waiting and
+* @ref R_OSPL_THREAD_GetIsWaiting function returns true.
+*
+* If time out was set to 0, @ref R_OSPL_THREAD_GetIsWaiting function returns
+* true at time out, even if any value was passed to @ref R_OSPL_THREAD_SetOnWait
+* function,
+*
+* If this function was called from the interrupt context, this function
+* returns false and @ref ASSERT_D in this function notifies in debug configuration.
+*
+* @par - Case of <R_OSPL_IS_PREEMPTION> = 1
+*
+* This function is for compatibility only.
+* This function returns false.
+*
+* @par Example
+* @code
+* e= R_OSPL_Delay( 100 ); IF(e){goto fin;}
+* if ( R_OSPL_THREAD_GetIsWaiting() ) { e=0; goto fin; }
+* @endcode
+*/
+INLINE bool_t R_OSPL_THREAD_GetIsWaiting(void)
+{
+ return false;
+}
+
+
+/**
+* @brief Exit waiting state, if current thread was waiting state.
+*
+* @par Parameters
+* None
+* @return None
+*
+* @par Description
+* @par - Case of <R_OSPL_IS_PREEMPTION> = 0
+*
+* The thread returned true from @ref R_OSPL_THREAD_GetIsWaiting function
+* after a waiting function must call the waiting function again.
+* After exiting waiting state, other operation and other waiting can
+* be done. If time out was set to 0, exiting does not have to do.
+*
+* If it was detected in OSPL API that necessary exiting was not done,
+* E_STATE error is raised. However sometimes the state can not be detected.
+* In this case, time out will be not correct.
+*
+* This function does not do anything called from the interrupt context.
+* "ASSERT_D" in this function notifies in debug configuration.
+*
+* @par - Case of <R_OSPL_IS_PREEMPTION> = 1
+*
+* This function is for compatibility only.
+* This function does not do anything.
+*/
+INLINE void R_OSPL_THREAD_ExitWaiting(void)
+{
+}
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* OSPL_OS_LESS_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_os_less_private.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,133 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_os_less_private.h
+* @brief OS Porting Layer private functions for OS less
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef OSPL_OS_LESS_PRIVATE_H
+#define OSPL_OS_LESS_PRIVATE_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl_os_less_typedef.h"
+#include "./r_ospl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+
+/**
+* @struct r_ospl_master_t
+* @brief Variables for OSPL
+*/
+typedef struct st_r_ospl_master_t r_ospl_master_t;
+struct st_r_ospl_master_t {
+#if ! R_OSPL_IS_PREEMPTION
+ /** CurrentThread */
+ r_ospl_thread_def_t *CurrentThread;
+
+ /** IdleCallback */
+ r_ospl_idle_callback_t IdleCallback;
+#endif
+ /** IsFreeRunTimerSpec */
+ bool_t IsFreeRunTimerSpec;
+
+ /** FreeRunTimerSpec */
+ r_ospl_ftimer_spec_t FreeRunTimerSpec;
+
+ /** MaxOneTimeoutTime */
+ uint32_t MaxOneTimeoutTime;
+};
+
+
+/* Section: Global */
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/**
+* @brief Returns <r_ospl_master_t> type variable.
+*
+* @par Parameters
+* None
+* @return <r_ospl_master_t> type variable.
+*/
+r_ospl_master_t *R_OSPL_GetPrivateContext(void);
+
+
+/**
+* @brief Sub routine of <R_OSPL_MEMORY_Flush>
+*
+* @par Parameters
+* None
+* @return None
+*/
+void R_OSPL_MEMORY_Flush_Sub(void);
+
+
+/**
+* @brief GetCacheLineSize
+*
+* @par Parameters
+* None
+* @return CacheLineSize
+*/
+size_t R_OSPL_MEMORY_GetCacheLineSize(void);
+
+
+/**
+* @brief Sub routine of <R_OSPL_MEMORY_RangeFlush>
+*
+* @par Parameters
+* None
+* @return None
+*/
+void R_OSPL_MEMORY_RangeFlush_Sub( uintptr_t Start, uintptr_t Over, size_t CacheLineSize );
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* OSPL_OS_LESS_PRIVATE_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_os_less_typedef.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,83 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_os_less_typedef.h
+* @brief OS Porting Layer API for OS less Compatibility. Data types.
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef OSPL_OS_LESS_TYPEDEF_H
+#define OSPL_OS_LESS_TYPEDEF_H
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @enum r_ospl_wait_t
+* @brief Waitnig mode of pseudo multi thread
+*
+* - R_OSPL_WAIT_POLLING - 0
+* - R_OSPL_WAIT_PM_THREAD - 1
+*/
+typedef enum {
+ R_OSPL_WAIT_POLLING = 0,
+ R_OSPL_WAIT_PM_THREAD = 1
+}
+ r_ospl_wait_t;
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+/* In "r_ospl_os_less.h" */
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* OSPL_OS_LESS_TYPEDEF_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_private.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,137 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_private.h
+* @brief OS Porting Layer private API for OS less
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef R_OSPL_PRIVATE_H
+#define R_OSPL_PRIVATE_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @struct r_ospl_table_block_t
+* @brief Block of <r_ospl_table_t>
+*/
+typedef struct st_r_ospl_table_block_t r_ospl_table_block_t;
+struct st_r_ospl_table_block_t {
+
+ /** this[ SortedKeyIndex ].Key ... */
+ const void *Key;
+
+ /** Index */
+ int16_t Index;
+
+ /** this[ Index ].NextFreeIndex : Index is not same as SortedKeyIndex */
+ int16_t NextFreeIndex;
+};
+enum {
+ R_OSPL_TABLE_BLOCK_USED = -1,
+ R_OSPL_TABLE_BLOCK_NO_NEXT = -2
+};
+
+
+/**
+* @struct r_ospl_table_searched_t
+* @brief Result of searching
+*/
+typedef struct st_r_ospl_table_searched_t r_ospl_table_searched_t;
+struct st_r_ospl_table_searched_t {
+
+ /** SortedKeyIndex */
+ int_fast32_t SortedKeyIndex;
+
+ /** IsFound */
+ bool_t IsFound;
+};
+
+
+/* Section: Global */
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+#if ! IS_MBED_USED
+#if defined( __CC_ARM )
+
+/* ->QAC 0289 */ /* ->QAC 1002 */ /* ->MISRA 5.1 */
+extern uint32_t Image$$BEGIN_OF_CACHED_RAM_BARRIER$$Base;
+extern uint32_t Image$$BEGIN_OF_NOCACHE_RAM_BARRIER$$Base;
+extern uint32_t Image$$BEGIN_OF_NOCACHE_RAM_BARRIER$$ZI$$Limit;
+extern uint32_t Image$$END_OF_INTERNAL_RAM_BARRIER$$ZI$$Limit;
+/* <-QAC 0289 */ /* <-QAC 1002 */ /* <-MISRA 5.1 */
+
+#endif
+#else /* IS_MBED_USED */
+extern uint32_t Image$$RW_DATA_NC$$Base;
+#endif
+
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/**
+* @brief LockUnlockedChannel
+*
+* @param out_ChannelNum ChannelNum
+* @param HardwareIndexMin HardwareIndexMin
+* @param HardwareIndexMax HardwareIndexMax
+* @return Error Code. 0=No Error.
+*/
+#if ! BSP_CFG_USER_LOCKING_ENABLED
+errnum_t R_OSPL_LockUnlockedChannel( int_fast32_t *out_ChannelNum,
+ mcu_lock_t HardwareIndexMin, mcu_lock_t HardwareIndexMax );
+#endif
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_OSPL_PRIVATE_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_test.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,95 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_test.h
+* @brief Test support functions
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef R_OSPL_TEST_H
+#define R_OSPL_TEST_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "Project_Config.h"
+
+#ifdef R_OSPL_TEST_CODE
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @enum r_ospl_axi_envronment_t
+* @brief r_ospl_axi_envronment_t
+*
+* - R_OSPL_AXI_L2CACHED - 0
+* - R_OSPL_AXI_L2STRONGLY - 1
+*/
+typedef enum st_r_ospl_axi_envronment_t r_ospl_axi_envronment_t;
+enum st_r_ospl_axi_envronment_t {
+ R_OSPL_AXI_L2CACHED,
+ R_OSPL_AXI_L2STRONGLY
+};
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/**
+* @brief R_OSPL_AXI_SetEnvironment
+*
+* @param Environment <r_ospl_axi_envronment_t>
+* @return Error Code. 0=No Error.
+*/
+errnum_t R_OSPL_AXI_SetEnvironment( r_ospl_axi_envronment_t Environment );
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_OSPL_TEST_CODE */
+#endif /* R_OSPL_TEST_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_ospl_typedef.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,908 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_typedef.h
+* @brief OS Porting Layer. Data types.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef R_OSPL_TYPEDEF_H
+#define R_OSPL_TYPEDEF_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#ifdef __GNUC__
+#include <stdint.h>
+#include <stdbool.h>
+#endif
+#include "Project_Config.h"
+#include "r_typedefs.h"
+#include "mcu_interrupts_typedef.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+typedef struct st_r_ospl_async_t r_ospl_async_t;
+typedef struct st_r_ospl_async_status_t r_ospl_async_status_t;
+typedef struct st_r_ospl_flag32_t r_ospl_flag32_t;
+typedef struct st_r_ospl_interrupt_t r_ospl_interrupt_t;
+typedef struct st_r_ospl_irq_mask_t r_ospl_irq_mask_t;
+typedef struct st_r_ospl_memory_spec_t r_ospl_memory_spec_t;
+typedef struct st_r_ospl_ftimer_spec_t r_ospl_ftimer_spec_t;
+typedef struct st_r_ospl_table_t r_ospl_table_t;
+typedef struct st_r_ospl_i_lock_vtable_t r_ospl_i_lock_vtable_t;
+typedef struct st_r_ospl_caller_t r_ospl_caller_t;
+
+
+/**
+* @typedef errnum_t
+* @brief Error number
+*/
+typedef int_fast32_t errnum_t;
+
+
+/**
+* @typedef bit_flags_fast32_t
+* @brief Bit flags as "uint_fast32_t"
+*/
+typedef uint_fast32_t bit_flags_fast32_t;
+
+
+/**
+* @typedef bit_flags32_t
+* @brief Bit flags as "uint32_t"
+*/
+typedef uint32_t bit_flags32_t;
+
+
+/**
+* @typedef bit_flags16_t
+* @brief Bit flags as "uint16_t"
+*/
+typedef uint16_t bit_flags16_t;
+
+
+/**
+* @typedef bit_flags8_t
+* @brief Bit flags as "uint8_t"
+*/
+typedef uint8_t bit_flags8_t;
+
+
+/**
+* @typedef byte_t
+* @brief Byte type
+*/
+typedef uint8_t byte_t;
+
+
+/***********************************************************************
+* Section: Global
+************************************************************************/
+/* Start of a part of CMSIS : Copy from cmsys_os.h */
+/* This is for not calling CMSIS function */
+
+
+/**
+* @typedef osMailQId
+* @brief osMailQId
+*/
+#ifdef IS_CMSIS_USED
+typedef struct os_mailQ_cb *osMailQId;
+#endif
+
+
+/**
+* @struct r_ospl_rtx_osMailQDef_t
+* @brief RTX:osMailQDef_t
+*/
+#ifdef IS_CMSIS_USED
+typedef struct r_ospl_rtx_os_mailQ_def {
+ uint32_t queue_sz; ///< number of elements in the queue
+ uint32_t item_sz; ///< size of an item
+ void *pool; ///< memory array for mail
+} r_ospl_rtx_osMailQDef_t;
+#endif
+
+
+/* Section: Global */
+/**
+* @def r_ospl_rtx_osMailQDef
+* @brief RTX:osMailQDef
+* @par Parameters
+* None
+* @return None.
+*/
+#ifdef IS_CMSIS_USED
+#if defined (osObjectsExternal) // object is external
+#define r_ospl_rtx_osMailQDef(name, queue_sz, type) \
+extern const osMailQDef_t os_mailQ_def_##name
+#else // define the object
+#define r_ospl_rtx_osMailQDef(name, queue_sz, type) \
+uint32_t os_mailQ_q_##name[4+(queue_sz)] = { 0 }; \
+uint32_t os_mailQ_m_##name[3+((sizeof(type)+3)/4)*(queue_sz)]; \
+void * os_mailQ_p_##name[2] = { (os_mailQ_q_##name), os_mailQ_m_##name }; \
+const r_ospl_rtx_osMailQDef_t os_mailQ_def_##name = \
+{ (queue_sz), sizeof(type), (os_mailQ_p_##name) }
+#endif
+#endif
+
+
+/**
+* @def osMailQ
+* @brief osMailQ
+* @par Parameters
+* None
+* @return None.
+*/
+#ifdef IS_CMSIS_USED
+#define osMailQ(name) \
+&os_mailQ_def_##name
+#endif
+
+
+/***********************************************************************
+* Section: Global
+************************************************************************/
+/* End of a part of CMSIS */
+
+
+/**
+* @struct r_ospl_thread_id_t
+* @brief Pointer to a thread
+*/
+#ifdef IS_CMSIS_USED
+typedef void * /*<r_ospl_thread_def_t*>*/ r_ospl_thread_id_t;
+#define R_OSPL_THREAD_INTERRUPT ((void*) 0 )
+#endif
+
+
+/* Section: Global */
+/**
+* @brief The function type of interrupt callback
+*
+* @param InterruptSource Source of interrupt
+* @param Caller Driver's internal parameters about interrupt operations
+* @return Error code. If there is no error, the return value is 0. The value set to "r_ospl_async_t::ReturnValue"
+*
+* @par Description
+* This is type of the interrupt callback function running in the
+* interrupt context and called from the interrupt handler.
+*
+* It is possible to replace to application defined interrupt callback function
+* by setting to "r_ospl_async_t::InterruptCallback". But it is usually not
+* necessary to replace.
+*
+* As interrupt callback function, the default interrupt callback function
+* provided from the driver is used. It is unusual to use application defined
+* interrupt callback function.
+* Write the response code of the interrupt (event driven code) next to the
+* code calling @ref R_OSPL_EVENT_Wait function
+*
+* Whether the asynchronous operation was ended is possible to know whether
+* the variable of "r_ospl_async_state_t" type referred from
+* @ref R_DRIVER_GetAsyncStatus function is set to @ref R_OSPL_RUNNABLE value.
+*
+* It is not necessary to write the code of interrupt return (IRET) in
+* the interrupt callback function. The interrupt handlers calling interrupt
+* callback function calls IRET, if necessary.
+*
+* It is not possible to divide interrupt callback functions by the kind of
+* interrupt. Alternatively, it is possible to write operations in interrupt
+* handlers calling interrupt callback function in porting layer under the driver.
+* There are interrupt handlers by each interrupt numbers.
+*
+* It is possible to signal any event from application defined interrupt
+* @par callback function. But it is necessary to do following operations
+*/
+typedef errnum_t (* r_ospl_callback_t )( const r_ospl_interrupt_t *InterruptSource, const r_ospl_caller_t *Caller );
+
+
+/**
+* @enum r_ospl_async_state_t
+* @brief Asynchronous State
+*
+* - R_OSPL_UNINITIALIZED - 0
+* - R_OSPL_RUNNABLE - 1, Runnable or Waitable
+* - R_OSPL_RUNNING - 2, Running or Waiting
+* - R_OSPL_INTERRUPTING - 3
+* - R_OSPL_INTERRUPTED - 4
+*/
+typedef enum {
+ R_OSPL_UNINITIALIZED = 0,
+ R_OSPL_RUNNABLE,
+ R_OSPL_RUNNING,
+ R_OSPL_INTERRUPTING,
+ R_OSPL_INTERRUPTED
+} r_ospl_async_state_t;
+
+
+/**
+* @enum r_ospl_async_type_t
+* @brief Asynchronous State
+*
+* - R_OSPL_ASYNC_TYPE_NORMAL - 1
+* - R_OSPL_ASYNC_TYPE_FINALIZE - 2, Asynchronous finalizing
+*/
+typedef enum {
+ R_OSPL_ASYNC_TYPE_NORMAL = 1,
+ R_OSPL_ASYNC_TYPE_FINALIZE = 2
+} r_ospl_async_type_t;
+
+
+/**
+* @struct r_ospl_block_t
+* @brief Block in queue
+*
+* @par Description
+* Member variables should not be accessed.
+*/
+typedef struct st_r_ospl_block_t r_ospl_block_t;
+struct st_r_ospl_block_t {
+ r_ospl_block_t *Next;
+};
+
+
+/**
+* @struct r_ospl_queue_status_t
+* @brief r_ospl_queue_status_t
+*/
+typedef struct st_r_ospl_queue_status_t {
+
+ /** UsedCount */
+ int_fast32_t UsedCount;
+
+ /** MaxCount */
+ int_fast32_t MaxCount;
+} r_ospl_queue_status_t;
+
+
+/**
+* @struct r_ospl_queue_def_t
+* @brief r_ospl_queue_def_t
+* @par Description
+* Member variables should not be accessed.
+*/
+typedef struct st_r_ospl_queue_def_t {
+ osMailQId MailQId;
+ r_ospl_queue_status_t PublicStatus;
+ const r_ospl_rtx_osMailQDef_t *MailQDef;
+} r_ospl_queue_def_t;
+
+
+/**
+* @struct r_ospl_queue_t
+* @brief r_ospl_queue_t
+* @par Description
+* Member variables should not be accessed.
+*/
+typedef r_ospl_queue_def_t r_ospl_queue_t;
+
+
+/* Section: Global */
+/**
+* @def R_OSPL_QUEUE_DEF
+* @brief Defines attributes of queue and work area.
+* @param Name Thread name. Do not bracket by ""
+* @param MaxCount Max count of elements in the queue
+* @param Type Output
+* @return None.
+*
+* @par Description
+* It is not possible to use this macro in the library.
+* If implement of OSPL was changed, the library must be recompiled.
+*/
+#define R_OSPL_QUEUE_DEF( Name, MaxCount, Type ) \
+ r_ospl_rtx_osMailQDef( Name, MaxCount, Type ); \
+ r_ospl_queue_def_t Name##_OSPL_DEF = { NULL, 0, (MaxCount), osMailQ( Name ) }
+
+
+/**
+* @def R_OSPL_QUEUE
+* @brief Returns initial attributes of queue and work area.
+* @param Name Queue's name. Do not bracket by ""
+* @return None.
+*
+* @par Description
+* It is not possible to use this macro in the library.
+* If implement of OSPL was changed, the library must be recompiled.
+*/
+#define R_OSPL_QUEUE( Name ) (&Name##_OSPL_DEF)
+
+
+/**
+* @typedef r_ospl_flush_t
+* @brief r_ospl_flush_t
+*/
+typedef bit_flags_fast32_t r_ospl_flush_t;
+#define /*<uint_fast32_t>*/ R_OSPL_FLUSH_INVALIDATE 0u
+#define /*<uint_fast32_t>*/ R_OSPL_FLUSH_WRITEBACK_INVALIDATE 2u
+#define /*<uint_fast32_t>*/ R_OSPL_FLUSH_WRITEBACK_INVALIDATE_2ND 8u
+
+
+/**
+* @struct r_ospl_flag32_t
+* @brief This is the type of flags having 32bit
+*
+* @par Description
+* Member variables should not be accessed.
+*/
+struct st_r_ospl_flag32_t {
+ volatile uint32_t Flags;
+};
+
+
+/**
+* @struct r_ospl_interrupt_t
+* @brief Structure related to interrupt source. e.g. interrupt number
+*/
+struct st_r_ospl_interrupt_t {
+
+ /** <bsp_int_src_t> */
+ bsp_int_src_t IRQ_Num;
+
+ /** ChannelNum */
+ int_fast32_t ChannelNum;
+
+ /** Type */
+ int_fast32_t Type;
+
+ /** Delegate */
+ void *Delegate;
+};
+
+
+/**
+* @struct r_ospl_async_status_t
+* @brief Structure of driver's status and interrupt status defined by OSPL
+*/
+struct st_r_ospl_async_status_t {
+
+ /** <r_ospl_async_state_t> */
+ volatile r_ospl_async_state_t State;
+
+ /** IsEnabledInterrupt */
+ volatile bool_t IsEnabledInterrupt;
+
+ /** InterruptEnables */
+ volatile r_ospl_flag32_t InterruptEnables;
+
+ /** InterruptFlags */
+ volatile r_ospl_flag32_t InterruptFlags;
+
+ /** r_ospl_flag32_t < <r_ospl_cancel_flag_t> > */
+ volatile r_ospl_flag32_t CancelFlags; /*<r_ospl_cancel_flag_t>*/
+#if R_OSPL_IS_PREEMPTION
+ union {
+
+ /** LockOwner */
+ volatile r_ospl_thread_id_t Thread;
+
+ /** LockOwner */
+ volatile void *Context;
+ } LockOwner;
+#endif
+};
+
+
+/**
+* @struct r_ospl_async_t
+* @brief Setting of notifications
+*/
+struct st_r_ospl_async_t {
+
+ /** Flags */
+ bit_flags_fast32_t Flags;
+
+ /** Delegate */
+ void *Delegate;
+
+ /** A_Thread */
+ r_ospl_thread_id_t A_Thread;
+
+ /** A_EventValue */
+ uint32_t A_EventValue; /* QAC 4130 */
+
+ /** I_Thread */
+ r_ospl_thread_id_t I_Thread;
+
+ /** I_EventValue */
+ uint32_t I_EventValue; /* QAC 4130 */
+
+ /** InterruptCallback */
+ r_ospl_callback_t InterruptCallback;
+
+ /** ReturnValue */
+ errnum_t ReturnValue;
+};
+
+enum {
+ R_F_OSPL_A_Thread = 0x0001,
+ R_F_OSPL_A_EventValue = 0x0002,
+ R_F_OSPL_I_Thread = 0x0004,
+ R_F_OSPL_I_EventValue = 0x0008,
+ R_F_OSPL_InterruptCallback = 0x0010,
+ R_F_OSPL_Delegate = 0x0080
+};
+
+
+/* Section: Global */
+/***********************************************************************
+* Macros: r_ospl_internal_sentinel
+*
+* : R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK - 0x7FFFFF40
+* : R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE - 0x4A5C0000
+************************************************************************/
+#ifndef R_OSPL_NDEBUG
+enum {
+ R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK = 0x7FFFFF40,
+ R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE = 0x4A5C0000
+};
+#endif
+
+
+/**
+* @struct r_ospl_caller_t
+* @brief Context of interrupt callback function caller
+*
+* @par Description
+* Member variables should not be accessed.
+*/
+struct st_r_ospl_caller_t {
+ r_ospl_async_t *Async;
+ volatile int_fast32_t *PointerToState;
+ int_fast32_t StateValueOfOnInterrupting;
+ void *I_Lock;
+ const r_ospl_i_lock_vtable_t *I_LockVTable;
+};
+
+
+/***********************************************************************
+* Class: r_ospl_i_lock_vtable_t
+* I-Lock V-Table
+************************************************************************/
+typedef bool_t (* r_ospl_i_lock_lock_func_t )( void *const self_ );
+typedef void (* r_ospl_i_lock_unlock_func_t )( void *const self_ );
+typedef void (* r_ospl_i_lock_get_rf_func_t )( void *const self_ ); /* rf = RequestFinalize */
+typedef bool_t (* r_ospl_i_lock_get_rcn_func_t )( const void *const self_ ); /* rcn = RootChannelNum */
+
+struct st_r_ospl_i_lock_vtable_t {
+
+ /**
+ * @brief Lock
+ *
+ * @par Parameters
+ * None
+ * @return None.
+ */
+ bool_t (* Lock )( void *const self_ );
+
+ /**
+ * @brief Unlock
+ *
+ * @par Parameters
+ * None
+ * @return None.
+ */
+ void (* Unlock )( void *const self_ );
+
+ /**
+ * @brief RequestFinalize
+ *
+ * @par Parameters
+ * None
+ * @return None.
+ */
+ void (* RequestFinalize )( void *const self_ );
+
+ /**
+ * @brief GetRootChannelNum
+ *
+ * @par Parameters
+ * None
+ * @return None.
+ */
+ int_fast32_t (* GetRootChannelNum )( const void *const self_ );
+};
+
+
+/**
+* @struct r_ospl_memory_spec_t
+* @brief Memory specification
+*/
+struct st_r_ospl_memory_spec_t {
+
+ /** (byte) */
+ uint_fast32_t CacheLineSize;
+};
+
+
+/**
+* @struct r_ospl_ftimer_spec_t
+* @brief Free run timer specification
+*/
+struct st_r_ospl_ftimer_spec_t {
+
+ /** msec_Numerator */
+ uint32_t msec_Numerator;
+
+ /** msec_Denominator */
+ uint32_t msec_Denominator;
+
+ /** MaxCount */
+ uint32_t MaxCount;
+
+ /** ExtensionOfCount */
+ uint32_t ExtensionOfCount;
+};
+
+
+/**
+* @struct r_ospl_table_t
+* @brief Index table
+*
+* @par Description
+* Member variables should not be accessed.
+*/
+struct st_r_ospl_table_t {
+ void *Area;
+ int_fast32_t Count;
+ int_fast32_t MaxCount;
+ const void *KeyCache;
+ int_fast32_t IndexCache; /* Not SortedKeyIndex */
+ int16_t FirstFreeIndex;
+#if R_OSPL_IS_PREEMPTION
+ bool_t Is_T_Lock;
+#endif
+};
+
+
+/* Section: Global */
+/**
+* @enum r_ospl_if_not_t
+* @brief Operation if not exists
+*
+* - R_OSPL_ERROR_IF_NOT - 0
+* - R_OSPL_ALLOCATE_IF_NOT - 1
+* - R_OSPL_DO_NOTHING_IF_NOT - 2
+*/
+typedef enum {
+ R_OSPL_ERROR_IF_NOT = 0,
+ R_OSPL_ALLOCATE_IF_NOT = 1,
+ R_OSPL_DO_NOTHING_IF_NOT = 2
+} r_ospl_if_not_t;
+
+
+/**
+* @struct r_ospl_error_t
+* @brief Error status of a thread
+*
+* @par Description
+* Member variables should not be accessed.
+*/
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+typedef struct st_r_ospl_error_t r_ospl_error_t;
+struct st_r_ospl_error_t {
+#if R_OSPL_ERROR_BREAK
+ bool_t IsError;
+ int_fast32_t ErrorID;
+ const char_t *FilePath;
+ int_fast32_t LineNum;
+#if R_OSPL_IS_PREEMPTION
+ int_fast32_t ThreadLockedCount;
+#endif
+#endif
+#if R_OSPL_TLS_ERROR_CODE
+ errnum_t ErrNum;
+#endif
+};
+#endif
+
+
+/**
+* @struct r_ospl_global_error_t
+* @brief Error status of global
+*
+* @par Description
+* Member variables should not be accessed.
+*/
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+typedef struct st_r_ospl_global_error_t r_ospl_global_error_t;
+struct st_r_ospl_global_error_t {
+ r_ospl_table_t ThreadIndexTable;
+ r_ospl_error_t *ErrorArray;
+
+#if R_OSPL_ERROR_BREAK
+ int_fast32_t RaisedGlobalErrorID;
+ int_fast32_t BreakGlobalErrorID;
+#endif
+};
+#endif
+
+
+/* Section: Global */
+/**
+* @enum r_ospl_axi_cache_attribute_t
+* @brief Cache attribute on AXI bus.
+*
+* - R_OSPL_AXI_CACHE_ZERO - Not AXI
+* - R_OSPL_AXI_STRONGLY - Strongly order access
+* - R_OSPL_AXI_DEVICE - DEVICE
+* - R_OSPL_AXI_UNCACHED - Normal access (Out of order) uncached
+* - R_OSPL_AXI_WRITE_BACK_W - Write back, allocate on write
+* - R_OSPL_AXI_WRITE_BACK - Write back, allocate on both read and write
+*/
+typedef enum {
+ R_OSPL_AXI_CACHE_ZERO = 0,
+ R_OSPL_AXI_STRONGLY = 0,
+ R_OSPL_AXI_DEVICE = 1,
+ R_OSPL_AXI_UNCACHED = 3,
+ R_OSPL_AXI_WRITE_BACK_W = 11,
+ R_OSPL_AXI_WRITE_BACK = 15
+} r_ospl_axi_cache_attribute_t;
+
+
+/**
+* @enum r_ospl_axi_protection_t
+* @brief Protection on AXI bus.
+*
+* - R_OSPL_AXI_PROTECTION_ZERO - Not AXI
+* - R_OSPL_AXI_SECURE - TrustZone secure acccess
+* - R_OSPL_AXI_NON_SECURE - TrustZone non-secure acccess
+*/
+typedef enum {
+ R_OSPL_AXI_PROTECTION_ZERO = 0,
+ R_OSPL_AXI_SECURE = 0,
+ R_OSPL_AXI_NON_SECURE = 2
+} r_ospl_axi_protection_t;
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @enum Event_Bit_Name
+* @brief Event_Bit_Name
+* - R_OSPL_ANY_FLAG - 0x0000
+* - R_OSPL_A_FLAG - 0x0001
+* - R_OSPL_I_FLAG - 0x0002
+* - R_OSPL_FINAL_A_FLAG - 0x0004
+*/
+enum {
+ R_OSPL_ANY_FLAG = 0x00000000,
+ R_OSPL_A_FLAG = 0x00000001,
+ R_OSPL_I_FLAG = 0x00000002,
+ R_OSPL_FINAL_A_FLAG = 0x00000004
+};
+
+
+/**
+* @typedef r_ospl_cancel_flag_t
+* @brief Bit flags of <r_ospl_cancel_bit_t>
+*/
+typedef int_t r_ospl_cancel_flag_t;
+
+
+/**
+* @enum r_ospl_cancel_bit_t
+* @brief r_ospl_cancel_bit_t
+* - R_OSPL_CANNEL_REQUEST - 0x0001
+* - R_OSPL_CANNELING - 0x0002
+* - R_OSPL_CANNELED - 0x0004
+* - R_OSPL_FINALIZE_REQUEST - 0x0010
+* - R_OSPL_FINALIZING - 0x0020
+* - R_OSPL_FINALIZED - 0x0040
+*/
+enum {
+ R_OSPL_CANNEL_REQUEST = 0x00000001,
+ R_OSPL_CANNELING = 0x00000002,
+ R_OSPL_CANNELED = 0x00000004,
+ R_OSPL_FINALIZE_REQUEST = 0x00000010,
+ R_OSPL_FINALIZING = 0x00000020,
+ R_OSPL_FINALIZED = 0x00000040
+};
+
+
+/***********************************************************************
+* Macros: OSPL_Others
+*
+* : R_OSPL_INFINITE - One of time out value
+* : R_OSPL_FLAG32_ALL_BITS - R_OSPL_FLAG32_ALL_BITS
+* : R_OSPL_EVENT_ALL_BITS - R_OSPL_EVENT_ALL_BITS
+* : R_OSPL_TIMEOUT - Raised time out
+* : R_OSPL_MAX_TIME_OUT - Max value of time out
+* : R_OSPL_NO_INDEX - R_OSPL_NO_INDEX
+* : R_OSPL_UNLOCKED_CHANNEL - R_OSPL_UNLOCKED_CHANNEL
+************************************************************************/
+#define R_OSPL_INFINITE 0xFFFFFFFFu /* uint32_t */
+#define R_OSPL_FLAG32_ALL_BITS 0xFFFFFFFFu /* uint32_t */
+enum { R_OSPL_EVENT_ALL_BITS = 0x0000FFFF };
+enum { R_OSPL_TIMEOUT = 0x40000000 };
+enum { R_OSPL_MAX_TIME_OUT = 65533 };
+enum { R_OSPL_NO_INDEX = -1 };
+enum { R_OSPL_UNLOCKED_CHANNEL = 0x00000FEE };
+
+
+/**
+* @def R_OSPL_TABLE_SIZE
+* @brief Calculates the size of <r_ospl_table_t> type index table
+* @param MaxCount Max index count
+* @return Table size
+*/
+/* ->MISRA 19.7 : Array count must const */ /* ->SEC M5.1.3 */
+#define R_OSPL_TABLE_1_SIZE 8 /* sizeof(r_ospl_table_block_t) */
+#define R_OSPL_TABLE_SIZE( MaxCount ) \
+ ( (MaxCount) * R_OSPL_TABLE_1_SIZE )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @def R_OSPL_DEBUG_WORK_SIZE
+* @brief Calculates the size of debug work area
+* @param ThreadMaxCount Max thread count using error breaking system of OSPL
+* @return Size of debug work area
+*/
+/* ->MISRA 19.7 : Array count must const */ /* ->SEC M5.1.3 */
+#define R_OSPL_DEBUG_WORK_1_SIZE 32 /* sizeof(r_ospl_table_block_t) + sizeof(r_ospl_error_t) */
+#define R_OSPL_DEBUG_WORK_SIZE( ThreadMaxCount ) \
+ ( (ThreadMaxCount) * R_OSPL_DEBUG_WORK_1_SIZE )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+
+/**
+* @enum errnum_t
+* @brief Error code defined by OSPL
+*
+* - E_OTHERS - 0x01
+* - E_FEW_ARRAY - 0x02
+* - E_FEW_MEMORY - 0x03
+* - E_FIFO_OVER - 0x04
+* - E_NOT_FOUND_SYMBOL - 0x05
+* - E_NO_NEXT - 0x06
+* - E_ACCESS_DENIED - 0x07
+* - E_NOT_IMPLEMENT_YET - 0x09
+* - E_ERRNO - 0x0E
+* - E_LIMITATION - 0x0F
+* - E_STATE - 0x10
+* - E_NOT_THREAD - 0x11
+* - E_PATH_NOT_FOUND - 0x12
+* - E_BAD_COMMAND_ID - 0x16
+* - E_TIME_OUT - 0x17
+* - E_NO_DEBUG_TLS - 0x1D
+* - E_EXIT_TEST - 0x1E
+*/
+#define E_CATEGORY_MASK 0xFFFFFFE0u /* E_CATEGORY_* */
+enum { E_OFFSET_MASK = 0x0000001F };
+
+#ifndef E_CATEGORY_COMMON /* Overwritable */
+#define E_CATEGORY_COMMON E_CATEGORY_COMMON
+enum { E_CATEGORY_COMMON = 0x00000000 }; /* 0x01, 0x02 .. 0x1F : Reseved */
+#endif
+
+enum { E_OTHERS = E_CATEGORY_COMMON | 0x01 }; /* 1 */
+enum { E_FEW_ARRAY = E_CATEGORY_COMMON | 0x02 }; /* 2 */
+enum { E_FEW_MEMORY = E_CATEGORY_COMMON | 0x03 }; /* 3 */
+enum { E_FIFO_OVER = E_CATEGORY_COMMON | 0x04 }; /* 4 */
+enum { E_NOT_FOUND_SYMBOL = E_CATEGORY_COMMON | 0x05 }; /* 5 */
+enum { E_NO_NEXT = E_CATEGORY_COMMON | 0x06 }; /* 6 */
+enum { E_ACCESS_DENIED = E_CATEGORY_COMMON | 0x07 }; /* 7 */
+enum { E_NOT_IMPLEMENT_YET = E_CATEGORY_COMMON | 0x09 }; /* 9 */
+enum { E_ERRNO = E_CATEGORY_COMMON | 0x0E }; /* 14 */
+enum { E_LIMITATION = E_CATEGORY_COMMON | 0x0F }; /* 15 */
+enum { E_STATE = E_CATEGORY_COMMON | 0x10 }; /* 16 */
+enum { E_NOT_THREAD = E_CATEGORY_COMMON | 0x11 }; /* 17 */
+enum { E_PATH_NOT_FOUND = E_CATEGORY_COMMON | 0x12 }; /* 18 */
+enum { E_BAD_COMMAND_ID = E_CATEGORY_COMMON | 0x16 }; /* 22 */
+enum { E_TIME_OUT = E_CATEGORY_COMMON | 0x17 }; /* 23 */
+enum { E_NO_DEBUG_TLS = E_CATEGORY_COMMON | 0x1D }; /* 29 */
+enum { E_EXIT_TEST = E_CATEGORY_COMMON | 0x1E }; /* 30 */
+
+
+/**
+* @def R_JOIN_SYMBOL_FOR_ASSERT
+* @brief Sub routine of <R_STATIC_ASSERT>
+* @par Parameters
+* None
+* @return None.
+*
+* - This macro extends "x", "y"
+* - This code is referenced by CERT secure coding standard PRE05-C
+*/
+/* ->MISRA 19.7 : Extend macro arguments */ /* ->SEC M5.1.3 */
+#define R_JOIN_SYMBOL_FOR_ASSERT(x, y) R_JOIN_SYMBOL_FOR_ASSERT_SUB(x, y)
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* ->MISRA 19.13 : This is used only assertion in compiling */ /* ->SEC M5.1.2 (1) */
+#define R_JOIN_SYMBOL_FOR_ASSERT_SUB(x, y) x##y
+/* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+
+/**
+* @def R_STATIC_ASSERT
+* @brief "static_assert" for in function
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* Compatible with static_assert (C++0x). But our naming rule is not match.
+* - This code is referenced by CERT secure coding standard DCL03 - C.
+* This macro raised QAC warning 3205. This is no problem.
+*/
+/* ->SEC M1.1.1 */
+#define R_STATIC_ASSERT( ConstantExpression, StringLiteral ) \
+ do { typedef char_t R_JOIN_SYMBOL_FOR_ASSERT( assertion_failed_t_, __LINE__ ) \
+ [(ConstantExpression) ? 1 : -1]; } while(0)
+/* If "ConstantExpression" is false, illegal array size error will be raised. */
+/* <-SEC M1.1.1 */
+
+
+/**
+* @def R_STATIC_ASSERT_GLOBAL
+* @brief "static_assert" for in global scope
+* @par Parameters
+* None
+* @return None.
+*/
+/* ->SEC M1.1.1 */
+/* ->MISRA 19.4 : There is not if statement in global */ /* ->SEC M1.8.2 */
+/* ->MISRA 19.7 : Cannot function */ /* ->SEC M5.1.3 */
+#define R_STATIC_ASSERT_GLOBAL( ConstantExpression, StringLiteral ) \
+ typedef char_t R_JOIN_SYMBOL_FOR_ASSERT( assertion_failed_t_, __LINE__ ) \
+ [(ConstantExpression) ? 1 : -1]
+/* If "ConstantExpression" is false, illegal array size error will be raised. */
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
+/* <-SEC M1.1.1 */
+
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+/* In "r_ospl.h" */
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_OSPL_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/inc/r_static_an_tag.h Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,376 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_static_an_tag.h
+* @brief Reviewed tag for warnings of static code analysis.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+#ifndef R_STATIC_AN_TAG_H
+#define R_STATIC_AN_TAG_H
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "Project_Config.h"
+#include "r_typedefs.h"
+#include "r_multi_compiler.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Variable Externs
+******************************************************************************/
+
+/******************************************************************************
+Functions Prototypes
+******************************************************************************/
+
+/***********************************************************************
+* Macros: IS
+* Changes the code accepted with MISRA 13.2 to readable
+*
+* Arguments:
+* bool_value - The expression that evaluated result becomes boolean type
+*
+* Return Value:
+* Evaluate result of "bool_value != 0".
+*
+* Description:
+* Avoid "not 0" as double negation.
+* "IS" macro corresponds to cast to boolean type specified in the language.
+*
+* This is for QAC warning : MISRA 13.2 Advice : Tests of a value against
+* zero should be made explicit, unless the operand is effectively Boolean.
+*
+* Write this macro after being warned by static code analyzer.
+*
+* Example:
+* > if ( IS( bool_value ) ) {...}
+* > if ( IS( bool_value ) && IS( bool_value2 ) && ! bool_value3 ) {...}
+* > if ( IS( unsigned_bitfield ) ) {...}
+* > bool_t is_flag = (bool_t) unsigned_bitfield; ("IS" is not used)
+************************************************************************/
+/* ->MISRA 19.7 : For return _Bool type */ /* ->SEC M5.1.3 */
+#if ! R_BOOL_IS_SIGNED
+#define IS( bool_value ) ( (bool_t)( bool_value ) != 0u )
+#else
+#define IS( bool_value ) ( (bool_t)( bool_value ) != 0 )
+#endif
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+
+#if 0
+/* Comment out because if checking type function(this) was called, raises SEC R3.6.2(QAC 3441) */
+#define IS( bool_value ) ( IS_Sub( bool_value ) != 0 )
+INLINE bool_t IS_Sub( bool_t const value ) /* Check type only */
+{
+ return value;
+}
+#endif
+
+
+/***********************************************************************
+* Macros: IF_DQ
+* Error check on DEBUG and QAC version for faster
+************************************************************************/
+/* ->MISRA 19.4 : Compliant with C language syntax. */ /* ->SEC M1.8.2 */
+#if defined(__QAC_ARM_H__)
+#define IF_DQ if
+#else
+#define IF_DQ IF_D
+#endif
+/* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
+
+
+/***********************************************************************
+* Macros: IF_DS
+* Error check on DEBUG and QAC version for always false
+*
+* Description:
+* QAC assist tool founds IF_DS keyword.
+* Sentence using this expects IPA SEC O4.1, O1.1.
+************************************************************************/
+#define IF_DS IF_DQ
+
+
+/***********************************************************************
+* Macros: IF_S
+* Error check on QAC version for always false
+*
+* Description:
+* QAC assist tool founds IF_S keyword.
+* Compiler always does not check it.
+************************************************************************/
+/* ->MISRA 19.4 : Compliant with C language syntax. */ /* ->SEC M1.8.2 */
+#if defined(__QAC_ARM_H__)
+#define IF_S if
+#else
+#define IF_S( Condition ) if ( false )
+#endif
+/* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
+
+
+/**
+* @def R_CUT_IF_ALWAYS
+* @brief Whether a expression always true/false was cut or not.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* The value is 0 or 1.
+* This macro is for @ref R_CUT_IF_ALWAYS_TRUE and @ref R_CUT_IF_ALWAYS_FALSE.
+*/
+#ifndef R_CUT_IF_ALWAYS
+#if defined(__QAC_ARM_H__)
+#define R_CUT_IF_ALWAYS 0
+#else
+#define R_CUT_IF_ALWAYS 1
+#endif
+#endif
+
+
+/**
+* @def R_CUT_IF_ALWAYS_TRUE
+* @brief Assertion that the expression is always true
+* @par Parameters
+* None
+* @return None.
+*/
+#if R_CUT_IF_ALWAYS
+#define R_CUT_IF_ALWAYS_TRUE( expression_and )
+#else
+/* ->MISRA 19.10 : Can not in ( ). e.g. expression_and = " a >= 0 &&" */
+#define R_CUT_IF_ALWAYS_TRUE( expression_and ) expression_and
+/* <-MISRA 19.10 */
+#endif
+
+
+/**
+* @def R_CUT_IF_ALWAYS_FALSE
+* @brief Assertion that the expression is always false
+* @par Parameters
+* None
+* @return None.
+*/
+#if R_CUT_IF_ALWAYS
+#define R_CUT_IF_ALWAYS_FALSE( expression_or )
+#else
+/* ->MISRA 19.10 : Can not in ( ). e.g. expression_and = " a >= 0 &&" */
+#define R_CUT_IF_ALWAYS_FALSE( expression_or ) expression_or
+/* <-MISRA 19.10 */
+#endif
+
+
+/**
+* @def R_UNREFERENCED_VARIABLE
+* @brief Assertion that specified variable is not referenced
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This avoids warning of "set but never used".
+*/
+/* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
+#define R_UNREFERENCED_VARIABLE( a1 ) R_UNREFERENCED_VARIABLE_Sub( &(a1) )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* ->QAC 3206 : Not used argument */
+INLINE void R_UNREFERENCED_VARIABLE_Sub( volatile const void *a1 ) { }
+/* <-QAC 3206 */
+
+
+/**
+* @def R_UNREFERENCED_VARIABLE_2
+* @brief Assertion that specified variable is not referenced
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This avoids warning of "set but never used".
+*/
+/* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
+#define R_UNREFERENCED_VARIABLE_2( a1,a2 ) R_UNREFERENCED_VARIABLE_2_Sub( &(a1), &(a2) )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* ->QAC 3206 : Not used argument */
+INLINE void R_UNREFERENCED_VARIABLE_2_Sub( volatile const void *a1, volatile const void *a2 ) { }
+/* <-QAC 3206 */
+
+
+/**
+* @def R_UNREFERENCED_VARIABLE_3
+* @brief Assertion that specified variable is not referenced
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This avoids warning of "set but never used".
+*/
+/* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
+#define R_UNREFERENCED_VARIABLE_3( a1,a2,a3 ) R_UNREFERENCED_VARIABLE_3_Sub( &(a1), &(a2), &(a3) )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* ->QAC 3206 : Not used argument */
+INLINE void R_UNREFERENCED_VARIABLE_3_Sub( volatile const void *a1, volatile const void *a2,
+ volatile const void *a3 ) { }
+/* <-QAC 3206 */
+
+
+/**
+* @def R_UNREFERENCED_VARIABLE_4
+* @brief Assertion that specified variable is not referenced
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This avoids warning of "set but never used".
+*/
+/* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
+#define R_UNREFERENCED_VARIABLE_4( a1,a2,a3,a4 ) R_UNREFERENCED_VARIABLE_4_Sub( &(a1), &(a2), &(a3), &(a4) )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* ->QAC 3206 : Not used argument */
+INLINE void R_UNREFERENCED_VARIABLE_4_Sub( volatile const void *a1, volatile const void *a2,
+ volatile const void *a3, volatile const void *a4 ) { }
+/* <-QAC 3206 */
+
+
+/**
+* @def R_IT_WILL_BE_NOT_CONST
+* @brief variable WILL_BE_NOT_CONST
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This avoids MISRA 16.7 advisory and SEC M1.11.1 for not modified API argument
+* will be not const future.
+*/
+/* ->MISRA 16.7 */ /* ->SEC M1.11.1 : Tell to QAC/compiler that "*Pointer" was changed */
+INLINE void R_IT_WILL_BE_NOT_CONST( void *Pointer ); /* MISRA 8.1 Advice */
+INLINE void R_IT_WILL_BE_NOT_CONST( void *Pointer )
+{
+ R_UNREFERENCED_VARIABLE( Pointer );
+}
+/* <-MISRA 16.7 */ /* <-SEC M1.11.1 */
+
+
+/**
+* @def R_AVOID_UNSAFE_ALWAYS_WARNING
+* @brief Specifies the code cannot be cut.
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This avoid MISRA 13.7 require always true/false condition.
+* This tells to QAC/compiler that "Variable" was changed.
+*/
+/* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
+#define R_AVOID_UNSAFE_ALWAYS_WARNING( Variable ) \
+ R_AVOID_UNSAFE_ALWAYS_WARNING_SUB( &(Variable) )
+/* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
+/* ->MISRA 16.7 : Tell to QAC/compiler that "Variable" was changed */ /* ->SEC M1.11.1 */
+INLINE void R_AVOID_UNSAFE_ALWAYS_WARNING_SUB( void *Pointer ); /* MISRA 8.1 Advice */
+INLINE void R_AVOID_UNSAFE_ALWAYS_WARNING_SUB( void *Pointer )
+/* <-MISRA 16.7 */ /* <-SEC M1.11.1 */
+{
+ R_UNREFERENCED_VARIABLE( Pointer );
+}
+
+
+/**
+* @def TO_UNSIGNED
+* @brief Cast to unsigned type constant value
+* @par Parameters
+* None
+* @return None.
+*/
+/* ->MISRA 19.7 : It is not able to replace to function because this expands macro's parameter */
+/* ->SEC M5.1.3 */
+#define TO_UNSIGNED(x) TO_UNSIGNED_AGAIN(x) /* Expand "x" */
+/* <-MISRA 19.7 */
+/* <-SEC M5.1.3 */
+
+/* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
+#define TO_UNSIGNED_AGAIN(x) (x##u)
+/* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
+
+
+/**
+* @brief Cast to unsigned type constant value
+*
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This can not avoid QAC warning. This macro is for count reviewed code automatically.
+*/
+INLINE uint32_t R_ToUnsigned( int32_t const ConstantInteger )
+{
+ return (uint32_t) ConstantInteger;
+}
+
+
+/**
+* @brief Cast to signed type constant value
+*
+* @par Parameters
+* None
+* @return None.
+*
+* @par Description
+* This can not avoid QAC warning. This macro is for count reviewed code automatically.
+*/
+INLINE int32_t R_ToSigned( uint32_t const ConstantInteger )
+{
+ return (int32_t) ConstantInteger;
+}
+
+
+/***********************************************************************
+* End of File:
+************************************************************************/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* R_STATIC_AN_TAG_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/porting/DebugBreak.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,78 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file DebugBreak.c
+* @brief General Break Point
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#ifndef R_OSPL_NDEBUG
+#include <stdio.h>
+#endif
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+
+/***********************************************************************
+* Implement: R_DebugBreak
+************************************************************************/
+void R_DebugBreak( const char_t *const File, int_fast32_t const Line )
+{
+#ifndef R_OSPL_NDEBUG
+ if ( File == NULL ) {
+ printf( "in R_DebugBreak errnum_t:0x%X\n", Line );
+ } else {
+ printf( "in R_DebugBreak (%d) %s\n", Line, File );
+ }
+#else
+ R_UNREFERENCED_VARIABLE_2( File, Line );
+#endif
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/porting/TOOLCHAIN_ARM/r_ospl_os_less_asm.s Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,151 @@
+;/*******************************************************************************
+;* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+;*******************************************************************************/
+;/*******************************************************************************
+;* $FileName: r_ospl_os_less_asm.s $
+;* $Module: OSPL $ $PublicVersion: 0.84 $ (=R_OSPL_VERSION)
+;* $Rev: 35 $
+;* $Date:: 2014-04-15 21:38:18 +0900#$
+;* Description : OS Porting Layer API
+;******************************************************************************/
+
+
+ AREA |.text|, CODE, READONLY
+
+
+;/******************************************************************************
+;* Function Name: [R_OSPL_MEMORY_Flush_Sub]
+;* Description :
+;* Arguments : None
+;* Return Value : None
+;******************************************************************************/
+
+ EXPORT R_OSPL_MEMORY_Flush_Sub
+
+R_OSPL_MEMORY_Flush_Sub FUNCTION
+
+ ARM
+
+ PUSH {r4-r7}
+
+ MRC p15, 1, r7, c0, c0, 1 ;// r7 = p15(CLIDR); // [r4] CLIDR(LoC) * 2 // LoC: level of coherency
+ MOV r4, r7, LSR #23 ;// r4 = r7 >> 23; // :
+ ANDS r4, r4, #0xE ;// r4 &= 0xE; // :
+ BEQ Fin ;// if ( r4 == 0 ) goto Fin; // if LoC == 0, no need to clean
+
+ MOV r3, #0 ;// for ( r3 = 0; r3 < r4; r3 += 2 ) { // [r3]: current_cache_level * 2
+Loop1
+ ADD r2, r3, r3, LSR #1 ;// r2 = r3 + (r3 >> 1); // r2 = current_cache_level * 3
+ MOV r0, r7, LSR r2 ;// r0 = (r7 >> r2); // r0 = CLIDR(Ctype#)
+ AND r0, r0, #7 ;// r0 &= 7; // :
+ CMP r0, #2 ;// if ( r0 < 2 ) goto Continue1;
+ BLT Continue1 ;// : // If no cache or only instruction cache at this level
+
+ MCR p15, 2, r3, c0, c0, 0 ;// p15(CSSELR) = r3; // CSSELR: Cache Size Selection Register
+ ISB ;// Guarantee MCR operation
+ MRC p15, 1, r0, c0, c0, 0 ;// r0 = p15(CCSIDR); // CCSIDR: Cache Size ID Registers
+ AND r6, r0, #7 ;// r6 = r0 & 7; // CCSIDR(LineSize): log2(cache_line_byte)-4
+ ADD r6, r6, #4 ;// r6 += 4; // [r6] log2(cache_line_byte)
+ LDR r7, =0x3FF ;// r7 = 0x3FF; // [r7] CCSIDR(Associativity): associativity_value - 1
+ AND r7, r7, r0, LSR #3 ;// r7 = r7 & r0 >> 3; // :
+ CLZ r5, r7 ;// r5 = CLZ( r7 ); // [r5] log2(WaySize), if exponential 2
+ LDR r2, =0x7FFF ;// r2 = 0x7FFF; // CCSIDR(NumSets) : max number of the index size - 1
+ AND r2, r2, r0, LSR #13 ;// r2 = r2 & r0 >> 13; // :
+ ;// for ( /*r2*/; r2 >= 0; r2 -= 1 ) { // [r2] Set number
+Loop2
+ MOV r1, r7 ;// for ( r1 = r7; r1 >= 0; r1 -= 1 ) { // [r1] Way number
+Loop3
+ ORR r0, r3, r1, LSL r5 ;// r0 = r3 | (r1 << r5)
+ ORR r0, r0, r2, LSL r6 ;// | (r2 << r6);
+ MCR p15, 0, r0, c7, c14, 2 ;// p15(DCCISW) = r0; // Clean(WriteBack) and Invalidate
+ SUBS r1, r1, #1 ;// } /* End of r1 loop */
+ BGE Loop3 ;// :
+ SUBS r2, r2, #1 ;// } /* End of r2 loop */
+ BGE Loop2 ;// :
+Continue1
+ ADD r3, r3, #2 ;// } /* End of r3 loop */
+ CMP r4, r3 ;// :
+ BGT Loop1 ;// :
+
+Fin
+ DSB
+ POP {r4-r7}
+ BX lr
+
+ ENDFUNC
+
+
+;/******************************************************************************
+;* Function Name: [R_OSPL_MEMORY_GetCacheLineSize]
+;* Description :
+;* Arguments : None
+;* Return Value : None
+;******************************************************************************/
+
+ EXPORT R_OSPL_MEMORY_GetCacheLineSize
+
+R_OSPL_MEMORY_GetCacheLineSize FUNCTION
+
+ ARM
+
+ MRC p15, 1, r0, c0, c0, 0 ;// r0 = p15(CCSIDR); // CCSIDR: Cache Size ID Registers
+ AND r0, r0, #7 ;// r0 = r0 & 7; // CCSIDR.LineSize: log2(cache_line_byte)-4
+ ADD r0, r0, #4 ;// r0 += 4; //
+ MOV r1, #1 ;// r0 = 1 << r0; // [r0] cache_line_byte
+ MOV r0, r1, LSL r0 ; :
+
+ BX lr
+
+ ENDFUNC
+
+
+;/******************************************************************************
+;* Function Name: [R_OSPL_MEMORY_RangeFlush_Sub]
+;* Description :
+;* Arguments : r0: Start address
+;* : r1: Over address (Last + 1)
+;* : r2: Cache line size
+;* Return Value : None
+;******************************************************************************/
+
+ EXPORT R_OSPL_MEMORY_RangeFlush_Sub
+
+R_OSPL_MEMORY_RangeFlush_Sub FUNCTION
+
+ ARM
+
+Loop
+ CMP r0, r1 ;// for ( r0 = r0; r0 < r1; r0 += r2 ) {
+ BGE Fin2 ;// :
+ MCR p15, 0, r0, c7, c6, 1 ;// p15(DCIMVAC) = r0; // Invalidate
+ ADD r0, r0, r2 ;// }
+ B Loop ;// :
+Fin2
+ DSB
+ BX lr
+
+ ENDFUNC
+
+ END
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ospl/porting/inline_body.c Wed Aug 19 08:58:26 2015 +0000 @@ -0,0 +1,33 @@ +/******************************************************************************* +* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved. +*******************************************************************************/ +/** +* @file inline_body.c +* @brief Body of inline functions +* +* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION) +* $Rev: 35 $ +* $Date:: 2014-04-15 21:38:18 +0900#$ +*/ + +#define R_OSPL_MAKE_INLINE_BODY +#include "r_ospl.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/porting/locking.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,393 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file locking.c
+* @brief Lock related FIT BSP.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#if R_OSPL_IS_PREEMPTION
+#include "r_ospl_RTX_private.h"
+#endif
+#if IS_RZ_A1_BSP_USED
+#include "dma_if.h" /* R_DMA_Alloc */
+#endif
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+/** gs_ospl_mutex */
+#if R_OSPL_IS_PREEMPTION
+static osMutexId gs_ospl_mutex; /* gs_OSPL_Mutex */
+#endif
+
+
+/** g_bsp_Locks */
+BSP_CFG_USER_LOCKING_TYPE g_bsp_Locks[ BSP_NUM_LOCKS ];
+
+
+/***********************************************************************
+* Implement: R_BSP_HardwareLock
+************************************************************************/
+bool_t R_BSP_HardwareLock( mcu_lock_t const HardwareIndex )
+{
+#if BSP_CFG_USER_LOCKING_ENABLED
+ return BSP_CFG_USER_LOCKING_HW_LOCK_FUNCTION( HardwareIndex );
+#else
+ bool_t is_success;
+
+
+#if IS_RZ_A1_BSP_USED
+ if ( HardwareIndex >= BSP_LOCK_DMAC0 && HardwareIndex <= BSP_LOCK_DMAC15 ) {
+ int_fast32_t channel_of_DMAC = HardwareIndex - BSP_LOCK_DMAC0;
+
+ channel_of_DMAC = R_DMA_Alloc( channel_of_DMAC, NULL );
+ IF ( channel_of_DMAC == -1 ) {
+ is_success = false;
+ goto fin;
+ }
+
+ is_success = true;
+ goto fin;
+ }
+#endif
+
+ IF_D ( R_CUT_IF_ALWAYS_FALSE( HardwareIndex < 0u ||) HardwareIndex >= R_COUNT_OF( g_bsp_Locks ) ) {
+ is_success = false;
+ goto fin;
+ }
+
+ is_success = R_BSP_SoftwareLock( &g_bsp_Locks[ HardwareIndex ] );
+ IF ( ! is_success ) {
+ goto fin;
+ }
+
+ is_success = true;
+fin:
+ return is_success;
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_LockUnlockedChannel
+************************************************************************/
+#if ! BSP_CFG_USER_LOCKING_ENABLED
+errnum_t R_OSPL_LockUnlockedChannel( int_fast32_t *out_ChannelNum,
+ mcu_lock_t HardwareIndexMin, mcu_lock_t HardwareIndexMax )
+{
+ errnum_t e;
+ mcu_lock_t hardware_index;
+#if R_OSPL_IS_PREEMPTION
+ bool_t is_lock = false;
+#endif
+
+#if R_OSPL_IS_PREEMPTION
+ if ( R_OSPL_THREAD_GetCurrentId() == NULL ) { /* If interrrupt context */
+ e = E_NOT_THREAD;
+ goto fin;
+ }
+ e= R_OSPL_Start_T_Lock();
+ if ( e != 0 ) {
+ R_OSPL_RaiseUnrecoverable( e );
+ goto fin;
+ }
+ is_lock = true; /* T-Lock to "self" */
+#endif
+
+
+#if IS_RZ_A1_BSP_USED
+ if ( HardwareIndexMin == BSP_LOCK_DMAC0 ) {
+ int_fast32_t channel_of_DMAC;
+
+ channel_of_DMAC = R_DMA_Alloc( DMA_ALLOC_CH, NULL );
+ IF ( channel_of_DMAC == -1 ) {
+ e = E_FEW_ARRAY;
+ goto fin;
+ }
+
+ *out_ChannelNum = channel_of_DMAC;
+ e = 0;
+ goto fin;
+ }
+#endif
+
+
+ for ( hardware_index = HardwareIndexMin; hardware_index <= HardwareIndexMax;
+ hardware_index += 1 ) {
+ r_ospl_c_lock_t *lock = &g_bsp_Locks[ hardware_index ];
+
+ if ( ! lock->IsLocked ) {
+ lock->IsLocked = true;
+ break;
+ }
+ }
+ IF ( hardware_index > HardwareIndexMax ) {
+ e=E_FEW_ARRAY;
+ goto fin;
+ }
+
+
+ *out_ChannelNum = hardware_index - HardwareIndexMin;
+
+
+ e=0;
+fin:
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( is_lock ) ) {
+ R_OSPL_End_T_Lock();
+ }
+#endif
+
+ return e;
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_BSP_HardwareUnlock
+************************************************************************/
+bool_t R_BSP_HardwareUnlock( mcu_lock_t const HardwareIndex )
+{
+#if BSP_CFG_USER_LOCKING_ENABLED
+ return BSP_CFG_USER_LOCKING_HW_UNLOCK_FUNCTION( HardwareIndex );
+#else
+ bool_t is_success;
+
+
+#if IS_RZ_A1_BSP_USED
+ if ( HardwareIndex >= BSP_LOCK_DMAC0 && HardwareIndex <= BSP_LOCK_DMAC15 ) {
+ int_fast32_t channel_of_DMAC = HardwareIndex - BSP_LOCK_DMAC0;
+ int_fast32_t err2;
+
+ err2 = R_DMA_Free( channel_of_DMAC, NULL );
+ IF ( err2 != ESUCCESS ) {
+ is_success = false;
+ goto fin;
+ }
+
+ is_success = true;
+ goto fin;
+ }
+#endif
+
+
+ IF_D ( R_CUT_IF_ALWAYS_FALSE( HardwareIndex < 0u ||) HardwareIndex >= R_COUNT_OF( g_bsp_Locks ) ) {
+ is_success = false;
+ R_OSPL_RaiseUnrecoverable( E_FEW_ARRAY );
+ goto fin;
+ }
+
+ is_success = R_BSP_SoftwareUnlock( &g_bsp_Locks[ HardwareIndex ] );
+ IF ( ! is_success ) {
+ goto fin;
+ }
+
+ is_success = true;
+fin:
+ return is_success;
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_BSP_SoftwareLock
+************************************************************************/
+bool_t R_BSP_SoftwareLock( BSP_CFG_USER_LOCKING_TYPE *const LockObject )
+{
+#if BSP_CFG_USER_LOCKING_ENABLED
+ return BSP_CFG_USER_LOCKING_SW_LOCK_FUNCTION( LockObject );
+#else
+ errnum_t e;
+#if R_OSPL_IS_PREEMPTION
+ bool_t is_lock = false;
+#endif
+
+#if R_OSPL_IS_PREEMPTION
+ if ( R_OSPL_THREAD_GetCurrentId() != NULL ) { /* If not interrrupt context */
+ e= R_OSPL_Start_T_Lock();
+ IF(e!=0) {
+ goto fin;
+ }
+ is_lock = true; /* T-Lock to "self" */
+ }
+#endif
+
+
+ e= R_OSPL_C_LOCK_Lock( LockObject );
+ if ( e == E_ACCESS_DENIED ) {
+ R_OSPL_CLEAR_ERROR();
+ goto fin;
+ }
+ IF(e) {
+ goto fin;
+ }
+
+ e=0;
+fin:
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( is_lock ) ) {
+ R_OSPL_End_T_Lock();
+ }
+#endif
+
+ return (bool_t)( e == 0 );
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_BSP_SoftwareUnlock
+************************************************************************/
+bool_t R_BSP_SoftwareUnlock( BSP_CFG_USER_LOCKING_TYPE *const LockObject )
+{
+#if BSP_CFG_USER_LOCKING_ENABLED
+ return BSP_CFG_USER_LOCKING_SW_UNLOCK_FUNCTION( LockObject );
+#else
+ errnum_t e;
+#if R_OSPL_IS_PREEMPTION
+ bool_t is_lock = false;
+#endif
+
+#if R_OSPL_IS_PREEMPTION
+ if ( R_OSPL_THREAD_GetCurrentId() != NULL ) { /* If not interrrupt context */
+ e= R_OSPL_Start_T_Lock();
+ IF ( e != 0 ) {
+ R_OSPL_RaiseUnrecoverable( e );
+ goto fin;
+ }
+ is_lock = true; /* T-Lock to "self" */
+ }
+#endif
+
+
+ e= R_OSPL_C_LOCK_Unlock( LockObject );
+ if ( e == E_ACCESS_DENIED ) {
+ R_OSPL_CLEAR_ERROR();
+ goto fin;
+ }
+ IF(e) {
+ goto fin;
+ }
+
+ e=0;
+fin:
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( is_lock ) ) {
+ R_OSPL_End_T_Lock();
+ }
+#endif
+
+ return (bool_t)( e == 0 );
+#endif
+}
+
+
+/**
+* @brief The function callbacked from OSPL internal, when T-Lock started
+*
+* @par Parameters
+* None
+* @return Error Code. 0=No Error.
+*/
+#if R_OSPL_IS_PREEMPTION
+errnum_t R_OSPL_Start_T_Lock(void)
+{
+ errnum_t e;
+ osStatus es;
+
+ static osMutexDef( gs_ospl_mutex );
+
+ if ( gs_ospl_mutex == NULL ) {
+ gs_ospl_mutex = osMutexCreate( osMutex( gs_ospl_mutex ) );
+ if ( gs_ospl_mutex == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ }
+
+ es= osMutexWait( gs_ospl_mutex, TO_UNSIGNED( osWaitForever ) );
+ if ( es == osErrorISR ) {
+ es = osOK;
+ }
+ if ( es != osOK ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ e=0;
+fin:
+ return e;
+}
+#endif
+
+
+/**
+* @brief The function callbacked from OSPL internal, when T-Lock ended
+*
+* @par Parameters
+* None
+* @return None
+*/
+#if R_OSPL_IS_PREEMPTION
+void R_OSPL_End_T_Lock(void)
+{
+ if ( gs_ospl_mutex != NULL ) {
+ osStatus rs;
+
+ rs= osMutexRelease( gs_ospl_mutex );
+ if ( rs == osErrorISR ) {
+ rs = osOK;
+ }
+ ASSERT_R( rs == osOK, R_OSPL_RaiseUnrecoverable( E_OTHERS ) );
+ }
+}
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/porting/mcu_interrupts.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,149 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file mcu_interrupts.c
+* @brief Interrupt related FIT BSP.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#include "mcu_interrupts.h"
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+
+/***********************************************************************
+* Implement: R_BSP_InterruptWrite
+************************************************************************/
+bsp_int_err_t R_BSP_InterruptWrite( bsp_int_src_t const in_IRQ_Num, bsp_int_cb_t const in_Callback )
+{
+ uint32_t er;
+ bsp_int_err_t eb;
+ IRQn_Type irq; /* QAC 3441 */
+
+ if ( in_Callback == FIT_NO_FUNC ) {
+ irq = R_CAST_bsp_int_src_t_to_IRQn_Type( in_IRQ_Num );
+ er= InterruptHandlerUnregister( irq );
+ IF ( er != 0u ) {
+ eb=BSP_INT_ERR_INVALID_ARG;
+ goto fin;
+ }
+ } else {
+ irq = R_CAST_bsp_int_src_t_to_IRQn_Type( in_IRQ_Num ); /* QAC 3441 */
+ er= InterruptHandlerRegister( irq, in_Callback );
+ IF ( er != 0u ) {
+ eb=BSP_INT_ERR_INVALID_ARG;
+ goto fin;
+ }
+ }
+
+ eb = BSP_INT_SUCCESS;
+fin:
+ return eb;
+}
+
+
+/***********************************************************************
+* Implement: R_BSP_InterruptRead
+************************************************************************/
+bsp_int_err_t R_BSP_InterruptRead( bsp_int_src_t const in_IRQ_Num, bsp_int_cb_t *const out_Callback )
+{
+ R_UNREFERENCED_VARIABLE_2( in_IRQ_Num, out_Callback );
+ return BSP_INT_ERR_UNSUPPORTED;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_OnInterruptForUnregistered
+************************************************************************/
+void R_OSPL_OnInterruptForUnregistered( uint32_t const int_sense )
+{
+ R_UNREFERENCED_VARIABLE( int_sense );
+ R_OSPL_RaiseUnrecoverable( E_OTHERS );
+}
+
+
+/***********************************************************************
+* Implement: R_BSP_InterruptControl
+************************************************************************/
+bsp_int_err_t R_BSP_InterruptControl( bsp_int_src_t const in_IRQ_Num, bsp_int_cmd_t const in_Command,
+ void *const in_NotUsed )
+{
+ bsp_int_err_t eb;
+ IRQn_Type irq; /* QAC 3441 */
+
+ R_UNREFERENCED_VARIABLE( in_NotUsed );
+ R_IT_WILL_BE_NOT_CONST( in_NotUsed );
+
+ switch ( in_Command ) {
+ case BSP_INT_CMD_INTERRUPT_ENABLE:
+
+ irq = R_CAST_bsp_int_src_t_to_IRQn_Type( in_IRQ_Num );
+ GIC_EnableIRQ( irq );
+ break;
+
+ default:
+ IF_DS( in_Command != BSP_INT_CMD_INTERRUPT_DISABLE ) {
+ eb=BSP_INT_ERR_INVALID_ARG;
+ goto fin;
+ }
+
+ irq = R_CAST_bsp_int_src_t_to_IRQn_Type( in_IRQ_Num );
+ GIC_DisableIRQ( irq );
+ break;
+ }
+
+ eb = BSP_INT_SUCCESS;
+#if !defined(NDEBUG) || defined(__QAC_ARM_H__)
+fin:
+#endif
+ return eb;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/porting/r_ospl_RTX.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,528 @@
+/*******************************************************************************
+* 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) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_RTX.c
+* @brief OS Porting Layer API for RTX
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#include "r_ospl_os_less_private.h"
+#include "r_ospl_private.h"
+#include "pl310.h" /* 2nd cache */
+#if R_OSPL_IS_PREEMPTION
+#include "cmsis_os.h"
+#include "gic.h"
+#include "r_ospl_RTX_private.h"
+#endif
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/**
+* @def OS_ERROR_SIGNAL
+* @brief CMSIS-RTOS defined immediate value
+* @par Parameters
+* None
+* @return None.
+*/
+#define OS_ERROR_SIGNAL 0x80000000
+
+
+/**
+* @def R_OSPL_EVENT_WATCH
+* @brief Debug tool
+* @par Parameters
+* None
+* @return None.
+*/
+#define R_OSPL_EVENT_WATCH 0 /* [R_OSPL_EVENT_WATCH] 0 or 1 */
+
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+
+/***********************************************************************
+* Implement: R_OSPL_Initialize
+************************************************************************/
+errnum_t R_OSPL_Initialize( const void *const in_NullConfig )
+{
+ R_UNREFERENCED_VARIABLE( in_NullConfig );
+ return 0;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_THREAD_GetCurrentId
+************************************************************************/
+r_ospl_thread_id_t R_OSPL_THREAD_GetCurrentId(void)
+{
+ return osThreadGetId();
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_EVENT_Set
+************************************************************************/
+void R_OSPL_EVENT_Set( r_ospl_thread_id_t const ThreadId, bit_flags32_t const SetFlags )
+{
+ int32_t ret;
+
+ if ( ThreadId != NULL ) {
+#if R_OSPL_EVENT_WATCH
+ R_D_AddToIntLog( 0x70100000 + SetFlags );
+ R_D_AddToIntLog( (uintptr_t) R_OSPL_THREAD_GetCurrentId() );
+ R_D_AddToIntLog( (uintptr_t) ThreadId );
+#endif
+
+ ret = osSignalSet( (osThreadId) ThreadId, (int32_t) SetFlags );
+ ASSERT_D( (ret & OS_ERROR_SIGNAL) == 0, R_NOOP() );
+ R_UNREFERENCED_VARIABLE( ret ); /* for Release configuration */
+ }
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_EVENT_Clear
+************************************************************************/
+void R_OSPL_EVENT_Clear( r_ospl_thread_id_t const ThreadId, bit_flags32_t const ClearFlags1 )
+{
+ int32_t ret;
+
+ if ( ThreadId != NULL ) {
+ IF_D( ( ClearFlags1 & ~0xFFFF ) != 0 ) {
+ R_NOOP();
+ }
+
+#if R_OSPL_EVENT_WATCH
+ R_D_AddToIntLog( 0x70C00000 + ClearFlags1 );
+ R_D_AddToIntLog( (uintptr_t) R_OSPL_THREAD_GetCurrentId() );
+ R_D_AddToIntLog( (uintptr_t) ThreadId );
+#endif
+
+ ret = osSignalClear( (osThreadId) ThreadId, (int32_t) ClearFlags1 );
+ /* "& 0xFFFF" is for avoiding error in osSignalClear */
+ ASSERT_D( (ret & OS_ERROR_SIGNAL) == 0, R_NOOP() );
+ R_UNREFERENCED_VARIABLE( ret ); /* for Release configuration */
+ }
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_EVENT_Get
+************************************************************************/
+#if ( ! defined( osCMSIS ) || osCMSIS <= 0x10001 ) && R_OSPL_VERSION < 85
+bit_flags32_t R_OSPL_EVENT_Get( r_ospl_thread_id_t const ThreadId )
+{
+ int32_t ret;
+
+ if ( ThreadId == NULL ) {
+ ret = 0;
+ } else {
+ ret = osSignalGet( (osThreadId) ThreadId );
+ ASSERT_D( (ret & OS_ERROR_SIGNAL) == 0, R_NOOP() );
+ }
+
+ return (bit_flags32_t) ret;
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_EVENT_Wait
+************************************************************************/
+errnum_t R_OSPL_EVENT_Wait( bit_flags32_t const WaigingFlags, bit_flags32_t *const out_GotFlags,
+ uint32_t const Timeout_msec )
+{
+ errnum_t e;
+ osEvent event;
+
+ R_STATIC_ASSERT( R_OSPL_INFINITE == TO_UNSIGNED( osWaitForever ), "" );
+
+#if R_OSPL_EVENT_WATCH
+ R_D_AddToIntLog( 0x70BE0000 + WaigingFlags );
+ R_D_AddToIntLog( (uintptr_t) R_OSPL_THREAD_GetCurrentId() );
+
+ {
+ static int tc;
+ if ( R_D_Counter( &tc, 0, NULL ) ) {
+ R_DEBUG_BREAK();
+ }
+ }
+#endif
+
+
+ event = osSignalWait( (int32_t) WaigingFlags, Timeout_msec );
+
+
+#if R_OSPL_EVENT_WATCH
+ R_D_AddToIntLog( 0x70AF0000 );
+ R_D_AddToIntLog( (uintptr_t) R_OSPL_THREAD_GetCurrentId() );
+#endif
+
+ if ( (event.status == osOK) || (event.status == osEventTimeout) ) {
+ if ( out_GotFlags != NULL ) {
+ *out_GotFlags = R_OSPL_TIMEOUT;
+ }
+ IF ( event.status == osEventTimeout ) {
+ e=E_TIME_OUT;
+ goto fin;
+ }
+ } else {
+ ASSERT_R( event.status == osEventSignal, e=E_OTHERS; goto fin );
+
+ if ( out_GotFlags != NULL ) {
+ *out_GotFlags = (bit_flags32_t) event.value.signals;
+ }
+ }
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_SetInterruptPriority
+************************************************************************/
+errnum_t R_OSPL_SetInterruptPriority( bsp_int_src_t const IRQ_Num, int_fast32_t const Priority )
+{
+ GIC_SetPriority( IRQ_Num, (uint32_t) Priority );
+ return 0;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_MEMORY_Flush
+************************************************************************/
+void R_OSPL_MEMORY_Flush( r_ospl_flush_t const FlushType )
+{
+ if ( FlushType == R_OSPL_FLUSH_WRITEBACK_INVALIDATE ) {
+#if 0
+ printf( "L1Flush\n" );
+#endif
+
+#if IS_RTX_USED
+ __v7_clean_inv_dcache_all();
+#else
+#error
+#endif
+ } else if ( FlushType == R_OSPL_FLUSH_WRITEBACK_INVALIDATE_2ND ) {
+#if 0
+ printf( "PL310Flush\n" );
+#endif
+
+ PL310_CleanInvAllByWay();
+ } else {
+ ASSERT_D( false, R_NOOP() );
+ }
+}
+
+
+/**
+* @brief R_OSPL_Is1bitOnly_Fast32_Sub
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#ifndef R_OSPL_NDEBUG
+static bool_t R_OSPL_Is1bitOnly_Fast32_Sub( uint_fast32_t Value )
+{
+ if ( (Value & 0x0000FFFFu) == 0 ) {
+ Value >>= 16;
+ }
+ if ( (Value & 0x000000FFu) == 0 ) {
+ Value >>= 8;
+ }
+ if ( (Value & 0x0000000Fu) == 0 ) {
+ Value >>= 4;
+ }
+ if ( (Value & 0x00000003u) == 0 ) {
+ Value >>= 2;
+ }
+ if ( (Value & 0x00000001u) == 0 ) {
+ Value >>= 1;
+ }
+ return ( Value == 1 );
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_MEMORY_RangeFlush
+************************************************************************/
+errnum_t R_OSPL_MEMORY_RangeFlush( r_ospl_flush_t const FlushType,
+ const void *const StartAddress, size_t const Length )
+{
+ errnum_t e;
+ size_t cache_line_size;
+ size_t cache_line_mask;
+ uintptr_t start;
+ uintptr_t over;
+
+ ASSERT_R( FlushType == R_OSPL_FLUSH_INVALIDATE, e=E_BAD_COMMAND_ID; goto fin );
+
+ cache_line_size = R_OSPL_MEMORY_GetCacheLineSize();
+ cache_line_mask = cache_line_size - 1u;
+ ASSERT_D( R_OSPL_Is1bitOnly_Fast32_Sub( cache_line_size ), e=E_OTHERS; goto fin );
+
+ /* ->MISRA 11.3 */ /* ->SEC R2.7.1 */
+ ASSERT_R( ( (uintptr_t) StartAddress & cache_line_mask ) == 0u, e=E_OTHERS; goto fin );
+ ASSERT_R( ( Length & cache_line_mask ) == 0u, e=E_OTHERS; goto fin );
+
+ start = (uintptr_t) StartAddress;
+ over = ((uintptr_t) StartAddress + Length) - 1u;
+ /* <-MISRA 11.3 */ /* <-SEC R2.7.1 */
+
+ R_OSPL_MEMORY_RangeFlush_Sub( start, over, cache_line_size );
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_MEMORY_GetSpecification
+************************************************************************/
+void R_OSPL_MEMORY_GetSpecification( r_ospl_memory_spec_t *const out_MemorySpec )
+{
+ IF_DQ( out_MemorySpec == NULL ) {
+ goto fin;
+ }
+
+ out_MemorySpec->CacheLineSize = R_OSPL_MEMORY_GetCacheLineSize();
+
+fin:
+ return;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_Delay
+************************************************************************/
+errnum_t R_OSPL_Delay( uint32_t const DelayTime_msec )
+{
+ errnum_t e;
+ osStatus rs;
+ bool_t const is_overflow = ( DelayTime_msec > R_OSPL_MAX_TIME_OUT );
+ uint32_t const delay_parameter = DelayTime_msec + 1u;
+
+ ASSERT_D( ! is_overflow, R_NOOP() );
+ /* RTX 5.16: If delay_parameter = 100000, "osDelay" waits 65534 */
+
+ rs= osDelay( delay_parameter );
+ IF ( rs == osErrorISR ) {
+ e=E_NOT_THREAD;
+ R_OSPL_RaiseUnrecoverable( e );
+ goto fin;
+ }
+ IF ( IS( is_overflow ) ) {
+ e=E_TIME_OUT;
+ goto fin;
+ }
+
+ IF (
+ (rs != osOK) && /* for delay_parameter == 0 */
+ (rs != osEventTimeout) ) { /* for delay_parameter != 0 */
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_QUEUE_Create
+************************************************************************/
+errnum_t R_OSPL_QUEUE_Create( r_ospl_queue_t **out_self, r_ospl_queue_def_t *QueueDefine )
+{
+ errnum_t e;
+ r_ospl_queue_t *self = QueueDefine;
+
+ self->MailQId = osMailCreate( (osMailQDef_t *) QueueDefine->MailQDef, NULL );
+ IF ( self->MailQId == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ self->PublicStatus.UsedCount = 0;
+
+ *out_self = self;
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_QUEUE_GetStatus
+************************************************************************/
+errnum_t R_OSPL_QUEUE_GetStatus( r_ospl_queue_t *self, const r_ospl_queue_status_t **out_Status )
+{
+ *out_Status = &self->PublicStatus;
+ return 0;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_QUEUE_Allocate
+************************************************************************/
+errnum_t R_OSPL_QUEUE_Allocate( r_ospl_queue_t *self, void *out_Address, uint32_t Timeout_msec )
+{
+ errnum_t e;
+ void *address;
+ bool_t was_all_enabled = false;
+
+ address = osMailAlloc( self->MailQId, Timeout_msec );
+ *(void **) out_Address = address;
+ IF ( address == NULL && Timeout_msec > 0 ) {
+ if ( R_OSPL_THREAD_GetCurrentId() == NULL ) {
+ e=E_NOT_THREAD;
+ } else {
+ e=E_TIME_OUT;
+ }
+ goto fin;
+ }
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+ self->PublicStatus.UsedCount += 1;
+
+ e=0;
+fin:
+ if ( was_all_enabled ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_QUEUE_Put
+************************************************************************/
+errnum_t R_OSPL_QUEUE_Put( r_ospl_queue_t *self, void *Address )
+{
+ errnum_t e;
+ osStatus status;
+
+ status = osMailPut( self->MailQId, Address );
+ IF ( status != osOK ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_QUEUE_Get
+************************************************************************/
+errnum_t R_OSPL_QUEUE_Get( r_ospl_queue_t *self, void *out_Address, uint32_t Timeout_msec )
+{
+ errnum_t e;
+ osEvent event;
+
+ event = osMailGet( self->MailQId, Timeout_msec );
+
+ if ( event.status != osOK ) {
+ IF ( event.status != osEventMail ) {
+ if ( event.status == osEventTimeout ) {
+ e = E_TIME_OUT;
+ } else if ( event.status == osErrorParameter ) {
+ if ( R_OSPL_THREAD_GetCurrentId() == NULL ) {
+ e = E_NOT_THREAD;
+ } else {
+ e = E_OTHERS;
+ }
+ } else {
+ e = E_OTHERS;
+ }
+ goto fin;
+ }
+ }
+
+ *(void **) out_Address = event.value.p;
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_QUEUE_Free
+************************************************************************/
+errnum_t R_OSPL_QUEUE_Free( r_ospl_queue_t *self, void *Address )
+{
+ errnum_t e;
+ osStatus status;
+ bool_t was_all_enabled = false;
+
+ status = osMailFree( self->MailQId, Address );
+ IF ( status != osOK ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+ self->PublicStatus.UsedCount -= 1;
+
+ e=0;
+fin:
+ if ( was_all_enabled ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+ return e;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/porting/r_ospl_debug.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,185 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_debug.c
+* @brief Debug tools provided by OSPL.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#include "r_ospl_debug.h"
+#if R_OSPL_DEBUG_TOOL
+#include <stdio.h>
+#endif
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @struct r_ospl_debug_watch4_t
+* @brief Watch context
+*
+* @par Description
+* Member variables should not be accessed.
+*/
+#if R_OSPL_DEBUG_TOOL
+typedef struct st_r_ospl_debug_watch4_t r_ospl_debug_watch4_t;
+struct st_r_ospl_debug_watch4_t {
+ volatile const uint32_t *Address;
+ uint32_t BreakValue;
+ bool_t IsPrintf;
+};
+static r_ospl_debug_watch4_t g_r_ospl_debug_watch4[ 10 ];
+#endif
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+
+/***********************************************************************
+* Implement: R_D_Add
+************************************************************************/
+#if R_OSPL_DEBUG_TOOL
+void R_D_Add( int_fast32_t IndexNum, volatile const void *in_Address, uint32_t BreakValue, bool_t IsPrintf )
+{
+ r_ospl_debug_watch4_t *self = &g_r_ospl_debug_watch4[ IndexNum ];
+ bool_t was_all_enabled; /* = false; */ /* QAC 3197 */
+ int_t r;
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+
+ if ( IS( IsPrintf ) ) {
+ r= printf( "Debug_add( %d, 0x%08X )\n", IndexNum, (uintptr_t) in_Address );
+ R_UNREFERENCED_VARIABLE( r ); /* QAC 3200 : This is not error information */
+ }
+ self->Address = (uint32_t *) in_Address;
+ self->BreakValue = BreakValue;
+ self->IsPrintf = IsPrintf;
+
+ if ( IS( was_all_enabled ) ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+}
+#endif /* R_OSPL_DEBUG_TOOL */
+
+
+/***********************************************************************
+* Implement: R_D_Watch
+************************************************************************/
+#if R_OSPL_DEBUG_TOOL
+void R_D_Watch( int_fast32_t in_IndexNum )
+{
+ r_ospl_debug_watch4_t *self = &g_r_ospl_debug_watch4[ in_IndexNum ];
+ bool_t was_all_enabled; /* = false; */ /* QAC 3197 */
+ int_t r;
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+
+ if ( self->Address != NULL ) {
+ if ( IS( self->IsPrintf ) ) {
+ r= printf( "Debug_watch( %d ): 0x%08X\n", in_IndexNum, *self->Address );
+ R_UNREFERENCED_VARIABLE( r ); /* QAC 3200 : This is not error information */
+ }
+ if ( *self->Address == self->BreakValue ) {
+ R_DEBUG_BREAK();
+ }
+ }
+
+ if ( IS( was_all_enabled ) ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+}
+#endif /* R_OSPL_DEBUG_TOOL */
+
+
+/***********************************************************************
+* Implement: R_D_AddToIntLog
+************************************************************************/
+#if R_OSPL_DEBUG_TOOL
+#define IntLogBreakID -1 /* -1=not break */
+
+volatile uint_fast32_t g_DebugVar[ g_DebugVarCount ];
+volatile int_fast32_t g_IntLog[ g_IntLogCount ];
+volatile int_fast32_t g_IntLogLength;
+
+void R_D_AddToIntLog( int_fast32_t in_Value ) /* Add to g_IntLog, g_IntLogLength */
+{
+ g_IntLog[ (uint_fast32_t) g_IntLogLength % ( sizeof(g_IntLog) / sizeof(*g_IntLog) ) ] = in_Value;
+ if ( g_IntLogLength == IntLogBreakID ) {
+ R_DEBUG_BREAK();
+ }
+ g_IntLogLength += 1;
+}
+#endif /* R_OSPL_DEBUG_TOOL */
+
+
+/***********************************************************************
+* Implement: R_D_Counter
+************************************************************************/
+#if R_OSPL_DEBUG_TOOL
+bool_t R_D_Counter( int_fast32_t *in_out_Counter, int_fast32_t TargetCount, char_t *in_Label )
+{
+ int_fast32_t counter;
+ bool_t is_stop;
+ int_t r;
+
+ counter = *in_out_Counter;
+ counter += 1;
+ is_stop = ( counter == TargetCount );
+ if ( in_Label != NULL ) {
+ r= printf( "%s %d:\n", in_Label, counter );
+ R_UNREFERENCED_VARIABLE( r ); /* QAC 3200 : This is not error information */
+ } else {
+ if ( counter == 1 ) {
+ printf( "R_D_Counter address: 0x%08X\n", (uintptr_t) in_out_Counter );
+ }
+ }
+ *in_out_Counter = counter;
+
+ return is_stop;
+}
+#endif /* R_OSPL_DEBUG_TOOL */
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/porting/r_ospl_memory.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,428 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl_memory.c
+* @brief Memory map
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: $
+* $Date:: $
+*/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#ifdef R_OSPL_TEST_CODE
+#include "r_ospl_test.h"
+#endif
+#include "r_ospl_private.h"
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/**
+* @struct gs_address_table_line_t
+* @brief gs_address_table_line_t
+*/
+typedef struct st_gs_address_table_line_t gs_address_table_line_t;
+struct st_gs_address_table_line_t {
+
+ /** Address */
+ uintptr_t Address;
+
+ /** Value */
+ int_fast32_t Value;
+};
+
+
+/**
+* @struct gs_address_table_line_c_t
+* @brief gs_address_table_line_c_t
+*/
+typedef struct st_gs_address_table_line_c_t gs_address_table_line_c_t;
+struct st_gs_address_table_line_c_t {
+
+ /** Address */
+ uintptr_t Address;
+
+ /** Value */
+ r_ospl_axi_cache_attribute_t Value;
+};
+
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/* ->MISRA 17.4 : These are addresses */
+
+#define GS_MIRROR_SIZE 0x40000000u
+#define GS_CACHED_START 0x00000000u
+#define GS_CACHED_END ( GS_CACHED_START + GS_MIRROR_SIZE )
+#define GS_UNCACHED_START 0x40000000u
+#define GS_UNCACHED_END ( GS_UNCACHED_START + GS_MIRROR_SIZE )
+
+#define GS_IO_START 0x60A00000u
+
+/* From "scatter.scat" file */
+#if defined( RZ_A1L )
+#define LRAM_SIZE 0x00300000u
+#else /* RZ/A1H */
+#define LRAM_SIZE 0x00A00000u
+#endif
+#define LRAM_START 0x20000000u
+#define LRAM_END ( LRAM_START + LRAM_SIZE )
+#define UNUSED_UNCACHED_LRAM_START 0x60000000u
+#define UNCACHED_LRAM_END ( UNUSED_UNCACHED_LRAM_START + LRAM_SIZE )
+
+/* <-MISRA 17.4 */
+
+#define GS_EXTERNAL_START_0x00000000 0x00000000u
+#define GS_EXTERNAL_SDRAM_START_0x08000000 0x08000000u
+#define GS_INTERNAL_RAM_START_0x20000000 0x20000000u
+#define GS_INTERNAL_REGISTERS_START_0x80000000 0x80000000u
+
+#if defined( RZ_A1L_EV_BOARD )
+#define GS_SDRAM_SIZE 0x04000000u
+#else
+#define GS_SDRAM_SIZE 0x08000000u
+#endif
+
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+#ifdef R_OSPL_TEST_CODE
+static r_ospl_axi_envronment_t gs_Environment;
+#endif
+
+
+/******************************************************************************
+* Implement: R_OSPL_ToPhysicalAddress
+******************************************************************************/
+errnum_t R_OSPL_ToPhysicalAddress( const volatile void *in_Address, uintptr_t *out_PhysicalAddress )
+{
+ errnum_t e;
+ /* ->MISRA 11.3 */ /* ->SEC R2.7.1 */
+ uintptr_t const address = (uintptr_t) in_Address;
+ /* <-MISRA 11.3 */ /* <-SEC R2.7.1 */
+
+ IF_DQ( out_PhysicalAddress == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ *out_PhysicalAddress = address;
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/******************************************************************************
+* Implement: R_OSPL_ToCachedAddress
+******************************************************************************/
+errnum_t R_OSPL_ToCachedAddress( const volatile void *in_Address, void *out_CachedAddress )
+{
+ /* ->MISRA 11.3 */ /* ->SEC R2.7.1 */
+ /* ->QAC 0289 */ /* ->QAC 1002 : Image$$BEGIN_OF_NOCACHE_RAM_BARRIER$$Base */
+ errnum_t e;
+#if IS_MBED_USED
+ uintptr_t address = (uintptr_t) in_Address;
+ const uintptr_t uncached_from_cached = UNUSED_UNCACHED_LRAM_START - LRAM_START;
+#else
+ uintptr_t const address = (uintptr_t) in_Address;
+#endif
+
+ IF_DQ( out_CachedAddress == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+#if IS_MBED_USED
+ IF ( address < LRAM_START ) {
+ e = E_ACCESS_DENIED;
+ }
+ else if ( address < LRAM_END ) {
+ e = 0;
+ } else IF ( address < (uintptr_t)&Image$$RW_DATA_NC$$Base ) {
+ e = E_ACCESS_DENIED;
+ }
+ else if ( address < UNCACHED_LRAM_END ) {
+ address -= uncached_from_cached;
+ e = 0;
+ } else {
+ e = E_ACCESS_DENIED;
+ }
+#else
+ IF ( (address >= (uintptr_t)&Image$$BEGIN_OF_NOCACHE_RAM_BARRIER$$Base) &&
+ (address < (uintptr_t)&Image$$END_OF_INTERNAL_RAM_BARRIER$$ZI$$Limit) ) {
+ /* "BEGIN_OF_NOCACHE_RAM_BARRIER" is defined in "scatter.sct" file. */
+ /* Image$$ execution region symbols */
+ /* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0377d/CHDFHJDJ.html */
+
+ e = E_ACCESS_DENIED;
+ }
+ else IF ( address >= UNUSED_UNCACHED_LRAM_START ) {
+ e = E_ACCESS_DENIED;
+ }
+ else {
+ e = 0;
+ }
+#endif
+
+ *(void **) out_CachedAddress = (void *) address;
+
+fin:
+ return e;
+ /* <-QAC 0289 *//* <-QAC 1002 */
+ /* <-MISRA 11.3 */ /* <-SEC R2.7.1 */
+}
+
+
+/******************************************************************************
+* Implement: R_OSPL_ToUncachedAddress
+******************************************************************************/
+errnum_t R_OSPL_ToUncachedAddress( const volatile void *in_Address, void *out_UncachedAddress )
+{
+ /* ->MISRA 11.3 */ /* ->SEC R2.7.1 */
+ /* ->QAC 0289 */ /* ->QAC 1002 : Image$$BEGIN_OF_CACHED_RAM_BARRIER$$Base */
+ errnum_t e;
+#if IS_MBED_USED
+ uintptr_t address = (uintptr_t) in_Address;
+ uintptr_t nc_base = (uintptr_t) &Image$$RW_DATA_NC$$Base;
+ const uintptr_t uncached_from_cached = UNUSED_UNCACHED_LRAM_START - LRAM_START;
+#else
+ uintptr_t const address = (uintptr_t) in_Address;
+#endif
+
+ IF_DQ( out_UncachedAddress == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+#if IS_MBED_USED
+ IF ( address < nc_base - uncached_from_cached ) {
+ e = E_ACCESS_DENIED;
+ }
+ else if ( address < LRAM_END ) {
+ address += uncached_from_cached;
+ e = 0;
+ } else IF ( address < nc_base ) {
+ e = E_ACCESS_DENIED;
+ }
+ else if ( address < UNCACHED_LRAM_END ) {
+ e = 0;
+ } else {
+ e = E_ACCESS_DENIED;
+ }
+#else
+ IF ( (address >= (uintptr_t)&Image$$BEGIN_OF_CACHED_RAM_BARRIER$$Base) &&
+ (address < (uintptr_t)&Image$$BEGIN_OF_NOCACHE_RAM_BARRIER$$ZI$$Limit) ) {
+ e = E_ACCESS_DENIED;
+ }
+ else if ( (address >= (uintptr_t)&Image$$BEGIN_OF_NOCACHE_RAM_BARRIER$$Base) &&
+ (address < (uintptr_t)&Image$$END_OF_INTERNAL_RAM_BARRIER$$ZI$$Limit) ) {
+ e = 0;
+ } else IF ( R_CUT_IF_ALWAYS_TRUE( (address >= GS_CACHED_START) &&) (address < GS_CACHED_END) ) {
+ e = E_ACCESS_DENIED;
+ }
+ else IF ( (address >= UNUSED_UNCACHED_LRAM_START) && (address < GS_IO_START) ) {
+ e = E_ACCESS_DENIED;
+ }
+ else {
+ e = 0;
+ }
+#endif
+
+ *(void **) out_UncachedAddress = (void *) address;
+
+fin:
+ return e;
+ /* <-QAC 0289 *//* <-QAC 1002 */
+ /* <-MISRA 11.3 */ /* <-SEC R2.7.1 */
+}
+
+
+/******************************************************************************
+* Implement: R_OSPL_MEMORY_GetLevelOfFlush
+******************************************************************************/
+errnum_t R_OSPL_MEMORY_GetLevelOfFlush( const void *in_Address, int_fast32_t *out_Level )
+{
+ uintptr_t address = (uintptr_t) in_Address;
+
+#ifdef R_OSPL_TEST_CODE
+ if ( gs_Environment == R_OSPL_AXI_L2CACHED ) {
+#endif
+ static const gs_address_table_line_t table[] = {
+ /* .Address .Value */
+ { GS_EXTERNAL_START_0x00000000, 0 },
+ { GS_EXTERNAL_SDRAM_START_0x08000000, 1 },
+ { GS_EXTERNAL_SDRAM_START_0x08000000 + GS_SDRAM_SIZE, 0 },
+ { GS_INTERNAL_RAM_START_0x20000000, 1 },
+ { GS_INTERNAL_RAM_START_0x20000000 + LRAM_SIZE, 0 }
+ };
+
+
+ if ( address < table[1].Address ) {
+ *out_Level = table[0].Value;
+ } else if ( address < table[2].Address ) {
+ *out_Level = table[1].Value;
+ } else if ( address < table[3].Address ) {
+ *out_Level = table[2].Value;
+ } else if ( address < table[4].Address ) {
+ *out_Level = table[3].Value;
+ } else {
+ *out_Level = table[4].Value;
+ }
+ R_STATIC_ASSERT( R_COUNT_OF( table ) == 5, "" );
+
+#ifdef R_OSPL_TEST_CODE
+ } else {
+ static const gs_address_table_line_t table[] = {
+ /* .Address .Value */
+ { GS_EXTERNAL_START_0x00000000, 0 },
+ { GS_EXTERNAL_SDRAM_START_0x08000000, 2 },
+ { GS_EXTERNAL_SDRAM_START_0x08000000 + GS_SDRAM_SIZE, 0 },
+ { GS_INTERNAL_RAM_START_0x20000000, 1 },
+ { GS_INTERNAL_RAM_START_0x20000000 + LRAM_SIZE, 0 },
+ /* { GS_EXTERNAL_SDRAM_MIRROR_START_0x48000000, 2 }, */
+ /* { GS_EXTERNAL_SDRAM_MIRROR_START_0x48000000 + GS_SDRAM_SIZE, 0 }, */
+ /* { GS_INTERNAL_RAM_MIRROR_START_0x60000000, 0 }, */
+ /* { GS_INTERNAL_RAM_MIRROR_START_0x60000000 + LRAM_SIZE, 0 } */
+ };
+
+
+ ASSERT_R( gs_Environment == R_OSPL_AXI_L2STRONGLY, R_NOOP() );
+
+ if ( address < table[1].Address ) {
+ *out_Level = table[0].Value;
+ } else if ( address < table[2].Address ) {
+ *out_Level = table[1].Value;
+ } else if ( address < table[3].Address ) {
+ *out_Level = table[2].Value;
+ } else if ( address < table[4].Address ) {
+ *out_Level = table[3].Value;
+ } else {
+ *out_Level = table[4].Value;
+ }
+ R_STATIC_ASSERT( R_COUNT_OF( table ) == 5, "" );
+ }
+#endif
+ return 0;
+}
+
+
+/******************************************************************************
+* Implement: R_OSPL_AXI_Get2ndCacheAttribute
+******************************************************************************/
+errnum_t R_OSPL_AXI_Get2ndCacheAttribute( uintptr_t const in_PhysicalAddress,
+ r_ospl_axi_cache_attribute_t *const out_CacheAttribute )
+{
+ uintptr_t address = in_PhysicalAddress;
+
+#ifdef R_OSPL_TEST_CODE
+ if ( gs_Environment == R_OSPL_AXI_L2CACHED ) {
+#endif
+ static const gs_address_table_line_c_t table[] = {
+ /* .Address .Value */
+ { GS_EXTERNAL_START_0x00000000, R_OSPL_AXI_WRITE_BACK_W },
+ /*{ GS_EXTERNAL_SDRAM_START_0x08000000, R_OSPL_AXI_WRITE_BACK_W },*/
+ { GS_INTERNAL_RAM_START_0x20000000, R_OSPL_AXI_CACHE_ZERO },
+ /*{ GS_INTERNAL_REGISTERS_START_0x80000000, R_OSPL_AXI_CACHE_ZERO }*/
+ /* If external I/O existed, "*out_CacheAttribute = R_AXI_DEVICE;" */
+ };
+
+
+ if ( address < table[1].Address ) {
+ *out_CacheAttribute = table[0].Value;
+ } else {
+ *out_CacheAttribute = table[1].Value;
+ }
+ R_STATIC_ASSERT( R_COUNT_OF( table ) == 2, "" );
+
+#ifdef R_OSPL_TEST_CODE
+ } else {
+ static const gs_address_table_line_c_t table[] = {
+ /* .Address .Value */
+ { GS_EXTERNAL_START_0x00000000, R_OSPL_AXI_STRONGLY },
+ /*{ GS_EXTERNAL_SDRAM_START_0x08000000, R_OSPL_AXI_STRONGLY },*/
+ { GS_INTERNAL_RAM_START_0x20000000, R_OSPL_AXI_CACHE_ZERO },
+ /*{ GS_EXTERNAL_MIRROR_START_0x40000000, R_OSPL_AXI_STRONGLY },*/
+ /*{ GS_EXTERNAL_SDRAM_MIRROR_START_0x48000000,R_OSPL_AXI_STRONGLY },*/
+ /*{ GS_INTERNAL_RAM_MIRROR_START_0x60000000, R_OSPL_AXI_CACHE_ZERO },*/
+ /*{ GS_INTERNAL_REGISTERS_START_0x80000000, R_OSPL_AXI_CACHE_ZERO }*/
+ /* If external I/O existed, "*out_CacheAttribute = R_AXI_DEVICE;" */
+ };
+
+
+ ASSERT_R( gs_Environment == R_OSPL_AXI_L2STRONGLY, R_NOOP() );
+
+ if ( address < table[1].Address ) {
+ *out_CacheAttribute = table[0].Value;
+ } else {
+ *out_CacheAttribute = table[1].Value;
+ }
+ R_STATIC_ASSERT( R_COUNT_OF( table ) == 2, "" );
+ }
+#endif
+ return 0;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_AXI_GetProtection
+************************************************************************/
+errnum_t R_OSPL_AXI_GetProtection( uintptr_t const in_PhysicalAddress,
+ r_ospl_axi_protection_t *const out_Protection )
+{
+ *out_Protection = R_OSPL_AXI_NON_SECURE; /* Same as CPU(TTB) NS bit */
+
+ return 0;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_AXI_SetEnvironment
+************************************************************************/
+#ifdef R_OSPL_TEST_CODE
+errnum_t R_OSPL_AXI_SetEnvironment( r_ospl_axi_envronment_t in_Environment )
+{
+ gs_Environment = in_Environment;
+ return 0;
+}
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/porting/r_ospl_unrecoverable.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,91 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/*******************************************************************************
+* $FileName: r_ospl_unrecoverable.c $
+* Unrecoverable State
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+******************************************************************************/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#ifdef R_OSPL_TEST_CODE
+#include "Test/T_OSPL.h"
+#endif
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+
+/***********************************************************************
+* Implement: R_OSPL_RaiseUnrecoverable
+************************************************************************/
+void R_OSPL_RaiseUnrecoverable( errnum_t const e )
+{
+ bool_t was_all_enabled; /* = false; */ /* QAC 3197 */
+ /* ->QAC 3204 */
+ volatile bool_t is_loop = true;
+ /* <-QAC 3204 */
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+
+#ifdef R_OSPL_TEST_CODE
+ TEST_CODE_CallbackFromTestCode( R_OSPL_RaiseUnrecoverable );
+ is_loop = false;
+#else
+ R_DebugBreak( NULL, e );
+#endif
+
+ while ( IS( is_loop ) ) {
+ /* Infinite Loop. Set "is_loop" by the debugger */
+ }
+
+ if ( IS( was_all_enabled ) ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ospl/src/r_ospl.c Wed Aug 19 08:58:26 2015 +0000
@@ -0,0 +1,1611 @@
+/*******************************************************************************
+* 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) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
+*******************************************************************************/
+/**
+* @file r_ospl.c
+* @brief OS Porting Layer. Functions not depended on any environment.
+*
+* $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
+* $Rev: 35 $
+* $Date:: 2014-04-15 21:38:18 +0900#$
+*/
+
+
+/******************************************************************************
+Includes <System Includes> , "Project Includes"
+******************************************************************************/
+#include "r_ospl.h"
+#include "iodefine.h"
+#include "iobitmasks/cpg_iobitmask.h"
+#include "r_ospl_private.h"
+#include "r_ospl_os_less_private.h"
+#if R_OSPL_IS_PREEMPTION
+#include "r_ospl_RTX_private.h"
+#endif
+#include "locking.h"
+#ifdef __ICCARM__
+#include <intrinsics.h>
+#endif
+#ifdef __GNUC__
+#if ! IS_MBED_USED
+#include "irq.h"
+#endif
+#endif
+#if R_OSPL_DEBUG_TOOL
+#include <stdio.h>
+#endif
+#ifndef R_OSPL_NDEBUG
+#include <string.h>
+#endif
+
+
+/******************************************************************************
+Typedef definitions
+******************************************************************************/
+
+/******************************************************************************
+Macro definitions
+******************************************************************************/
+
+/******************************************************************************
+Imported global variables and functions (from other files)
+******************************************************************************/
+
+/******************************************************************************
+Exported global variables and functions (to be accessed by other files)
+******************************************************************************/
+
+/******************************************************************************
+Private global variables and functions
+******************************************************************************/
+
+static void R_OSPL_TABLE_Search_Sub( const r_ospl_table_t *self,
+ const void *Key, r_ospl_table_searched_t *out_Searched );
+
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+static r_ospl_error_t *R_OSPL_GetCurrentThreadError_Sub( r_ospl_if_not_t TypeOfIfNot );
+#endif
+
+
+/**
+* @def R_OSPL_DEFAULT_DEBUG_THREAD_COUNT
+* @brief For until calling "R_OSPL_SET_DEBUG_WORK"
+* @par Parameters
+* None
+* @return None.
+*/
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+#define R_OSPL_DEFAULT_DEBUG_THREAD_COUNT 2
+#endif
+
+
+/** For until calling "R_OSPL_SET_DEBUG_WORK" */
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+static r_ospl_table_block_t gs_thread_index_table_body[ R_OSPL_DEFAULT_DEBUG_THREAD_COUNT ];
+#endif
+
+
+/** For until calling "R_OSPL_SET_DEBUG_WORK" */
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+static r_ospl_error_t gs_error;
+#endif
+
+
+/** as <r_ospl_global_error_t> */
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+
+/* ->MISRA 8.7 : If not defined R_OSPL_ERROR_BREAK, this is referenced by only 1 function. */ /* ->SEC M2.2.1 */
+static r_ospl_global_error_t gs_global_error =
+ /* <-MISRA 8.7 */ /* <-SEC M2.2.1 */
+{
+ { /* .ThreadIndexTable */
+ gs_thread_index_table_body, /* .Area */
+ 0, /* .Count */
+ R_OSPL_DEFAULT_DEBUG_THREAD_COUNT, /* .MaxCount */
+ NULL, /* .KeyCache */
+ 0, /* .IndexCache */
+ 0, /* .FirstFreeIndex */
+#if R_OSPL_IS_PREEMPTION
+ true /* .Is_T_Lock */
+#endif
+ },
+ &gs_error, /* .ErrorArray */
+
+#if R_OSPL_ERROR_BREAK
+ 0, /* .RaisedGlobalErrorID */ /* Necessary T-Lock */
+ 0 /* .BreakGlobalErrorID */
+#endif
+};
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_GetVersion
+************************************************************************/
+int32_t R_OSPL_GetVersion(void)
+{
+ return R_OSPL_VERSION;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_IsPreemption
+************************************************************************/
+bool_t R_OSPL_IsPreemption(void)
+{
+ return R_OSPL_IS_PREEMPTION;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FLAG32_InitConst
+************************************************************************/
+void R_OSPL_FLAG32_InitConst( volatile r_ospl_flag32_t *const self )
+{
+ IF_DQ( self == NULL ) {
+ goto fin;
+ }
+
+ self->Flags = 0;
+
+fin:
+ return;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FLAG32_Set
+************************************************************************/
+void R_OSPL_FLAG32_Set( volatile r_ospl_flag32_t *const self, bit_flags32_t const SetFlags )
+{
+ IF_DQ( self == NULL ) {
+ goto fin;
+ }
+
+ self->Flags |= SetFlags;
+
+fin:
+ return;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FLAG32_Clear
+************************************************************************/
+void R_OSPL_FLAG32_Clear( volatile r_ospl_flag32_t *const self, bit_flags32_t const ClearFlags1 )
+{
+ IF_DQ( self == NULL ) {
+ goto fin;
+ }
+
+ self->Flags &= ~ClearFlags1;
+
+fin:
+ return;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FLAG32_Get
+************************************************************************/
+bit_flags32_t R_OSPL_FLAG32_Get( volatile const r_ospl_flag32_t *const self )
+{
+ bit_flags32_t return_value;
+
+ IF_DQ( self == NULL ) {
+ return_value = 0;
+ goto fin;
+ }
+
+ return_value = self->Flags;
+
+fin:
+ return return_value;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FLAG32_GetAndClear
+************************************************************************/
+bit_flags32_t R_OSPL_FLAG32_GetAndClear( volatile r_ospl_flag32_t *const self )
+{
+ bit_flags32_t return_value;
+
+ IF_DQ( self == NULL ) {
+ return_value = 0;
+ goto fin;
+ }
+
+ return_value = self->Flags;
+ self->Flags = 0;
+
+fin:
+ return return_value;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_ASYNC_CopyExceptAThread
+************************************************************************/
+void R_OSPL_ASYNC_CopyExceptAThread( const r_ospl_async_t *const Source,
+ r_ospl_async_t *const Destination )
+{
+ IF_DQ( Destination == NULL ) {
+ goto fin;
+ }
+ IF_DQ( Source == NULL ) {
+ goto fin;
+ }
+
+ *Destination = *Source;
+ Destination->A_Thread = NULL;
+
+fin:
+ return;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_EnableAllInterrupt
+************************************************************************/
+void R_OSPL_EnableAllInterrupt(void)
+{
+ __enable_irq();
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_DisableAllInterrupt
+************************************************************************/
+bool_t R_OSPL_DisableAllInterrupt(void)
+{
+#ifdef __ICCARM__
+ bool_t was_enabled = ( ( __get_interrupt_state() & 0x80 ) == 0 );
+ __disable_irq();
+ return was_enabled;
+#else
+ return (bool_t)( __disable_irq() == 0 );
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_BSP_InterruptsEnable
+************************************************************************/
+void R_BSP_InterruptsEnable(void)
+{
+ __enable_irq();
+}
+
+
+/***********************************************************************
+* Implement: R_BSP_InterruptsDisable
+************************************************************************/
+void R_BSP_InterruptsDisable(void)
+{
+#ifdef __ICCARM__
+ __disable_irq();
+#else
+ int_fast32_t ret;
+
+ ret = __disable_irq();
+ R_UNREFERENCED_VARIABLE( ret ); /* QAC 3200 : This is not error information */
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_LockChannel
+************************************************************************/
+errnum_t R_OSPL_LockChannel( int_fast32_t ChannelNum, int_fast32_t *out_ChannelNum,
+ mcu_lock_t HardwareIndexMin, mcu_lock_t HardwareIndexMax )
+{
+ errnum_t e;
+ bool_t is_success;
+ mcu_lock_t hardware_index;
+
+ ASSERT_D( HardwareIndexMin <= HardwareIndexMax, e=E_OTHERS; goto fin );
+
+ if ( ChannelNum == R_OSPL_UNLOCKED_CHANNEL ) {
+ ASSERT_D( out_ChannelNum != NULL, e=E_OTHERS; goto fin );
+
+#if BSP_CFG_USER_LOCKING_ENABLED
+ for ( hardware_index = HardwareIndexMin; hardware_index <= HardwareIndexMax;
+ hardware_index += 1 ) {
+ is_success = R_BSP_HardwareLock( hardware_index );
+ if ( is_success ) {
+ break;
+ }
+ }
+ IF ( hardware_index > HardwareIndexMax ) {
+ e=E_FEW_ARRAY;
+ goto fin;
+ }
+#else
+ e= R_OSPL_LockUnlockedChannel( out_ChannelNum,
+ HardwareIndexMin, HardwareIndexMax );
+ IF(e) {
+ goto fin;
+ }
+ out_ChannelNum = NULL;
+#endif
+ } else {
+ hardware_index = (mcu_lock_t)( HardwareIndexMin + ChannelNum );
+
+ IF_D ( hardware_index < HardwareIndexMin || hardware_index > HardwareIndexMax ) {
+ e=E_FEW_ARRAY;
+ goto fin;
+ }
+
+ is_success = R_BSP_HardwareLock( hardware_index );
+ IF ( ! is_success ) {
+ e=E_ACCESS_DENIED;
+ goto fin;
+ }
+ }
+
+ if ( out_ChannelNum != NULL ) {
+ *out_ChannelNum = hardware_index - HardwareIndexMin;
+ }
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_UnlockChannel
+************************************************************************/
+errnum_t R_OSPL_UnlockChannel( int_fast32_t ChannelNum, errnum_t e,
+ mcu_lock_t HardwareIndexMin, mcu_lock_t HardwareIndexMax )
+{
+ bool_t is_success;
+ mcu_lock_t hardware_index;
+
+ ASSERT_D( HardwareIndexMin <= HardwareIndexMax, e= R_OSPL_MergeErrNum( e, E_OTHERS ) );
+
+ hardware_index = (mcu_lock_t)( HardwareIndexMin + ChannelNum );
+
+ if ( hardware_index >= HardwareIndexMin && hardware_index <= HardwareIndexMax ) {
+ is_success = R_BSP_HardwareUnlock( hardware_index );
+ IF ( ! is_success ) {
+ e= R_OSPL_MergeErrNum( e, E_ACCESS_DENIED );
+ }
+ }
+
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_C_LOCK_InitConst
+************************************************************************/
+void R_OSPL_C_LOCK_InitConst( r_ospl_c_lock_t *const self )
+{
+ IF_DQ( self == NULL ) {
+ goto fin;
+ }
+
+ self->IsLocked = false;
+
+fin:
+ return;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_C_LOCK_Lock
+************************************************************************/
+errnum_t R_OSPL_C_LOCK_Lock( r_ospl_c_lock_t *const self )
+{
+ errnum_t e;
+
+ IF_DQ( self == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ IF ( R_OSPL_THREAD_GetCurrentId() == NULL ) { /* Interrupt */
+ e = E_NOT_THREAD;
+ R_OSPL_RaiseUnrecoverable( e );
+ goto fin;
+ }
+
+ IF ( IS( self->IsLocked ) ) {
+ e=E_ACCESS_DENIED;
+ goto fin;
+ }
+
+ self->IsLocked = true;
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_C_LOCK_Unlock
+************************************************************************/
+errnum_t R_OSPL_C_LOCK_Unlock( r_ospl_c_lock_t *const self )
+{
+ errnum_t e;
+
+ if ( self != NULL ) {
+
+ IF ( R_OSPL_THREAD_GetCurrentId() == NULL ) { /* Interrupt */
+ e = E_NOT_THREAD;
+ R_OSPL_RaiseUnrecoverable( e );
+ goto fin;
+ }
+
+ IF ( ! self->IsLocked ) {
+ /* Check not unlock the object that was initialized by other thread */
+ e = E_ACCESS_DENIED;
+ goto fin;
+ }
+
+ self->IsLocked = false;
+ }
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_I_LOCK_LockStub
+************************************************************************/
+bool_t R_OSPL_I_LOCK_LockStub( void *const self_ )
+{
+ R_IT_WILL_BE_NOT_CONST( self_ );
+ R_UNREFERENCED_VARIABLE( self_ );
+ return false;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_I_LOCK_UnlockStub
+************************************************************************/
+void R_OSPL_I_LOCK_UnlockStub( void *const self_ )
+{
+ R_IT_WILL_BE_NOT_CONST( self_ );
+ R_UNREFERENCED_VARIABLE( self_ );
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_I_LOCK_RequestFinalizeStub
+************************************************************************/
+void R_OSPL_I_LOCK_RequestFinalizeStub( void *const self_ )
+{
+ R_IT_WILL_BE_NOT_CONST( self_ );
+ R_UNREFERENCED_VARIABLE( self_ );
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_MEMORY_Barrier
+************************************************************************/
+void R_OSPL_MEMORY_Barrier(void)
+{
+ /* ->QAC 1006 : asm */
+ __asm("DSB");
+ /* <-QAC 1006 */
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_InstructionSyncBarrier
+************************************************************************/
+void R_OSPL_InstructionSyncBarrier(void)
+{
+ /* ->QAC 1006 : asm */
+ __asm("ISB");
+ /* <-QAC 1006 */
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_CALLER_Initialize
+************************************************************************/
+void R_OSPL_CALLER_Initialize( r_ospl_caller_t *const self, r_ospl_async_t *const Async,
+ volatile void *const PointerToState, int_t const StateValueOfOnInterrupting,
+ void *const I_Lock, const r_ospl_i_lock_vtable_t *const I_LockVTable )
+{
+ ASSERT_D( Async != NULL, R_NOOP() );
+ ASSERT_D( PointerToState != NULL, R_NOOP() );
+ IF_DQ( self == NULL ) {}
+ else {
+ self->Async = Async;
+ self->PointerToState = (volatile int_fast32_t *) PointerToState;
+ self->StateValueOfOnInterrupting = StateValueOfOnInterrupting;
+ self->I_Lock = I_Lock;
+ self->I_LockVTable = I_LockVTable;
+ }
+
+#ifndef R_OSPL_NDEBUG
+ /* Set sentinel */
+ ASSERT_D( IS_ALL_BITS_NOT_SET( Async->Flags, R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK ),
+ R_NOOP() );
+ ASSERT_D( IS_ALL_BITS_NOT_SET( R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE,
+ ~R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK ), R_NOOP() );
+
+ Async->Flags |= R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE;
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FTIMER_InitializeIfNot
+************************************************************************/
+errnum_t R_OSPL_FTIMER_InitializeIfNot( r_ospl_ftimer_spec_t *const out_Specification )
+{
+ /* ->SEC M1.11.1 : Can not const "is_initialized" because timing */
+ bool_t is_initialized;
+ /* <-SEC M1.11.1 */
+#if R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_MTU2_1_2
+ enum { bits_CST1_CST2 = 0x06 };
+#endif
+
+ /* ->QAC 0306 */
+#if R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_OSTM0
+ struct st_ostm *const reg_OSTM = &OSTM0;
+#elif R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_OSTM1
+ struct st_ostm *const reg_OSTM = &OSTM1;
+#endif
+ /* <-QAC 0306 */
+
+ /* ->QAC 0306 */
+#if R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_OSTM0
+ R_OSPL_SET_TO_8_BIT_REGISTER( &CPG.STBCR5, CPG_STBCR5_MSTP51,
+ CPG_STBCR5_MSTP51_SHIFT, 0 );
+
+#elif R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_OSTM1
+ R_OSPL_SET_TO_8_BIT_REGISTER( &CPG.STBCR5, CPG_STBCR5_MSTP50,
+ CPG_STBCR5_MSTP50_SHIFT, 0 );
+
+#elif R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_MTU2_1_2
+ R_OSPL_SET_TO_8_BIT_REGISTER( &CPG.STBCR3, CPG_STBCR3_MSTP33,
+ CPG_STBCR3_MSTP33_SHIFT, 0 );
+#endif
+
+#if R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_MTU2_1_2
+ is_initialized = IS_ALL_BITS_NOT_SET( MTU2.TSTR, bits_CST1_CST2 );
+#else
+ is_initialized = ( (int_fast32_t) reg_OSTM->OSTMnTE == 0 );
+#endif
+ /* <-QAC 0306 */
+
+ if ( IS( is_initialized ) ) { /* Integer Promotions */
+#if R_OSPL_FTIMER_IS != R_OSPL_FTIMER_IS_MTU2_1_2
+ enum { free_running_no_interrupt = 2 };
+#endif
+ bool_t was_all_enabled; /* = false; */ /* QAC 3197 */
+
+ was_all_enabled = R_OSPL_DisableAllInterrupt();
+
+#if R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_MTU2_1_2
+ {
+ enum { external_clock_TCLKD = 0x07u };
+
+ /* ->QAC 0306 */
+
+ /* Channel 1 */
+ MTU2.TCR_1 = (uint8_t) external_clock_TCLKD; /* overflow of the timer2 */
+ MTU2.TMDR_1 = 0;
+ MTU2.TIOR_1 = 0;
+ MTU2.TIER_1 = 0;
+ MTU2.TSR_1 = 0;
+ MTU2.TCNT_1 = 0;
+
+ /* Channel 2 */
+ MTU2.TCR_2 = 0; /* 33MHz */
+ MTU2.TMDR_2 = 0;
+ MTU2.TIOR_2 = 0;
+ MTU2.TIER_2 = 0;
+ MTU2.TSR_2 = 0;
+ MTU2.TCNT_2 = 0;
+
+ /* Timer start */
+ /* MTU2.TSTR |= bits_CST1_CST2; */
+ {
+ uint8_t const value = MTU2.TSTR;
+ MTU2.TSTR = (uint8_t)( (uint_fast32_t) value | bits_CST1_CST2 );
+ } /* QAC 2100 */
+
+ /* <-QAC 0306 */
+ }
+#else
+ if ( (int_fast32_t) reg_OSTM->OSTMnTE == 0 ) { /* Integer Promotions */
+ reg_OSTM->OSTMnCTL = free_running_no_interrupt;
+ reg_OSTM->OSTMnTS = 1;
+ }
+#endif
+
+ if ( IS( was_all_enabled ) ) {
+ R_OSPL_EnableAllInterrupt();
+ }
+ }
+
+ R_OSPL_FTIMER_GetSpecification( out_Specification );
+
+ return 0;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FTIMER_GetSpecification
+************************************************************************/
+void R_OSPL_FTIMER_GetSpecification( r_ospl_ftimer_spec_t *const out_Specification )
+{
+ if ( out_Specification != NULL ) {
+ enum { msec_numerator = 1 }; /* SEC M1.10.1, QAC-3132 */
+ enum { msec_denominator = 33333 }; /* SEC M1.10.1, QAC-3132 */
+ static const uint32_t max_count = 0xFFFFFFFFu; /* SEC M1.10.1, QAC-3132 */
+ static const uint32_t extension_of_count = (1000 * msec_denominator) / msec_numerator;
+ /* SEC M1.10.1, QAC-3132 */
+
+ out_Specification->msec_Numerator = msec_numerator;
+ out_Specification->msec_Denominator = msec_denominator;
+ out_Specification->MaxCount = max_count;
+ out_Specification->ExtensionOfCount = extension_of_count;
+ }
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FTIMER_Get
+************************************************************************/
+uint32_t R_OSPL_FTIMER_Get(void)
+{
+#if R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_MTU2_1_2
+ enum { num_16bit = 16 }; /* SEC M1.10.1, QAC-3132 */
+ /* ->QAC 0306 */
+
+ uint32_t now_high = (uint32_t)(MTU2.TCNT_1);
+ uint32_t not_low = (uint32_t)(MTU2.TCNT_2);
+
+ while( now_high != (uint32_t)(MTU2.TCNT_1) ) {
+ /* If higher byte was changed while reading lower byte, re-read. */
+ now_high = (uint32_t)(MTU2.TCNT_1);
+ not_low = (uint32_t)(MTU2.TCNT_2);
+ }
+
+ return ( now_high << num_16bit ) | not_low;
+
+ /* <-QAC 0306 */
+#else
+
+ /* ->QAC 0306 */
+#if R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_OSTM0
+ struct st_ostm *const reg_OSTM = &OSTM0;
+#elif R_OSPL_FTIMER_IS == R_OSPL_FTIMER_IS_OSTM1
+ struct st_ostm *const reg_OSTM = &OSTM1;
+#endif
+ /* <-QAC 0306 */
+
+ ASSERT_R( reg_OSTM->OSTMnCMP == 0x0000000u, R_NOOP() );
+ /* If "OSTMnCMP != 0", OSTMnCNT is set from 0 to OSTMnCMP-1 */
+
+ return reg_OSTM->OSTMnCNT;
+
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_FTIMER_IsPast
+************************************************************************/
+errnum_t R_OSPL_FTIMER_IsPast( const r_ospl_ftimer_spec_t *const ts,
+ uint32_t const Now, uint32_t const TargetTime, bool_t *const out_IsPast )
+{
+ uint32_t const target_minus_now = TargetTime - Now;
+ static const uint32_t minus_flag = 0x80000000u;
+ errnum_t e;
+ bool_t const is_past = IS_BIT_SET( target_minus_now, minus_flag );
+
+ IF_DQ( ts == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ IF_DQ( out_IsPast == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ if ( IS( is_past ) ) {
+ uint32_t const now_minus_target = Now - TargetTime;
+
+ IF ( now_minus_target > ts->ExtensionOfCount ) {
+ e=E_TIME_OUT;
+ goto fin;
+ }
+ }
+
+ *out_IsPast = is_past;
+
+ e=0;
+fin:
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_TABLE_InitConst
+************************************************************************/
+void R_OSPL_TABLE_InitConst( r_ospl_table_t *const self,
+ void *const Area, size_t const AreaByteSize, bool_t const Is_T_Lock )
+{
+#if ! defined( R_OSPL_NDEBUG ) || R_OSPL_IS_PREEMPTION
+ errnum_t e;
+#endif
+#if R_OSPL_IS_PREEMPTION
+ bool_t is_lock = false;
+#endif
+
+ IF_DQ( self == NULL ) {
+#ifndef R_OSPL_NDEBUG
+ e=E_OTHERS;
+#endif
+ goto fin;
+ }
+
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( Is_T_Lock ) ) {
+ if ( R_OSPL_THREAD_GetCurrentId() != NULL ) { /* If not interrrupt context */
+ e= R_OSPL_Start_T_Lock();
+ if(e!=0) {
+ goto fin;
+ }
+ is_lock = true; /* T-Lock to "self" */
+ }
+ }
+#endif
+
+ self->Area = Area;
+ self->Count = 0;
+ self->MaxCount = (int_fast32_t)( AreaByteSize / sizeof( r_ospl_table_block_t ) );
+ self->KeyCache = NULL;
+ self->FirstFreeIndex = 0;
+#if R_OSPL_IS_PREEMPTION
+ self->Is_T_Lock = Is_T_Lock;
+#else
+ R_UNREFERENCED_VARIABLE( Is_T_Lock );
+#endif
+
+ /* Set "self->Area[].NextFreeIndex" */
+ {
+ r_ospl_table_block_t *const block_array = (r_ospl_table_block_t *) Area;
+ int_fast32_t index;
+ int_fast32_t const max_index = self->MaxCount - 1;
+
+ IF_DQ( block_array == NULL ) {
+#ifndef R_OSPL_NDEBUG
+ e=E_OTHERS;
+#endif
+ goto fin;
+ }
+
+ for ( index = 0; index < max_index; index += 1 ) {
+ block_array[ index ].NextFreeIndex = (int16_t)( index + 1 );
+ }
+ block_array[ max_index ].NextFreeIndex = (int16_t) R_OSPL_TABLE_BLOCK_NO_NEXT;
+ }
+
+#ifndef R_OSPL_NDEBUG
+ e=0;
+#endif
+fin:
+ R_NOOP();/* for following all #if is false */
+
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( is_lock ) ) {
+ R_OSPL_End_T_Lock();
+ }
+#endif
+#ifndef R_OSPL_NDEBUG
+ if ( e != 0 ) {
+ R_DebugBreak( NULL, e );
+ }
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_TABLE_GetIndex
+************************************************************************/
+errnum_t R_OSPL_TABLE_GetIndex( r_ospl_table_t *const self, const void *const Key,
+ int_fast32_t *const out_Index, r_ospl_if_not_t const TypeOfIfNot )
+{
+ errnum_t e;
+#if R_OSPL_IS_PREEMPTION
+ bool_t is_lock = false;
+#endif
+
+ IF_DQ( self == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ IF_DQ( out_Index == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( self->Is_T_Lock ) ) {
+ if ( R_OSPL_THREAD_GetCurrentId() != NULL ) { /* If not interrrupt context */
+ e= R_OSPL_Start_T_Lock();
+ if(e!=0) {
+ goto fin;
+ }
+ is_lock = true; /* T-Lock to "self" */
+ }
+ }
+#endif
+
+
+ if ( (Key == self->KeyCache) && (self->Count >= 1) ) {
+ *out_Index = self->IndexCache;
+ } else {
+ r_ospl_table_searched_t searched;
+ r_ospl_table_block_t *const block_array = self->Area;
+ int_fast32_t found_index;
+
+ R_OSPL_TABLE_Search_Sub( self, Key, &searched );
+
+ if ( ! searched.IsFound ) {
+ int_fast32_t so_index; /* sorted_key_index */
+ int_fast32_t first_index; /* FirstFreeIndex */
+
+ if ( TypeOfIfNot == R_OSPL_ALLOCATE_IF_NOT ) {
+ if ( self->Count == self->MaxCount ) {
+ e = E_FEW_ARRAY;
+ goto fin;
+ }
+
+ /* Insert and Set "block_array[ searched.SortedKeyIndex ].Key" */
+ for ( so_index = self->Count - 1;
+ so_index >= searched.SortedKeyIndex;
+ so_index -= 1 ) {
+ block_array[ so_index + 1 ].Key = block_array[ so_index ].Key;
+ block_array[ so_index + 1 ].Index = block_array[ so_index ].Index;
+ }
+ block_array[ searched.SortedKeyIndex ].Key = Key;
+ self->Count += 1;
+
+ /* Set "block_array[ searched.SortedKeyIndex ].Index" */
+ first_index = self->FirstFreeIndex;
+ block_array[ searched.SortedKeyIndex ].Index = (int16_t) first_index;
+ self->FirstFreeIndex = block_array[ first_index ].NextFreeIndex;
+ block_array[ first_index ].NextFreeIndex = R_OSPL_TABLE_BLOCK_USED;
+
+ } else if ( TypeOfIfNot == R_OSPL_ERROR_IF_NOT ) {
+ e = E_NOT_FOUND_SYMBOL;
+ goto fin;
+ } else { /* TypeOfIfNot == R_OSPL_DO_NOTHING_IF_NOT */
+ e = 0;
+ goto fin;
+ }
+ /* Don't use "IF", Because this function called from "IF". */
+ }
+
+ self->KeyCache = Key;
+ found_index = block_array[ searched.SortedKeyIndex ].Index;
+ self->IndexCache = found_index;
+ *out_Index = found_index;
+ }
+
+ e=0;
+fin:
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( is_lock ) ) {
+ R_OSPL_End_T_Lock();
+ }
+#endif
+ return e;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_TABLE_Free
+************************************************************************/
+void R_OSPL_TABLE_Free( r_ospl_table_t *const self, const void *const Key )
+{
+#if ! defined( R_OSPL_NDEBUG ) || R_OSPL_IS_PREEMPTION
+ errnum_t e;
+#endif
+#if R_OSPL_IS_PREEMPTION
+ bool_t is_lock = false;
+#endif
+ r_ospl_table_searched_t searched;
+
+ IF_DQ( self == NULL ) {
+#ifndef R_OSPL_NDEBUG
+ e=0;
+#endif
+ goto fin;
+ }
+
+#if R_OSPL_IS_PREEMPTION
+ if ( R_OSPL_THREAD_GetCurrentId() != NULL ) { /* If not interrrupt context */
+ e= R_OSPL_Start_T_Lock();
+ if(e!=0) {
+ goto fin;
+ }
+ is_lock = true; /* T-Lock to "gs_global_error" */
+ }
+#endif
+
+ R_OSPL_TABLE_Search_Sub( self, Key, &searched );
+
+ if ( IS( searched.IsFound ) ) {
+ r_ospl_table_block_t *const block_array = self->Area;
+ int_fast32_t so_index; /* sorted_key_index */
+ int_fast32_t first_index; /* FirstFreeIndex */
+ int_fast32_t const count_ = self->Count; /* _ is for MISRA 5.6 */
+
+ /* Set "FirstFreeIndex", ".NextFreeIndex" */
+ first_index = self->FirstFreeIndex;
+ self->FirstFreeIndex = block_array[ searched.SortedKeyIndex ].Index;
+ block_array[ self->FirstFreeIndex ].NextFreeIndex = (int16_t) first_index;
+
+ /* Remove one "r_ospl_table_block_t" */
+ /* Set "self->KeyCache" */
+ if ( searched.SortedKeyIndex < count_ ) {
+ for ( so_index = searched.SortedKeyIndex; so_index < count_ ; so_index += 1 ) {
+ block_array[ so_index ].Key = block_array[ so_index + 1 ].Key;
+ block_array[ so_index ].Index = block_array[ so_index + 1 ].Index;
+ }
+ self->KeyCache = block_array[ searched.SortedKeyIndex ].Key;
+ self->IndexCache = block_array[ searched.SortedKeyIndex ].Index;
+ } else if ( searched.SortedKeyIndex > 0 ) { /* searched.SortedKeyIndex >= 1 */
+ self->KeyCache = block_array[ searched.SortedKeyIndex - 1 ].Key;
+ self->IndexCache = block_array[ searched.SortedKeyIndex - 1 ].Index;
+ } else {
+ self->KeyCache = NULL;
+ }
+ self->Count -= 1;
+ }
+
+#if ! defined( R_OSPL_NDEBUG )
+ e=0;
+#endif
+fin:
+ R_NOOP();/* for following all #if is false */
+
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( is_lock ) ) {
+ R_OSPL_End_T_Lock();
+ }
+#endif
+#ifndef R_OSPL_NDEBUG
+ if ( e != 0 ) {
+ R_DebugBreak( NULL, e );
+ }
+#endif
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_TABLE_Search_Sub
+************************************************************************/
+static void R_OSPL_TABLE_Search_Sub( const r_ospl_table_t *const self,
+ const void *const Key, r_ospl_table_searched_t *const out_Searched )
+{
+ int_fast32_t left;
+ int_fast32_t right;
+ int_fast32_t middle;
+ /* ->QAC 0306 : Sort by pointer value */
+ uintptr_t const target_key = (uintptr_t) Key;
+ /* <-QAC 0306 */
+ uintptr_t middle_key;
+ enum { num_2 = 2 }; /* SEC M1.10.1, QAC-3132 */
+ r_ospl_table_block_t *array;
+
+ IF_DQ( self == NULL ) {
+ goto fin;
+ }
+ IF_DQ( out_Searched == NULL ) {
+ goto fin;
+ }
+
+ array = self->Area;
+
+
+ if ( self->Count == 0 ) {
+ out_Searched->SortedKeyIndex = 0;
+ out_Searched->IsFound = false;
+ } else {
+ left = 0;
+ right = self->Count - 1;
+
+ while ( (right - left) >= num_2 ) {
+ middle = (int_fast32_t)( (uint_fast32_t)( right + left ) / num_2 );
+ /* ->QAC 0306 : Sort by pointer value */
+ middle_key = (uintptr_t) array[ middle ].Key;
+ /* <-QAC 0306 */
+
+ if ( target_key == middle_key ) {
+ out_Searched->SortedKeyIndex = middle;
+ out_Searched->IsFound = true;
+ goto fin;
+ } else if ( target_key < middle_key ) {
+ right = (int_fast32_t)( middle - 1 );
+ } else {
+ left = (int_fast32_t)( middle + 1 );
+ }
+ }
+
+ /* ->QAC 0306 : Sort by pointer value */
+ if ( target_key == (uintptr_t) array[ left ].Key ) {
+ out_Searched->SortedKeyIndex = left;
+ out_Searched->IsFound = true;
+ } else if ( target_key == (uintptr_t) array[ right ].Key ) {
+ out_Searched->SortedKeyIndex = right;
+ out_Searched->IsFound = true;
+ } else if ( target_key < (uintptr_t) array[ left ].Key ) {
+ out_Searched->SortedKeyIndex = left;
+ out_Searched->IsFound = false;
+ } else if ( target_key > (uintptr_t) array[ right ].Key ) {
+ out_Searched->SortedKeyIndex = right + 1;
+ out_Searched->IsFound = false;
+ } else {
+ out_Searched->SortedKeyIndex = right;
+ out_Searched->IsFound = false;
+ }
+ /* <-QAC 0306 */
+ }
+
+fin:
+ return;
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_TABLE_Print
+************************************************************************/
+#if R_OSPL_DEBUG_TOOL
+void R_OSPL_TABLE_Print( r_ospl_table_t *const self )
+{
+ int_fast32_t so_index; /* sorted_key_index */
+ int_fast32_t index;
+ r_ospl_table_block_t *const array = self->Area;
+
+ printf( "R_OSPL_TABLE_Print: r_ospl_table_t 0x%08X\n", (uintptr_t) self );
+ printf( " .Count = %d\n", self->Count );
+ for ( so_index = 0; so_index < self->Count; so_index += 1 ) {
+ printf( " .Area[%d].Key, Index = 0x%08X, %d\n",
+ so_index, array[ so_index ].Key, array[ so_index ].Index );
+ }
+ printf( " .FirstFreeIndex = %d\n", self->FirstFreeIndex );
+ for ( index = 0; index < self->MaxCount; index += 1 ) {
+ printf( " .Area[%d].NextFreeIndex = %d\n", index, array[ index ].NextFreeIndex );
+ }
+ printf( " %d = R_OSPL_TABLE_BLOCK_NO_NEXT\n", R_OSPL_TABLE_BLOCK_NO_NEXT );
+ printf( " %d = R_OSPL_TABLE_BLOCK_USED\n", R_OSPL_TABLE_BLOCK_USED );
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_CallInterruptCallback
+************************************************************************/
+void R_OSPL_CallInterruptCallback( const r_ospl_caller_t *const self,
+ const r_ospl_interrupt_t *const InterruptSource )
+{
+ errnum_t e;
+ r_ospl_async_t *async;
+#if ! R_OSPL_IS_PREEMPTION
+ r_ospl_master_t *const gs_master = R_OSPL_GetPrivateContext();
+ r_ospl_thread_def_t *current_thread = NULL; /* NULL is for avoid QAC 3353 */
+#endif
+#if R_OSPL_ERROR_BREAK
+ static int_fast32_t gs_nested_interrupt_level = 0;
+#endif
+
+#if R_OSPL_ERROR_BREAK
+ gs_nested_interrupt_level += 1;
+#endif
+
+#if ! R_OSPL_IS_PREEMPTION
+ IF_DQ( gs_master == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+#if R_OSPL_CPU_LOAD
+ e= gs_master->IdleCallback( R_OSPL_INTERRUPT_START );
+ IF(e) {
+ goto fin;
+ }
+#endif
+
+ current_thread = gs_master->CurrentThread;
+#endif
+
+ IF_DQ( self == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ IF_DQ( self->Async == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+ async = self->Async;
+
+ ASSERT_D( ( async->Flags & R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK ) ==
+ R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE, e=E_OTHERS; goto fin );
+ /* If failed, memory area of "Async" variable was overwritten by other variable. */
+ /* Reason of failed may be not disabled interrupt */
+ /* or not called "*_I_LOCK_Unlock()" disabling interrupt by "*_I_LOCK_Disable()". */
+
+ IF_DQ( self->PointerToState == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+ IF_DQ( async->InterruptCallback == NULL ) {
+ e=E_OTHERS;
+ goto fin;
+ }
+
+#if ! R_OSPL_IS_PREEMPTION
+ gs_master->CurrentThread = NULL; /* Interrupt */
+#endif
+
+ *self->PointerToState = self->StateValueOfOnInterrupting;
+
+ e= async->InterruptCallback( InterruptSource, self );
+
+
+ if ( e != 0 ) {
+ if ( async->ReturnValue == 0 ) {
+ async->ReturnValue = e;
+ }
+ R_OSPL_CLEAR_ERROR();
+ }
+
+ e=0;
+fin:
+#if ! R_OSPL_IS_PREEMPTION
+ IF_DQ ( gs_master == NULL ) {}
+ else {
+ gs_master->CurrentThread = current_thread;
+
+#if R_OSPL_CPU_LOAD
+ {
+ errnum_t ee;
+
+ ee= gs_master->IdleCallback( R_OSPL_INTERRUPT_END );
+ e= R_OSPL_MergeErrNum( e, ee );
+ }
+#endif
+ }
+#endif
+
+
+#if R_OSPL_ERROR_BREAK
+ gs_nested_interrupt_level -= 1;
+
+ if ( gs_nested_interrupt_level == 0 ) {
+ R_DEBUG_BREAK_IF_ERROR();
+ }
+#endif
+ R_UNREFERENCED_VARIABLE( e );
+}
+
+
+/***********************************************************************
+* Implement: R_OSPL_SetErrNum
+************************************************************************/
+#if R_OSPL_TLS_ERROR_CODE
+void R_OSPL_SetErrNum( errnum_t const e )
+{
+ r_ospl_error_t *err;
+
+ if ( e != 0 ) {
+
+ err = R_OSPL_GetCurrentThreadError_Sub( R_OSPL_ALLOCATE_IF_NOT );
+
+ if ( err != NULL ) {
+ if ( err->ErrNum == 0 ) {
+ err->ErrNum = e;
+ }
+ }
+ }
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_GetErrNum
+************************************************************************/
+#if R_OSPL_TLS_ERROR_CODE
+errnum_t R_OSPL_GetErrNum(void)
+{
+ errnum_t e;
+ r_ospl_error_t *err;
+
+ err = R_OSPL_GetCurrentThreadError_Sub( R_OSPL_ALLOCATE_IF_NOT );
+
+ if ( err != NULL ) {
+ e = err->ErrNum;
+ } else {
+ e = E_NO_DEBUG_TLS;
+ }
+
+ return e;
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_CLEAR_ERROR
+************************************************************************/
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+void R_OSPL_CLEAR_ERROR(void)
+{
+ r_ospl_error_t *err;
+
+ err = R_OSPL_GetCurrentThreadError_Sub( R_OSPL_DO_NOTHING_IF_NOT );
+
+ if ( err != NULL ) {
+#if R_OSPL_ERROR_BREAK
+ err->IsError = false;
+#endif
+
+#if R_OSPL_TLS_ERROR_CODE
+ err->ErrNum = 0;
+#endif
+ }
+}
+#endif
+
+
+/**
+* @brief Function part of error break
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#if R_OSPL_ERROR_BREAK
+static bool_t R_OSPL_OnRaisingError_Sub( const char_t *const FilePath,
+ int_fast32_t const LineNum ); /* QAC-3450 */
+static bool_t R_OSPL_OnRaisingError_Sub( const char_t *const FilePath,
+ int_fast32_t const LineNum )
+{
+#if ! defined( R_OSPL_NDEBUG ) || R_OSPL_IS_PREEMPTION
+ errnum_t e;
+#endif
+ bool_t is_break = false;
+#if R_OSPL_IS_PREEMPTION
+ bool_t is_lock = false;
+#endif
+ r_ospl_error_t *err;
+
+
+ err = R_OSPL_GetCurrentThreadError_Sub( R_OSPL_ALLOCATE_IF_NOT );
+
+
+ if ( err != NULL ) {
+ if ( IS( err->IsError ) ) {
+ is_break = false;
+ } else {
+#if R_OSPL_IS_PREEMPTION
+ if ( R_OSPL_THREAD_GetCurrentId() != NULL ) { /* If not interrrupt context */
+ e= R_OSPL_Start_T_Lock();
+ if(e!=0) {
+ goto fin;
+ }
+ is_lock = true; /* T-Lock to "gs_global_error" */
+ }
+#endif
+
+ gs_global_error.RaisedGlobalErrorID ++;
+ is_break = ( gs_global_error.RaisedGlobalErrorID ==
+ gs_global_error.BreakGlobalErrorID );
+
+ err->IsError = true;
+ err->ErrorID = gs_global_error.RaisedGlobalErrorID;
+ err->FilePath = FilePath;
+ err->LineNum = LineNum;
+ }
+ }
+
+#ifndef R_OSPL_NDEBUG
+ e=0;
+#endif
+#if R_OSPL_IS_PREEMPTION
+fin:
+ if ( IS( is_lock ) ) {
+ R_OSPL_End_T_Lock();
+ }
+#endif
+#ifndef R_OSPL_NDEBUG
+ if ( e != 0 ) {
+ R_DebugBreak( NULL, e );
+ }
+#endif
+ return is_break;
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_OnRaisingErrorForMISRA
+************************************************************************/
+#if R_OSPL_ERROR_BREAK
+bool_t R_OSPL_OnRaisingErrorForMISRA( bool_t const Condition, const char_t *const File,
+ int_t const Line )
+{
+ if ( IS( Condition ) ) {
+ if ( R_OSPL_OnRaisingError_Sub( File, Line ) != 0 ) {
+ R_DebugBreak( File, Line );
+ }
+ }
+ return Condition;
+}
+#endif
+
+
+/**
+* @brief Function part of <R_DEBUG_BREAK_IF_ERROR>
+*
+* @par Parameters
+* None
+* @return None.
+*/
+#if R_OSPL_ERROR_BREAK
+void R_OSPL_DebugBreakIfError( const char_t *const File, int_t const Line )
+{
+ r_ospl_error_t *err;
+
+ err = R_OSPL_GetCurrentThreadError_Sub( R_OSPL_DO_NOTHING_IF_NOT );
+
+ if ( err != NULL && err->IsError ) {
+ /* See the value of "err->ErrorID" in watch window. */
+ /* Call R_OSPL_SET_BREAK_ERROR_ID( N ); at main function. */
+ printf( "<ERROR error_ID=\"0x%X\" file=\"%s(%d)\"/>\n",
+ err->ErrorID, err->FilePath, err->LineNum );
+ R_DebugBreak( File, Line );
+ }
+
+ R_OSPL_CLEAR_ERROR();
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_GET_ERROR_ID
+************************************************************************/
+#if R_OSPL_ERROR_BREAK
+int_fast32_t R_OSPL_GET_ERROR_ID(void)
+{
+ return gs_global_error.RaisedGlobalErrorID;
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_SET_BREAK_ERROR_ID
+************************************************************************/
+#if R_OSPL_ERROR_BREAK
+void R_OSPL_SET_BREAK_ERROR_ID( int_fast32_t const ErrorID )
+{
+#ifndef R_OSPL_NDEBUG
+ if ( gs_global_error.BreakGlobalErrorID != ErrorID ) {
+ printf( ">R_OSPL_SET_BREAK_ERROR_ID( %d );\n", ErrorID );
+ }
+#endif
+
+ gs_global_error.BreakGlobalErrorID = ErrorID;
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_GetCurrentThreadError
+************************************************************************/
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+r_ospl_error_t *R_OSPL_GetCurrentThreadError(void)
+{
+ return R_OSPL_GetCurrentThreadError_Sub( R_OSPL_ALLOCATE_IF_NOT );
+}
+#endif
+
+
+/**
+* @brief GetCurrentThreadError
+*
+* @param TypeOfIfNot <r_ospl_if_not_t>
+* @return Error information of current thread
+*/
+#if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
+static r_ospl_error_t *R_OSPL_GetCurrentThreadError_Sub( r_ospl_if_not_t const TypeOfIfNot )
+{
+ errnum_t e;
+ int_fast32_t index;
+ r_ospl_error_t *err = NULL;
+ r_ospl_thread_id_t th; /* QAC 3441 */
+
+ index = R_OSPL_NO_INDEX;
+
+ th = R_OSPL_THREAD_GetCurrentId();
+ e= R_OSPL_TABLE_GetIndex( &gs_global_error.ThreadIndexTable, th, &index, TypeOfIfNot );
+ if ( e == E_FEW_ARRAY ) {
+#ifndef R_OSPL_NDEBUG
+ if ( gs_global_error.ThreadIndexTable.Area == gs_thread_index_table_body ) {
+ e = E_NO_DEBUG_TLS;
+ }
+#endif
+ goto fin;
+ }
+ if ( e != 0 ) {
+ goto fin;
+ }
+
+ if ( index != R_OSPL_NO_INDEX ) {
+ IF_DQ( gs_global_error.ErrorArray == NULL ) {
+#ifndef R_OSPL_NDEBUG
+ e=E_OTHERS;
+#endif
+ goto fin;
+ }
+ IF_DQ( index < -1 ) {
+#ifndef R_OSPL_NDEBUG
+ e=E_OTHERS;
+#endif
+ goto fin;
+ }
+
+ err = &gs_global_error.ErrorArray[ index ];
+ }
+
+#ifndef R_OSPL_NDEBUG
+ e=0;
+#endif
+fin:
+#ifndef R_OSPL_NDEBUG
+ if ( e != 0 ) {
+ R_DebugBreak( NULL, e );
+ /* If e == 2 (E_FEW_ARRAY), Set big work area by "R_OSPL_SET_DEBUG_WORK". */
+ /* If e == 29 (E_NO_DEBUG_TLS), Call "R_OSPL_SET_DEBUG_WORK". */
+ }
+#endif
+
+ return err;
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_SET_DEBUG_WORK
+************************************************************************/
+#if R_OSPL_ERROR_BREAK
+void R_OSPL_SET_DEBUG_WORK( void *const WorkArea, uint32_t const WorkAreaSize )
+{
+ errnum_t e;
+ int_fast32_t count = WorkAreaSize / R_OSPL_DEBUG_WORK_1_SIZE;
+ uint8_t *work = WorkArea;
+ r_ospl_table_block_t *thread_index_array;
+ r_ospl_error_t *error_array;
+ int_fast32_t index;
+#if R_OSPL_IS_PREEMPTION
+ bool_t is_lock = false;
+#endif
+
+#if R_OSPL_IS_PREEMPTION
+ if ( R_OSPL_THREAD_GetCurrentId() != NULL ) { /* If not interrrupt context */
+ e= R_OSPL_Start_T_Lock();
+ if(e!=0) {
+ goto fin;
+ }
+ is_lock = true; /* T-Lock to "gs_global_error" */
+ }
+#endif
+
+
+ if ( gs_global_error.ThreadIndexTable.Area != gs_thread_index_table_body ) {
+ e = E_ACCESS_DENIED;
+ goto fin;
+ }
+
+ thread_index_array = (r_ospl_table_block_t *) &work[0];
+ error_array = (r_ospl_error_t *) &thread_index_array[ count ];
+ ASSERT_D( (uint8_t *) &error_array[ count ] <= &work[ WorkAreaSize ], e=E_FEW_ARRAY; goto fin );
+
+ R_OSPL_TABLE_InitConst( &gs_global_error.ThreadIndexTable,
+ thread_index_array, count * sizeof( thread_index_array[0] ), true );
+
+ e= R_OSPL_TABLE_GetIndex( &gs_global_error.ThreadIndexTable,
+ gs_thread_index_table_body[0].Key, &index, R_OSPL_ALLOCATE_IF_NOT );
+ if(e!=0) {
+ goto fin;
+ }
+
+ gs_global_error.ErrorArray = error_array;
+ gs_global_error.ErrorArray[ index ] = gs_error;
+
+#ifndef R_OSPL_NDEBUG
+ memset( gs_thread_index_table_body, 0xFE, sizeof(gs_thread_index_table_body) );
+ memset( &gs_error, 0xFE, sizeof(gs_error) );
+#endif
+
+ e=0;
+fin:
+#if R_OSPL_IS_PREEMPTION
+ if ( IS( is_lock ) ) {
+ R_OSPL_End_T_Lock();
+ }
+#endif
+#ifndef R_OSPL_NDEBUG
+ if ( e != 0 ) {
+ R_DebugBreak( NULL, e );
+ }
+#endif
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_MODIFY_THREAD_LOCKED_COUNT
+************************************************************************/
+#if R_OSPL_ERROR_BREAK && R_OSPL_IS_PREEMPTION
+void R_OSPL_MODIFY_THREAD_LOCKED_COUNT( int_fast32_t Plus )
+{
+ r_ospl_error_t *err;
+
+ err = R_OSPL_GetCurrentThreadError_Sub( R_OSPL_ALLOCATE_IF_NOT );
+
+ if ( err != NULL ) {
+ err->ThreadLockedCount += Plus;
+ }
+}
+#endif
+
+
+/***********************************************************************
+* Implement: R_OSPL_GET_THREAD_LOCKED_COUNT
+************************************************************************/
+#if R_OSPL_ERROR_BREAK && R_OSPL_IS_PREEMPTION
+int_fast32_t R_OSPL_GET_THREAD_LOCKED_COUNT(void)
+{
+ int_fast32_t count;
+ r_ospl_error_t *err;
+
+ err = R_OSPL_GetCurrentThreadError_Sub( R_OSPL_ALLOCATE_IF_NOT );
+
+ if ( err != NULL ) {
+ count = err->ThreadLockedCount;
+ } else {
+ count = 0;
+ }
+
+ return count;
+}
+#endif
+
+
