1 /*! 2 \file gd32f4xx_ipa.h 3 \brief definitions for the IPA 4 5 \version 2016-08-15, V1.0.0, firmware for GD32F4xx 6 \version 2018-12-12, V2.0.0, firmware for GD32F4xx 7 \version 2020-09-30, V2.1.0, firmware for GD32F4xx 8 \version 2022-03-09, V3.0.0, firmware for GD32F4xx 9 */ 10 11 /* 12 Copyright (c) 2022, GigaDevice Semiconductor Inc. 13 14 Redistribution and use in source and binary forms, with or without modification, 15 are permitted provided that the following conditions are met: 16 17 1. Redistributions of source code must retain the above copyright notice, this 18 list of conditions and the following disclaimer. 19 2. Redistributions in binary form must reproduce the above copyright notice, 20 this list of conditions and the following disclaimer in the documentation 21 and/or other materials provided with the distribution. 22 3. Neither the name of the copyright holder nor the names of its contributors 23 may be used to endorse or promote products derived from this software without 24 specific prior written permission. 25 26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 29 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 30 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 31 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 33 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 OF SUCH DAMAGE. 36 */ 37 38 #ifndef GD32F4XX_IPA_H 39 #define GD32F4XX_IPA_H 40 41 #include "gd32f4xx.h" 42 43 /* TLI definitions */ 44 #define IPA IPA_BASE /*!< IPA base address */ 45 46 /* bits definitions */ 47 /* registers definitions */ 48 #define IPA_CTL REG32(IPA + 0x00000000U) /*!< IPA control register */ 49 #define IPA_INTF REG32(IPA + 0x00000004U) /*!< IPA interrupt flag register */ 50 #define IPA_INTC REG32(IPA + 0x00000008U) /*!< IPA interrupt flag clear register */ 51 #define IPA_FMADDR REG32(IPA + 0x0000000CU) /*!< IPA foreground memory base address register */ 52 #define IPA_FLOFF REG32(IPA + 0x00000010U) /*!< IPA foreground line offset register */ 53 #define IPA_BMADDR REG32(IPA + 0x00000014U) /*!< IPA background memory base address register */ 54 #define IPA_BLOFF REG32(IPA + 0x00000018U) /*!< IPA background line offset register */ 55 #define IPA_FPCTL REG32(IPA + 0x0000001CU) /*!< IPA foreground pixel control register */ 56 #define IPA_FPV REG32(IPA + 0x00000020U) /*!< IPA foreground pixel value register */ 57 #define IPA_BPCTL REG32(IPA + 0x00000024U) /*!< IPA background pixel control register */ 58 #define IPA_BPV REG32(IPA + 0x00000028U) /*!< IPA background pixel value register */ 59 #define IPA_FLMADDR REG32(IPA + 0x0000002CU) /*!< IPA foreground LUT memory base address register */ 60 #define IPA_BLMADDR REG32(IPA + 0x00000030U) /*!< IPA background LUT memory base address register */ 61 #define IPA_DPCTL REG32(IPA + 0x00000034U) /*!< IPA destination pixel control register */ 62 #define IPA_DPV REG32(IPA + 0x00000038U) /*!< IPA destination pixel value register */ 63 #define IPA_DMADDR REG32(IPA + 0x0000003CU) /*!< IPA destination memory base address register */ 64 #define IPA_DLOFF REG32(IPA + 0x00000040U) /*!< IPA destination line offset register */ 65 #define IPA_IMS REG32(IPA + 0x00000044U) /*!< IPA image size register */ 66 #define IPA_LM REG32(IPA + 0x00000048U) /*!< IPA line mark register */ 67 #define IPA_ITCTL REG32(IPA + 0x0000004CU) /*!< IPA inter-timer control register */ 68 69 /* IPA_CTL */ 70 #define IPA_CTL_TEN BIT(0) /*!< transfer enable */ 71 #define IPA_CTL_THU BIT(1) /*!< transfer hang up */ 72 #define IPA_CTL_TST BIT(2) /*!< transfer stop */ 73 #define IPA_CTL_TAEIE BIT(8) /*!< enable bit for transfer access error interrupt */ 74 #define IPA_CTL_FTFIE BIT(9) /*!< enable bit for full transfer finish interrup */ 75 #define IPA_CTL_TLMIE BIT(10) /*!< enable bit for transfer line mark interrupt */ 76 #define IPA_CTL_LACIE BIT(11) /*!< enable bit for LUT access conflict interrupt */ 77 #define IPA_CTL_LLFIE BIT(12) /*!< enable bit for LUT loading finish interrupt */ 78 #define IPA_CTL_WCFIE BIT(13) /*!< enable bit for wrong configuration interrupt */ 79 #define IPA_CTL_PFCM BITS(16,17) /*!< pixel format convert mode */ 80 81 /* IPA_INTF */ 82 #define IPA_INTF_TAEIF BIT(0) /*!< transfer access error interrupt flag */ 83 #define IPA_INTF_FTFIF BIT(1) /*!< full transfer finish interrupt flag */ 84 #define IPA_INTF_TLMIF BIT(2) /*!< transfer line mark interrupt flag */ 85 #define IPA_INTF_LACIF BIT(3) /*!< LUT access conflict interrupt flag */ 86 #define IPA_INTF_LLFIF BIT(4) /*!< LUT loading finish interrupt flag */ 87 #define IPA_INTF_WCFIF BIT(5) /*!< wrong configuration interrupt flag */ 88 89 /* IPA_INTC */ 90 #define IPA_INTC_TAEIFC BIT(0) /*!< clear bit for transfer access error interrupt flag */ 91 #define IPA_INTC_FTFIFC BIT(1) /*!< clear bit for full transfer finish interrupt flag */ 92 #define IPA_INTC_TLMIFC BIT(2) /*!< clear bit for transfer line mark interrupt flag */ 93 #define IPA_INTC_LACIFC BIT(3) /*!< clear bit for LUT access conflict interrupt flag */ 94 #define IPA_INTC_LLFIFC BIT(4) /*!< clear bit for LUT loading finish interrupt flag */ 95 #define IPA_INTC_WCFIFC BIT(5) /*!< clear bit for wrong configuration interrupt flag */ 96 97 /* IPA_FMADDR */ 98 #define IPA_FMADDR_FMADDR BITS(0,31) /*!< foreground memory base address */ 99 100 /* IPA_FLOFF */ 101 #define IPA_FLOFF_FLOFF BITS(0,13) /*!< foreground line offset */ 102 103 /* IPA_BMADDR */ 104 #define IPA_BMADDR_BMADDR BITS(0,31) /*!< background memory base address */ 105 106 /* IPA_BLOFF */ 107 #define IPA_BLOFF_BLOFF BITS(0,13) /*!< background line offset */ 108 109 /* IPA_FPCTL */ 110 #define IPA_FPCTL_FPF BITS(0,3) /*!< foreground pixel format */ 111 #define IPA_FPCTL_FLPF BIT(4) /*!< foreground LUT pixel format */ 112 #define IPA_FPCTL_FLLEN BIT(5) /*!< foreground LUT loading enable */ 113 #define IPA_FPCTL_FCNP BITS(8,15) /*!< foreground LUT number of pixel */ 114 #define IPA_FPCTL_FAVCA BITS(16,17) /*!< foreground alpha value calculation algorithm */ 115 #define IPA_FPCTL_FPDAV BITS(24,31) /*!< foreground pre- defined alpha value */ 116 117 /* IPA_FPV */ 118 #define IPA_FPV_FPDBV BITS(0,7) /*!< foreground pre-defined red value */ 119 #define IPA_FPV_FPDGV BITS(8,15) /*!< foreground pre-defined green value */ 120 #define IPA_FPV_FPDRV BITS(16,23) /*!< foreground pre-defined red value */ 121 122 /* IPA_BPCTL */ 123 #define IPA_BPCTL_BPF BITS(0,3) /*!< background pixel format */ 124 #define IPA_BPCTL_BLPF BIT(4) /*!< background LUT pixel format */ 125 #define IPA_BPCTL_BLLEN BIT(5) /*!< background LUT loading enable */ 126 #define IPA_BPCTL_BCNP BITS(8,15) /*!< background LUT number of pixel */ 127 #define IPA_BPCTL_BAVCA BITS(16,17) /*!< background alpha value calculation algorithm */ 128 #define IPA_BPCTL_BPDAV BITS(24,31) /*!< background pre- defined alpha value */ 129 130 /* IPA_BPV */ 131 #define IPA_BPV_BPDBV BITS(0,7) /*!< background pre-defined blue value */ 132 #define IPA_BPV_BPDGV BITS(8,15) /*!< background pre-defined green value */ 133 #define IPA_BPV_BPDRV BITS(16,23) /*!< background pre-defined red value */ 134 135 /* IPA_FLMADDR */ 136 #define IPA_FLMADDR_FLMADDR BITS(0,31) /*!< foreground LUT memory base address */ 137 138 /* IPA_BLMADDR */ 139 #define IPA_BLMADDR_BLMADDR BITS(0,31) /*!< background LUT memory base address */ 140 141 /* IPA_DPCTL */ 142 #define IPA_DPCTL_DPF BITS(0,2) /*!< destination pixel control register */ 143 144 /* IPA_DPV */ 145 /* destination pixel format ARGB8888 */ 146 #define IPA_DPV_DPDBV_0 BITS(0,7) /*!< destination pre-defined blue value */ 147 #define IPA_DPV_DPDGV_0 BITS(8,15) /*!< destination pre-defined green value */ 148 #define IPA_DPV_DPDRV_0 BITS(16,23) /*!< destination pre-defined red value */ 149 #define IPA_DPV_DPDAV_0 BITS(24,31) /*!< destination pre-defined alpha value */ 150 151 /* destination pixel format RGB8888 */ 152 #define IPA_DPV_DPDBV_1 BITS(0,7) /*!< destination pre-defined blue value */ 153 #define IPA_DPV_DPDGV_1 BITS(8,15) /*!< destination pre-defined green value */ 154 #define IPA_DPV_DPDRV_1 BITS(16,23) /*!< destination pre-defined red value */ 155 156 /* destination pixel format RGB565 */ 157 #define IPA_DPV_DPDBV_2 BITS(0,4) /*!< destination pre-defined blue value */ 158 #define IPA_DPV_DPDGV_2 BITS(5,10) /*!< destination pre-defined green value */ 159 #define IPA_DPV_DPDRV_2 BITS(11,15) /*!< destination pre-defined red value */ 160 161 /* destination pixel format ARGB1555 */ 162 #define IPA_DPV_DPDBV_3 BITS(0,4) /*!< destination pre-defined blue value */ 163 #define IPA_DPV_DPDGV_3 BITS(5,9) /*!< destination pre-defined green value */ 164 #define IPA_DPV_DPDRV_3 BITS(10,14) /*!< destination pre-defined red value */ 165 #define IPA_DPV_DPDAV_3 BIT(15) /*!< destination pre-defined alpha value */ 166 167 /* destination pixel format ARGB4444 */ 168 #define IPA_DPV_DPDBV_4 BITS(0,3) /*!< destination pre-defined blue value */ 169 #define IPA_DPV_DPDGV_4 BITS(4,7) /*!< destination pre-defined green value */ 170 #define IPA_DPV_DPDRV_4 BITS(8,11) /*!< destination pre-defined red value */ 171 #define IPA_DPV_DPDAV_4 BITS(12,15) /*!< destination pre-defined alpha value */ 172 173 /* IPA_DMADDR */ 174 #define IPA_DMADDR_DMADDR BITS(0,31) /*!< destination memory base address */ 175 176 /* IPA_DLOFF */ 177 #define IPA_DLOFF_DLOFF BITS(0,13) /*!< destination line offset */ 178 179 /* IPA_IMS */ 180 #define IPA_IMS_HEIGHT BITS(0,15) /*!< height of the image to be processed */ 181 #define IPA_IMS_WIDTH BITS(16,29) /*!< width of the image to be processed */ 182 183 /* IPA_LM */ 184 #define IPA_LM_LM BITS(0,15) /*!< line mark */ 185 186 /* IPA_ITCTL */ 187 #define IPA_ITCTL_ITEN BIT(0) /*!< inter-timer enable */ 188 #define IPA_ITCTL_NCCI BITS(8,15) /*!< number of clock cycles interval */ 189 190 191 /* constants definitions */ 192 /* IPA foreground parameter struct definitions */ 193 typedef struct { 194 uint32_t foreground_memaddr; /*!< foreground memory base address */ 195 uint32_t foreground_lineoff; /*!< foreground line offset */ 196 uint32_t foreground_prealpha; /*!< foreground pre-defined alpha value */ 197 uint32_t foreground_alpha_algorithm; /*!< foreground alpha value calculation algorithm */ 198 uint32_t foreground_pf; /*!< foreground pixel format */ 199 uint32_t foreground_prered; /*!< foreground pre-defined red value */ 200 uint32_t foreground_pregreen; /*!< foreground pre-defined green value */ 201 uint32_t foreground_preblue; /*!< foreground pre-defined blue value */ 202 } ipa_foreground_parameter_struct; 203 204 /* IPA background parameter struct definitions */ 205 typedef struct { 206 uint32_t background_memaddr; /*!< background memory base address */ 207 uint32_t background_lineoff; /*!< background line offset */ 208 uint32_t background_prealpha; /*!< background pre-defined alpha value */ 209 uint32_t background_alpha_algorithm; /*!< background alpha value calculation algorithm */ 210 uint32_t background_pf; /*!< background pixel format */ 211 uint32_t background_prered; /*!< background pre-defined red value */ 212 uint32_t background_pregreen; /*!< background pre-defined green value */ 213 uint32_t background_preblue; /*!< background pre-defined blue value */ 214 } ipa_background_parameter_struct; 215 216 /* IPA destination parameter struct definitions */ 217 typedef struct { 218 uint32_t destination_memaddr; /*!< destination memory base address */ 219 uint32_t destination_lineoff; /*!< destination line offset */ 220 uint32_t destination_prealpha; /*!< destination pre-defined alpha value */ 221 uint32_t destination_pf; /*!< destination pixel format */ 222 uint32_t destination_prered; /*!< destination pre-defined red value */ 223 uint32_t destination_pregreen; /*!< destination pre-defined green value */ 224 uint32_t destination_preblue; /*!< destination pre-defined blue value */ 225 uint32_t image_width; /*!< width of the image to be processed */ 226 uint32_t image_height; /*!< height of the image to be processed */ 227 } ipa_destination_parameter_struct; 228 229 /* destination pixel format */ 230 typedef enum { 231 IPA_DPF_ARGB8888, /*!< destination pixel format ARGB8888 */ 232 IPA_DPF_RGB888, /*!< destination pixel format RGB888 */ 233 IPA_DPF_RGB565, /*!< destination pixel format RGB565 */ 234 IPA_DPF_ARGB1555, /*!< destination pixel format ARGB1555 */ 235 IPA_DPF_ARGB4444 /*!< destination pixel format ARGB4444 */ 236 } ipa_dpf_enum; 237 238 /* LUT pixel format */ 239 #define IPA_LUT_PF_ARGB8888 ((uint8_t)0x00U) /*!< LUT pixel format ARGB8888 */ 240 #define IPA_LUT_PF_RGB888 ((uint8_t)0x01U) /*!< LUT pixel format RGB888 */ 241 242 /* Inter-timer */ 243 #define IPA_INTER_TIMER_DISABLE ((uint8_t)0x00U) /*!< inter-timer disable */ 244 #define IPA_INTER_TIMER_ENABLE ((uint8_t)0x01U) /*!< inter-timer enable */ 245 246 /* IPA pixel format convert mode */ 247 #define CTL_PFCM(regval) (BITS(16,17) & ((uint32_t)(regval) << 16)) 248 #define IPA_FGTODE CTL_PFCM(0) /*!< foreground memory to destination memory without pixel format convert */ 249 #define IPA_FGTODE_PF_CONVERT CTL_PFCM(1) /*!< foreground memory to destination memory with pixel format convert */ 250 #define IPA_FGBGTODE CTL_PFCM(2) /*!< blending foreground and background memory to destination memory */ 251 #define IPA_FILL_UP_DE CTL_PFCM(3) /*!< fill up destination memory with specific color */ 252 253 /* foreground alpha value calculation algorithm */ 254 #define FPCTL_FAVCA(regval) (BITS(16,17) & ((uint32_t)(regval) << 16)) 255 #define IPA_FG_ALPHA_MODE_0 FPCTL_FAVCA(0) /*!< no effect */ 256 #define IPA_FG_ALPHA_MODE_1 FPCTL_FAVCA(1) /*!< FPDAV[7:0] is selected as the foreground alpha value */ 257 #define IPA_FG_ALPHA_MODE_2 FPCTL_FAVCA(2) /*!< FPDAV[7:0] multiplied by read alpha value */ 258 259 /* background alpha value calculation algorithm */ 260 #define BPCTL_BAVCA(regval) (BITS(16,17) & ((uint32_t)(regval) << 16)) 261 #define IPA_BG_ALPHA_MODE_0 BPCTL_BAVCA(0) /*!< no effect */ 262 #define IPA_BG_ALPHA_MODE_1 BPCTL_BAVCA(1) /*!< BPDAV[7:0] is selected as the background alpha value */ 263 #define IPA_BG_ALPHA_MODE_2 BPCTL_BAVCA(2) /*!< BPDAV[7:0] multiplied by read alpha value */ 264 265 /* foreground pixel format */ 266 #define FPCTL_PPF(regval) (BITS(0,3) & ((uint32_t)(regval))) 267 #define FOREGROUND_PPF_ARGB8888 FPCTL_PPF(0) /*!< foreground pixel format ARGB8888 */ 268 #define FOREGROUND_PPF_RGB888 FPCTL_PPF(1) /*!< foreground pixel format RGB888 */ 269 #define FOREGROUND_PPF_RGB565 FPCTL_PPF(2) /*!< foreground pixel format RGB565 */ 270 #define FOREGROUND_PPF_ARG1555 FPCTL_PPF(3) /*!< foreground pixel format ARGB1555 */ 271 #define FOREGROUND_PPF_ARGB4444 FPCTL_PPF(4) /*!< foreground pixel format ARGB4444 */ 272 #define FOREGROUND_PPF_L8 FPCTL_PPF(5) /*!< foreground pixel format L8 */ 273 #define FOREGROUND_PPF_AL44 FPCTL_PPF(6) /*!< foreground pixel format AL44 */ 274 #define FOREGROUND_PPF_AL88 FPCTL_PPF(7) /*!< foreground pixel format AL88 */ 275 #define FOREGROUND_PPF_L4 FPCTL_PPF(8) /*!< foreground pixel format L4 */ 276 #define FOREGROUND_PPF_A8 FPCTL_PPF(9) /*!< foreground pixel format A8 */ 277 #define FOREGROUND_PPF_A4 FPCTL_PPF(10) /*!< foreground pixel format A4 */ 278 279 /* background pixel format */ 280 #define BPCTL_PPF(regval) (BITS(0,3) & ((uint32_t)(regval))) 281 #define BACKGROUND_PPF_ARGB8888 BPCTL_PPF(0) /*!< background pixel format ARGB8888 */ 282 #define BACKGROUND_PPF_RGB888 BPCTL_PPF(1) /*!< background pixel format RGB888 */ 283 #define BACKGROUND_PPF_RGB565 BPCTL_PPF(2) /*!< background pixel format RGB565 */ 284 #define BACKGROUND_PPF_ARG1555 BPCTL_PPF(3) /*!< background pixel format ARGB1555 */ 285 #define BACKGROUND_PPF_ARGB4444 BPCTL_PPF(4) /*!< background pixel format ARGB4444 */ 286 #define BACKGROUND_PPF_L8 BPCTL_PPF(5) /*!< background pixel format L8 */ 287 #define BACKGROUND_PPF_AL44 BPCTL_PPF(6) /*!< background pixel format AL44 */ 288 #define BACKGROUND_PPF_AL88 BPCTL_PPF(7) /*!< background pixel format AL88 */ 289 #define BACKGROUND_PPF_L4 BPCTL_PPF(8) /*!< background pixel format L4 */ 290 #define BACKGROUND_PPF_A8 BPCTL_PPF(9) /*!< background pixel format A8 */ 291 #define BACKGROUND_PPF_A4 BPCTL_PPF(10) /*!< background pixel format A4 */ 292 293 /* IPA flags */ 294 #define IPA_FLAG_TAE IPA_INTF_TAEIF /*!< transfer access error interrupt flag */ 295 #define IPA_FLAG_FTF IPA_INTF_FTFIF /*!< full transfer finish interrupt flag */ 296 #define IPA_FLAG_TLM IPA_INTF_TLMIF /*!< transfer line mark interrupt flag */ 297 #define IPA_FLAG_LAC IPA_INTF_LACIF /*!< LUT access conflict interrupt flag */ 298 #define IPA_FLAG_LLF IPA_INTF_LLFIF /*!< LUT loading finish interrupt flag */ 299 #define IPA_FLAG_WCF IPA_INTF_WCFIF /*!< wrong configuration interrupt flag */ 300 301 /* IPA interrupt enable or disable */ 302 #define IPA_INT_TAE IPA_CTL_TAEIE /*!< transfer access error interrupt */ 303 #define IPA_INT_FTF IPA_CTL_FTFIE /*!< full transfer finish interrupt */ 304 #define IPA_INT_TLM IPA_CTL_TLMIE /*!< transfer line mark interrupt */ 305 #define IPA_INT_LAC IPA_CTL_LACIE /*!< LUT access conflict interrupt */ 306 #define IPA_INT_LLF IPA_CTL_LLFIE /*!< LUT loading finish interrupt */ 307 #define IPA_INT_WCF IPA_CTL_WCFIE /*!< wrong configuration interrupt */ 308 309 /* IPA interrupt flags */ 310 #define IPA_INT_FLAG_TAE IPA_INTF_TAEIF /*!< transfer access error interrupt flag */ 311 #define IPA_INT_FLAG_FTF IPA_INTF_FTFIF /*!< full transfer finish interrupt flag */ 312 #define IPA_INT_FLAG_TLM IPA_INTF_TLMIF /*!< transfer line mark interrupt flag */ 313 #define IPA_INT_FLAG_LAC IPA_INTF_LACIF /*!< LUT access conflict interrupt flag */ 314 #define IPA_INT_FLAG_LLF IPA_INTF_LLFIF /*!< LUT loading finish interrupt flag */ 315 #define IPA_INT_FLAG_WCF IPA_INTF_WCFIF /*!< wrong configuration interrupt flag */ 316 317 /* function declarations */ 318 /* functions enable or disable, pixel format convert mode set */ 319 /* deinitialize IPA */ 320 void ipa_deinit(void); 321 /* enable IPA transfer */ 322 void ipa_transfer_enable(void); 323 /* enable IPA transfer hang up */ 324 void ipa_transfer_hangup_enable(void); 325 /* disable IPA transfer hang up */ 326 void ipa_transfer_hangup_disable(void); 327 /* enable IPA transfer stop */ 328 void ipa_transfer_stop_enable(void); 329 /* disable IPA transfer stop */ 330 void ipa_transfer_stop_disable(void); 331 /* enable IPA foreground LUT loading */ 332 void ipa_foreground_lut_loading_enable(void); 333 /* enable IPA background LUT loading */ 334 void ipa_background_lut_loading_enable(void); 335 /* set pixel format convert mode, the function is invalid when the IPA transfer is enabled */ 336 void ipa_pixel_format_convert_mode_set(uint32_t pfcm); 337 338 /* structure initialization, foreground, background, destination and LUT initialization */ 339 /* initialize the structure of IPA foreground parameter struct with the default values, it is 340 suggested that call this function after an ipa_foreground_parameter_struct structure is defined */ 341 void ipa_foreground_struct_para_init(ipa_foreground_parameter_struct *foreground_struct); 342 /* initialize foreground parameters */ 343 void ipa_foreground_init(ipa_foreground_parameter_struct *foreground_struct); 344 /* initialize the structure of IPA background parameter struct with the default values, it is 345 suggested that call this function after an ipa_background_parameter_struct structure is defined */ 346 void ipa_background_struct_para_init(ipa_background_parameter_struct *background_struct); 347 /* initialize background parameters */ 348 void ipa_background_init(ipa_background_parameter_struct *background_struct); 349 /* initialize the structure of IPA destination parameter struct with the default values, it is 350 suggested that call this function after an ipa_destination_parameter_struct structure is defined */ 351 void ipa_destination_struct_para_init(ipa_destination_parameter_struct *destination_struct); 352 /* initialize destination parameters */ 353 void ipa_destination_init(ipa_destination_parameter_struct *destination_struct); 354 /* initialize IPA foreground LUT parameters */ 355 void ipa_foreground_lut_init(uint8_t fg_lut_num, uint8_t fg_lut_pf, uint32_t fg_lut_addr); 356 /* initialize IPA background LUT parameters */ 357 void ipa_background_lut_init(uint8_t bg_lut_num, uint8_t bg_lut_pf, uint32_t bg_lut_addr); 358 359 /* configuration functions */ 360 /* configure IPA line mark */ 361 void ipa_line_mark_config(uint16_t line_num); 362 /* inter-timer enable or disable */ 363 void ipa_inter_timer_config(uint8_t timer_cfg); 364 /* configure the number of clock cycles interval */ 365 void ipa_interval_clock_num_config(uint8_t clk_num); 366 367 /* flag and interrupt functions */ 368 /* get IPA flag status in IPA_INTF register */ 369 FlagStatus ipa_flag_get(uint32_t flag); 370 /* clear IPA flag in IPA_INTF register */ 371 void ipa_flag_clear(uint32_t flag); 372 /* enable IPA interrupt */ 373 void ipa_interrupt_enable(uint32_t int_flag); 374 /* disable IPA interrupt */ 375 void ipa_interrupt_disable(uint32_t int_flag); 376 /* get IPA interrupt flag */ 377 FlagStatus ipa_interrupt_flag_get(uint32_t int_flag); 378 /* clear IPA interrupt flag */ 379 void ipa_interrupt_flag_clear(uint32_t int_flag); 380 381 #endif /* GD32F4XX_IPA_H */ 382