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.

JPEGCorrespondence
Width>0(greater than 0)
Height>0(greater than 0)
Color formatYCbCr444, YCbCr422, YCbCr420, YCbCr411
BitmapCorrespondence
Width>0(greater than 0)
Height>0(greater than 0)
Color formatYCbCr422

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

Committer:
dkato
Date:
Mon Apr 24 08:16:23 2017 +0000
Revision:
13:1ee2176ef13f
Parent:
12:80f4beab1243
Add "SetQuality()" to JCU.
; Bug fixes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dkato 0:37e1e6a45ced 1 /*******************************************************************************
dkato 0:37e1e6a45ced 2 * DISCLAIMER
dkato 0:37e1e6a45ced 3 * This software is supplied by Renesas Electronics Corporation and is only
dkato 0:37e1e6a45ced 4 * intended for use with Renesas products. No other uses are authorized. This
dkato 0:37e1e6a45ced 5 * software is owned by Renesas Electronics Corporation and is protected under
dkato 0:37e1e6a45ced 6 * all applicable laws, including copyright laws.
dkato 0:37e1e6a45ced 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
dkato 0:37e1e6a45ced 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
dkato 0:37e1e6a45ced 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
dkato 0:37e1e6a45ced 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
dkato 0:37e1e6a45ced 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
dkato 0:37e1e6a45ced 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
dkato 0:37e1e6a45ced 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
dkato 0:37e1e6a45ced 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
dkato 0:37e1e6a45ced 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
dkato 0:37e1e6a45ced 16 * Renesas reserves the right, without notice, to make changes to this software
dkato 0:37e1e6a45ced 17 * and to discontinue the availability of this software. By using this software,
dkato 0:37e1e6a45ced 18 * you agree to the additional terms and conditions found by accessing the
dkato 0:37e1e6a45ced 19 * following link:
dkato 0:37e1e6a45ced 20 * http://www.renesas.com/disclaimer
dkato 0:37e1e6a45ced 21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
dkato 0:37e1e6a45ced 22 *******************************************************************************/
dkato 0:37e1e6a45ced 23 /*******************************************************************************
dkato 0:37e1e6a45ced 24 * $FileName: jcu_pl.c $
dkato 0:37e1e6a45ced 25 * $Module: JCU $ $PublicVersion: 1.00 $ (=JCU_VERSION)
dkato 0:37e1e6a45ced 26 * $Rev: 35 $
dkato 0:37e1e6a45ced 27 * $Date:: 2014-02-26 13:18:53 +0900#$
dkato 0:37e1e6a45ced 28 * Description : JCU driver porting layer
dkato 0:37e1e6a45ced 29 ******************************************************************************/
dkato 0:37e1e6a45ced 30
dkato 0:37e1e6a45ced 31
dkato 0:37e1e6a45ced 32 /******************************************************************************
dkato 0:37e1e6a45ced 33 Includes <System Includes> , "Project Includes"
dkato 0:37e1e6a45ced 34 ******************************************************************************/
dkato 0:37e1e6a45ced 35 #include "r_ospl.h"
dkato 0:37e1e6a45ced 36 #include "iodefine.h"
dkato 0:37e1e6a45ced 37 #include "r_jcu_api.h"
dkato 0:37e1e6a45ced 38 #include "r_jcu_pl.h"
dkato 0:37e1e6a45ced 39
dkato 0:37e1e6a45ced 40 /******************************************************************************
dkato 0:37e1e6a45ced 41 Typedef definitions
dkato 0:37e1e6a45ced 42 ******************************************************************************/
dkato 0:37e1e6a45ced 43 typedef struct st_jcu_pl_t jcu_pl_t;
dkato 0:37e1e6a45ced 44
dkato 0:37e1e6a45ced 45 /*[jcu_pl_t]*/
dkato 0:37e1e6a45ced 46 struct st_jcu_pl_t {
dkato 0:37e1e6a45ced 47 const r_ospl_caller_t *InterruptCallbackCaller;
dkato 0:37e1e6a45ced 48 const jcu_async_status_t *Status;
dkato 0:37e1e6a45ced 49 };
dkato 0:37e1e6a45ced 50
dkato 0:37e1e6a45ced 51 /*[gs_jcu_pl]*/
dkato 0:37e1e6a45ced 52 static jcu_pl_t gs_jcu_pl
dkato 0:37e1e6a45ced 53 ;
dkato 0:37e1e6a45ced 54
dkato 0:37e1e6a45ced 55 /******************************************************************************
dkato 0:37e1e6a45ced 56 Macro definitions
dkato 0:37e1e6a45ced 57 ******************************************************************************/
dkato 0:37e1e6a45ced 58 enum { JCU_INT_PRI = 2 };
dkato 0:37e1e6a45ced 59 #define CPG_JCU_CLOCK_POWER_OFF 0x00000002u
dkato 0:37e1e6a45ced 60
dkato 0:37e1e6a45ced 61 /******************************************************************************
dkato 0:37e1e6a45ced 62 Imported global variables and functions (from other files)
dkato 0:37e1e6a45ced 63 ******************************************************************************/
dkato 0:37e1e6a45ced 64
dkato 0:37e1e6a45ced 65 /******************************************************************************
dkato 0:37e1e6a45ced 66 Exported global variables and functions (to be accessed by other files)
dkato 0:37e1e6a45ced 67 ******************************************************************************/
dkato 0:37e1e6a45ced 68
dkato 0:37e1e6a45ced 69 /******************************************************************************
dkato 0:37e1e6a45ced 70 Private global variables and functions
dkato 0:37e1e6a45ced 71 ******************************************************************************/
dkato 0:37e1e6a45ced 72 static void JCU_IRQ_JEDI_Handler(void);
dkato 0:37e1e6a45ced 73 static void JCU_IRQ_JDTI_Handler(void);
dkato 0:37e1e6a45ced 74
dkato 0:37e1e6a45ced 75 /*[gs_jedi_interrupt_context] JEDI interrupt context */
dkato 0:37e1e6a45ced 76 /*[gs_jdti_interrupt_context] JDTI interrupt context */
dkato 0:37e1e6a45ced 77 static const r_ospl_interrupt_t gs_jedi_interrupt_context = { BSP_INT_SRC_JEDI, 0 };
dkato 0:37e1e6a45ced 78 static const r_ospl_interrupt_t gs_jdti_interrupt_context = { BSP_INT_SRC_JDTI, 0 };
dkato 0:37e1e6a45ced 79
dkato 0:37e1e6a45ced 80
dkato 0:37e1e6a45ced 81 /**************************************************************************//**
dkato 0:37e1e6a45ced 82 * Function Name: [R_JCU_SetDefaultAsync]
dkato 0:37e1e6a45ced 83 * @retval None
dkato 0:37e1e6a45ced 84 ******************************************************************************/
dkato 0:37e1e6a45ced 85 void R_JCU_SetDefaultAsync( r_ospl_async_t *const Async, r_ospl_async_type_t AsyncType )
dkato 0:37e1e6a45ced 86 {
dkato 0:37e1e6a45ced 87 IF_DQ( Async == NULL ) {
dkato 0:37e1e6a45ced 88 goto fin;
dkato 0:37e1e6a45ced 89 }
dkato 0:37e1e6a45ced 90
dkato 0:37e1e6a45ced 91 if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_A_Thread ) ) {
dkato 0:37e1e6a45ced 92 Async->A_Thread = NULL;
dkato 0:37e1e6a45ced 93 }
dkato 0:37e1e6a45ced 94
dkato 0:37e1e6a45ced 95 if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_A_EventValue ) ) {
dkato 0:37e1e6a45ced 96 if ( AsyncType == R_OSPL_ASYNC_TYPE_NORMAL ) {
dkato 0:37e1e6a45ced 97 Async->A_EventValue = R_OSPL_A_FLAG;
dkato 0:37e1e6a45ced 98 } else {
dkato 0:37e1e6a45ced 99 Async->A_EventValue = R_OSPL_FINAL_A_FLAG;
dkato 0:37e1e6a45ced 100 }
dkato 0:37e1e6a45ced 101 } else {
dkato 0:37e1e6a45ced 102 ASSERT_D( IS_BIT_SET( Async->Flags, R_F_OSPL_A_Thread ), R_NOOP() );
dkato 0:37e1e6a45ced 103 }
dkato 0:37e1e6a45ced 104
dkato 0:37e1e6a45ced 105 if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_I_Thread ) ) {
dkato 0:37e1e6a45ced 106 Async->I_Thread = NULL;
dkato 0:37e1e6a45ced 107 }
dkato 0:37e1e6a45ced 108
dkato 0:37e1e6a45ced 109 if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_I_EventValue ) ) {
dkato 0:37e1e6a45ced 110 Async->I_EventValue = R_OSPL_I_FLAG;
dkato 0:37e1e6a45ced 111 } else {
dkato 0:37e1e6a45ced 112 ASSERT_D( IS_BIT_SET( Async->Flags, R_F_OSPL_I_Thread ), R_NOOP() );
dkato 0:37e1e6a45ced 113 }
dkato 0:37e1e6a45ced 114
dkato 0:37e1e6a45ced 115 if ( IS_BIT_NOT_SET( Async->Flags, R_F_OSPL_InterruptCallback ) ) {
dkato 0:37e1e6a45ced 116 Async->InterruptCallback = &( R_JCU_OnInterruptDefault ); /* MISRA 16.9 */
dkato 0:37e1e6a45ced 117 }
dkato 0:37e1e6a45ced 118
dkato 0:37e1e6a45ced 119 Async->Flags = R_F_OSPL_A_Thread | R_F_OSPL_A_EventValue |
dkato 0:37e1e6a45ced 120 R_F_OSPL_I_Thread | R_F_OSPL_I_EventValue |
dkato 0:37e1e6a45ced 121 R_F_OSPL_InterruptCallback | R_F_OSPL_Delegate;
dkato 0:37e1e6a45ced 122 fin:
dkato 0:37e1e6a45ced 123 return;
dkato 0:37e1e6a45ced 124 }
dkato 0:37e1e6a45ced 125
dkato 0:37e1e6a45ced 126
dkato 0:37e1e6a45ced 127 /**************************************************************************//**
dkato 0:37e1e6a45ced 128 * Function Name: [R_JCU_OnInitialize]
dkato 0:37e1e6a45ced 129 * @retval Error code, 0=No error
dkato 0:37e1e6a45ced 130 ******************************************************************************/
dkato 0:37e1e6a45ced 131 errnum_t R_JCU_OnInitialize(void)
dkato 0:37e1e6a45ced 132 {
dkato 0:37e1e6a45ced 133 errnum_t e;
dkato 0:37e1e6a45ced 134 bsp_int_err_t eb;
dkato 0:37e1e6a45ced 135 bsp_int_src_t const num_of_JEDI_IRQ = gs_jedi_interrupt_context.IRQ_Num;
dkato 0:37e1e6a45ced 136 bsp_int_src_t const num_of_JDTI_IRQ = gs_jdti_interrupt_context.IRQ_Num;
dkato 0:37e1e6a45ced 137 jcu_pl_t *const self = &gs_jcu_pl;
dkato 0:37e1e6a45ced 138
dkato 0:37e1e6a45ced 139 self->InterruptCallbackCaller = NULL;
dkato 0:37e1e6a45ced 140 self->Status = NULL;
dkato 0:37e1e6a45ced 141
dkato 0:37e1e6a45ced 142
dkato 0:37e1e6a45ced 143 /* Register "JEDI" */
dkato 0:37e1e6a45ced 144 eb= R_BSP_InterruptWrite( num_of_JEDI_IRQ, &( JCU_IRQ_JEDI_Handler ) ); /* MISRA 16.9 */
dkato 0:37e1e6a45ced 145 IF ( eb != 0 ) {
dkato 0:37e1e6a45ced 146 e=E_OTHERS;
dkato 0:37e1e6a45ced 147 goto fin;
dkato 0:37e1e6a45ced 148 }
dkato 0:37e1e6a45ced 149
dkato 0:37e1e6a45ced 150 e= R_OSPL_SetInterruptPriority( num_of_JEDI_IRQ, JCU_INT_PRI );
dkato 0:37e1e6a45ced 151 IF ( e != 0 ) {
dkato 0:37e1e6a45ced 152 goto fin;
dkato 0:37e1e6a45ced 153 }
dkato 0:37e1e6a45ced 154
dkato 0:37e1e6a45ced 155
dkato 0:37e1e6a45ced 156 /* Register "JDTI" */
dkato 0:37e1e6a45ced 157 eb= R_BSP_InterruptWrite( num_of_JDTI_IRQ, &( JCU_IRQ_JDTI_Handler ) ); /* MISRA 16.9 */
dkato 0:37e1e6a45ced 158 IF ( eb != 0 ) {
dkato 0:37e1e6a45ced 159 e=E_OTHERS;
dkato 0:37e1e6a45ced 160 goto fin;
dkato 0:37e1e6a45ced 161 }
dkato 0:37e1e6a45ced 162
dkato 0:37e1e6a45ced 163 e= R_OSPL_SetInterruptPriority( num_of_JDTI_IRQ, JCU_INT_PRI );
dkato 0:37e1e6a45ced 164 IF ( e != 0 ) {
dkato 0:37e1e6a45ced 165 goto fin;
dkato 0:37e1e6a45ced 166 }
dkato 0:37e1e6a45ced 167
dkato 0:37e1e6a45ced 168
dkato 0:37e1e6a45ced 169 /* start to suuply the clock for JCU */
dkato 0:37e1e6a45ced 170 { /* ->QAC 0306 */
dkato 0:37e1e6a45ced 171 uint32_t cpg_reg;
dkato 0:37e1e6a45ced 172 cpg_reg = (uint32_t)(CPG.STBCR6) & ~CPG_JCU_CLOCK_POWER_OFF;
dkato 0:37e1e6a45ced 173 CPG.STBCR6 =(uint8_t)cpg_reg;
dkato 0:37e1e6a45ced 174 } /* <-QAC 0306 */
dkato 0:37e1e6a45ced 175
dkato 0:37e1e6a45ced 176 e=0;
dkato 0:37e1e6a45ced 177 fin:
dkato 0:37e1e6a45ced 178 return e;
dkato 0:37e1e6a45ced 179 }
dkato 0:37e1e6a45ced 180
dkato 0:37e1e6a45ced 181
dkato 0:37e1e6a45ced 182 /**************************************************************************//**
dkato 0:37e1e6a45ced 183 * Function Name: [R_JCU_OnFinalize]
dkato 0:37e1e6a45ced 184 * @retval Error code, 0=No error and e=0
dkato 0:37e1e6a45ced 185 ******************************************************************************/
dkato 0:37e1e6a45ced 186 /* ->QAC 3227 : "e" is usually changed in finalize function. */
dkato 0:37e1e6a45ced 187 errnum_t R_JCU_OnFinalize( errnum_t e )
dkato 0:37e1e6a45ced 188 /* <-QAC 3227 */
dkato 0:37e1e6a45ced 189 {
dkato 0:37e1e6a45ced 190 /* stop to suuply the clock for JCU */
dkato 0:37e1e6a45ced 191 { /* ->QAC 0306 */
dkato 0:37e1e6a45ced 192 uint32_t cpg_reg;
dkato 0:37e1e6a45ced 193 cpg_reg = (uint32_t)(CPG.STBCR6) | CPG_JCU_CLOCK_POWER_OFF;
dkato 0:37e1e6a45ced 194 CPG.STBCR6 = (uint8_t)cpg_reg;
dkato 0:37e1e6a45ced 195 } /* <-QAC 0306 */
dkato 0:37e1e6a45ced 196
dkato 0:37e1e6a45ced 197 return e;
dkato 0:37e1e6a45ced 198 }
dkato 0:37e1e6a45ced 199
dkato 0:37e1e6a45ced 200
dkato 0:37e1e6a45ced 201 /******************************************************************************
dkato 0:37e1e6a45ced 202 * Function Name: [R_JCU_SetInterruptCallbackCaller]
dkato 0:37e1e6a45ced 203 * @retval Error code, 0=No error
dkato 0:37e1e6a45ced 204 ******************************************************************************/
dkato 0:37e1e6a45ced 205 errnum_t R_JCU_SetInterruptCallbackCaller( const r_ospl_caller_t *const Caller )
dkato 0:37e1e6a45ced 206 {
dkato 0:37e1e6a45ced 207 jcu_pl_t *const self = &gs_jcu_pl;
dkato 0:37e1e6a45ced 208
dkato 0:37e1e6a45ced 209 self->InterruptCallbackCaller = Caller;
dkato 0:37e1e6a45ced 210
dkato 0:37e1e6a45ced 211 return 0;
dkato 0:37e1e6a45ced 212 }
dkato 0:37e1e6a45ced 213
dkato 0:37e1e6a45ced 214
dkato 0:37e1e6a45ced 215 /******************************************************************************
dkato 0:37e1e6a45ced 216 * Function Name: [R_JCU_OnEnableInterrupt]
dkato 0:37e1e6a45ced 217 * @retval None
dkato 0:37e1e6a45ced 218 ******************************************************************************/
dkato 0:37e1e6a45ced 219 void R_JCU_OnEnableInterrupt( jcu_interrupt_lines_t const Enables )
dkato 0:37e1e6a45ced 220 {
dkato 0:37e1e6a45ced 221 bsp_int_err_t eb;
dkato 0:37e1e6a45ced 222
dkato 0:37e1e6a45ced 223 if ( IS_BIT_SET( Enables, JCU_INTERRUPT_LINE_JEDI ) ) {
dkato 0:37e1e6a45ced 224 bsp_int_src_t const num_of_IRQ = gs_jedi_interrupt_context.IRQ_Num;
dkato 0:37e1e6a45ced 225
dkato 0:37e1e6a45ced 226 eb= R_BSP_InterruptControl( num_of_IRQ, BSP_INT_CMD_INTERRUPT_ENABLE, FIT_NO_PTR );
dkato 0:37e1e6a45ced 227 ASSERT_D( eb == 0, R_NOOP() );
dkato 0:37e1e6a45ced 228 R_UNREFERENCED_VARIABLE( eb ); /* for Release configuration */
dkato 0:37e1e6a45ced 229 }
dkato 0:37e1e6a45ced 230
dkato 0:37e1e6a45ced 231 if ( IS_BIT_SET( Enables, JCU_INTERRUPT_LINE_JDTI ) ) {
dkato 0:37e1e6a45ced 232 bsp_int_src_t const num_of_IRQ = gs_jdti_interrupt_context.IRQ_Num;
dkato 0:37e1e6a45ced 233
dkato 0:37e1e6a45ced 234 eb= R_BSP_InterruptControl( num_of_IRQ, BSP_INT_CMD_INTERRUPT_ENABLE, FIT_NO_PTR );
dkato 0:37e1e6a45ced 235 ASSERT_D( eb == 0, R_NOOP() );
dkato 0:37e1e6a45ced 236 R_UNREFERENCED_VARIABLE( eb ); /* for Release configuration */
dkato 0:37e1e6a45ced 237 }
dkato 0:37e1e6a45ced 238 }
dkato 0:37e1e6a45ced 239
dkato 0:37e1e6a45ced 240
dkato 0:37e1e6a45ced 241 /******************************************************************************
dkato 0:37e1e6a45ced 242 * Function Name: [R_JCU_OnDisableInterrupt]
dkato 0:37e1e6a45ced 243 * @retval None
dkato 0:37e1e6a45ced 244 ******************************************************************************/
dkato 0:37e1e6a45ced 245 void R_JCU_OnDisableInterrupt( jcu_interrupt_lines_t const Disables1 )
dkato 0:37e1e6a45ced 246 {
dkato 0:37e1e6a45ced 247 bsp_int_err_t eb;
dkato 0:37e1e6a45ced 248
dkato 0:37e1e6a45ced 249 if ( IS_BIT_SET( Disables1, JCU_INTERRUPT_LINE_JEDI ) ) {
dkato 0:37e1e6a45ced 250 bsp_int_src_t const num_of_IRQ = gs_jedi_interrupt_context.IRQ_Num;
dkato 0:37e1e6a45ced 251
dkato 0:37e1e6a45ced 252 eb= R_BSP_InterruptControl( num_of_IRQ, BSP_INT_CMD_INTERRUPT_DISABLE, FIT_NO_PTR );
dkato 0:37e1e6a45ced 253 ASSERT_D( eb == 0, R_NOOP() );
dkato 0:37e1e6a45ced 254 R_UNREFERENCED_VARIABLE( eb ); /* for Release configuration */
dkato 0:37e1e6a45ced 255 }
dkato 0:37e1e6a45ced 256
dkato 0:37e1e6a45ced 257 if ( IS_BIT_SET( Disables1, JCU_INTERRUPT_LINE_JDTI ) ) {
dkato 0:37e1e6a45ced 258 bsp_int_src_t const num_of_IRQ = gs_jdti_interrupt_context.IRQ_Num;
dkato 0:37e1e6a45ced 259
dkato 0:37e1e6a45ced 260 eb= R_BSP_InterruptControl( num_of_IRQ, BSP_INT_CMD_INTERRUPT_DISABLE, FIT_NO_PTR );
dkato 0:37e1e6a45ced 261 ASSERT_D( eb == 0, R_NOOP() );
dkato 0:37e1e6a45ced 262 R_UNREFERENCED_VARIABLE( eb ); /* for Release configuration */
dkato 0:37e1e6a45ced 263 }
dkato 0:37e1e6a45ced 264 }
dkato 0:37e1e6a45ced 265
dkato 0:37e1e6a45ced 266
dkato 0:37e1e6a45ced 267 /******************************************************************************
dkato 0:37e1e6a45ced 268 * Function Name: [R_JCU_OnInterruptDefault]
dkato 0:37e1e6a45ced 269 * @retval Error code, 0=No error
dkato 0:37e1e6a45ced 270 ******************************************************************************/
dkato 0:37e1e6a45ced 271 errnum_t R_JCU_OnInterruptDefault( const r_ospl_interrupt_t *const InterruptSource,
dkato 0:37e1e6a45ced 272 const r_ospl_caller_t *const Caller )
dkato 0:37e1e6a45ced 273 {
dkato 0:37e1e6a45ced 274 errnum_t e;
dkato 0:37e1e6a45ced 275 errnum_t ee;
dkato 0:37e1e6a45ced 276 r_ospl_async_t *async;
dkato 0:37e1e6a45ced 277
dkato 0:37e1e6a45ced 278 e = 0;
dkato 0:37e1e6a45ced 279 R_AVOID_UNSAFE_ALWAYS_WARNING( e );
dkato 0:37e1e6a45ced 280
dkato 0:37e1e6a45ced 281 IF_DQ( Caller == NULL ) {
dkato 0:37e1e6a45ced 282 goto fin;
dkato 0:37e1e6a45ced 283 }
dkato 0:37e1e6a45ced 284
dkato 0:37e1e6a45ced 285 ee= R_JCU_OnInterrupting( InterruptSource );
dkato 0:37e1e6a45ced 286 IF ( (ee != 0) && (e == 0) ) {
dkato 0:37e1e6a45ced 287 e = ee;
dkato 0:37e1e6a45ced 288 }
dkato 0:37e1e6a45ced 289
dkato 0:37e1e6a45ced 290 async = Caller->Async;
dkato 0:37e1e6a45ced 291
dkato 0:37e1e6a45ced 292 if ( async->I_Thread == NULL ) {
dkato 0:37e1e6a45ced 293 ee= R_JCU_OnInterrupted();
dkato 0:37e1e6a45ced 294 IF ( (ee != 0) && (e == 0) ) {
dkato 0:37e1e6a45ced 295 e = ee;
dkato 0:37e1e6a45ced 296 }
dkato 0:37e1e6a45ced 297 } else {
dkato 0:37e1e6a45ced 298 R_OSPL_EVENT_Set( async->I_Thread, async->I_EventValue );
dkato 0:37e1e6a45ced 299 }
dkato 0:37e1e6a45ced 300
dkato 0:37e1e6a45ced 301 fin:
dkato 0:37e1e6a45ced 302 return e;
dkato 0:37e1e6a45ced 303 }
dkato 0:37e1e6a45ced 304
dkato 0:37e1e6a45ced 305
dkato 0:37e1e6a45ced 306 /**************************************************************************//**
dkato 0:37e1e6a45ced 307 * Function Name: [JCU_IRQ_JEDI_Handler]
dkato 0:37e1e6a45ced 308 * @brief JEDI (JCU Encode Decode Interrupt) interrupt handler
dkato 0:37e1e6a45ced 309 * @retval None
dkato 0:37e1e6a45ced 310 ******************************************************************************/
dkato 0:37e1e6a45ced 311 static void JCU_IRQ_JEDI_Handler(void)
dkato 0:37e1e6a45ced 312 {
dkato 0:37e1e6a45ced 313 jcu_pl_t *const self = &gs_jcu_pl;
dkato 0:37e1e6a45ced 314 const r_ospl_interrupt_t *const i_context = &gs_jedi_interrupt_context;
dkato 0:37e1e6a45ced 315
dkato 0:37e1e6a45ced 316 R_OSPL_CallInterruptCallback( self->InterruptCallbackCaller, i_context );
dkato 0:37e1e6a45ced 317 }
dkato 0:37e1e6a45ced 318
dkato 0:37e1e6a45ced 319
dkato 0:37e1e6a45ced 320 /**************************************************************************//**
dkato 0:37e1e6a45ced 321 * Function Name: [JCU_IRQ_JDTI_Handler]
dkato 0:37e1e6a45ced 322 * @brief JDTI (JCU Data Transfer Interrupt) interrupt handler
dkato 0:37e1e6a45ced 323 * @retval None
dkato 0:37e1e6a45ced 324 ******************************************************************************/
dkato 0:37e1e6a45ced 325 static void JCU_IRQ_JDTI_Handler(void)
dkato 0:37e1e6a45ced 326 {
dkato 0:37e1e6a45ced 327 jcu_pl_t *const self = &gs_jcu_pl;
dkato 0:37e1e6a45ced 328 const r_ospl_interrupt_t *const i_context = &gs_jdti_interrupt_context;
dkato 0:37e1e6a45ced 329
dkato 0:37e1e6a45ced 330 R_OSPL_CallInterruptCallback( self->InterruptCallbackCaller, i_context );
dkato 0:37e1e6a45ced 331 }
dkato 0:37e1e6a45ced 332
dkato 0:37e1e6a45ced 333