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

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

Fork of R_BSP by Daiki Kato

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers scux_int.c Source File

scux_int.c

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * DISCLAIMER
00003 * This software is supplied by Renesas Electronics Corporation and is only
00004 * intended for use with Renesas products. No other uses are authorized. This
00005 * software is owned by Renesas Electronics Corporation and is protected under
00006 * all applicable laws, including copyright laws.
00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
00016 * Renesas reserves the right, without notice, to make changes to this software
00017 * and to discontinue the availability of this software. By using this software,
00018 * you agree to the additional terms and conditions found by accessing the
00019 * following link:
00020 * http://www.renesas.com/disclaimer
00021 * Copyright (C) 2013-2014 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 
00024 /**************************************************************************//**
00025 * @file         scux_int.c
00026 * $Rev: 993 $
00027 * $Date:: 2014-07-22 09:54:45 +0900#$
00028 * @brief        SCUX Driver interrupt functions
00029 ******************************************************************************/
00030 
00031 /*******************************************************************************
00032 Includes <System Includes>, "Project Includes"
00033 *******************************************************************************/
00034 #include "scux.h"
00035 
00036 /******************************************************************************
00037 Typedef definitions
00038 ******************************************************************************/
00039 
00040 /******************************************************************************
00041 Macro definitions
00042 ******************************************************************************/
00043 
00044 /******************************************************************************
00045 Imported global variables and functions (from other files)
00046 ******************************************************************************/
00047 
00048 /******************************************************************************
00049 Exported global variables and functions (to be accessed by other files)
00050 ******************************************************************************/
00051 
00052 /******************************************************************************
00053 Private global variables and functions
00054 ******************************************************************************/
00055 
00056 static void R_SCUX_Fdi0InterruptHandler(void);
00057 static void R_SCUX_Fdi1InterruptHandler(void);
00058 static void R_SCUX_Fdi2InterruptHandler(void);
00059 static void R_SCUX_Fdi3InterruptHandler(void);
00060 static void R_SCUX_FdiHandlerProcess(const scux_ch_num_t channel);
00061 
00062 static void R_SCUX_Fui0InterruptHandler(void);
00063 static void R_SCUX_Fui1InterruptHandler(void);
00064 static void R_SCUX_Fui2InterruptHandler(void);
00065 static void R_SCUX_Fui3InterruptHandler(void);
00066 static void R_SCUX_FuiHandlerProcess(const scux_ch_num_t channel);
00067 
00068 static void R_SCUX_Dvi0InterruptHandler(void);
00069 static void R_SCUX_Dvi1InterruptHandler(void);
00070 static void R_SCUX_Dvi2InterruptHandler(void);
00071 static void R_SCUX_Dvi3InterruptHandler(void);
00072 static void R_SCUX_DviHandlerProcess(const scux_ch_num_t channel);
00073 
00074 static void R_SCUX_Ai0InterruptHandler(void);
00075 static void R_SCUX_Ai1InterruptHandler(void);
00076 static void R_SCUX_AiHandlerProcess(const uint32_t src_channel);
00077 
00078 static void R_SCUX_ErrHandlerProcess(scux_info_ch_t * const p_scux_info_ch, const int_t ercd);
00079 
00080 /**************************************************************************//**
00081 * Function Name: SCUX_InterruptInit
00082 * @brief         Initialize SCUX interrupts.
00083 *
00084 *                Description:<br>
00085 *                
00086 * @param[in] channel : SCUX channel number.
00087 * @retval        None.
00088 ******************************************************************************/
00089 
00090 void SCUX_InterruptInit(const int_t channel)
00091 {
00092     uint32_t int_type;
00093     uint32_t ercd;
00094     scux_info_ch_t * const p_scux_info_ch = SCUX_GetDrvChInfo(channel);
00095     
00096     /* interrupt information table define */
00097     static const scux_info_int_t scux_int_info[SCUX_CH_NUM][SCUX_INT_MAX] = 
00098     {
00099         {                                                                 /* ch0 */
00100             {&R_SCUX_Fdi0InterruptHandler, SCUFDI0_IRQn, SCUX_INT_LEVEL}, /* FDI */
00101             {&R_SCUX_Fui0InterruptHandler, SCUFUI0_IRQn, SCUX_INT_LEVEL}, /* FUI */
00102             {&R_SCUX_Dvi0InterruptHandler, SCUDVI0_IRQn, SCUX_INT_LEVEL}, /* DVI */
00103             {&R_SCUX_Ai0InterruptHandler,  SCUAI0_IRQn,  SCUX_INT_LEVEL}  /* AI */
00104         },
00105         {                                                                 /* ch1 */
00106             {&R_SCUX_Fdi1InterruptHandler, SCUFDI1_IRQn, SCUX_INT_LEVEL}, /* FDI */
00107             {&R_SCUX_Fui1InterruptHandler, SCUFUI1_IRQn, SCUX_INT_LEVEL}, /* FUI */
00108             {&R_SCUX_Dvi1InterruptHandler, SCUDVI1_IRQn, SCUX_INT_LEVEL}, /* DVI */
00109             {&R_SCUX_Ai0InterruptHandler,  SCUAI0_IRQn,  SCUX_INT_LEVEL}  /* AI */
00110         },
00111         {                                                                 /* ch2 */
00112             {&R_SCUX_Fdi2InterruptHandler, SCUFDI2_IRQn, SCUX_INT_LEVEL}, /* FDI */
00113             {&R_SCUX_Fui2InterruptHandler, SCUFUI2_IRQn, SCUX_INT_LEVEL}, /* FUI */
00114             {&R_SCUX_Dvi2InterruptHandler, SCUDVI2_IRQn, SCUX_INT_LEVEL}, /* DVI */
00115             {&R_SCUX_Ai1InterruptHandler,  SCUAI1_IRQn,  SCUX_INT_LEVEL}  /* AI */
00116         },
00117         {                                                                 /* ch3 */
00118             {&R_SCUX_Fdi3InterruptHandler, SCUFDI3_IRQn, SCUX_INT_LEVEL}, /* FDI */
00119             {&R_SCUX_Fui3InterruptHandler, SCUFUI3_IRQn, SCUX_INT_LEVEL}, /* FUI */
00120             {&R_SCUX_Dvi3InterruptHandler, SCUDVI3_IRQn, SCUX_INT_LEVEL}, /* DVI */
00121             {&R_SCUX_Ai1InterruptHandler,  SCUAI1_IRQn,  SCUX_INT_LEVEL}  /* AI */
00122         }
00123     };
00124     
00125     if (NULL == p_scux_info_ch)
00126     {
00127         /* NON_NOTICE_ASSERT: NULL pointer */
00128     }
00129     else
00130     {
00131         for (int_type = SCUX_INT_FDI; int_type < SCUX_INT_MAX; int_type++)
00132         {
00133             ercd = InterruptHandlerRegister(scux_int_info[channel][int_type].int_num,
00134                                      scux_int_info[channel][int_type].int_handler
00135                                      );
00136                                      
00137             if (0U != ercd)
00138             {
00139                 /* NON_NOTICE_ASSERT: interrupt handler regist error */
00140             }
00141                                      
00142             /* set interrupt level (1-N model) */
00143             GIC_SetLevelModel(scux_int_info[channel][int_type].int_num, 
00144                               (int8_t)scux_int_info[channel][int_type].info_level, 
00145                               1
00146                               );
00147             
00148             /* set interrupt priority */
00149             GIC_SetPriority(scux_int_info[channel][int_type].int_num, p_scux_info_ch->int_level);
00150             
00151             /* get interrupt number */
00152             p_scux_info_ch->int_num[int_type] = scux_int_info[channel][int_type].int_num;
00153         }
00154     }
00155 
00156     return;
00157 }
00158 
00159 /******************************************************************************
00160 End of function SCUX_InterrptInit
00161 ******************************************************************************/
00162 
00163 /**************************************************************************//**
00164 * Function Name: SCUX_InterruptUntinit
00165 * @brief         Uninitialize SCUX interrupts.
00166 *
00167 *                Description:<br>
00168 *                
00169 * @param[in/out] channel : SCUX channel number.
00170 * @retval        None.
00171 ******************************************************************************/
00172 
00173 void SCUX_InterruptUninit(const int_t channel)
00174 {
00175     uint32_t int_type;
00176     uint32_t ercd;
00177     scux_info_ch_t * const p_scux_info_ch = SCUX_GetDrvChInfo(channel);
00178     
00179     if (NULL == p_scux_info_ch)
00180     {
00181         /* NON_NOTICE_ASSERT: NULL pointer */
00182     }
00183     else
00184     {
00185         for (int_type = SCUX_INT_FDI; int_type < SCUX_INT_MAX; int_type++)
00186         {
00187             GIC_DisableIRQ(p_scux_info_ch->int_num[int_type]);
00188             ercd = InterruptHandlerUnregister(p_scux_info_ch->int_num[int_type]);
00189             
00190             if (0U != ercd)
00191             {
00192                 /* NON_NOTICE_ASSERT: interrupt handler unregist error */
00193             }
00194         }
00195     }
00196 
00197     return;
00198 }
00199 
00200 /******************************************************************************
00201 End of function SCUX_InterruptUnInit
00202 ******************************************************************************/
00203 
00204 /**************************************************************************//**
00205 * Function Name: R_SCUX_Fdi0InterruptHandler
00206 * @brief         FDI interrupt handler on channel 0.
00207 *
00208 *                Description:<br>
00209 *                
00210 * @param         None.
00211 * @retval        None.
00212 ******************************************************************************/
00213 
00214 static void R_SCUX_Fdi0InterruptHandler(void)
00215 {
00216     
00217     R_SCUX_FdiHandlerProcess(SCUX_CH_0);
00218     
00219 }
00220 
00221 /******************************************************************************
00222 End of function R_SCUX_Fdi0InterruptHandler
00223 ******************************************************************************/
00224 
00225 /**************************************************************************//**
00226 * Function Name: R_SCUX_Fdi1InterruptHandler
00227 * @brief         FDI interrupt handler on channel 1.
00228 *
00229 *                Description:<br>
00230 *                
00231 * @param         None.
00232 * @retval        None.
00233 ******************************************************************************/
00234 
00235 static void R_SCUX_Fdi1InterruptHandler(void)
00236 {
00237     
00238     R_SCUX_FdiHandlerProcess(SCUX_CH_1);
00239     
00240 }
00241 
00242 /******************************************************************************
00243 End of function R_SCUX_Fdi1InterruptHandler
00244 ******************************************************************************/
00245 
00246 /**************************************************************************//**
00247 * Function Name: R_SCUX_Fdi2InterruptHandler
00248 * @brief         FDI interrupt handler on channel 2.
00249 *
00250 *                Description:<br>
00251 *                
00252 * @param         None.
00253 * @retval        None.
00254 ******************************************************************************/
00255 
00256 static void R_SCUX_Fdi2InterruptHandler(void)
00257 {
00258     
00259     R_SCUX_FdiHandlerProcess(SCUX_CH_2);
00260     
00261 }
00262 
00263 /******************************************************************************
00264 End of function R_SCUX_Fdi2InterruptHandler
00265 ******************************************************************************/
00266 
00267 /**************************************************************************//**
00268 * Function Name: R_SCUX_Fdi3InterruptHandler
00269 * @brief         FDI interrupt handler on channel 3.
00270 *
00271 *                Description:<br>
00272 *                
00273 * @param         None.
00274 * @retval        None.
00275 ******************************************************************************/
00276 
00277 static void R_SCUX_Fdi3InterruptHandler(void)
00278 {
00279     
00280     R_SCUX_FdiHandlerProcess(SCUX_CH_3);
00281     
00282 }
00283 
00284 /******************************************************************************
00285 End of function R_SCUX_Fdi3InterruptHandler
00286 ******************************************************************************/
00287 
00288 /**************************************************************************//**
00289 * Function Name: R_SCUX_FdiHandlerProcess
00290 * @brief         Processing FDI interrupt handler.
00291 *
00292 *                Description:<br>
00293 *                
00294 * @param[in] channel:SCUX channel number.
00295 * @retval        None.
00296 ******************************************************************************/
00297 
00298 static void R_SCUX_FdiHandlerProcess(const scux_ch_num_t channel)
00299 {   
00300     scux_info_ch_t * const p_info_ch = SCUX_GetDrvChInfo((int_t)channel);
00301     int_t ercd;
00302 
00303     if (NULL == p_info_ch)
00304     {
00305         /* NON_NOTICE_ASSERT: NULL pointer */
00306     }
00307     else
00308     {
00309         /* check error type */
00310         if ((p_info_ch->p_scux_reg->p_ffd_reg->DEVCR_FFD0_0 & DEVCR_FFD0_DEVCOL_MASK) != 0)
00311         {
00312             /* critical error (over lap) */
00313             ercd = EIO;
00314         }
00315         else
00316         {
00317             /* be returned error (FFD under flow, over flow) */
00318             ercd = EOVERFLOW;
00319         }
00320         
00321         p_info_ch->p_scux_reg->p_ffd_reg->DEVCR_FFD0_0 &= ~(DEVCR_FFD0_DEVCUF_SET | 
00322                                                             DEVCR_FFD0_DEVCOF_SET | 
00323                                                             DEVCR_FFD0_DEVCOL_SET | 
00324                                                             DEVCR_FFD0_DEVCIUF_SET);
00325                                                             
00326         R_SCUX_ErrHandlerProcess(p_info_ch, ercd);
00327     }
00328 
00329 }
00330 
00331 /******************************************************************************
00332 End of function R_SCUX_FdiHandlerProcess
00333 ******************************************************************************/
00334 
00335 /**************************************************************************//**
00336 * Function Name: R_SCUX_Fui0InterruptHandler
00337 * @brief         FUI interrupt handler on channel 0.
00338 *
00339 *                Description:<br>
00340 *                
00341 * @param         None.
00342 * @retval        None.
00343 ******************************************************************************/
00344 
00345 static void R_SCUX_Fui0InterruptHandler(void)
00346 {
00347     
00348     R_SCUX_FuiHandlerProcess(SCUX_CH_0);
00349     
00350 }
00351 
00352 /******************************************************************************
00353 End of function R_SCUX_Fui0InterruptHandler
00354 ******************************************************************************/
00355 
00356 /**************************************************************************//**
00357 * Function Name: R_SCUX_Fui1InterruptHandler
00358 * @brief         FUI interrupt handler on channel 1.
00359 *
00360 *                Description:<br>
00361 *                
00362 * @param         None.
00363 * @retval        None.
00364 ******************************************************************************/
00365 
00366 static void R_SCUX_Fui1InterruptHandler(void)
00367 {
00368     
00369     R_SCUX_FuiHandlerProcess(SCUX_CH_1);
00370     
00371 }
00372 
00373 /******************************************************************************
00374 End of function R_SCUX_Fui1InterruptHandler
00375 ******************************************************************************/
00376 
00377 /**************************************************************************//**
00378 * Function Name: R_SCUX_Fui2InterruptHandler
00379 * @brief         FUI interrupt handler on channel 2.
00380 *
00381 *                Description:<br>
00382 *                
00383 * @param         None.
00384 * @retval        None.
00385 ******************************************************************************/
00386 
00387 static void R_SCUX_Fui2InterruptHandler(void)
00388 {
00389     
00390     R_SCUX_FuiHandlerProcess(SCUX_CH_2);
00391     
00392 }
00393 
00394 /******************************************************************************
00395 End of function R_SCUX_Fui2InterruptHandler
00396 ******************************************************************************/
00397 
00398 /**************************************************************************//**
00399 * Function Name: R_SCUX_Fui3InterruptHandler
00400 * @brief         FUI interrupt handler on channel 3.
00401 *
00402 *                Description:<br>
00403 *                
00404 * @param         None.
00405 * @retval        None.
00406 ******************************************************************************/
00407 
00408 static void R_SCUX_Fui3InterruptHandler(void)
00409 {
00410     
00411     R_SCUX_FuiHandlerProcess(SCUX_CH_3);
00412     
00413 }
00414 
00415 /******************************************************************************
00416 End of function R_SCUX_Fui3InterruptHandler
00417 ******************************************************************************/
00418 
00419 /**************************************************************************//**
00420 * Function Name: R_SCUX_FuiHandlerProcess
00421 * @brief         Processing FUI interrupt handler.
00422 *
00423 *                Description:<br>
00424 *                
00425 * @param[in] channel:SCUX channel number.
00426 * @retval        None.
00427 ******************************************************************************/
00428 
00429 static void R_SCUX_FuiHandlerProcess(const scux_ch_num_t channel)
00430 {
00431     scux_info_ch_t * const p_info_ch = SCUX_GetDrvChInfo((int_t)channel);
00432     int_t ercd;
00433 
00434     if (NULL == p_info_ch)
00435     {
00436         /* NON_NOTICE_ASSERT: NULL pointer */
00437     }
00438     else
00439     {
00440         /* check error type */
00441         if ((p_info_ch->p_scux_reg->p_ffu_reg->UEVCR_FFU0_0 & UEVCR_FFU0_UEVCOL_MASK) != 0)
00442         {
00443             /* critical error (over lap) */
00444             ercd = EIO;
00445         }
00446         else
00447         {
00448             /* be returned error (FFU under flow, over flow) */
00449             ercd = EOVERFLOW;
00450         }
00451         
00452         p_info_ch->p_scux_reg->p_ffu_reg->UEVCR_FFU0_0 &= ~(UEVCR_FFU0_UEVCUF_SET | 
00453                                                             UEVCR_FFU0_UEVCOF_SET | 
00454                                                             UEVCR_FFU0_UEVCOL_SET);
00455                                                                 
00456         R_SCUX_ErrHandlerProcess(p_info_ch, ercd);
00457 
00458     }
00459 
00460 }
00461 
00462 /******************************************************************************
00463 End of function R_SCUX_FuiHandlerProcess
00464 ******************************************************************************/
00465 
00466 /**************************************************************************//**
00467 * Function Name: R_SCUX_Dvi0InterruptHandler
00468 * @brief         DVI interrupt handler on channel 0.
00469 *
00470 *                Description:<br>
00471 *                
00472 * @param         None.
00473 * @retval        None.
00474 ******************************************************************************/
00475 
00476 static void R_SCUX_Dvi0InterruptHandler(void)
00477 {
00478     
00479     R_SCUX_DviHandlerProcess(SCUX_CH_0);
00480     
00481 }
00482 
00483 /******************************************************************************
00484 End of function R_SCUX_Dvi0InterruptHandler
00485 ******************************************************************************/
00486 
00487 /**************************************************************************//**
00488 * Function Name: R_SCUX_Dvi1InterruptHandler
00489 * @brief         DVI interrupt handler on channel 1.
00490 *
00491 *                Description:<br>
00492 *                
00493 * @param         None.
00494 * @retval        None.
00495 ******************************************************************************/
00496 
00497 static void R_SCUX_Dvi1InterruptHandler(void)
00498 {
00499     
00500     R_SCUX_DviHandlerProcess(SCUX_CH_1);
00501     
00502 }
00503 
00504 /******************************************************************************
00505 End of function R_SCUX_Dvi1InterruptHandler
00506 ******************************************************************************/
00507 
00508 /**************************************************************************//**
00509 * Function Name: R_SCUX_Dvi2InterruptHandler
00510 * @brief         DVI interrupt handler on channel 2.
00511 *
00512 *                Description:<br>
00513 *                
00514 * @param         None.
00515 * @retval        None.
00516 ******************************************************************************/
00517 
00518 static void R_SCUX_Dvi2InterruptHandler(void)
00519 {
00520     
00521     R_SCUX_DviHandlerProcess(SCUX_CH_2);
00522     
00523 }
00524 
00525 /******************************************************************************
00526 End of function R_SCUX_Dvi2InterruptHandler
00527 ******************************************************************************/
00528 
00529 /**************************************************************************//**
00530 * Function Name: R_SCUX_Dvi3InterruptHandler
00531 * @brief         DVI interrupt handler on channel 3.
00532 *
00533 *                Description:<br>
00534 *                
00535 * @param         None.
00536 * @retval        None.
00537 ******************************************************************************/
00538 
00539 static void R_SCUX_Dvi3InterruptHandler(void)
00540 {
00541     
00542     R_SCUX_DviHandlerProcess(SCUX_CH_3);
00543     
00544 }
00545 
00546 /******************************************************************************
00547 End of function R_SCUX_Dvi3InterruptHandler
00548 ******************************************************************************/
00549 
00550 /**************************************************************************//**
00551 * Function Name: R_SCUX_DviHandlerProcess
00552 * @brief         Processing DVI interrupt handler.
00553 *
00554 *                Description:<br>
00555 *                
00556 * @param[in] channel:SCUX channel number.
00557 * @retval        None.
00558 ******************************************************************************/
00559 
00560 static void R_SCUX_DviHandlerProcess(const scux_ch_num_t channel)
00561 {
00562     uint32_t stat_zerocross;
00563     int_t    ch_zerocross;
00564     scux_info_ch_t * const p_info_ch = SCUX_GetDrvChInfo((int_t)channel);
00565 
00566     if (NULL == p_info_ch)
00567     {
00568         /* NON_NOTICE_ASSERT: NULL pointer */
00569     }
00570     else
00571     {
00572         stat_zerocross = p_info_ch->p_scux_reg->p_dvu_reg->VEVCR_DVU0_0;
00573         
00574         for (ch_zerocross = 0; ch_zerocross <= p_info_ch->src_cfg.use_ch; ch_zerocross++)
00575         {
00576             /* check zerocross bit */
00577             if (0U != (stat_zerocross & (VEVCR_DVU0_VEVCZCM_SET << ch_zerocross)))
00578             {
00579                 p_info_ch->dvu_mute_stat |= (1U << ch_zerocross);
00580                 if (NULL != p_info_ch->dvu_cfg.dvu_zc_mute.pcallback[ch_zerocross])
00581                 {
00582                     /* callback function */
00583                     p_info_ch->dvu_cfg.dvu_zc_mute.pcallback[ch_zerocross]();
00584                 }
00585             }
00586             p_info_ch->p_scux_reg->p_dvu_reg->VEVCR_DVU0_0 &= ~stat_zerocross;
00587         }
00588     }
00589 
00590 }
00591 
00592 /******************************************************************************
00593 End of function R_SCUX_DviHandlerProcess
00594 ******************************************************************************/
00595 
00596 /**************************************************************************//**
00597 * Function Name: R_SCUX_Ai0InterruptHandler
00598 * @brief         AI interrupt handler on channel 0.
00599 *
00600 *                Description:<br>
00601 *                
00602 * @param         None.
00603 * @retval        None.
00604 ******************************************************************************/
00605 
00606 static void R_SCUX_Ai0InterruptHandler(void)
00607 {
00608     
00609     R_SCUX_AiHandlerProcess(SRC_MOD_SRC0);
00610     
00611 }
00612 
00613 /******************************************************************************
00614 End of function R_SCUX_Ai0InterruptHandler
00615 ******************************************************************************/
00616 
00617 /**************************************************************************//**
00618 * Function Name: R_SCUX_Ai1InterruptHandler
00619 * @brief         AI interrupt handler on channel 1.
00620 *
00621 *                Description:<br>
00622 *                
00623 * @param         None.
00624 * @retval        None.
00625 ******************************************************************************/
00626 
00627 static void R_SCUX_Ai1InterruptHandler(void)
00628 {
00629     
00630     R_SCUX_AiHandlerProcess(SRC_MOD_SRC1);
00631     
00632 }
00633 
00634 /******************************************************************************
00635 End of function R_SCUX_Ai1InterruptHandler
00636 ******************************************************************************/
00637 
00638 /**************************************************************************//**
00639 * Function Name: R_SCUX_AiHandlerProcess
00640 * @brief         Processing AI interrupt handler.
00641 *
00642 *                Description:<br>
00643 *                
00644 * @param[in] channel:SCUX channel number.
00645 * @retval        None.
00646 ******************************************************************************/
00647 
00648 static void R_SCUX_AiHandlerProcess(const uint32_t src_channel)
00649 {
00650     scux_info_ch_t *p_info_ch_check;
00651     scux_info_ch_t *p_info_ch;
00652 
00653     if (SRC_MOD_SRC0 == src_channel)
00654     {
00655         p_info_ch_check = SCUX_GetDrvChInfo(SCUX_CH_0);
00656         if (NULL == p_info_ch_check)
00657         {
00658             /* NON_NOTICE_ASSERT: NULL pointer */
00659         }
00660         else
00661         {
00662             if (0U != p_info_ch_check->p_scux_reg->p_src_reg->SEVCR0_2SRC0_0)
00663             {
00664                 p_info_ch = SCUX_GetDrvChInfo(SCUX_CH_0);
00665                 if (NULL == p_info_ch)
00666                 {
00667                     /* NON_NOTICE_ASSERT: NULL pointer */
00668                 }
00669                 else
00670                 {
00671                     p_info_ch->p_scux_reg->p_src_reg->SEVCR0_2SRC0_0 &= ~(SEVCR_2SRC0_EVCUF_SET | 
00672                                                                           SEVCR_2SRC0_EVCOF_SET);
00673                     /* be returned error (FFU under flow, over flow) */
00674                     R_SCUX_ErrHandlerProcess(p_info_ch, EOVERFLOW);
00675                 }
00676             }
00677             
00678             if (0U != p_info_ch_check->p_scux_reg->p_src_reg->SEVCR1_2SRC0_0)
00679             {
00680                 
00681                 p_info_ch = SCUX_GetDrvChInfo(SCUX_CH_1);
00682                 if (NULL == p_info_ch)
00683                 {
00684                     /* NON_NOTICE_ASSERT: NULL pointer */
00685                 }
00686                 else
00687                 {
00688                     p_info_ch->p_scux_reg->p_src_reg->SEVCR1_2SRC0_0 &= ~(SEVCR_2SRC0_EVCUF_SET | 
00689                                                                           SEVCR_2SRC0_EVCOF_SET);
00690                     /* be returned error (FFU under flow, over flow) */                                                      
00691                     R_SCUX_ErrHandlerProcess(p_info_ch, EOVERFLOW);
00692                 }
00693             }
00694         }
00695     }
00696     else
00697     {
00698         p_info_ch_check = SCUX_GetDrvChInfo(SCUX_CH_2);
00699         if (NULL == p_info_ch_check)
00700         {
00701             /* NON_NOTICE_ASSERT: NULL pointer */
00702         }
00703         else
00704         {
00705             if (0U != p_info_ch_check->p_scux_reg->p_src_reg->SEVCR0_2SRC0_0)
00706             {
00707                 p_info_ch = SCUX_GetDrvChInfo(SCUX_CH_2);
00708                 if (NULL == p_info_ch)
00709                 {
00710                     /* NON_NOTICE_ASSERT: NULL pointer */
00711                 }
00712                 else
00713                 {
00714                     p_info_ch->p_scux_reg->p_src_reg->SEVCR0_2SRC0_0 &= ~(SEVCR_2SRC0_EVCUF_SET | 
00715                                                                           SEVCR_2SRC0_EVCOF_SET);
00716                     /* be returned error (FFU under flow, over flow) */                                                       
00717                     R_SCUX_ErrHandlerProcess(p_info_ch, EOVERFLOW);
00718                 }
00719             }
00720             
00721             if (0U != p_info_ch_check->p_scux_reg->p_src_reg->SEVCR1_2SRC0_0)
00722             {
00723                 
00724                 p_info_ch = SCUX_GetDrvChInfo(SCUX_CH_3);
00725                 if (NULL == p_info_ch)
00726                 {
00727                     /* NON_NOTICE_ASSERT: NULL pointer */
00728                 }
00729                 else
00730                 {
00731                     p_info_ch->p_scux_reg->p_src_reg->SEVCR1_2SRC0_0 &= ~(SEVCR_2SRC0_EVCUF_SET | 
00732                                                                           SEVCR_2SRC0_EVCOF_SET);
00733                     /* be returned error (FFU under flow, over flow) */                                                       
00734                     R_SCUX_ErrHandlerProcess(p_info_ch, EOVERFLOW);
00735                 }
00736             }
00737         }
00738     }
00739 }
00740 
00741 /******************************************************************************
00742 End of function R_SCUX_AiHandlerProcess
00743 ******************************************************************************/
00744 
00745 /**************************************************************************//**
00746 * Function Name: R_SCUX_ErrHandlerProcess
00747 * @brief         Error processing on interrupt handler.
00748 *
00749 *                Description:<br>
00750 *                
00751 * @param[in] p_scux_info_ch:SCUX channel information.
00752 * @param[in] ercd:return error code.
00753 * @retval        None.
00754 ******************************************************************************/
00755 
00756 static void R_SCUX_ErrHandlerProcess(scux_info_ch_t * const p_scux_info_ch, const int_t ercd)
00757 {
00758     int_t retval;
00759     int_t dma_retval;
00760     scux_stat_ch_t old_stat;
00761     uint32_t tx_remain_size = 0;
00762     uint32_t rx_remain_size = 0;
00763 
00764     if (NULL == p_scux_info_ch)
00765     {
00766         /* NON_NOTICE_ASSERT: NULL pointer */
00767     }
00768     else
00769     {
00770         retval = R_DMA_Cancel(p_scux_info_ch->dma_tx_ch, &tx_remain_size, &dma_retval);
00771         /* DMA stop check, (when dma_retval is EBADF, DMA stopped already) */
00772         if ((ESUCCESS != retval) && (EBADF != dma_retval))
00773         {
00774             /* NON_NOTICE_ASSERT: NULL pointer */
00775         }
00776         else
00777         {
00778             p_scux_info_ch->tx_fifo_total_size += p_scux_info_ch->dma_tx_current_size;
00779             p_scux_info_ch->dma_tx_current_size = 0;
00780         }
00781         
00782         if (SCUX_ROUTE_MEM_TO_MEM == (p_scux_info_ch->route_set & SCUX_GET_ROUTE_MASK))
00783         {
00784             retval = R_DMA_Cancel(p_scux_info_ch->dma_rx_ch, &rx_remain_size, &dma_retval);
00785 
00786             /* DMA stop check, (when dma_retval is EBADF, DMA stopped already) */
00787             if ((ESUCCESS != retval) && (EBADF != dma_retval))
00788             {
00789                 /* NON_NOTICE_ASSERT: NULL pointer */
00790             }
00791             else
00792             {
00793                 p_scux_info_ch->rx_fifo_total_size += p_scux_info_ch->dma_rx_current_size;
00794                 p_scux_info_ch->dma_rx_current_size = 0;
00795             }
00796             
00797             retval = R_DMA_Free(p_scux_info_ch->dma_rx_ch, NULL);
00798             
00799             if (ESUCCESS != retval)
00800             {
00801                 /* NON_NOTICE_ASSERT: NULL pointer */
00802             }
00803         }
00804         
00805         SCUX_AdjustAccessFifo(p_scux_info_ch, tx_remain_size, rx_remain_size);
00806         /* stop HW */
00807         if (false != p_scux_info_ch->src_cfg.mode_sync)
00808         {
00809             SCUX_SyncStopHw(p_scux_info_ch);
00810         }
00811         else
00812         {
00813             SCUX_AsyncStopHw(p_scux_info_ch);
00814         }
00815 
00816         if (false == p_scux_info_ch->first_tx_flag)
00817         {
00818             /* return callback on normal operation */
00819             if (NULL != p_scux_info_ch->p_tx_aio)
00820             {
00821                 p_scux_info_ch->p_tx_aio->aio_return = ercd;
00822                 ahf_complete(&p_scux_info_ch->tx_que, p_scux_info_ch->p_tx_aio);
00823             }
00824             if (NULL != p_scux_info_ch->p_tx_next_aio)
00825             {
00826                 if (NULL == p_scux_info_ch->p_tx_aio)
00827                 {
00828                     p_scux_info_ch->p_tx_next_aio->aio_return = ercd;
00829                 }
00830                 else
00831                 {
00832                     p_scux_info_ch->p_tx_next_aio->aio_return = ECANCELED;
00833                 }
00834                 ahf_complete(&p_scux_info_ch->tx_que, p_scux_info_ch->p_tx_next_aio);
00835             }
00836             ahf_cancelall(&p_scux_info_ch->tx_que);
00837             p_scux_info_ch->p_tx_aio = NULL;
00838             p_scux_info_ch->p_tx_next_aio = NULL;
00839         }
00840         else
00841         {
00842             /* return callback on first operation */
00843             if (NULL != p_scux_info_ch->p_tx_next_aio)
00844             {
00845                 p_scux_info_ch->p_tx_next_aio->aio_return = ercd;
00846                 ahf_complete(&p_scux_info_ch->tx_que, p_scux_info_ch->p_tx_next_aio);
00847             }
00848             else
00849             {
00850                 p_scux_info_ch->p_tx_aio->aio_return = ercd;
00851                 ahf_complete(&p_scux_info_ch->tx_que, p_scux_info_ch->p_tx_aio);                
00852             }
00853             ahf_cancelall(&p_scux_info_ch->tx_que);
00854             p_scux_info_ch->p_tx_aio = NULL;
00855             p_scux_info_ch->p_tx_next_aio = NULL;
00856         }
00857         
00858         if (SCUX_ROUTE_MEM_TO_MEM == (p_scux_info_ch->route_set & SCUX_GET_ROUTE_MASK))
00859         {
00860             /* if request is nothing, aio is NULL */
00861             if (NULL != p_scux_info_ch->p_rx_aio)
00862             {
00863                 p_scux_info_ch->p_rx_aio->aio_return = ercd;
00864                 ahf_complete(&p_scux_info_ch->rx_que, p_scux_info_ch->p_rx_aio);
00865             }
00866             ahf_cancelall(&p_scux_info_ch->rx_que);
00867             p_scux_info_ch->p_rx_aio = NULL;
00868         }
00869         old_stat = p_scux_info_ch->ch_stat;
00870         p_scux_info_ch->ch_stat = SCUX_CH_STOP;
00871         if ((SCUX_CH_STOP_WAIT == old_stat) || (SCUX_CH_STOP_WAIT_IDLE == old_stat))
00872         {
00873             if (NULL != p_scux_info_ch->p_flush_callback)
00874             {
00875                 p_scux_info_ch->p_flush_callback(ercd);
00876             }
00877         }
00878         
00879         /* set error status */
00880         p_scux_info_ch->err_stat_backup = ercd;
00881     }
00882 }
00883 
00884 /******************************************************************************
00885 End of function R_SCUX_ErrHandlerProcess
00886 ******************************************************************************/
00887