Video library for GR-PEACH
Dependents: Trace_Program2 GR-PEACH_Camera_in_barcode GR-PEACH_LCD_sample GR-PEACH_LCD_4_3inch_sample ... more
Video library for GR-PEACH.
Hello World!
Import programGR-PEACH_Camera_in
Camera in sample for GR-PEACH. This sample works on GR-LYCHEE besides GR-PEACH.
API
Import library
Interface
See the Pinout page for more details
drivers/vdc5/src/r_vdc5.c@0:853f5b7408a7, 2015-06-26 (annotated)
- Committer:
- dkato
- Date:
- Fri Jun 26 02:17:53 2015 +0000
- Revision:
- 0:853f5b7408a7
first commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkato | 0:853f5b7408a7 | 1 | /******************************************************************************* |
dkato | 0:853f5b7408a7 | 2 | * DISCLAIMER |
dkato | 0:853f5b7408a7 | 3 | * This software is supplied by Renesas Electronics Corporation and is only |
dkato | 0:853f5b7408a7 | 4 | * intended for use with Renesas products. No other uses are authorized. This |
dkato | 0:853f5b7408a7 | 5 | * software is owned by Renesas Electronics Corporation and is protected under |
dkato | 0:853f5b7408a7 | 6 | * all applicable laws, including copyright laws. |
dkato | 0:853f5b7408a7 | 7 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING |
dkato | 0:853f5b7408a7 | 8 | * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT |
dkato | 0:853f5b7408a7 | 9 | * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
dkato | 0:853f5b7408a7 | 10 | * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. |
dkato | 0:853f5b7408a7 | 11 | * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS |
dkato | 0:853f5b7408a7 | 12 | * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE |
dkato | 0:853f5b7408a7 | 13 | * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR |
dkato | 0:853f5b7408a7 | 14 | * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE |
dkato | 0:853f5b7408a7 | 15 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
dkato | 0:853f5b7408a7 | 16 | * Renesas reserves the right, without notice, to make changes to this software |
dkato | 0:853f5b7408a7 | 17 | * and to discontinue the availability of this software. By using this software, |
dkato | 0:853f5b7408a7 | 18 | * you agree to the additional terms and conditions found by accessing the |
dkato | 0:853f5b7408a7 | 19 | * following link: |
dkato | 0:853f5b7408a7 | 20 | * http://www.renesas.com/disclaimer |
dkato | 0:853f5b7408a7 | 21 | * Copyright (C) 2012 - 2015 Renesas Electronics Corporation. All rights reserved. |
dkato | 0:853f5b7408a7 | 22 | *******************************************************************************/ |
dkato | 0:853f5b7408a7 | 23 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 24 | * @file r_vdc5.c |
dkato | 0:853f5b7408a7 | 25 | * @version 1.00 |
dkato | 0:853f5b7408a7 | 26 | * $Rev: 199 $ |
dkato | 0:853f5b7408a7 | 27 | * $Date:: 2014-05-23 16:33:52 +0900#$ |
dkato | 0:853f5b7408a7 | 28 | * @brief VDC5 driver API function |
dkato | 0:853f5b7408a7 | 29 | ******************************************************************************/ |
dkato | 0:853f5b7408a7 | 30 | |
dkato | 0:853f5b7408a7 | 31 | /****************************************************************************** |
dkato | 0:853f5b7408a7 | 32 | Includes <System Includes> , "Project Includes" |
dkato | 0:853f5b7408a7 | 33 | ******************************************************************************/ |
dkato | 0:853f5b7408a7 | 34 | #include "r_vdc5.h" |
dkato | 0:853f5b7408a7 | 35 | #include "r_vdc5_user.h" |
dkato | 0:853f5b7408a7 | 36 | #include "r_vdc5_register.h" |
dkato | 0:853f5b7408a7 | 37 | #include "r_vdc5_shared_param.h" |
dkato | 0:853f5b7408a7 | 38 | #include "r_vdc5_check_parameter.h" |
dkato | 0:853f5b7408a7 | 39 | |
dkato | 0:853f5b7408a7 | 40 | |
dkato | 0:853f5b7408a7 | 41 | /****************************************************************************** |
dkato | 0:853f5b7408a7 | 42 | Macro definitions |
dkato | 0:853f5b7408a7 | 43 | ******************************************************************************/ |
dkato | 0:853f5b7408a7 | 44 | |
dkato | 0:853f5b7408a7 | 45 | /****************************************************************************** |
dkato | 0:853f5b7408a7 | 46 | Typedef definitions |
dkato | 0:853f5b7408a7 | 47 | ******************************************************************************/ |
dkato | 0:853f5b7408a7 | 48 | |
dkato | 0:853f5b7408a7 | 49 | /****************************************************************************** |
dkato | 0:853f5b7408a7 | 50 | Private global variables and functions |
dkato | 0:853f5b7408a7 | 51 | ******************************************************************************/ |
dkato | 0:853f5b7408a7 | 52 | static vdc5_scaling_type_t ConvertRwProcId2SclId(const vdc5_layer_id_t layer_id); |
dkato | 0:853f5b7408a7 | 53 | static vdc5_graphics_type_t ConvertRwProcId2GrId(const vdc5_layer_id_t layer_id); |
dkato | 0:853f5b7408a7 | 54 | |
dkato | 0:853f5b7408a7 | 55 | |
dkato | 0:853f5b7408a7 | 56 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 57 | * @brief VDC5 driver initialization |
dkato | 0:853f5b7408a7 | 58 | * |
dkato | 0:853f5b7408a7 | 59 | * Description:<br> |
dkato | 0:853f5b7408a7 | 60 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 61 | * - Initializes the VDC5 driver's internal variables. |
dkato | 0:853f5b7408a7 | 62 | * - Calls the user-defined function specified in init_func. |
dkato | 0:853f5b7408a7 | 63 | * - Sets up and enables the VDC5's panel clock. |
dkato | 0:853f5b7408a7 | 64 | * - Sets up and enables the LVDS only if LVDS is used. |
dkato | 0:853f5b7408a7 | 65 | * - Disables all the VDC5 interrupts. |
dkato | 0:853f5b7408a7 | 66 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 67 | * @param[in] param : Initialization parameter |
dkato | 0:853f5b7408a7 | 68 | * @param[in] init_func : Pointer to a user-defined function |
dkato | 0:853f5b7408a7 | 69 | * @param[in] user_num : User defined number |
dkato | 0:853f5b7408a7 | 70 | * @retval Error code |
dkato | 0:853f5b7408a7 | 71 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 72 | vdc5_error_t R_VDC5_Initialize ( |
dkato | 0:853f5b7408a7 | 73 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 74 | const vdc5_init_t * const param, |
dkato | 0:853f5b7408a7 | 75 | void (* const init_func)(uint32_t), |
dkato | 0:853f5b7408a7 | 76 | const uint32_t user_num) |
dkato | 0:853f5b7408a7 | 77 | { |
dkato | 0:853f5b7408a7 | 78 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 79 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 80 | |
dkato | 0:853f5b7408a7 | 81 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 82 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 83 | ret = VDC5_InitializeCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 84 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 85 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 86 | VDC5_ShrdPrmInit(ch); |
dkato | 0:853f5b7408a7 | 87 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 88 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_LVDS_CLK); |
dkato | 0:853f5b7408a7 | 89 | if (rsrc_state != VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 90 | /* The LVDS PLL clock has been already set. */ |
dkato | 0:853f5b7408a7 | 91 | if (param->lvds != NULL) { |
dkato | 0:853f5b7408a7 | 92 | ret = VDC5_ERR_RESOURCE_LVDS_CLK; |
dkato | 0:853f5b7408a7 | 93 | } |
dkato | 0:853f5b7408a7 | 94 | } |
dkato | 0:853f5b7408a7 | 95 | } |
dkato | 0:853f5b7408a7 | 96 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 97 | VDC5_ShrdPrmSetInitParam(ch, param); |
dkato | 0:853f5b7408a7 | 98 | |
dkato | 0:853f5b7408a7 | 99 | /* Callback function */ |
dkato | 0:853f5b7408a7 | 100 | if (init_func != 0) { |
dkato | 0:853f5b7408a7 | 101 | init_func(user_num); |
dkato | 0:853f5b7408a7 | 102 | } |
dkato | 0:853f5b7408a7 | 103 | |
dkato | 0:853f5b7408a7 | 104 | VDC5_Initialize(ch, param); |
dkato | 0:853f5b7408a7 | 105 | |
dkato | 0:853f5b7408a7 | 106 | /* Disable all VDC5 interrupts */ |
dkato | 0:853f5b7408a7 | 107 | VDC5_Int_Disable(ch); |
dkato | 0:853f5b7408a7 | 108 | |
dkato | 0:853f5b7408a7 | 109 | VDC5_ShrdPrmSetResource(ch, VDC5_RESOURCE_PANEL_CLK, VDC5_RESOURCE_ST_VALID); |
dkato | 0:853f5b7408a7 | 110 | if (param->lvds != NULL) { |
dkato | 0:853f5b7408a7 | 111 | VDC5_ShrdPrmSetResource(ch, VDC5_RESOURCE_LVDS_CLK, VDC5_RESOURCE_ST_VALID); |
dkato | 0:853f5b7408a7 | 112 | } |
dkato | 0:853f5b7408a7 | 113 | } |
dkato | 0:853f5b7408a7 | 114 | return ret; |
dkato | 0:853f5b7408a7 | 115 | } /* End of function R_VDC5_Initialize() */ |
dkato | 0:853f5b7408a7 | 116 | |
dkato | 0:853f5b7408a7 | 117 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 118 | * @brief VDC5 driver termination |
dkato | 0:853f5b7408a7 | 119 | * |
dkato | 0:853f5b7408a7 | 120 | * Description:<br> |
dkato | 0:853f5b7408a7 | 121 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 122 | * - Disables all the VDC5 interrupts. |
dkato | 0:853f5b7408a7 | 123 | * - Disables the VDC5 panel clock. |
dkato | 0:853f5b7408a7 | 124 | * - Disables the LVDS if one is used and becomes unnecessary as the result of calling this function. |
dkato | 0:853f5b7408a7 | 125 | * - Calls the user-defined function specified in quit_func. |
dkato | 0:853f5b7408a7 | 126 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 127 | * @param[in] quit_func : Pointer to a user-defined function |
dkato | 0:853f5b7408a7 | 128 | * @param[in] user_num : User defined number |
dkato | 0:853f5b7408a7 | 129 | * @retval Error code |
dkato | 0:853f5b7408a7 | 130 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 131 | vdc5_error_t R_VDC5_Terminate (const vdc5_channel_t ch, void (* const quit_func)(uint32_t), const uint32_t user_num) |
dkato | 0:853f5b7408a7 | 132 | { |
dkato | 0:853f5b7408a7 | 133 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 134 | vdc5_onoff_t lvds_ref; |
dkato | 0:853f5b7408a7 | 135 | |
dkato | 0:853f5b7408a7 | 136 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 137 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 138 | ret = VDC5_TerminateCheckPrm(ch); |
dkato | 0:853f5b7408a7 | 139 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 140 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 141 | VDC5_ShrdPrmSetTerminate(ch); |
dkato | 0:853f5b7408a7 | 142 | |
dkato | 0:853f5b7408a7 | 143 | /* Disable all VDC5 interrupts */ |
dkato | 0:853f5b7408a7 | 144 | VDC5_Int_Disable(ch); |
dkato | 0:853f5b7408a7 | 145 | |
dkato | 0:853f5b7408a7 | 146 | VDC5_Terminate(ch); |
dkato | 0:853f5b7408a7 | 147 | |
dkato | 0:853f5b7408a7 | 148 | VDC5_ShrdPrmSetResource(ch, VDC5_RESOURCE_PANEL_CLK, VDC5_RESOURCE_ST_INVALID); |
dkato | 0:853f5b7408a7 | 149 | |
dkato | 0:853f5b7408a7 | 150 | lvds_ref = VDC5_ShrdPrmGetLvdsClkRef(); |
dkato | 0:853f5b7408a7 | 151 | if (lvds_ref == VDC5_OFF) { /* LVDS PLL clock is not referred. */ |
dkato | 0:853f5b7408a7 | 152 | VDC5_ShrdPrmSetResource(ch, VDC5_RESOURCE_LVDS_CLK, VDC5_RESOURCE_ST_INVALID); |
dkato | 0:853f5b7408a7 | 153 | } |
dkato | 0:853f5b7408a7 | 154 | |
dkato | 0:853f5b7408a7 | 155 | /* Callback function */ |
dkato | 0:853f5b7408a7 | 156 | if (quit_func != 0) { |
dkato | 0:853f5b7408a7 | 157 | quit_func(user_num); |
dkato | 0:853f5b7408a7 | 158 | } |
dkato | 0:853f5b7408a7 | 159 | } |
dkato | 0:853f5b7408a7 | 160 | return ret; |
dkato | 0:853f5b7408a7 | 161 | } /* End of function R_VDC5_Terminate() */ |
dkato | 0:853f5b7408a7 | 162 | |
dkato | 0:853f5b7408a7 | 163 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 164 | * @brief Video input setup |
dkato | 0:853f5b7408a7 | 165 | * |
dkato | 0:853f5b7408a7 | 166 | * Description:<br> |
dkato | 0:853f5b7408a7 | 167 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 168 | * - Selects the video input. |
dkato | 0:853f5b7408a7 | 169 | * - Sets up the phase timing of the input signals. |
dkato | 0:853f5b7408a7 | 170 | * - Performs delay control on the sync signal for the video inputs. |
dkato | 0:853f5b7408a7 | 171 | * - Sets up the parameters for the external input video signals only when they are used. |
dkato | 0:853f5b7408a7 | 172 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 173 | * @param[in] param : Video input setup parameter |
dkato | 0:853f5b7408a7 | 174 | * @retval Error code |
dkato | 0:853f5b7408a7 | 175 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 176 | vdc5_error_t R_VDC5_VideoInput (const vdc5_channel_t ch, const vdc5_input_t * const param) |
dkato | 0:853f5b7408a7 | 177 | { |
dkato | 0:853f5b7408a7 | 178 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 179 | |
dkato | 0:853f5b7408a7 | 180 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 181 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 182 | ret = VDC5_VideoInputCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 183 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 184 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 185 | VDC5_ShrdPrmSetInputParam(ch, param); |
dkato | 0:853f5b7408a7 | 186 | |
dkato | 0:853f5b7408a7 | 187 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 188 | VDC5_VideoInput(ch, param); |
dkato | 0:853f5b7408a7 | 189 | |
dkato | 0:853f5b7408a7 | 190 | VDC5_ShrdPrmSetResource(ch, VDC5_RESOURCE_VIDEO_IN, VDC5_RESOURCE_ST_VALID); |
dkato | 0:853f5b7408a7 | 191 | } |
dkato | 0:853f5b7408a7 | 192 | return ret; |
dkato | 0:853f5b7408a7 | 193 | } /* End of function R_VDC5_VideoInput() */ |
dkato | 0:853f5b7408a7 | 194 | |
dkato | 0:853f5b7408a7 | 195 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 196 | * @brief Sync control setup |
dkato | 0:853f5b7408a7 | 197 | * |
dkato | 0:853f5b7408a7 | 198 | * Description:<br> |
dkato | 0:853f5b7408a7 | 199 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 200 | * - Selects the vertical sync signal. |
dkato | 0:853f5b7408a7 | 201 | * - Sets up the period of the sync signal. |
dkato | 0:853f5b7408a7 | 202 | * - Sets up the delay of the vertical sync signal. |
dkato | 0:853f5b7408a7 | 203 | * - Sets up the full-screen enable signal. |
dkato | 0:853f5b7408a7 | 204 | * - Sets up the compensation for the vertical sync signal. |
dkato | 0:853f5b7408a7 | 205 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 206 | * @param[in] param : Sync control parameter |
dkato | 0:853f5b7408a7 | 207 | * @retval Error code |
dkato | 0:853f5b7408a7 | 208 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 209 | vdc5_error_t R_VDC5_SyncControl (const vdc5_channel_t ch, const vdc5_sync_ctrl_t * const param) |
dkato | 0:853f5b7408a7 | 210 | { |
dkato | 0:853f5b7408a7 | 211 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 212 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 213 | |
dkato | 0:853f5b7408a7 | 214 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 215 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 216 | ret = VDC5_SyncControlCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 217 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 218 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 219 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 220 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_PANEL_CLK); |
dkato | 0:853f5b7408a7 | 221 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 222 | ret = VDC5_ERR_RESOURCE_CLK; |
dkato | 0:853f5b7408a7 | 223 | } |
dkato | 0:853f5b7408a7 | 224 | } |
dkato | 0:853f5b7408a7 | 225 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 226 | if (param->res_vs_sel == VDC5_OFF) { |
dkato | 0:853f5b7408a7 | 227 | /* External input Vsync signal is selected. */ |
dkato | 0:853f5b7408a7 | 228 | if (param->res_vs_in_sel == VDC5_RES_VS_IN_SEL_SC0) { |
dkato | 0:853f5b7408a7 | 229 | /* Scaler 0 */ |
dkato | 0:853f5b7408a7 | 230 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_VIDEO_IN); |
dkato | 0:853f5b7408a7 | 231 | } else { |
dkato | 0:853f5b7408a7 | 232 | /* Scaler 1 */ |
dkato | 0:853f5b7408a7 | 233 | rsrc_state = VDC5_ShrdPrmGetResource( |
dkato | 0:853f5b7408a7 | 234 | ((ch == VDC5_CHANNEL_0) ? VDC5_CHANNEL_1 : VDC5_CHANNEL_0), |
dkato | 0:853f5b7408a7 | 235 | VDC5_RESOURCE_VIDEO_IN); |
dkato | 0:853f5b7408a7 | 236 | } |
dkato | 0:853f5b7408a7 | 237 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 238 | ret = VDC5_ERR_RESOURCE_INPUT; |
dkato | 0:853f5b7408a7 | 239 | } |
dkato | 0:853f5b7408a7 | 240 | } |
dkato | 0:853f5b7408a7 | 241 | } |
dkato | 0:853f5b7408a7 | 242 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 243 | VDC5_ShrdPrmSetSyncParam(ch, param); |
dkato | 0:853f5b7408a7 | 244 | |
dkato | 0:853f5b7408a7 | 245 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 246 | VDC5_SyncControl(ch, param); |
dkato | 0:853f5b7408a7 | 247 | |
dkato | 0:853f5b7408a7 | 248 | VDC5_ShrdPrmSetResource(ch, VDC5_RESOURCE_VSYNC, VDC5_RESOURCE_ST_VALID); |
dkato | 0:853f5b7408a7 | 249 | } |
dkato | 0:853f5b7408a7 | 250 | return ret; |
dkato | 0:853f5b7408a7 | 251 | } /* End of function R_VDC5_SyncControl() */ |
dkato | 0:853f5b7408a7 | 252 | |
dkato | 0:853f5b7408a7 | 253 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 254 | * @brief Display output setup |
dkato | 0:853f5b7408a7 | 255 | * |
dkato | 0:853f5b7408a7 | 256 | * Description:<br> |
dkato | 0:853f5b7408a7 | 257 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 258 | * - Sets up the timing signals for driving the LCD panel. |
dkato | 0:853f5b7408a7 | 259 | * - Sets up the phase, data sequence, and format of the LCD panel output data. |
dkato | 0:853f5b7408a7 | 260 | * - Sets up the background color. |
dkato | 0:853f5b7408a7 | 261 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 262 | * @param[in] param : Display output configuration parameter |
dkato | 0:853f5b7408a7 | 263 | * @retval Error code |
dkato | 0:853f5b7408a7 | 264 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 265 | vdc5_error_t R_VDC5_DisplayOutput (const vdc5_channel_t ch, const vdc5_output_t * const param) |
dkato | 0:853f5b7408a7 | 266 | { |
dkato | 0:853f5b7408a7 | 267 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 268 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 269 | |
dkato | 0:853f5b7408a7 | 270 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 271 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 272 | ret = VDC5_DisplayOutputCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 273 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 274 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 275 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 276 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_PANEL_CLK); |
dkato | 0:853f5b7408a7 | 277 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 278 | ret = VDC5_ERR_RESOURCE_CLK; |
dkato | 0:853f5b7408a7 | 279 | } else { |
dkato | 0:853f5b7408a7 | 280 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_VSYNC); |
dkato | 0:853f5b7408a7 | 281 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 282 | ret = VDC5_ERR_RESOURCE_VSYNC; |
dkato | 0:853f5b7408a7 | 283 | } |
dkato | 0:853f5b7408a7 | 284 | } |
dkato | 0:853f5b7408a7 | 285 | } |
dkato | 0:853f5b7408a7 | 286 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 287 | VDC5_ShrdPrmSetOutputParam(ch, param); |
dkato | 0:853f5b7408a7 | 288 | |
dkato | 0:853f5b7408a7 | 289 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 290 | VDC5_DisplayOutput(ch, param); |
dkato | 0:853f5b7408a7 | 291 | |
dkato | 0:853f5b7408a7 | 292 | VDC5_ShrdPrmSetResource(ch, VDC5_RESOURCE_LCD_PANEL, VDC5_RESOURCE_ST_VALID); |
dkato | 0:853f5b7408a7 | 293 | } |
dkato | 0:853f5b7408a7 | 294 | return ret; |
dkato | 0:853f5b7408a7 | 295 | } /* End of function R_VDC5_DisplayOutput() */ |
dkato | 0:853f5b7408a7 | 296 | |
dkato | 0:853f5b7408a7 | 297 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 298 | * @brief Interrupt callback setup |
dkato | 0:853f5b7408a7 | 299 | * |
dkato | 0:853f5b7408a7 | 300 | * Description:<br> |
dkato | 0:853f5b7408a7 | 301 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 302 | * - Enables the interrupt when the pointer to the corresponding interrupt callback function is specified. |
dkato | 0:853f5b7408a7 | 303 | * - Registers the specified interrupt callback function. |
dkato | 0:853f5b7408a7 | 304 | * - Disables the interrupt when the pointer to the corresponding interrupt callback function is not |
dkato | 0:853f5b7408a7 | 305 | * specified. |
dkato | 0:853f5b7408a7 | 306 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 307 | * @param[in] param : Interrupt callback setup parameter |
dkato | 0:853f5b7408a7 | 308 | * @retval Error code |
dkato | 0:853f5b7408a7 | 309 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 310 | vdc5_error_t R_VDC5_CallbackISR (const vdc5_channel_t ch, const vdc5_int_t * const param) |
dkato | 0:853f5b7408a7 | 311 | { |
dkato | 0:853f5b7408a7 | 312 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 313 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 314 | |
dkato | 0:853f5b7408a7 | 315 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 316 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 317 | ret = VDC5_CallbackISRCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 318 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 319 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 320 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 321 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_PANEL_CLK); |
dkato | 0:853f5b7408a7 | 322 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 323 | ret = VDC5_ERR_RESOURCE_CLK; |
dkato | 0:853f5b7408a7 | 324 | } else { |
dkato | 0:853f5b7408a7 | 325 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_VSYNC); |
dkato | 0:853f5b7408a7 | 326 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 327 | ret = VDC5_ERR_RESOURCE_VSYNC; |
dkato | 0:853f5b7408a7 | 328 | } |
dkato | 0:853f5b7408a7 | 329 | } |
dkato | 0:853f5b7408a7 | 330 | } |
dkato | 0:853f5b7408a7 | 331 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 332 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 333 | VDC5_Int_SetInterrupt(ch, param); |
dkato | 0:853f5b7408a7 | 334 | } |
dkato | 0:853f5b7408a7 | 335 | return ret; |
dkato | 0:853f5b7408a7 | 336 | } /* End of function R_VDC5_CallbackISR() */ |
dkato | 0:853f5b7408a7 | 337 | |
dkato | 0:853f5b7408a7 | 338 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 339 | * @brief Data write control processing |
dkato | 0:853f5b7408a7 | 340 | * |
dkato | 0:853f5b7408a7 | 341 | * Description:<br> |
dkato | 0:853f5b7408a7 | 342 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 343 | * - Sets up the input image area to be captured. |
dkato | 0:853f5b7408a7 | 344 | * - Makes input image scale-down/rotation control settings (layers 0 and 1 only). |
dkato | 0:853f5b7408a7 | 345 | * - Makes frame buffer write control settings. |
dkato | 0:853f5b7408a7 | 346 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 347 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 348 | * - VDC5_LAYER_ID_0_WR |
dkato | 0:853f5b7408a7 | 349 | * - VDC5_LAYER_ID_1_WR |
dkato | 0:853f5b7408a7 | 350 | * - VDC5_LAYER_ID_OIR_WR |
dkato | 0:853f5b7408a7 | 351 | * @param[in] param : Data write control parameter |
dkato | 0:853f5b7408a7 | 352 | * @retval Error code |
dkato | 0:853f5b7408a7 | 353 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 354 | vdc5_error_t R_VDC5_WriteDataControl ( |
dkato | 0:853f5b7408a7 | 355 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 356 | const vdc5_layer_id_t layer_id, |
dkato | 0:853f5b7408a7 | 357 | const vdc5_write_t * const param) |
dkato | 0:853f5b7408a7 | 358 | { |
dkato | 0:853f5b7408a7 | 359 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 360 | vdc5_scaling_type_t scaling_id; |
dkato | 0:853f5b7408a7 | 361 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 362 | |
dkato | 0:853f5b7408a7 | 363 | scaling_id = ConvertRwProcId2SclId(layer_id); |
dkato | 0:853f5b7408a7 | 364 | |
dkato | 0:853f5b7408a7 | 365 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 366 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 367 | ret = VDC5_WriteDataControlCheckPrm(ch, layer_id, param); |
dkato | 0:853f5b7408a7 | 368 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 369 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 370 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 371 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, layer_id); |
dkato | 0:853f5b7408a7 | 372 | if (rsrc_state != VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 373 | /* The specified layer is already used. */ |
dkato | 0:853f5b7408a7 | 374 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 375 | } else { |
dkato | 0:853f5b7408a7 | 376 | if (layer_id == VDC5_LAYER_ID_0_WR) { |
dkato | 0:853f5b7408a7 | 377 | /* Layer 0 */ |
dkato | 0:853f5b7408a7 | 378 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_VIDEO_IN); |
dkato | 0:853f5b7408a7 | 379 | } else if (layer_id == VDC5_LAYER_ID_1_WR) { |
dkato | 0:853f5b7408a7 | 380 | /* Layer 1 */ |
dkato | 0:853f5b7408a7 | 381 | rsrc_state = VDC5_ShrdPrmGetResource( |
dkato | 0:853f5b7408a7 | 382 | ((ch == VDC5_CHANNEL_0) ? VDC5_CHANNEL_1 : VDC5_CHANNEL_0), |
dkato | 0:853f5b7408a7 | 383 | VDC5_RESOURCE_VIDEO_IN); |
dkato | 0:853f5b7408a7 | 384 | } else { |
dkato | 0:853f5b7408a7 | 385 | /* Layer OIR */ |
dkato | 0:853f5b7408a7 | 386 | rsrc_state = VDC5_RESOURCE_ST_VALID; |
dkato | 0:853f5b7408a7 | 387 | } |
dkato | 0:853f5b7408a7 | 388 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 389 | ret = VDC5_ERR_RESOURCE_INPUT; |
dkato | 0:853f5b7408a7 | 390 | } |
dkato | 0:853f5b7408a7 | 391 | } |
dkato | 0:853f5b7408a7 | 392 | } |
dkato | 0:853f5b7408a7 | 393 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 394 | VDC5_ShrdPrmSetWriteParam(ch, scaling_id, param); |
dkato | 0:853f5b7408a7 | 395 | |
dkato | 0:853f5b7408a7 | 396 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 397 | VDC5_WriteDataControl(ch, scaling_id, param); |
dkato | 0:853f5b7408a7 | 398 | |
dkato | 0:853f5b7408a7 | 399 | VDC5_ShrdPrmSetLayerResource(ch, layer_id, VDC5_RESOURCE_ST_VALID); |
dkato | 0:853f5b7408a7 | 400 | } |
dkato | 0:853f5b7408a7 | 401 | return ret; |
dkato | 0:853f5b7408a7 | 402 | } /* End of function R_VDC5_WriteDataControl() */ |
dkato | 0:853f5b7408a7 | 403 | |
dkato | 0:853f5b7408a7 | 404 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 405 | * @brief Data write change processing |
dkato | 0:853f5b7408a7 | 406 | * |
dkato | 0:853f5b7408a7 | 407 | * Description:<br> |
dkato | 0:853f5b7408a7 | 408 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 409 | * - Changes the input image area to be captured. |
dkato | 0:853f5b7408a7 | 410 | * - Makes changes with respect to scaling-down/rotation control of the input image (layers 0 and 1 only). |
dkato | 0:853f5b7408a7 | 411 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 412 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 413 | * - VDC5_LAYER_ID_0_WR |
dkato | 0:853f5b7408a7 | 414 | * - VDC5_LAYER_ID_1_WR |
dkato | 0:853f5b7408a7 | 415 | * - VDC5_LAYER_ID_OIR_WR |
dkato | 0:853f5b7408a7 | 416 | * @param[in] param : Data write change parameter |
dkato | 0:853f5b7408a7 | 417 | * @retval Error code |
dkato | 0:853f5b7408a7 | 418 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 419 | vdc5_error_t R_VDC5_ChangeWriteProcess ( |
dkato | 0:853f5b7408a7 | 420 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 421 | const vdc5_layer_id_t layer_id, |
dkato | 0:853f5b7408a7 | 422 | const vdc5_write_chg_t * const param) |
dkato | 0:853f5b7408a7 | 423 | { |
dkato | 0:853f5b7408a7 | 424 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 425 | vdc5_scaling_type_t scaling_id; |
dkato | 0:853f5b7408a7 | 426 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 427 | |
dkato | 0:853f5b7408a7 | 428 | scaling_id = ConvertRwProcId2SclId(layer_id); |
dkato | 0:853f5b7408a7 | 429 | |
dkato | 0:853f5b7408a7 | 430 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 431 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 432 | ret = VDC5_ChangeWriteProcessCheckPrm(ch, layer_id, param); |
dkato | 0:853f5b7408a7 | 433 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 434 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 435 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 436 | rsrc_state = VDC5_ShrdPrmGetRwProcEnabled(ch, layer_id); |
dkato | 0:853f5b7408a7 | 437 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 438 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 439 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 440 | } |
dkato | 0:853f5b7408a7 | 441 | } |
dkato | 0:853f5b7408a7 | 442 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 443 | VDC5_ShrdPrmSetChgWriteParam(ch, scaling_id, param); |
dkato | 0:853f5b7408a7 | 444 | |
dkato | 0:853f5b7408a7 | 445 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 446 | VDC5_ChangeWriteProcess(ch, scaling_id, param); |
dkato | 0:853f5b7408a7 | 447 | } |
dkato | 0:853f5b7408a7 | 448 | return ret; |
dkato | 0:853f5b7408a7 | 449 | } /* End of function R_VDC5_ChangeWriteProcess() */ |
dkato | 0:853f5b7408a7 | 450 | |
dkato | 0:853f5b7408a7 | 451 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 452 | * @brief Data read control processing |
dkato | 0:853f5b7408a7 | 453 | * |
dkato | 0:853f5b7408a7 | 454 | * Description:<br> |
dkato | 0:853f5b7408a7 | 455 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 456 | * - Sets up the display area for graphics images. |
dkato | 0:853f5b7408a7 | 457 | * - Makes image scale-up control settings (layers 0 and 1 only). |
dkato | 0:853f5b7408a7 | 458 | * - Makes frame buffer read control settings. |
dkato | 0:853f5b7408a7 | 459 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 460 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 461 | * - VDC5_LAYER_ID_0_RD |
dkato | 0:853f5b7408a7 | 462 | * - VDC5_LAYER_ID_1_RD |
dkato | 0:853f5b7408a7 | 463 | * - VDC5_LAYER_ID_2_RD |
dkato | 0:853f5b7408a7 | 464 | * - VDC5_LAYER_ID_3_RD |
dkato | 0:853f5b7408a7 | 465 | * - VDC5_LAYER_ID_OIR_RD |
dkato | 0:853f5b7408a7 | 466 | * @param[in] param : Data read control parameter |
dkato | 0:853f5b7408a7 | 467 | * @retval Error code |
dkato | 0:853f5b7408a7 | 468 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 469 | vdc5_error_t R_VDC5_ReadDataControl ( |
dkato | 0:853f5b7408a7 | 470 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 471 | const vdc5_layer_id_t layer_id, |
dkato | 0:853f5b7408a7 | 472 | const vdc5_read_t * const param) |
dkato | 0:853f5b7408a7 | 473 | { |
dkato | 0:853f5b7408a7 | 474 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 475 | vdc5_graphics_type_t graphics_id; |
dkato | 0:853f5b7408a7 | 476 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 477 | |
dkato | 0:853f5b7408a7 | 478 | graphics_id = ConvertRwProcId2GrId(layer_id); |
dkato | 0:853f5b7408a7 | 479 | |
dkato | 0:853f5b7408a7 | 480 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 481 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 482 | ret = VDC5_ReadDataControlCheckPrm(ch, layer_id, graphics_id, param); |
dkato | 0:853f5b7408a7 | 483 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 484 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 485 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 486 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, layer_id); |
dkato | 0:853f5b7408a7 | 487 | if (rsrc_state != VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 488 | /* The specified layer is already used. */ |
dkato | 0:853f5b7408a7 | 489 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 490 | } |
dkato | 0:853f5b7408a7 | 491 | } |
dkato | 0:853f5b7408a7 | 492 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 493 | VDC5_ShrdPrmSetReadParam(ch, graphics_id, param); |
dkato | 0:853f5b7408a7 | 494 | |
dkato | 0:853f5b7408a7 | 495 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 496 | VDC5_ReadDataControl(ch, graphics_id, param); |
dkato | 0:853f5b7408a7 | 497 | |
dkato | 0:853f5b7408a7 | 498 | VDC5_ShrdPrmSetLayerResource(ch, layer_id, VDC5_RESOURCE_ST_VALID); |
dkato | 0:853f5b7408a7 | 499 | } |
dkato | 0:853f5b7408a7 | 500 | return ret; |
dkato | 0:853f5b7408a7 | 501 | } /* End of function R_VDC5_ReadDataControl() */ |
dkato | 0:853f5b7408a7 | 502 | |
dkato | 0:853f5b7408a7 | 503 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 504 | * @brief Data read change processing |
dkato | 0:853f5b7408a7 | 505 | * |
dkato | 0:853f5b7408a7 | 506 | * Description:<br> |
dkato | 0:853f5b7408a7 | 507 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 508 | * - Changes the frame buffer base address. |
dkato | 0:853f5b7408a7 | 509 | * - Changes the frame buffer read size (image scale-up control) (layers 0 and 1 only). |
dkato | 0:853f5b7408a7 | 510 | * - Changes the display area for graphics images. |
dkato | 0:853f5b7408a7 | 511 | * - Changes the graphics display mode. |
dkato | 0:853f5b7408a7 | 512 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 513 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 514 | * - VDC5_LAYER_ID_0_RD |
dkato | 0:853f5b7408a7 | 515 | * - VDC5_LAYER_ID_1_RD |
dkato | 0:853f5b7408a7 | 516 | * - VDC5_LAYER_ID_2_RD |
dkato | 0:853f5b7408a7 | 517 | * - VDC5_LAYER_ID_3_RD |
dkato | 0:853f5b7408a7 | 518 | * - VDC5_LAYER_ID_OIR_RD |
dkato | 0:853f5b7408a7 | 519 | * @param[in] param : Data read change parameter |
dkato | 0:853f5b7408a7 | 520 | * @retval Error code |
dkato | 0:853f5b7408a7 | 521 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 522 | vdc5_error_t R_VDC5_ChangeReadProcess ( |
dkato | 0:853f5b7408a7 | 523 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 524 | const vdc5_layer_id_t layer_id, |
dkato | 0:853f5b7408a7 | 525 | const vdc5_read_chg_t * const param) |
dkato | 0:853f5b7408a7 | 526 | { |
dkato | 0:853f5b7408a7 | 527 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 528 | vdc5_graphics_type_t graphics_id; |
dkato | 0:853f5b7408a7 | 529 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 530 | |
dkato | 0:853f5b7408a7 | 531 | graphics_id = ConvertRwProcId2GrId(layer_id); |
dkato | 0:853f5b7408a7 | 532 | |
dkato | 0:853f5b7408a7 | 533 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 534 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 535 | ret = VDC5_ChangeReadProcessCheckPrm(ch, layer_id, param); |
dkato | 0:853f5b7408a7 | 536 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 537 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 538 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 539 | rsrc_state = VDC5_ShrdPrmGetRwProcEnabled(ch, layer_id); |
dkato | 0:853f5b7408a7 | 540 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 541 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 542 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 543 | } |
dkato | 0:853f5b7408a7 | 544 | } |
dkato | 0:853f5b7408a7 | 545 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 546 | VDC5_ShrdPrmSetChgReadParam(ch, graphics_id, param); |
dkato | 0:853f5b7408a7 | 547 | |
dkato | 0:853f5b7408a7 | 548 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 549 | VDC5_ChangeReadProcess(ch, graphics_id, param); |
dkato | 0:853f5b7408a7 | 550 | } |
dkato | 0:853f5b7408a7 | 551 | return ret; |
dkato | 0:853f5b7408a7 | 552 | } /* End of function R_VDC5_ChangeReadProcess() */ |
dkato | 0:853f5b7408a7 | 553 | |
dkato | 0:853f5b7408a7 | 554 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 555 | * @brief Data write/read start processing |
dkato | 0:853f5b7408a7 | 556 | * |
dkato | 0:853f5b7408a7 | 557 | * Description:<br> |
dkato | 0:853f5b7408a7 | 558 | * This function performs layer start processing. If the layer ID specified in layer_id |
dkato | 0:853f5b7408a7 | 559 | * is VDC5_LAYER_ID_ALL, the function starts all the layers that are in the stopped state |
dkato | 0:853f5b7408a7 | 560 | * and also enabled. If the layer ID is not VDC5_LAYER_ID_ALL, the function starts only |
dkato | 0:853f5b7408a7 | 561 | * the specified layer.<br> |
dkato | 0:853f5b7408a7 | 562 | * When performing start processing for write, the function starts a write to the frame buffer. |
dkato | 0:853f5b7408a7 | 563 | * When performing start processing for read, the function starts a read from the frame buffer |
dkato | 0:853f5b7408a7 | 564 | * and sets the graphics display mode to the specified values for each layer. |
dkato | 0:853f5b7408a7 | 565 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 566 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 567 | * @param[in] param : Data write/read start parameter |
dkato | 0:853f5b7408a7 | 568 | * @retval Error code |
dkato | 0:853f5b7408a7 | 569 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 570 | vdc5_error_t R_VDC5_StartProcess ( |
dkato | 0:853f5b7408a7 | 571 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 572 | const vdc5_layer_id_t layer_id, |
dkato | 0:853f5b7408a7 | 573 | const vdc5_start_t * const param) |
dkato | 0:853f5b7408a7 | 574 | { |
dkato | 0:853f5b7408a7 | 575 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 576 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 577 | |
dkato | 0:853f5b7408a7 | 578 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 579 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 580 | ret = VDC5_StartProcessCheckPrm(ch, layer_id, param); |
dkato | 0:853f5b7408a7 | 581 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 582 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 583 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 584 | if (layer_id != VDC5_LAYER_ID_ALL) { |
dkato | 0:853f5b7408a7 | 585 | rsrc_state = VDC5_ShrdPrmGetRwProcReady(ch, layer_id); |
dkato | 0:853f5b7408a7 | 586 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 587 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 588 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 589 | } |
dkato | 0:853f5b7408a7 | 590 | } |
dkato | 0:853f5b7408a7 | 591 | } |
dkato | 0:853f5b7408a7 | 592 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 593 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 594 | VDC5_StartProcess(ch, layer_id, param); |
dkato | 0:853f5b7408a7 | 595 | } |
dkato | 0:853f5b7408a7 | 596 | return ret; |
dkato | 0:853f5b7408a7 | 597 | } /* End of function R_VDC5_StartProcess() */ |
dkato | 0:853f5b7408a7 | 598 | |
dkato | 0:853f5b7408a7 | 599 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 600 | * @brief Data write/read stop processing |
dkato | 0:853f5b7408a7 | 601 | * |
dkato | 0:853f5b7408a7 | 602 | * Description:<br> |
dkato | 0:853f5b7408a7 | 603 | * This function performs layer stop processing. If the layer ID specified in layer_id is |
dkato | 0:853f5b7408a7 | 604 | * VDC5_LAYER_ID_ALL, the function stops all the layers that are enabled and running. |
dkato | 0:853f5b7408a7 | 605 | * If the layer ID is not VDC5_LAYER_ID_ALL, the function stops only the specified layer.<br> |
dkato | 0:853f5b7408a7 | 606 | * When performing stop processing for write, the function stops the write to the frame buffer. |
dkato | 0:853f5b7408a7 | 607 | * When performing stop processing for read, the function stops the read from the frame buffer |
dkato | 0:853f5b7408a7 | 608 | * and resets the graphics display mode to the initial values for each of the layers. |
dkato | 0:853f5b7408a7 | 609 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 610 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 611 | * @retval Error code |
dkato | 0:853f5b7408a7 | 612 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 613 | vdc5_error_t R_VDC5_StopProcess (const vdc5_channel_t ch, const vdc5_layer_id_t layer_id) |
dkato | 0:853f5b7408a7 | 614 | { |
dkato | 0:853f5b7408a7 | 615 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 616 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 617 | |
dkato | 0:853f5b7408a7 | 618 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 619 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 620 | ret = VDC5_StopProcessCheckPrm(ch, layer_id); |
dkato | 0:853f5b7408a7 | 621 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 622 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 623 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 624 | if (layer_id != VDC5_LAYER_ID_ALL) { |
dkato | 0:853f5b7408a7 | 625 | rsrc_state = VDC5_ShrdPrmGetRwProcEnabled(ch, layer_id); |
dkato | 0:853f5b7408a7 | 626 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 627 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 628 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 629 | } |
dkato | 0:853f5b7408a7 | 630 | } |
dkato | 0:853f5b7408a7 | 631 | } |
dkato | 0:853f5b7408a7 | 632 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 633 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 634 | VDC5_StopProcess(ch, layer_id); |
dkato | 0:853f5b7408a7 | 635 | } |
dkato | 0:853f5b7408a7 | 636 | return ret; |
dkato | 0:853f5b7408a7 | 637 | } /* End of function R_VDC5_StopSurface() */ |
dkato | 0:853f5b7408a7 | 638 | |
dkato | 0:853f5b7408a7 | 639 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 640 | * @brief Data write/read control release processing |
dkato | 0:853f5b7408a7 | 641 | * |
dkato | 0:853f5b7408a7 | 642 | * Description:<br> |
dkato | 0:853f5b7408a7 | 643 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 644 | * - Disables the specified layer. |
dkato | 0:853f5b7408a7 | 645 | * - Initializes the cascaded connection settings (layer 1 read processing only). |
dkato | 0:853f5b7408a7 | 646 | * - Initializes the VIN synthesizer settings (layer 0 and 1 read processing only). |
dkato | 0:853f5b7408a7 | 647 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 648 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 649 | * @retval Error code |
dkato | 0:853f5b7408a7 | 650 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 651 | vdc5_error_t R_VDC5_ReleaseDataControl (const vdc5_channel_t ch, const vdc5_layer_id_t layer_id) |
dkato | 0:853f5b7408a7 | 652 | { |
dkato | 0:853f5b7408a7 | 653 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 654 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 655 | |
dkato | 0:853f5b7408a7 | 656 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 657 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 658 | ret = VDC5_ReleaseDataControlCheckPrm(ch, layer_id); |
dkato | 0:853f5b7408a7 | 659 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 660 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 661 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 662 | if (layer_id != VDC5_LAYER_ID_ALL) { |
dkato | 0:853f5b7408a7 | 663 | rsrc_state = VDC5_ShrdPrmGetRwProcReady(ch, layer_id); |
dkato | 0:853f5b7408a7 | 664 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 665 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 666 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 667 | } |
dkato | 0:853f5b7408a7 | 668 | } |
dkato | 0:853f5b7408a7 | 669 | } |
dkato | 0:853f5b7408a7 | 670 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 671 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 672 | VDC5_ReleaseDataControl(ch, layer_id); |
dkato | 0:853f5b7408a7 | 673 | |
dkato | 0:853f5b7408a7 | 674 | VDC5_ShrdPrmSetLayerResource(ch, layer_id, VDC5_RESOURCE_ST_INVALID); |
dkato | 0:853f5b7408a7 | 675 | } |
dkato | 0:853f5b7408a7 | 676 | return ret; |
dkato | 0:853f5b7408a7 | 677 | } /* End of function R_VDC5_ReleaseDataControl() */ |
dkato | 0:853f5b7408a7 | 678 | |
dkato | 0:853f5b7408a7 | 679 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 680 | * @brief Noise reduction setup |
dkato | 0:853f5b7408a7 | 681 | * |
dkato | 0:853f5b7408a7 | 682 | * Description:<br> |
dkato | 0:853f5b7408a7 | 683 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 684 | * - Turns on and off noise reduction processing. |
dkato | 0:853f5b7408a7 | 685 | * - Sets up the noise reduction parameters for the Y/G, Cb/B, and Cr/R signals. |
dkato | 0:853f5b7408a7 | 686 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 687 | * @param[in] nr1d_on : Noise reduction ON/OFF setting |
dkato | 0:853f5b7408a7 | 688 | * @param[in] param : Noise reduction setup parameter |
dkato | 0:853f5b7408a7 | 689 | * @retval Error code |
dkato | 0:853f5b7408a7 | 690 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 691 | vdc5_error_t R_VDC5_VideoNoiseReduction ( |
dkato | 0:853f5b7408a7 | 692 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 693 | const vdc5_onoff_t nr1d_on, |
dkato | 0:853f5b7408a7 | 694 | const vdc5_noise_reduction_t * const param) |
dkato | 0:853f5b7408a7 | 695 | { |
dkato | 0:853f5b7408a7 | 696 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 697 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 698 | |
dkato | 0:853f5b7408a7 | 699 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 700 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 701 | ret = VDC5_VideoNoiseReductCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 702 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 703 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 704 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 705 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_VIDEO_IN); |
dkato | 0:853f5b7408a7 | 706 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 707 | ret = VDC5_ERR_RESOURCE_INPUT; |
dkato | 0:853f5b7408a7 | 708 | } |
dkato | 0:853f5b7408a7 | 709 | } |
dkato | 0:853f5b7408a7 | 710 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 711 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 712 | VDC5_VideoNoiseReduction(ch, nr1d_on, param); |
dkato | 0:853f5b7408a7 | 713 | } |
dkato | 0:853f5b7408a7 | 714 | return ret; |
dkato | 0:853f5b7408a7 | 715 | } /* End of function R_VDC5_VideoNoiseReduction() */ |
dkato | 0:853f5b7408a7 | 716 | |
dkato | 0:853f5b7408a7 | 717 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 718 | * @brief Color matrix setup |
dkato | 0:853f5b7408a7 | 719 | * |
dkato | 0:853f5b7408a7 | 720 | * Description:<br> |
dkato | 0:853f5b7408a7 | 721 | * This function sets up the specified color matrix. |
dkato | 0:853f5b7408a7 | 722 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 723 | * @param[in] param : Color matrix setup parameter |
dkato | 0:853f5b7408a7 | 724 | * @retval Error code |
dkato | 0:853f5b7408a7 | 725 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 726 | vdc5_error_t R_VDC5_ImageColorMatrix (const vdc5_channel_t ch, const vdc5_color_matrix_t * const param) |
dkato | 0:853f5b7408a7 | 727 | { |
dkato | 0:853f5b7408a7 | 728 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 729 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 730 | |
dkato | 0:853f5b7408a7 | 731 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 732 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 733 | ret = VDC5_ImageColorMatrixCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 734 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 735 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 736 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 737 | if (param->module == VDC5_COLORMTX_IMGCNT) { |
dkato | 0:853f5b7408a7 | 738 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, VDC5_LAYER_ID_0_WR); |
dkato | 0:853f5b7408a7 | 739 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 740 | rsrc_state = VDC5_ShrdPrmGetLayerResource( |
dkato | 0:853f5b7408a7 | 741 | ((ch == VDC5_CHANNEL_0) ? VDC5_CHANNEL_1 : VDC5_CHANNEL_0), |
dkato | 0:853f5b7408a7 | 742 | VDC5_LAYER_ID_1_WR); |
dkato | 0:853f5b7408a7 | 743 | } |
dkato | 0:853f5b7408a7 | 744 | } else if (param->module == VDC5_COLORMTX_ADJ_0) { |
dkato | 0:853f5b7408a7 | 745 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, VDC5_LAYER_ID_0_RD); |
dkato | 0:853f5b7408a7 | 746 | } else { |
dkato | 0:853f5b7408a7 | 747 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, VDC5_LAYER_ID_1_RD); |
dkato | 0:853f5b7408a7 | 748 | } |
dkato | 0:853f5b7408a7 | 749 | |
dkato | 0:853f5b7408a7 | 750 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 751 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 752 | } |
dkato | 0:853f5b7408a7 | 753 | } |
dkato | 0:853f5b7408a7 | 754 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 755 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 756 | VDC5_ImageColorMatrix(ch, param); |
dkato | 0:853f5b7408a7 | 757 | } |
dkato | 0:853f5b7408a7 | 758 | return ret; |
dkato | 0:853f5b7408a7 | 759 | } /* End of function R_VDC5_ImageColorMatrix() */ |
dkato | 0:853f5b7408a7 | 760 | |
dkato | 0:853f5b7408a7 | 761 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 762 | * @brief Image enhancement processing |
dkato | 0:853f5b7408a7 | 763 | * |
dkato | 0:853f5b7408a7 | 764 | * Description:<br> |
dkato | 0:853f5b7408a7 | 765 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 766 | * - Turns on and off sharpness processing. |
dkato | 0:853f5b7408a7 | 767 | * - Sets up the sharpness parameter. |
dkato | 0:853f5b7408a7 | 768 | * - Turns on and off LTI processing. |
dkato | 0:853f5b7408a7 | 769 | * - Sets up the LTI parameter. |
dkato | 0:853f5b7408a7 | 770 | * - Sets up the enhancer-enabled area to be subjected to sharpness and LTI processing. |
dkato | 0:853f5b7408a7 | 771 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 772 | * @param[in] imgimprv_id : Image quality improver ID |
dkato | 0:853f5b7408a7 | 773 | * @param[in] shp_h_on : Sharpness ON/OFF setting |
dkato | 0:853f5b7408a7 | 774 | * @param[in] sharp_param : Sharpness setup parameter |
dkato | 0:853f5b7408a7 | 775 | * @param[in] lti_h_on : LTI ON/OFF setting |
dkato | 0:853f5b7408a7 | 776 | * @param[in] lti_param : LTI setup parameter |
dkato | 0:853f5b7408a7 | 777 | * @param[in] enh_area : Enhancer-enabled area setup parameter |
dkato | 0:853f5b7408a7 | 778 | * @retval Error code |
dkato | 0:853f5b7408a7 | 779 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 780 | vdc5_error_t R_VDC5_ImageEnhancement ( |
dkato | 0:853f5b7408a7 | 781 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 782 | const vdc5_imgimprv_id_t imgimprv_id, |
dkato | 0:853f5b7408a7 | 783 | const vdc5_onoff_t shp_h_on, |
dkato | 0:853f5b7408a7 | 784 | const vdc5_enhance_sharp_t * const sharp_param, |
dkato | 0:853f5b7408a7 | 785 | const vdc5_onoff_t lti_h_on, |
dkato | 0:853f5b7408a7 | 786 | const vdc5_enhance_lti_t * const lti_param, |
dkato | 0:853f5b7408a7 | 787 | const vdc5_period_rect_t * const enh_area) |
dkato | 0:853f5b7408a7 | 788 | { |
dkato | 0:853f5b7408a7 | 789 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 790 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 791 | vdc5_color_space_t color_space; |
dkato | 0:853f5b7408a7 | 792 | |
dkato | 0:853f5b7408a7 | 793 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 794 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 795 | ret = VDC5_ImageEnhancementCheckPrm(ch, imgimprv_id, sharp_param, enh_area); |
dkato | 0:853f5b7408a7 | 796 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 797 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 798 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 799 | rsrc_state = VDC5_ShrdPrmGetLayerResource( |
dkato | 0:853f5b7408a7 | 800 | ch, |
dkato | 0:853f5b7408a7 | 801 | ((imgimprv_id == VDC5_IMG_IMPRV_0) ? VDC5_LAYER_ID_0_RD : VDC5_LAYER_ID_1_RD)); |
dkato | 0:853f5b7408a7 | 802 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 803 | /* The layer is invalid. */ |
dkato | 0:853f5b7408a7 | 804 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 805 | } else { |
dkato | 0:853f5b7408a7 | 806 | /* Condition checks */ |
dkato | 0:853f5b7408a7 | 807 | color_space = VDC5_ShrdPrmGetColorSpaceFbRd( |
dkato | 0:853f5b7408a7 | 808 | ch, |
dkato | 0:853f5b7408a7 | 809 | ((imgimprv_id == VDC5_IMG_IMPRV_0) ? VDC5_GR_TYPE_GR0 : VDC5_GR_TYPE_GR1)); |
dkato | 0:853f5b7408a7 | 810 | if (color_space == VDC5_COLOR_SPACE_GBR) { |
dkato | 0:853f5b7408a7 | 811 | /* The image quality improver does not act on RGB signals. */ |
dkato | 0:853f5b7408a7 | 812 | ret = VDC5_ERR_IF_CONDITION; |
dkato | 0:853f5b7408a7 | 813 | } |
dkato | 0:853f5b7408a7 | 814 | } |
dkato | 0:853f5b7408a7 | 815 | } |
dkato | 0:853f5b7408a7 | 816 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 817 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 818 | VDC5_ImageEnhancement(ch, imgimprv_id, shp_h_on, sharp_param, lti_h_on, lti_param, enh_area); |
dkato | 0:853f5b7408a7 | 819 | } |
dkato | 0:853f5b7408a7 | 820 | return ret; |
dkato | 0:853f5b7408a7 | 821 | } /* End of function R_VDC5_ImageEnhancement() */ |
dkato | 0:853f5b7408a7 | 822 | |
dkato | 0:853f5b7408a7 | 823 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 824 | * @brief Black stretch setup |
dkato | 0:853f5b7408a7 | 825 | * |
dkato | 0:853f5b7408a7 | 826 | * Description:<br> |
dkato | 0:853f5b7408a7 | 827 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 828 | * - Turns on and off black stretch processing. |
dkato | 0:853f5b7408a7 | 829 | * - Sets up the black stretch parameters. |
dkato | 0:853f5b7408a7 | 830 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 831 | * @param[in] imgimprv_id : Image quality improver ID |
dkato | 0:853f5b7408a7 | 832 | * @param[in] bkstr_on : Black stretch ON/OFF setting |
dkato | 0:853f5b7408a7 | 833 | * @param[in] param : Black stretch setup parameter |
dkato | 0:853f5b7408a7 | 834 | * @retval Error code |
dkato | 0:853f5b7408a7 | 835 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 836 | vdc5_error_t R_VDC5_ImageBlackStretch ( |
dkato | 0:853f5b7408a7 | 837 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 838 | const vdc5_imgimprv_id_t imgimprv_id, |
dkato | 0:853f5b7408a7 | 839 | const vdc5_onoff_t bkstr_on, |
dkato | 0:853f5b7408a7 | 840 | const vdc5_black_t * const param) |
dkato | 0:853f5b7408a7 | 841 | { |
dkato | 0:853f5b7408a7 | 842 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 843 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 844 | vdc5_color_space_t color_space; |
dkato | 0:853f5b7408a7 | 845 | |
dkato | 0:853f5b7408a7 | 846 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 847 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 848 | ret = VDC5_ImageBlackStretchCheckPrm(ch, imgimprv_id, param); |
dkato | 0:853f5b7408a7 | 849 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 850 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 851 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 852 | rsrc_state = VDC5_ShrdPrmGetLayerResource( |
dkato | 0:853f5b7408a7 | 853 | ch, |
dkato | 0:853f5b7408a7 | 854 | ((imgimprv_id == VDC5_IMG_IMPRV_0) ? VDC5_LAYER_ID_0_RD : VDC5_LAYER_ID_1_RD)); |
dkato | 0:853f5b7408a7 | 855 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 856 | /* The layer is invalid. */ |
dkato | 0:853f5b7408a7 | 857 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 858 | } else { |
dkato | 0:853f5b7408a7 | 859 | /* Condition checks */ |
dkato | 0:853f5b7408a7 | 860 | color_space = VDC5_ShrdPrmGetColorSpaceFbRd( |
dkato | 0:853f5b7408a7 | 861 | ch, |
dkato | 0:853f5b7408a7 | 862 | ((imgimprv_id == VDC5_IMG_IMPRV_0) ? VDC5_GR_TYPE_GR0 : VDC5_GR_TYPE_GR1)); |
dkato | 0:853f5b7408a7 | 863 | if (color_space == VDC5_COLOR_SPACE_GBR) { |
dkato | 0:853f5b7408a7 | 864 | /* The image quality improver does not act on RGB signals. */ |
dkato | 0:853f5b7408a7 | 865 | ret = VDC5_ERR_IF_CONDITION; |
dkato | 0:853f5b7408a7 | 866 | } |
dkato | 0:853f5b7408a7 | 867 | } |
dkato | 0:853f5b7408a7 | 868 | } |
dkato | 0:853f5b7408a7 | 869 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 870 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 871 | VDC5_ImageBlackStretch(ch, imgimprv_id, bkstr_on, param); |
dkato | 0:853f5b7408a7 | 872 | } |
dkato | 0:853f5b7408a7 | 873 | return ret; |
dkato | 0:853f5b7408a7 | 874 | } /* End of function R_VDC5_ImageBlackStretch() */ |
dkato | 0:853f5b7408a7 | 875 | |
dkato | 0:853f5b7408a7 | 876 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 877 | * @brief Alpha blending setup |
dkato | 0:853f5b7408a7 | 878 | * |
dkato | 0:853f5b7408a7 | 879 | * Description:<br> |
dkato | 0:853f5b7408a7 | 880 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 881 | * - Sets up the alpha value of the ARGB1555/RGBA5551 formats. |
dkato | 0:853f5b7408a7 | 882 | * - Make settings for premultiplication processing at alpha blending in one-pixel. |
dkato | 0:853f5b7408a7 | 883 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 884 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 885 | * - VDC5_LAYER_ID_1_RD |
dkato | 0:853f5b7408a7 | 886 | * - VDC5_LAYER_ID_2_RD |
dkato | 0:853f5b7408a7 | 887 | * - VDC5_LAYER_ID_3_RD |
dkato | 0:853f5b7408a7 | 888 | * @param[in] param : Alpha blending setup parameter |
dkato | 0:853f5b7408a7 | 889 | * @retval Error code |
dkato | 0:853f5b7408a7 | 890 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 891 | vdc5_error_t R_VDC5_AlphaBlending ( |
dkato | 0:853f5b7408a7 | 892 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 893 | const vdc5_layer_id_t layer_id, |
dkato | 0:853f5b7408a7 | 894 | const vdc5_alpha_blending_t * const param) |
dkato | 0:853f5b7408a7 | 895 | { |
dkato | 0:853f5b7408a7 | 896 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 897 | vdc5_graphics_type_t graphics_id; |
dkato | 0:853f5b7408a7 | 898 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 899 | |
dkato | 0:853f5b7408a7 | 900 | graphics_id = ConvertRwProcId2GrId(layer_id); |
dkato | 0:853f5b7408a7 | 901 | |
dkato | 0:853f5b7408a7 | 902 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 903 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 904 | ret = VDC5_AlphaBlendingCheckPrm(ch, layer_id, param); |
dkato | 0:853f5b7408a7 | 905 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 906 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 907 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 908 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, layer_id); |
dkato | 0:853f5b7408a7 | 909 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 910 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 911 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 912 | } |
dkato | 0:853f5b7408a7 | 913 | } |
dkato | 0:853f5b7408a7 | 914 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 915 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 916 | VDC5_AlphaBlending(ch, graphics_id, param); |
dkato | 0:853f5b7408a7 | 917 | } |
dkato | 0:853f5b7408a7 | 918 | return ret; |
dkato | 0:853f5b7408a7 | 919 | } /* End of function R_VDC5_AlphaBlending() */ |
dkato | 0:853f5b7408a7 | 920 | |
dkato | 0:853f5b7408a7 | 921 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 922 | * @brief Rectangle alpha blending setup |
dkato | 0:853f5b7408a7 | 923 | * |
dkato | 0:853f5b7408a7 | 924 | * Description:<br> |
dkato | 0:853f5b7408a7 | 925 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 926 | * - Turns on and off alpha blending in a rectangular area. |
dkato | 0:853f5b7408a7 | 927 | * - Sets up the rectangular area subjected to alpha blending. |
dkato | 0:853f5b7408a7 | 928 | * - Sets up the alpha value for alpha blending in a rectangular area. |
dkato | 0:853f5b7408a7 | 929 | * - Makes fade-in/-out settings to be applied to rectangle alpha blending. |
dkato | 0:853f5b7408a7 | 930 | * - Allocates graphics 0 and 1 to the lower-layer/current graphics in the VIN synthesizer. |
dkato | 0:853f5b7408a7 | 931 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 932 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 933 | * - VDC5_LAYER_ID_1_RD |
dkato | 0:853f5b7408a7 | 934 | * - VDC5_LAYER_ID_2_RD |
dkato | 0:853f5b7408a7 | 935 | * - VDC5_LAYER_ID_3_RD |
dkato | 0:853f5b7408a7 | 936 | * - VDC5_LAYER_ID_VIN_RD |
dkato | 0:853f5b7408a7 | 937 | * @param[in] gr_arc_on : ON/OFF setting for alpha blending in a rectangular area |
dkato | 0:853f5b7408a7 | 938 | * @param[in] param : Setup parameter for alpha blending in a rectangular area |
dkato | 0:853f5b7408a7 | 939 | * @retval Error code |
dkato | 0:853f5b7408a7 | 940 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 941 | vdc5_error_t R_VDC5_AlphaBlendingRect ( |
dkato | 0:853f5b7408a7 | 942 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 943 | const vdc5_layer_id_t layer_id, |
dkato | 0:853f5b7408a7 | 944 | const vdc5_onoff_t gr_arc_on, |
dkato | 0:853f5b7408a7 | 945 | const vdc5_alpha_blending_rect_t * const param) |
dkato | 0:853f5b7408a7 | 946 | { |
dkato | 0:853f5b7408a7 | 947 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 948 | vdc5_graphics_type_t graphics_id; |
dkato | 0:853f5b7408a7 | 949 | vdc5_color_space_t color_space; |
dkato | 0:853f5b7408a7 | 950 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 951 | |
dkato | 0:853f5b7408a7 | 952 | graphics_id = ConvertRwProcId2GrId(layer_id); |
dkato | 0:853f5b7408a7 | 953 | |
dkato | 0:853f5b7408a7 | 954 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 955 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 956 | ret = VDC5_AlphaBlendingRectCheckPrm(ch, layer_id, param); |
dkato | 0:853f5b7408a7 | 957 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 958 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 959 | if (layer_id != VDC5_LAYER_ID_VIN_RD) { |
dkato | 0:853f5b7408a7 | 960 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 961 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, layer_id); |
dkato | 0:853f5b7408a7 | 962 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 963 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 964 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 965 | } else { |
dkato | 0:853f5b7408a7 | 966 | /* Condition checks */ |
dkato | 0:853f5b7408a7 | 967 | color_space = VDC5_ShrdPrmGetColorSpaceFbRd(ch, graphics_id); |
dkato | 0:853f5b7408a7 | 968 | if (color_space == VDC5_COLOR_SPACE_YCBCR) { |
dkato | 0:853f5b7408a7 | 969 | /* Alpha blending cannot be used |
dkato | 0:853f5b7408a7 | 970 | when the format of the signal read from the frame buffer is YCbCr422 or YCbCr444. */ |
dkato | 0:853f5b7408a7 | 971 | ret = VDC5_ERR_IF_CONDITION; |
dkato | 0:853f5b7408a7 | 972 | } |
dkato | 0:853f5b7408a7 | 973 | } |
dkato | 0:853f5b7408a7 | 974 | } |
dkato | 0:853f5b7408a7 | 975 | } |
dkato | 0:853f5b7408a7 | 976 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 977 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 978 | VDC5_AlphaBlendingRect(ch, graphics_id, gr_arc_on, param); |
dkato | 0:853f5b7408a7 | 979 | } |
dkato | 0:853f5b7408a7 | 980 | return ret; |
dkato | 0:853f5b7408a7 | 981 | } /* End of function R_VDC5_AlphaBlendingRect() */ |
dkato | 0:853f5b7408a7 | 982 | |
dkato | 0:853f5b7408a7 | 983 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 984 | * @brief Chroma-key setup |
dkato | 0:853f5b7408a7 | 985 | * |
dkato | 0:853f5b7408a7 | 986 | * Description:<br> |
dkato | 0:853f5b7408a7 | 987 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 988 | * - Turns on and off the chroma-key processing. |
dkato | 0:853f5b7408a7 | 989 | * - Sets up the color signals to be subject to chroma-key processing and |
dkato | 0:853f5b7408a7 | 990 | * the color signals after replacement. |
dkato | 0:853f5b7408a7 | 991 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 992 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 993 | * - VDC5_LAYER_ID_0_RD |
dkato | 0:853f5b7408a7 | 994 | * - VDC5_LAYER_ID_1_RD |
dkato | 0:853f5b7408a7 | 995 | * - VDC5_LAYER_ID_2_RD |
dkato | 0:853f5b7408a7 | 996 | * - VDC5_LAYER_ID_3_RD |
dkato | 0:853f5b7408a7 | 997 | * - VDC5_LAYER_ID_OIR_RD |
dkato | 0:853f5b7408a7 | 998 | * @param[in] gr_ck_on : Chroma-key ON/OFF setting |
dkato | 0:853f5b7408a7 | 999 | * @param[in] param : Chroma-key setup parameter |
dkato | 0:853f5b7408a7 | 1000 | * @retval Error code |
dkato | 0:853f5b7408a7 | 1001 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 1002 | vdc5_error_t R_VDC5_Chromakey ( |
dkato | 0:853f5b7408a7 | 1003 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 1004 | const vdc5_layer_id_t layer_id, |
dkato | 0:853f5b7408a7 | 1005 | const vdc5_onoff_t gr_ck_on, |
dkato | 0:853f5b7408a7 | 1006 | const vdc5_chromakey_t * const param) |
dkato | 0:853f5b7408a7 | 1007 | { |
dkato | 0:853f5b7408a7 | 1008 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 1009 | vdc5_graphics_type_t graphics_id; |
dkato | 0:853f5b7408a7 | 1010 | vdc5_color_space_t color_space; |
dkato | 0:853f5b7408a7 | 1011 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 1012 | |
dkato | 0:853f5b7408a7 | 1013 | graphics_id = ConvertRwProcId2GrId(layer_id); |
dkato | 0:853f5b7408a7 | 1014 | |
dkato | 0:853f5b7408a7 | 1015 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 1016 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 1017 | ret = VDC5_ChromakeyCheckPrm(ch, layer_id, graphics_id, param); |
dkato | 0:853f5b7408a7 | 1018 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 1019 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 1020 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 1021 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, layer_id); |
dkato | 0:853f5b7408a7 | 1022 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 1023 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 1024 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 1025 | } else { |
dkato | 0:853f5b7408a7 | 1026 | /* Condition checks */ |
dkato | 0:853f5b7408a7 | 1027 | color_space = VDC5_ShrdPrmGetColorSpaceFbRd(ch, graphics_id); |
dkato | 0:853f5b7408a7 | 1028 | if (color_space == VDC5_COLOR_SPACE_YCBCR) { |
dkato | 0:853f5b7408a7 | 1029 | /* Chroma-key processing cannot be used |
dkato | 0:853f5b7408a7 | 1030 | when the format of the signal read from the frame buffer is YCbCr422 or YCbCr444. */ |
dkato | 0:853f5b7408a7 | 1031 | ret = VDC5_ERR_IF_CONDITION; |
dkato | 0:853f5b7408a7 | 1032 | } |
dkato | 0:853f5b7408a7 | 1033 | } |
dkato | 0:853f5b7408a7 | 1034 | } |
dkato | 0:853f5b7408a7 | 1035 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 1036 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 1037 | VDC5_Chromakey(ch, graphics_id, gr_ck_on, param); |
dkato | 0:853f5b7408a7 | 1038 | } |
dkato | 0:853f5b7408a7 | 1039 | return ret; |
dkato | 0:853f5b7408a7 | 1040 | } /* End of function R_VDC5_Chromakey() */ |
dkato | 0:853f5b7408a7 | 1041 | |
dkato | 0:853f5b7408a7 | 1042 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 1043 | * @brief CLUT setup |
dkato | 0:853f5b7408a7 | 1044 | * |
dkato | 0:853f5b7408a7 | 1045 | * Description:<br> |
dkato | 0:853f5b7408a7 | 1046 | * This function sets up CLUT for the specified layer. |
dkato | 0:853f5b7408a7 | 1047 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 1048 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 1049 | * - VDC5_LAYER_ID_0_RD |
dkato | 0:853f5b7408a7 | 1050 | * - VDC5_LAYER_ID_1_RD |
dkato | 0:853f5b7408a7 | 1051 | * - VDC5_LAYER_ID_2_RD |
dkato | 0:853f5b7408a7 | 1052 | * - VDC5_LAYER_ID_3_RD |
dkato | 0:853f5b7408a7 | 1053 | * - VDC5_LAYER_ID_OIR_RD |
dkato | 0:853f5b7408a7 | 1054 | * @param[in] param : CLUT setup parameter |
dkato | 0:853f5b7408a7 | 1055 | * @retval Error code |
dkato | 0:853f5b7408a7 | 1056 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 1057 | vdc5_error_t R_VDC5_CLUT (const vdc5_channel_t ch, const vdc5_layer_id_t layer_id, const vdc5_clut_t * const param) |
dkato | 0:853f5b7408a7 | 1058 | { |
dkato | 0:853f5b7408a7 | 1059 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 1060 | vdc5_graphics_type_t graphics_id; |
dkato | 0:853f5b7408a7 | 1061 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 1062 | |
dkato | 0:853f5b7408a7 | 1063 | graphics_id = ConvertRwProcId2GrId(layer_id); |
dkato | 0:853f5b7408a7 | 1064 | |
dkato | 0:853f5b7408a7 | 1065 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 1066 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 1067 | ret = VDC5_CLUTCheckPrm(ch, layer_id, graphics_id, param); |
dkato | 0:853f5b7408a7 | 1068 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 1069 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 1070 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 1071 | rsrc_state = VDC5_ShrdPrmGetLayerResource(ch, layer_id); |
dkato | 0:853f5b7408a7 | 1072 | if (rsrc_state == VDC5_RESOURCE_ST_INVALID) { |
dkato | 0:853f5b7408a7 | 1073 | /* The specified layer is invalid. */ |
dkato | 0:853f5b7408a7 | 1074 | ret = VDC5_ERR_RESOURCE_LAYER; |
dkato | 0:853f5b7408a7 | 1075 | } |
dkato | 0:853f5b7408a7 | 1076 | } |
dkato | 0:853f5b7408a7 | 1077 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 1078 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 1079 | VDC5_CLUT(ch, graphics_id, param); |
dkato | 0:853f5b7408a7 | 1080 | } |
dkato | 0:853f5b7408a7 | 1081 | return ret; |
dkato | 0:853f5b7408a7 | 1082 | } /* End of function R_VDC5_SetCLUT() */ |
dkato | 0:853f5b7408a7 | 1083 | |
dkato | 0:853f5b7408a7 | 1084 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 1085 | * @brief Display calibration processing |
dkato | 0:853f5b7408a7 | 1086 | * |
dkato | 0:853f5b7408a7 | 1087 | * Description:<br> |
dkato | 0:853f5b7408a7 | 1088 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 1089 | * - Sets up panel brightness adjustment. |
dkato | 0:853f5b7408a7 | 1090 | * - Sets up contrast adjustment. |
dkato | 0:853f5b7408a7 | 1091 | * - Sets up panel dithering. |
dkato | 0:853f5b7408a7 | 1092 | * - Makes control settings for the correction circuit sequence. |
dkato | 0:853f5b7408a7 | 1093 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 1094 | * @param[in] param : Display calibration parameter |
dkato | 0:853f5b7408a7 | 1095 | * @retval Error code |
dkato | 0:853f5b7408a7 | 1096 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 1097 | vdc5_error_t R_VDC5_DisplayCalibration (const vdc5_channel_t ch, const vdc5_disp_calibration_t * const param) |
dkato | 0:853f5b7408a7 | 1098 | { |
dkato | 0:853f5b7408a7 | 1099 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 1100 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 1101 | |
dkato | 0:853f5b7408a7 | 1102 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 1103 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 1104 | ret = VDC5_DisplayCalibrationCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 1105 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 1106 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 1107 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 1108 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_LCD_PANEL); |
dkato | 0:853f5b7408a7 | 1109 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 1110 | ret = VDC5_ERR_RESOURCE_OUTPUT; |
dkato | 0:853f5b7408a7 | 1111 | } |
dkato | 0:853f5b7408a7 | 1112 | } |
dkato | 0:853f5b7408a7 | 1113 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 1114 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 1115 | VDC5_DisplayCalibration(ch, param); |
dkato | 0:853f5b7408a7 | 1116 | } |
dkato | 0:853f5b7408a7 | 1117 | return ret; |
dkato | 0:853f5b7408a7 | 1118 | } /* End of function R_VDC5_DisplayCalibration() */ |
dkato | 0:853f5b7408a7 | 1119 | |
dkato | 0:853f5b7408a7 | 1120 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 1121 | * @brief Gamma correction setup |
dkato | 0:853f5b7408a7 | 1122 | * |
dkato | 0:853f5b7408a7 | 1123 | * Description:<br> |
dkato | 0:853f5b7408a7 | 1124 | * This function performs the following processing: |
dkato | 0:853f5b7408a7 | 1125 | * - Turns on and off gamma correction processing. |
dkato | 0:853f5b7408a7 | 1126 | * - Sets up the gamma correction gain adjustment values for the G/B/R signals. |
dkato | 0:853f5b7408a7 | 1127 | * - Sets up the gamma correction start threshold values for the G/B/R signals. |
dkato | 0:853f5b7408a7 | 1128 | * @param[in] ch : Channel |
dkato | 0:853f5b7408a7 | 1129 | * @param[in] gam_on : Gamma correction ON/OFF setting |
dkato | 0:853f5b7408a7 | 1130 | * @param[in] param : Gamma correction setup parameter |
dkato | 0:853f5b7408a7 | 1131 | * @retval Error code |
dkato | 0:853f5b7408a7 | 1132 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 1133 | vdc5_error_t R_VDC5_GammaCorrection ( |
dkato | 0:853f5b7408a7 | 1134 | const vdc5_channel_t ch, |
dkato | 0:853f5b7408a7 | 1135 | const vdc5_onoff_t gam_on, |
dkato | 0:853f5b7408a7 | 1136 | const vdc5_gamma_correction_t * const param) |
dkato | 0:853f5b7408a7 | 1137 | { |
dkato | 0:853f5b7408a7 | 1138 | vdc5_error_t ret; |
dkato | 0:853f5b7408a7 | 1139 | vdc5_resource_state_t rsrc_state; |
dkato | 0:853f5b7408a7 | 1140 | |
dkato | 0:853f5b7408a7 | 1141 | ret = VDC5_OK; |
dkato | 0:853f5b7408a7 | 1142 | #ifdef R_VDC5_CHECK_PARAMETERS |
dkato | 0:853f5b7408a7 | 1143 | ret = VDC5_GammaCorrectionCheckPrm(ch, param); |
dkato | 0:853f5b7408a7 | 1144 | #endif /* R_VDC5_CHECK_PARAMETERS */ |
dkato | 0:853f5b7408a7 | 1145 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 1146 | /* Resource checks */ |
dkato | 0:853f5b7408a7 | 1147 | rsrc_state = VDC5_ShrdPrmGetResource(ch, VDC5_RESOURCE_LCD_PANEL); |
dkato | 0:853f5b7408a7 | 1148 | if (rsrc_state != VDC5_RESOURCE_ST_VALID) { |
dkato | 0:853f5b7408a7 | 1149 | ret = VDC5_ERR_RESOURCE_OUTPUT; |
dkato | 0:853f5b7408a7 | 1150 | } |
dkato | 0:853f5b7408a7 | 1151 | } |
dkato | 0:853f5b7408a7 | 1152 | if (ret == VDC5_OK) { |
dkato | 0:853f5b7408a7 | 1153 | /* Setting VDC5 registers */ |
dkato | 0:853f5b7408a7 | 1154 | VDC5_GammaCorrection(ch, gam_on, param); |
dkato | 0:853f5b7408a7 | 1155 | } |
dkato | 0:853f5b7408a7 | 1156 | return ret; |
dkato | 0:853f5b7408a7 | 1157 | } /* End of function R_VDC5_GammaCorrection() */ |
dkato | 0:853f5b7408a7 | 1158 | |
dkato | 0:853f5b7408a7 | 1159 | /****************************************************************************** |
dkato | 0:853f5b7408a7 | 1160 | Local Functions |
dkato | 0:853f5b7408a7 | 1161 | ******************************************************************************/ |
dkato | 0:853f5b7408a7 | 1162 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 1163 | * @brief Convert read/write process ID into scaling type ID |
dkato | 0:853f5b7408a7 | 1164 | * |
dkato | 0:853f5b7408a7 | 1165 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 1166 | * @retval Scaling type ID |
dkato | 0:853f5b7408a7 | 1167 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 1168 | static vdc5_scaling_type_t ConvertRwProcId2SclId (const vdc5_layer_id_t layer_id) |
dkato | 0:853f5b7408a7 | 1169 | { |
dkato | 0:853f5b7408a7 | 1170 | vdc5_scaling_type_t scaling_id; |
dkato | 0:853f5b7408a7 | 1171 | |
dkato | 0:853f5b7408a7 | 1172 | switch (layer_id) { |
dkato | 0:853f5b7408a7 | 1173 | case VDC5_LAYER_ID_0_WR: /* Layer 0, write process */ |
dkato | 0:853f5b7408a7 | 1174 | scaling_id = VDC5_SC_TYPE_SC0; /* Scaler 0 */ |
dkato | 0:853f5b7408a7 | 1175 | break; |
dkato | 0:853f5b7408a7 | 1176 | case VDC5_LAYER_ID_1_WR: /* Layer 1, write process */ |
dkato | 0:853f5b7408a7 | 1177 | scaling_id = VDC5_SC_TYPE_SC1; /* Scaler 1 */ |
dkato | 0:853f5b7408a7 | 1178 | break; |
dkato | 0:853f5b7408a7 | 1179 | case VDC5_LAYER_ID_OIR_WR: /* Layer OIR, write process */ |
dkato | 0:853f5b7408a7 | 1180 | scaling_id = VDC5_SC_TYPE_OIR; /* OIR */ |
dkato | 0:853f5b7408a7 | 1181 | break; |
dkato | 0:853f5b7408a7 | 1182 | default: /* Error */ |
dkato | 0:853f5b7408a7 | 1183 | scaling_id = VDC5_SC_TYPE_NUM; |
dkato | 0:853f5b7408a7 | 1184 | break; |
dkato | 0:853f5b7408a7 | 1185 | } |
dkato | 0:853f5b7408a7 | 1186 | return scaling_id; |
dkato | 0:853f5b7408a7 | 1187 | } /* End of function ConvertRwProcId2SclId() */ |
dkato | 0:853f5b7408a7 | 1188 | |
dkato | 0:853f5b7408a7 | 1189 | /**************************************************************************//** |
dkato | 0:853f5b7408a7 | 1190 | * @brief Convert read/write process ID into graphics type ID |
dkato | 0:853f5b7408a7 | 1191 | * |
dkato | 0:853f5b7408a7 | 1192 | * @param[in] layer_id : Layer ID |
dkato | 0:853f5b7408a7 | 1193 | * @retval Graphics type ID |
dkato | 0:853f5b7408a7 | 1194 | *****************************************************************************/ |
dkato | 0:853f5b7408a7 | 1195 | static vdc5_graphics_type_t ConvertRwProcId2GrId (const vdc5_layer_id_t layer_id) |
dkato | 0:853f5b7408a7 | 1196 | { |
dkato | 0:853f5b7408a7 | 1197 | vdc5_graphics_type_t graphics_id; |
dkato | 0:853f5b7408a7 | 1198 | |
dkato | 0:853f5b7408a7 | 1199 | switch (layer_id) { |
dkato | 0:853f5b7408a7 | 1200 | case VDC5_LAYER_ID_0_RD: /* Layer 0, read process */ |
dkato | 0:853f5b7408a7 | 1201 | graphics_id = VDC5_GR_TYPE_GR0; /* Graphics 0 */ |
dkato | 0:853f5b7408a7 | 1202 | break; |
dkato | 0:853f5b7408a7 | 1203 | case VDC5_LAYER_ID_1_RD: /* Layer 1, read process */ |
dkato | 0:853f5b7408a7 | 1204 | graphics_id = VDC5_GR_TYPE_GR1; /* Graphics 1 */ |
dkato | 0:853f5b7408a7 | 1205 | break; |
dkato | 0:853f5b7408a7 | 1206 | case VDC5_LAYER_ID_2_RD: /* Layer 2, read process */ |
dkato | 0:853f5b7408a7 | 1207 | graphics_id = VDC5_GR_TYPE_GR2; /* Graphics 2 */ |
dkato | 0:853f5b7408a7 | 1208 | break; |
dkato | 0:853f5b7408a7 | 1209 | case VDC5_LAYER_ID_3_RD: /* Layer 3, read process */ |
dkato | 0:853f5b7408a7 | 1210 | graphics_id = VDC5_GR_TYPE_GR3; /* Graphics 3 */ |
dkato | 0:853f5b7408a7 | 1211 | break; |
dkato | 0:853f5b7408a7 | 1212 | case VDC5_LAYER_ID_VIN_RD: /* Layer VIN, read process */ |
dkato | 0:853f5b7408a7 | 1213 | graphics_id = VDC5_GR_TYPE_VIN; /* VIN */ |
dkato | 0:853f5b7408a7 | 1214 | break; |
dkato | 0:853f5b7408a7 | 1215 | case VDC5_LAYER_ID_OIR_RD: /* Layer OIR, read process */ |
dkato | 0:853f5b7408a7 | 1216 | graphics_id = VDC5_GR_TYPE_OIR; /* OIR */ |
dkato | 0:853f5b7408a7 | 1217 | break; |
dkato | 0:853f5b7408a7 | 1218 | default: /* Error */ |
dkato | 0:853f5b7408a7 | 1219 | graphics_id = VDC5_GR_TYPE_NUM; |
dkato | 0:853f5b7408a7 | 1220 | break; |
dkato | 0:853f5b7408a7 | 1221 | } |
dkato | 0:853f5b7408a7 | 1222 | return graphics_id; |
dkato | 0:853f5b7408a7 | 1223 | } /* End of function ConvertRwProcId2GrId() */ |
dkato | 0:853f5b7408a7 | 1224 |