/*********************************************************************************************************************** * DISCLAIMER * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. * No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all * applicable laws, including copyright laws. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED * OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY * LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT, * INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR * ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability * of this software. By using this software, you agree to the additional terms and conditions found by accessing the * following link: * http://www.renesas.com/disclaimer * * Copyright (C) 2011, 2016 Renesas Electronics Corporation. All rights reserved. ***********************************************************************************************************************/ /*********************************************************************************************************************** * File Name : r_cg_dmac.c * Version : CodeGenerator for RL78/G13 V2.03.04.01 [11 Nov 2016] * Device(s) : R5F100LG * Tool-Chain : CCRL * Description : This file implements device driver for DMAC module. * Creation Date: ***********************************************************************************************************************/ /*********************************************************************************************************************** Includes ***********************************************************************************************************************/ #include "r_cg_macrodriver.h" #include "r_cg_dmac.h" /* Start user code for include. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */ #include "r_cg_userdefine.h" /*********************************************************************************************************************** Pragma directive ***********************************************************************************************************************/ /* Start user code for pragma. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */ /*********************************************************************************************************************** Global variables and functions ***********************************************************************************************************************/ /* Start user code for global. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */ /*********************************************************************************************************************** * Function Name: R_DMAC0_Create * Description : This function initializes the DMA0 transfer. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_DMAC0_Create(void) { DRC0 = _80_DMA_OPERATION_ENABLE; NOP(); NOP(); DMAMK0 = 1U; /* disable INTDMA0 interrupt */ DMAIF0 = 0U; /* clear INTDMA0 interrupt flag */ DMC0 = _00_DMA_TRANSFER_DIR_SFR2RAM | _00_DMA_DATA_SIZE_8 | _01_DMA_TRIGGER_AD; DSA0 = _1F_DMA0_SFR_ADDRESS; DRA0 = _FEDF_DMA0_RAM_ADDRESS; DBC0 = _0001_DMA0_BYTE_COUNT; DEN0 = 0U; /* disable DMA0 operation */ } /*********************************************************************************************************************** * Function Name: R_DMAC0_Start * Description : This function enables DMA0 transfer. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_DMAC0_Start(void) { DEN0 = 1U; DST0 = 1U; } /*********************************************************************************************************************** * Function Name: R_DMAC0_Stop * Description : This function disables DMA0 transfer. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_DMAC0_Stop(void) { if (DST0 != 0U) { DST0 = 0U; } NOP(); NOP(); DEN0 = 0U; /* disable DMA0 operation */ } /* Start user code for adding. Do not edit comment generated here */ extern volatile uint8_t g_AdResult[1024]; /****************************************************************************** * Function Name: R_DMAC0_UserInit * Description : This function re-initialize DMA0. * Arguments : None * Return Value : None ******************************************************************************/ void R_DMAC0_UserInit(void) { DEN0 = 1U; /* Enable DMA0 operation */ DRA0 = (uint16_t)&g_AdResult; DBC0 = 100; DEN0 = 0U; /* Disable DMA0 operation */ } /****************************************************************************** * Function Name: R_DMAC0_Is_Running * Description : This function returns whether DMA0 is running or not. * Arguments : None * Return Value : true (DMAC0 is running) / false (DMAC0 is not running) ******************************************************************************/ int8_t R_DMAC0_Is_Running(void) { return (DST0 != 0U) ? 1U : 0U; } /* End user code. Do not edit comment generated here */