mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-07 13:45:00 -05:00
Baseline new RX projects before refining and tidying them up.
This commit is contained in:
parent
87243e4a16
commit
e5c8119b96
105 changed files with 631 additions and 126 deletions
|
|
@ -0,0 +1,131 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_cgc.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for CGC module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_cgc.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"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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_CGC_Create
|
||||
* Description : This function initializes the clock generator.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_CGC_Create(void)
|
||||
{
|
||||
uint32_t sckcr_dummy;
|
||||
uint32_t w_count;
|
||||
|
||||
/* Set main clock control registers */
|
||||
SYSTEM.MOFCR.BYTE = _00_CGC_MAINOSC_RESONATOR | _20_CGC_MAINOSC_OVER10M;
|
||||
SYSTEM.MOSCWTCR.BYTE = _06_CGC_OSC_WAIT_CYCLE_32768;
|
||||
|
||||
/* Set main clock operation */
|
||||
SYSTEM.MOSCCR.BIT.MOSTP = 0U;
|
||||
|
||||
/* Wait for main clock oscillator wait counter overflow */
|
||||
while (1U != SYSTEM.OSCOVFSR.BIT.MOOVF);
|
||||
|
||||
/* Set system clock */
|
||||
sckcr_dummy = _00000000_CGC_PCLKD_DIV_1 | _00000000_CGC_PCLKB_DIV_1 | _00000000_CGC_ICLK_DIV_1 |
|
||||
_00000000_CGC_FCLK_DIV_1;
|
||||
SYSTEM.SCKCR.LONG = sckcr_dummy;
|
||||
|
||||
while (SYSTEM.SCKCR.LONG != sckcr_dummy);
|
||||
|
||||
/* Set PLL circuit */
|
||||
SYSTEM.PLLCR.WORD = _0002_CGC_PLL_FREQ_DIV_4 | _0F00_CGC_PLL_FREQ_MUL_8;
|
||||
SYSTEM.PLLCR2.BIT.PLLEN = 0U;
|
||||
|
||||
/* Wait for PLL wait counter overflow */
|
||||
while (1U != SYSTEM.OSCOVFSR.BIT.PLOVF);
|
||||
|
||||
/* Stop sub-clock */
|
||||
SYSTEM.SOSCCR.BIT.SOSTP = 1U;
|
||||
|
||||
/* Wait for the register modification to complete */
|
||||
while (1U != SYSTEM.SOSCCR.BIT.SOSTP);
|
||||
|
||||
/* Stop sub-clock */
|
||||
RTC.RCR3.BIT.RTCEN = 0U;
|
||||
|
||||
/* Wait for the register modification to complete */
|
||||
while (0U != RTC.RCR3.BIT.RTCEN);
|
||||
|
||||
/* Wait for 5 sub-clock cycles */
|
||||
for (w_count = 0U; w_count < _007B_CGC_SUBSTPWT_WAIT; w_count++)
|
||||
{
|
||||
nop();
|
||||
}
|
||||
|
||||
/* Set sub-clock drive capacity */
|
||||
RTC.RCR3.BIT.RTCDV = 1U;
|
||||
|
||||
/* Wait for the register modification to complete */
|
||||
while (1U != RTC.RCR3.BIT.RTCDV);
|
||||
|
||||
/* Set sub-clock */
|
||||
SYSTEM.SOSCCR.BIT.SOSTP = 0U;
|
||||
|
||||
/* Wait for the register modification to complete */
|
||||
while (0U != SYSTEM.SOSCCR.BIT.SOSTP);
|
||||
|
||||
/* Wait for sub-clock to be stable */
|
||||
for (w_count = 0U; w_count < _00061A81_CGC_SUBOSCWT_WAIT; w_count++)
|
||||
{
|
||||
nop();
|
||||
}
|
||||
|
||||
/* Set clock source */
|
||||
SYSTEM.SCKCR3.WORD = _0400_CGC_CLOCKSOURCE_PLL;
|
||||
|
||||
while (SYSTEM.SCKCR3.WORD != _0400_CGC_CLOCKSOURCE_PLL);
|
||||
|
||||
/* Set LOCO */
|
||||
SYSTEM.LOCOCR.BIT.LCSTP = 1U;
|
||||
}
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_cgc.h
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for CGC module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
#ifndef CGC_H
|
||||
#define CGC_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions (Register bit)
|
||||
***********************************************************************************************************************/
|
||||
/*
|
||||
System Clock Control Register (SCKCR)
|
||||
*/
|
||||
/* Peripheral Module Clock D (PCLKD) */
|
||||
#define _00000000_CGC_PCLKD_DIV_1 (0x00000000UL) /* x1 */
|
||||
#define _00000001_CGC_PCLKD_DIV_2 (0x00000001UL) /* x1/2 */
|
||||
#define _00000002_CGC_PCLKD_DIV_4 (0x00000002UL) /* x1/4 */
|
||||
#define _00000003_CGC_PCLKD_DIV_8 (0x00000003UL) /* x1/8 */
|
||||
#define _00000004_CGC_PCLKD_DIV_16 (0x00000004UL) /* x1/16 */
|
||||
#define _00000005_CGC_PCLKD_DIV_32 (0x00000005UL) /* x1/32 */
|
||||
#define _00000006_CGC_PCLKD_DIV_64 (0x00000006UL) /* x1/64 */
|
||||
/* Peripheral Module Clock B (PCLKB) */
|
||||
#define _00000000_CGC_PCLKB_DIV_1 (0x00000000UL) /* x1 */
|
||||
#define _00000100_CGC_PCLKB_DIV_2 (0x00000100UL) /* x1/2 */
|
||||
#define _00000200_CGC_PCLKB_DIV_4 (0x00000200UL) /* x1/4 */
|
||||
#define _00000300_CGC_PCLKB_DIV_8 (0x00000300UL) /* x1/8 */
|
||||
#define _00000400_CGC_PCLKB_DIV_16 (0x00000400UL) /* x1/16 */
|
||||
#define _00000500_CGC_PCLKB_DIV_32 (0x00000500UL) /* x1/32 */
|
||||
#define _00000600_CGC_PCLKB_DIV_64 (0x00000600UL) /* x1/64 */
|
||||
/* System Clock (ICLK) */
|
||||
#define _00000000_CGC_ICLK_DIV_1 (0x00000000UL) /* x1 */
|
||||
#define _01000000_CGC_ICLK_DIV_2 (0x01000000UL) /* x1/2 */
|
||||
#define _02000000_CGC_ICLK_DIV_4 (0x02000000UL) /* x1/4 */
|
||||
#define _03000000_CGC_ICLK_DIV_8 (0x03000000UL) /* x1/8 */
|
||||
#define _04000000_CGC_ICLK_DIV_16 (0x04000000UL) /* x1/16 */
|
||||
#define _05000000_CGC_ICLK_DIV_32 (0x05000000UL) /* x1/32 */
|
||||
#define _06000000_CGC_ICLK_DIV_64 (0x06000000UL) /* x1/64 */
|
||||
/* System Clock (FCLK) */
|
||||
#define _00000000_CGC_FCLK_DIV_1 (0x00000000UL) /* x1 */
|
||||
#define _10000000_CGC_FCLK_DIV_2 (0x10000000UL) /* x1/2 */
|
||||
#define _20000000_CGC_FCLK_DIV_4 (0x20000000UL) /* x1/4 */
|
||||
#define _30000000_CGC_FCLK_DIV_8 (0x30000000UL) /* x1/8 */
|
||||
#define _40000000_CGC_FCLK_DIV_16 (0x40000000UL) /* x1/16 */
|
||||
#define _50000000_CGC_FCLK_DIV_32 (0x50000000UL) /* x1/32 */
|
||||
#define _60000000_CGC_FCLK_DIV_64 (0x60000000UL) /* x1/64 */
|
||||
|
||||
/*
|
||||
System Clock Control Register 3 (SCKCR3)
|
||||
*/
|
||||
#define _0000_CGC_CLOCKSOURCE_LOCO (0x0000U) /* LOCO */
|
||||
#define _0100_CGC_CLOCKSOURCE_HOCO (0x0100U) /* HOCO */
|
||||
#define _0200_CGC_CLOCKSOURCE_MAINCLK (0x0200U) /* Main clock oscillator */
|
||||
#define _0300_CGC_CLOCKSOURCE_SUBCLK (0x0300U) /* Sub-clock oscillator */
|
||||
#define _0400_CGC_CLOCKSOURCE_PLL (0x0400U) /* PLL circuit */
|
||||
|
||||
/*
|
||||
PLL Control Register (PLLCR)
|
||||
*/
|
||||
/* PLL Input Frequency Division Ratio Select (PLIDIV[1:0]) */
|
||||
#define _0000_CGC_PLL_FREQ_DIV_1 (0x0000U) /* x1 */
|
||||
#define _0001_CGC_PLL_FREQ_DIV_2 (0x0001U) /* x1/2 */
|
||||
#define _0002_CGC_PLL_FREQ_DIV_4 (0x0002U) /* x1/4 */
|
||||
/* Frequency Multiplication Factor Select (STC[5:0]) */
|
||||
#define _0B00_CGC_PLL_FREQ_MUL_6 (0x0B00U) /* x6 */
|
||||
#define _0F00_CGC_PLL_FREQ_MUL_8 (0x0F00U) /* x8 */
|
||||
|
||||
/*
|
||||
USB-dedicated PLL Control Register (UPLLCR)
|
||||
*/
|
||||
/* USB-dedicated PLL Input Frequency Division Ratio Select (UPLIDIV[1:0]) */
|
||||
#define _0000_CGC_PLL_UPLIDIV_1 (0x0000U) /* x1 */
|
||||
#define _0001_CGC_PLL_UPLIDIV_2 (0x0001U) /* x1/2 */
|
||||
#define _0002_CGC_PLL_UPLIDIV_4 (0x0002U) /* x1/4 */
|
||||
/* UCLK Source USB-Dedicated PLL Select (UCKUPLLSEL) */
|
||||
#define _0000_CGC_UCLK_SYSCLK (0x0000U) /* System clock is selected as UCLK */
|
||||
#define _0010_CGC_UCLK_USBPLL (0x0010U) /* USB-dedicated PLL is selected as UCLK */
|
||||
/* Frequency Multiplication Factor Select (USTC[5:0]) */
|
||||
#define _0B00_CGC_PLL_USTC_6 (0x0B00U) /* x6 */
|
||||
#define _0F00_CGC_PLL_USTC_8 (0x0F00U) /* x8 */
|
||||
|
||||
/*
|
||||
Oscillation Stop Detection Control Register (OSTDCR)
|
||||
*/
|
||||
/* Oscillation Stop Detection Interrupt Enable (OSTDIE) */
|
||||
#define _00_CGC_OSC_STOP_INT_DISABLE (0x00U) /* The oscillation stop detection interrupt is disabled */
|
||||
#define _01_CGC_OSC_STOP_INT_ENABLE (0x01U) /* The oscillation stop detection interrupt is enabled */
|
||||
/* Oscillation Stop Detection Function Enable (OSTDE) */
|
||||
#define _00_CGC_OSC_STOP_DISABLE (0x00U) /* Oscillation stop detection function is disabled */
|
||||
#define _80_CGC_OSC_STOP_ENABLE (0x80U) /* Oscillation stop detection function is enabled */
|
||||
|
||||
/*
|
||||
Main Clock Oscillator Wait Control Register (MOSCWTCR)
|
||||
*/
|
||||
/* Main Clock Oscillator Wait Time (MSTS[4:0]) */
|
||||
#define _00_CGC_OSC_WAIT_CYCLE_2 (0x00U) /* Wait time = 2 cycles */
|
||||
#define _01_CGC_OSC_WAIT_CYCLE_1024 (0x01U) /* Wait time = 1024 cycles */
|
||||
#define _02_CGC_OSC_WAIT_CYCLE_2048 (0x02U) /* Wait time = 2048 cycles */
|
||||
#define _03_CGC_OSC_WAIT_CYCLE_4096 (0x03U) /* Wait time = 4096 cycles */
|
||||
#define _04_CGC_OSC_WAIT_CYCLE_8192 (0x04U) /* Wait time = 8192 cycles */
|
||||
#define _05_CGC_OSC_WAIT_CYCLE_16384 (0x05U) /* Wait time = 16384 cycles */
|
||||
#define _06_CGC_OSC_WAIT_CYCLE_32768 (0x06U) /* Wait time = 32768 cycles */
|
||||
#define _07_CGC_OSC_WAIT_CYCLE_65536 (0x07U) /* Wait time = 65536 cycles */
|
||||
|
||||
/*
|
||||
HOCO Wait Control Register (HOCOWTCR)
|
||||
*/
|
||||
/* HOCO Wait Time (HOCOWTCR) */
|
||||
#define _05_CGC_HOCO_WAIT_CYCLE_138 (0x05U) /* Wait time = 138 cycles (34.5us) */
|
||||
#define _06_CGC_HOCO_WAIT_CYCLE_266 (0x06U) /* Wait time = 266 cycles (66.5us) */
|
||||
|
||||
/*
|
||||
Clock Output Control Register (CKOCR)
|
||||
*/
|
||||
/* Clock Output Source Select (CKOSEL[2:0]) */
|
||||
#define _0000_CGC_CLKOUT_LOCO (0x0000U) /* LOCO */
|
||||
#define _0100_CGC_CLKOUT_HOCO (0x0100U) /* HOCO */
|
||||
#define _0200_CGC_CLKOUT_MAINCLK (0x0200U) /* Main clock oscillator */
|
||||
#define _0300_CGC_CLKOUT_SUBCLK (0x0300U) /* Sub-clock oscillator */
|
||||
/* Clock Output Division Ratio Select (CKODIV[2:0]) */
|
||||
#define _0000_CGC_CLKOUT_DIV_1 (0x0000U) /* x1 */
|
||||
#define _1000_CGC_CLKOUT_DIV_2 (0x1000U) /* x1/2 */
|
||||
#define _2000_CGC_CLKOUT_DIV_4 (0x2000U) /* x1/4 */
|
||||
#define _3000_CGC_CLKOUT_DIV_8 (0x3000U) /* x1/8 */
|
||||
#define _4000_CGC_CLKOUT_DIV_16 (0x4000U) /* x1/16 */
|
||||
/* Clock Output Control (CKOSTP) */
|
||||
#define _0000_CGC_CLKOUT_ENABLE (0x0000U) /* CLKOUT pin output is operating */
|
||||
#define _8000_CGC_CLKOUT_DISABLE (0x8000U) /* CLKOUT pin output is stopped (fixed at low level) */
|
||||
|
||||
/*
|
||||
Main Clock Oscillator Forced Oscillation Control Register (MOFCR)
|
||||
*/
|
||||
/* Main Oscillator Drive Capability Switch (MODRV21) */
|
||||
#define _00_CGC_MAINOSC_UNDER10M (0x00U) /* 1 MHz to 10 MHz */
|
||||
#define _20_CGC_MAINOSC_OVER10M (0x20U) /* 10 MHz to 20 MHz */
|
||||
/* Main Clock Oscillator Switch (MOSEL) */
|
||||
#define _00_CGC_MAINOSC_RESONATOR (0x00U) /* Resonator */
|
||||
#define _40_CGC_MAINOSC_EXTERNAL (0x40U) /* External oscillator input */
|
||||
|
||||
/*
|
||||
LCD Source Clock Control Register (LCDSCLKCR)
|
||||
*/
|
||||
/* LCD Source Clock Select (LCDSCLKSEL[2:0]) */
|
||||
#define _00_CGC_LCDSCLKSEL_LOCO (0x00U) /* LOCO */
|
||||
#define _01_CGC_LCDSCLKSEL_HOCO (0x01U) /* HOCO */
|
||||
#define _02_CGC_LCDSCLKSEL_MAINCLK (0x02U) /* Main clock oscillator */
|
||||
#define _03_CGC_LCDSCLKSEL_SUBCLK (0x03U) /* Sub-clock oscillator */
|
||||
#define _04_CGC_LCDSCLKSEL_IWDT (0x04U) /* IWDT-dedicated on-chip oscillator */
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
#define _007B_CGC_SUBSTPWT_WAIT (0x007BU) /* Wait time for 5 sub clock cycles */
|
||||
#define _00061A81_CGC_SUBOSCWT_WAIT (0x00061A81U) /* Wait time for sub clock stable */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
void R_CGC_Create(void);
|
||||
|
||||
/* Start user code for function. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
#endif
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_cgc_user.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for CGC module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_cgc.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"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for global. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_dbsct.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Setting of B.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_userdefine.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma unpack
|
||||
|
||||
#pragma section C C$DSEC
|
||||
extern const struct {
|
||||
uint8_t *rom_s; /* Start address of the initialized data section in ROM */
|
||||
uint8_t *rom_e; /* End address of the initialized data section in ROM */
|
||||
uint8_t *ram_s; /* Start address of the initialized data section in RAM */
|
||||
} _DTBL[] = {
|
||||
{ __sectop("D"), __secend("D"), __sectop("R") },
|
||||
{ __sectop("D_2"), __secend("D_2"), __sectop("R_2") },
|
||||
{ __sectop("D_1"), __secend("D_1"), __sectop("R_1") }
|
||||
};
|
||||
#pragma section C C$BSEC
|
||||
extern const struct {
|
||||
uint8_t *b_s; /* Start address of non-initialized data section */
|
||||
uint8_t *b_e; /* End address of non-initialized data section */
|
||||
} _BTBL[] = {
|
||||
{ __sectop("B"), __secend("B") },
|
||||
{ __sectop("B_2"), __secend("B_2") },
|
||||
{ __sectop("B_1"), __secend("B_1") }
|
||||
};
|
||||
|
||||
#pragma section
|
||||
|
||||
/*
|
||||
** CTBL prevents excessive output of L1100 messages when linking.
|
||||
** Even if CTBL is deleted, the operation of the program does not change.
|
||||
*/
|
||||
uint8_t * const _CTBL[] = {
|
||||
__sectop("C_1"), __sectop("C_2"), __sectop("C"),
|
||||
__sectop("W_1"), __sectop("W_2"), __sectop("W"),
|
||||
__sectop("L"), __sectop("SU"),
|
||||
__sectop("C$DSEC"), __sectop("C$BSEC"),
|
||||
__sectop("C$INIT"), __sectop("C$VTBL"), __sectop("C$VECT")
|
||||
};
|
||||
|
||||
#pragma packoption
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_hardware_setup.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements system initializing function.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_cgc.h"
|
||||
#include "r_cg_port.h"
|
||||
#include "r_cg_sci.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"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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_Systeminit
|
||||
* Description : This function initializes every macro.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_Systeminit(void)
|
||||
{
|
||||
/* Enable writing to registers related to operating modes, LPC, CGC and software reset */
|
||||
SYSTEM.PRCR.WORD = 0xA50FU;
|
||||
|
||||
/* Enable writing to MPC pin function control registers */
|
||||
MPC.PWPR.BIT.B0WI = 0U;
|
||||
MPC.PWPR.BIT.PFSWE = 1U;
|
||||
|
||||
/* Initialize non-existent pins */
|
||||
PORT0.PDR.BYTE = 0x6BU;
|
||||
PORT3.PDR.BYTE = 0xD8U;
|
||||
PORT4.PDR.BYTE = 0xA0U;
|
||||
PORT5.PDR.BYTE = 0x80U;
|
||||
PORT9.PDR.BYTE = 0xF8U;
|
||||
PORTD.PDR.BYTE = 0xE0U;
|
||||
PORTF.PDR.BYTE = 0x3FU;
|
||||
PORTJ.PDR.BYTE = 0x32U;
|
||||
|
||||
/* Set peripheral settings */
|
||||
R_CGC_Create();
|
||||
R_PORT_Create();
|
||||
R_SCI1_Create();
|
||||
|
||||
/* Disable writing to MPC pin function control registers */
|
||||
MPC.PWPR.BIT.PFSWE = 0U;
|
||||
MPC.PWPR.BIT.B0WI = 1U;
|
||||
|
||||
/* Enable protection */
|
||||
SYSTEM.PRCR.WORD = 0xA500U;
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: HardwareSetup
|
||||
* Description : This function initializes hardware setting.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void HardwareSetup(void)
|
||||
{
|
||||
R_Systeminit();
|
||||
}
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_intprg.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Setting of B.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include <machine.h>
|
||||
#include "r_cg_vect.h"
|
||||
#include "r_cg_userdefine.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma section IntPRG
|
||||
|
||||
/* Undefined exceptions for supervisor instruction, undefined instruction and floating point exceptions */
|
||||
void r_undefined_exception(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* Reserved */
|
||||
void r_reserved_exception(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* NMI */
|
||||
void r_nmi_exception(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* BRK */
|
||||
void r_brk_exception(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_macrodriver.h
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements general head file.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
#ifndef MODULEID_H
|
||||
#define MODULEID_H
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "../iodefine.h"
|
||||
#include <machine.h>
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions (Register bit)
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
#ifndef __TYPEDEF__
|
||||
|
||||
/* Status list definition */
|
||||
#define MD_STATUSBASE (0x00U)
|
||||
#define MD_OK (MD_STATUSBASE + 0x00U) /* register setting OK */
|
||||
#define MD_SPT (MD_STATUSBASE + 0x01U) /* IIC stop */
|
||||
#define MD_NACK (MD_STATUSBASE + 0x02U) /* IIC no ACK */
|
||||
#define MD_BUSY1 (MD_STATUSBASE + 0x03U) /* busy 1 */
|
||||
#define MD_BUSY2 (MD_STATUSBASE + 0x04U) /* busy 2 */
|
||||
|
||||
/* Error list definition */
|
||||
#define MD_ERRORBASE (0x80U)
|
||||
#define MD_ERROR (MD_ERRORBASE + 0x00U) /* error */
|
||||
#define MD_ARGERROR (MD_ERRORBASE + 0x01U) /* error argument input error */
|
||||
#define MD_ERROR1 (MD_ERRORBASE + 0x02U) /* error 1 */
|
||||
#define MD_ERROR2 (MD_ERRORBASE + 0x03U) /* error 2 */
|
||||
#define MD_ERROR3 (MD_ERRORBASE + 0x04U) /* error 3 */
|
||||
#define MD_ERROR4 (MD_ERRORBASE + 0x05U) /* error 4 */
|
||||
#define MD_ERROR5 (MD_ERRORBASE + 0x06U) /* error 5 */
|
||||
|
||||
/* BRK handler command options */
|
||||
typedef enum {
|
||||
BRK_NO_COMMAND,
|
||||
BRK_ALL_MODULE_CLOCK_STOP,
|
||||
BRK_SLEEP,
|
||||
BRK_DEEP_SLEEP,
|
||||
BRK_STANDBY,
|
||||
BRK_LOAD_FINTV_REGISTER
|
||||
} brk_commands;
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
#ifndef __TYPEDEF__
|
||||
#ifndef _STD_USING_INT_TYPES
|
||||
#define _SYS_INT_TYPES_H
|
||||
#ifndef _STD_USING_BIT_TYPES
|
||||
#define __int8_t_defined
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed long int32_t;
|
||||
typedef unsigned long uint32_t;
|
||||
|
||||
typedef signed char int_least8_t;
|
||||
typedef signed short int_least16_t;
|
||||
typedef signed long int_least32_t;
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef unsigned long uint_least32_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned short MD_STATUS;
|
||||
#define __TYPEDEF__
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
void HardwareSetup(void);
|
||||
void R_Systeminit(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_port.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for Port module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_port.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"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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_PORT_Create
|
||||
* Description : This function initializes the Port I/O.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_PORT_Create(void)
|
||||
{
|
||||
PORT2.PDR.BYTE = _04_Pm2_MODE_OUTPUT | _08_Pm3_MODE_OUTPUT | _10_Pm4_MODE_OUTPUT | _20_Pm5_MODE_OUTPUT |
|
||||
_00_Pm7_MODE_INPUT;
|
||||
PORT3.PDR.BYTE = _00_Pm2_MODE_INPUT | _D8_PDR3_DEFAULT;
|
||||
PORTJ.PDR.BYTE = _00_Pm0_MODE_INPUT | _32_PDRJ_DEFAULT;
|
||||
}
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_port.h
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for Port module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
#ifndef PORT_H
|
||||
#define PORT_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions (Register bit)
|
||||
***********************************************************************************************************************/
|
||||
/*
|
||||
Port Direction Register (PDR)
|
||||
*/
|
||||
/* Pmn Direction Control (B7 - B0) */
|
||||
#define _00_Pm0_MODE_NOT_USED (0x00U) /* Pm0 not used */
|
||||
#define _00_Pm0_MODE_INPUT (0x00U) /* Pm0 as input */
|
||||
#define _01_Pm0_MODE_OUTPUT (0x01U) /* Pm0 as output */
|
||||
#define _00_Pm1_MODE_NOT_USED (0x00U) /* Pm1 not used */
|
||||
#define _00_Pm1_MODE_INPUT (0x00U) /* Pm1 as input */
|
||||
#define _02_Pm1_MODE_OUTPUT (0x02U) /* Pm1 as output */
|
||||
#define _00_Pm2_MODE_NOT_USED (0x00U) /* Pm2 not used */
|
||||
#define _00_Pm2_MODE_INPUT (0x00U) /* Pm2 as input */
|
||||
#define _04_Pm2_MODE_OUTPUT (0x04U) /* Pm2 as output */
|
||||
#define _00_Pm3_MODE_NOT_USED (0x00U) /* Pm3 not used */
|
||||
#define _00_Pm3_MODE_INPUT (0x00U) /* Pm3 as input */
|
||||
#define _08_Pm3_MODE_OUTPUT (0x08U) /* Pm3 as output */
|
||||
#define _00_Pm4_MODE_NOT_USED (0x00U) /* Pm4 not used */
|
||||
#define _00_Pm4_MODE_INPUT (0x00U) /* Pm4 as input */
|
||||
#define _10_Pm4_MODE_OUTPUT (0x10U) /* Pm4 as output */
|
||||
#define _00_Pm5_MODE_NOT_USED (0x00U) /* Pm5 not used */
|
||||
#define _00_Pm5_MODE_INPUT (0x00U) /* Pm5 as input */
|
||||
#define _20_Pm5_MODE_OUTPUT (0x20U) /* Pm5 as output */
|
||||
#define _00_Pm6_MODE_NOT_USED (0x00U) /* Pm6 not used */
|
||||
#define _00_Pm6_MODE_INPUT (0x00U) /* Pm6 as input */
|
||||
#define _40_Pm6_MODE_OUTPUT (0x40U) /* Pm6 as output */
|
||||
#define _00_Pm7_MODE_NOT_USED (0x00U) /* Pm7 not used */
|
||||
#define _00_Pm7_MODE_INPUT (0x00U) /* Pm7 as input */
|
||||
#define _80_Pm7_MODE_OUTPUT (0x80U) /* Pm7 as output */
|
||||
|
||||
/*
|
||||
Port Output Data Register (PODR)
|
||||
*/
|
||||
/* Pmn Output Data Store (B7 - B0) */
|
||||
#define _00_Pm0_OUTPUT_0 (0x00U) /* output low at B0 */
|
||||
#define _01_Pm0_OUTPUT_1 (0x01U) /* output high at B0 */
|
||||
#define _00_Pm1_OUTPUT_0 (0x00U) /* output low at B1 */
|
||||
#define _02_Pm1_OUTPUT_1 (0x02U) /* output high at B1 */
|
||||
#define _00_Pm2_OUTPUT_0 (0x00U) /* output low at B2 */
|
||||
#define _04_Pm2_OUTPUT_1 (0x04U) /* output high at B2 */
|
||||
#define _00_Pm3_OUTPUT_0 (0x00U) /* output low at B3 */
|
||||
#define _08_Pm3_OUTPUT_1 (0x08U) /* output high at B3 */
|
||||
#define _00_Pm4_OUTPUT_0 (0x00U) /* output low at B4 */
|
||||
#define _10_Pm4_OUTPUT_1 (0x10U) /* output high at B4 */
|
||||
#define _00_Pm5_OUTPUT_0 (0x00U) /* output low at B5 */
|
||||
#define _20_Pm5_OUTPUT_1 (0x20U) /* output high at B5 */
|
||||
#define _00_Pm6_OUTPUT_0 (0x00U) /* output low at B6 */
|
||||
#define _40_Pm6_OUTPUT_1 (0x40U) /* output high at B6 */
|
||||
#define _00_Pm7_OUTPUT_0 (0x00U) /* output low at B7 */
|
||||
#define _80_Pm7_OUTPUT_1 (0x80U) /* output high at B7 */
|
||||
|
||||
/*
|
||||
Open Drain Control Register 0 (ODR0)
|
||||
*/
|
||||
/* Pmn Output Type Select (Pm0 to Pm3) */
|
||||
#define _00_Pm0_CMOS_OUTPUT (0x00U) /* CMOS output */
|
||||
#define _01_Pm0_NCH_OPEN_DRAIN (0x01U) /* N-channel open-drain output */
|
||||
#define _02_Pm0_PCH_OPEN_DRAIN (0x02U) /* P-channel open-drain output */
|
||||
#define _00_Pm1_CMOS_OUTPUT (0x00U) /* CMOS output */
|
||||
#define _04_Pm1_NCH_OPEN_DRAIN (0x04U) /* N-channel open-drain output */
|
||||
#define _08_Pm1_PCH_OPEN_DRAIN (0x08U) /* P-channel open-drain output */
|
||||
#define _00_Pm2_CMOS_OUTPUT (0x00U) /* CMOS output */
|
||||
#define _10_Pm2_NCH_OPEN_DRAIN (0x10U) /* N-channel open-drain output */
|
||||
#define _20_Pm2_PCH_OPEN_DRAIN (0x20U) /* P-channel open-drain output */
|
||||
#define _00_Pm3_CMOS_OUTPUT (0x00U) /* CMOS output */
|
||||
#define _40_Pm3_NCH_OPEN_DRAIN (0x40U) /* N-channel open-drain output */
|
||||
#define _80_Pm3_PCH_OPEN_DRAIN (0x80U) /* P-channel open-drain output */
|
||||
|
||||
/*
|
||||
Open Drain Control Register 1 (ODR1)
|
||||
*/
|
||||
/* Pmn Output Type Select (Pm4 to Pm7) */
|
||||
#define _00_Pm4_CMOS_OUTPUT (0x00U) /* CMOS output */
|
||||
#define _01_Pm4_NCH_OPEN_DRAIN (0x01U) /* N-channel open-drain output */
|
||||
#define _02_Pm4_PCH_OPEN_DRAIN (0x02U) /* P-channel open-drain output */
|
||||
#define _00_Pm5_CMOS_OUTPUT (0x00U) /* CMOS output */
|
||||
#define _04_Pm5_NCH_OPEN_DRAIN (0x04U) /* N-channel open-drain output */
|
||||
#define _08_Pm5_PCH_OPEN_DRAIN (0x08U) /* P-channel open-drain output */
|
||||
#define _00_Pm6_CMOS_OUTPUT (0x00U) /* CMOS output */
|
||||
#define _10_Pm6_NCH_OPEN_DRAIN (0x10U) /* N-channel open-drain output */
|
||||
#define _20_Pm6_PCH_OPEN_DRAIN (0x20U) /* P-channel open-drain output */
|
||||
#define _00_Pm7_CMOS_OUTPUT (0x00U) /* CMOS output */
|
||||
#define _40_Pm7_NCH_OPEN_DRAIN (0x40U) /* N-channel open-drain output */
|
||||
#define _80_Pm7_PCH_OPEN_DRAIN (0x80U) /* P-channel open-drain output */
|
||||
|
||||
/*
|
||||
Pull-Up Control Register (PCR)
|
||||
*/
|
||||
/* Pm0 Input Pull-Up Resistor Control ((B7 - B0)) */
|
||||
#define _00_Pm0_PULLUP_OFF (0x00U) /* Pn0 pull-up resistor not connected */
|
||||
#define _01_Pm0_PULLUP_ON (0x01U) /* Pn0 pull-up resistor connected */
|
||||
#define _00_Pm1_PULLUP_OFF (0x00U) /* Pn1 pull-up resistor not connected */
|
||||
#define _02_Pm1_PULLUP_ON (0x02U) /* Pn1 pull-up resistor connected */
|
||||
#define _00_Pm2_PULLUP_OFF (0x00U) /* Pn2 Pull-up resistor not connected */
|
||||
#define _04_Pm2_PULLUP_ON (0x04U) /* Pn2 pull-up resistor connected */
|
||||
#define _00_Pm3_PULLUP_OFF (0x00U) /* Pn3 pull-up resistor not connected */
|
||||
#define _08_Pm3_PULLUP_ON (0x08U) /* Pn3 pull-up resistor connected */
|
||||
#define _00_Pm4_PULLUP_OFF (0x00U) /* Pn4 pull-up resistor not connected */
|
||||
#define _10_Pm4_PULLUP_ON (0x10U) /* Pn4 pull-up resistor connected */
|
||||
#define _00_Pm5_PULLUP_OFF (0x00U) /* Pn5 pull-up resistor not connected */
|
||||
#define _20_Pm5_PULLUP_ON (0x20U) /* Pn5 pull-up resistor connected */
|
||||
#define _00_Pm6_PULLUP_OFF (0x00U) /* Pn6 pull-up resistor not connected */
|
||||
#define _40_Pm6_PULLUP_ON (0x40U) /* Pn6 pull-up resistor connected */
|
||||
#define _00_Pm7_PULLUP_OFF (0x00U) /* Pn7 pull-up resistor not connected */
|
||||
#define _80_Pm7_PULLUP_ON (0x80U) /* Pn7 pull-up resistor connected */
|
||||
|
||||
/*
|
||||
Port Switching Register A (PSRA)
|
||||
*/
|
||||
/* PB6/PC0 Switching (PSEL6) */
|
||||
#define _00_PORT_PSEL6_PB6 (0x00U) /* PB6 general I/O port function is selected */
|
||||
#define _40_PORT_PSEL6_PC0 (0x40U) /* PC0 general I/O port function is selected */
|
||||
/* PB7/PC1 Switching (PSEL7) */
|
||||
#define _00_PORT_PSEL7_PB7 (0x00U) /* PB7 general I/O port function is selected */
|
||||
#define _80_PORT_PSEL7_PC1 (0x80U) /* PC1 general I/O port function is selected */
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
#define _6B_PDR0_DEFAULT (0x6BU) /* PDR0 default value */
|
||||
#define _D8_PDR3_DEFAULT (0xD8U) /* PDR3 default value */
|
||||
#define _A0_PDR4_DEFAULT (0xA0U) /* PDR4 default value */
|
||||
#define _80_PDR5_DEFAULT (0x80U) /* PDR5 default value */
|
||||
#define _F8_PDR9_DEFAULT (0xF8U) /* PDR9 default value */
|
||||
#define _E0_PDRD_DEFAULT (0xE0U) /* PDRD default value */
|
||||
#define _3F_PDRF_DEFAULT (0x3FU) /* PDRF default value */
|
||||
#define _32_PDRJ_DEFAULT (0x32U) /* PDRJ default value */
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
void R_PORT_Create(void);
|
||||
|
||||
/* Start user code for function. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
#endif
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_port_user.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for Port module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_port.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"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for global. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_resetprg.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Reset program.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include <machine.h>
|
||||
#include <_h_c_lib.h>
|
||||
//#include <stddef.h> // Remove the comment when you use errno
|
||||
//#include <stdlib.h> // Remove the comment when you use rand()
|
||||
#include "r_cg_stacksct.h"
|
||||
#include "r_cg_userdefine.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void PowerON_Reset(void);
|
||||
void main(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PSW_init 0x00010000 /* PSW bit pattern */
|
||||
#define FPSW_init 0x00000000 /* FPSW bit base pattern */
|
||||
|
||||
#pragma section ResetPRG /* output PowerON_Reset to PResetPRG section */
|
||||
|
||||
#pragma entry PowerON_Reset
|
||||
|
||||
void PowerON_Reset(void)
|
||||
{
|
||||
set_intb(__sectop("C$VECT"));
|
||||
|
||||
_INITSCT(); /* Initialize Sections */
|
||||
HardwareSetup(); /* Use Hardware Setup */
|
||||
nop();
|
||||
set_psw(PSW_init); /* Set Ubit & Ibit for PSW */
|
||||
main();
|
||||
brk();
|
||||
}
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_sbrk.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Program of sbrk.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include "r_cg_sbrk.h"
|
||||
#include "r_cg_userdefine.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
int8_t *sbrk(size_t size);
|
||||
|
||||
extern int8_t *_s1ptr;
|
||||
|
||||
union HEAP_TYPE
|
||||
{
|
||||
int16_t dummy ; /* Dummy for 4-byte boundary */
|
||||
int8_t heap[HEAPSIZE]; /* Declaration of the area managed by sbrk */
|
||||
};
|
||||
|
||||
static union HEAP_TYPE heap_area ;
|
||||
|
||||
/* End address allocated by sbrk */
|
||||
static int8_t *brk = (int8_t *) &heap_area;
|
||||
|
||||
/**************************************************************************/
|
||||
/* sbrk:Memory area allocation */
|
||||
/* Return value:Start address of allocated area (Pass) */
|
||||
/* -1 (Failure) */
|
||||
/**************************************************************************/
|
||||
int8_t *sbrk(size_t size) /* Assigned area size */
|
||||
{
|
||||
int8_t *p;
|
||||
|
||||
if (brk+size > heap_area.heap + HEAPSIZE) /* Empty area size */
|
||||
{
|
||||
p = (int8_t *)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = brk; /* Area assignment */
|
||||
brk += size; /* End address update */
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_sbrk.h
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Header file of sbrk file.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
#ifndef _SBRK_H
|
||||
#define _SBRK_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions (Register bit)
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
#define HEAPSIZE (0x400U) /* Size of area managed by sbrk */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_sci.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for SCI module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_sci.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"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
uint8_t * gp_sci1_tx_address; /* SCI1 transmit buffer address */
|
||||
uint16_t g_sci1_tx_count; /* SCI1 transmit data number */
|
||||
uint8_t * gp_sci1_rx_address; /* SCI1 receive buffer address */
|
||||
uint16_t g_sci1_rx_count; /* SCI1 receive data number */
|
||||
uint16_t g_sci1_rx_length; /* SCI1 receive data length */
|
||||
/* Start user code for global. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_SCI1_Create
|
||||
* Description : This function initializes the SCI1.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_SCI1_Create(void)
|
||||
{
|
||||
/* Cancel SCI1 module stop state */
|
||||
MSTP(SCI1) = 0U;
|
||||
|
||||
/* Set interrupt priority */
|
||||
IPR(SCI1, ERI1) = _0F_SCI_PRIORITY_LEVEL15;
|
||||
|
||||
/* Clear the SCR.TIE, RIE, TE, RE and TEIE bits */
|
||||
SCI1.SCR.BIT.TIE = 0U;
|
||||
SCI1.SCR.BIT.RIE = 0U;
|
||||
SCI1.SCR.BIT.TE = 0U;
|
||||
SCI1.SCR.BIT.RE = 0U;
|
||||
SCI1.SCR.BIT.TEIE = 0U;
|
||||
|
||||
/* Set RXD1 pin */
|
||||
MPC.P15PFS.BYTE = 0x0AU;
|
||||
PORT1.PMR.BYTE |= 0x20U;
|
||||
/* Set TXD1 pin */
|
||||
MPC.P16PFS.BYTE = 0x0AU;
|
||||
PORT1.PODR.BYTE |= 0x40U;
|
||||
PORT1.PDR.BYTE |= 0x40U;
|
||||
PORT1.PMR.BYTE |= 0x40U;
|
||||
|
||||
/* Set clock enable */
|
||||
SCI1.SCR.BYTE = _00_SCI_INTERNAL_SCK_UNUSED;
|
||||
|
||||
/* Clear the SIMR1.IICM, SPMR.CKPH, and CKPOL bit */
|
||||
SCI1.SIMR1.BIT.IICM = 0U;
|
||||
SCI1.SPMR.BYTE = _00_SCI_RTS | _00_SCI_CLOCK_NOT_INVERTED | _00_SCI_CLOCK_NOT_DELAYED;
|
||||
|
||||
/* Set control registers */
|
||||
SCI1.SMR.BYTE = _01_SCI_CLOCK_PCLK_4 | _00_SCI_STOP_1 | _00_SCI_PARITY_EVEN | _00_SCI_PARITY_DISABLE |
|
||||
_00_SCI_DATA_LENGTH_8 | _00_SCI_MULTI_PROCESSOR_DISABLE | _00_SCI_ASYNCHRONOUS_MODE;
|
||||
SCI1.SCMR.BYTE = _00_SCI_SERIAL_MODE | _00_SCI_DATA_INVERT_NONE | _00_SCI_DATA_LSB_FIRST | _72_SCI_SCMR_DEFAULT;
|
||||
|
||||
/* Set SEMR, SNFR */
|
||||
SCI1.SEMR.BYTE = _00_SCI_LOW_LEVEL_START_BIT | _00_SCI_NOISE_FILTER_DISABLE | _10_SCI_8_BASE_CLOCK;
|
||||
|
||||
/* Set bitrate */
|
||||
SCI1.BRR = 0x19U;
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_SCI1_Start
|
||||
* Description : This function starts the SCI1.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_SCI1_Start(void)
|
||||
{
|
||||
IR(SCI1,TXI1) = 0U;
|
||||
IR(SCI1,TEI1) = 0U;
|
||||
IR(SCI1,RXI1) = 0U;
|
||||
IR(SCI1,ERI1) = 0U;
|
||||
IEN(SCI1,TXI1) = 1U;
|
||||
IEN(SCI1,TEI1) = 1U;
|
||||
IEN(SCI1,RXI1) = 1U;
|
||||
IEN(SCI1,ERI1) = 1U;
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_SCI1_Stop
|
||||
* Description : This function stops the SCI1.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_SCI1_Stop(void)
|
||||
{
|
||||
/* Set TXD1 pin */
|
||||
PORT1.PMR.BYTE &= 0xBFU;
|
||||
|
||||
SCI1.SCR.BYTE &= 0xCF; /* Disable serial transmit and receive */
|
||||
SCI1.SCR.BIT.TIE = 0U; /* Disable TXI interrupt */
|
||||
SCI1.SCR.BIT.RIE = 0U; /* Disable RXI and ERI interrupt */
|
||||
IR(SCI1,TXI1) = 0U;
|
||||
IEN(SCI1,TXI1) = 0U;
|
||||
IR(SCI1,TEI1) = 0U;
|
||||
IEN(SCI1,TEI1) = 0U;
|
||||
IR(SCI1,RXI1) = 0U;
|
||||
IEN(SCI1,RXI1) = 0U;
|
||||
IR(SCI1,ERI1) = 0U;
|
||||
IEN(SCI1,ERI1) = 0U;
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_SCI1_Serial_Receive
|
||||
* Description : This function receives SCI1 data.
|
||||
* Arguments : rx_buf -
|
||||
* receive buffer pointer (Not used when receive data handled by DTC)
|
||||
* rx_num -
|
||||
* buffer size
|
||||
* Return Value : status -
|
||||
* MD_OK or MD_ARGERROR
|
||||
***********************************************************************************************************************/
|
||||
MD_STATUS R_SCI1_Serial_Receive(uint8_t * const rx_buf, uint16_t rx_num)
|
||||
{
|
||||
MD_STATUS status = MD_OK;
|
||||
|
||||
if (rx_num < 1U)
|
||||
{
|
||||
status = MD_ARGERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_sci1_rx_count = 0U;
|
||||
g_sci1_rx_length = rx_num;
|
||||
gp_sci1_rx_address = rx_buf;
|
||||
SCI1.SCR.BIT.RIE = 1U;
|
||||
SCI1.SCR.BIT.RE = 1U;
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_SCI1_Serial_Send
|
||||
* Description : This function transmits SCI1 data.
|
||||
* Arguments : tx_buf -
|
||||
* transfer buffer pointer (Not used when transmit data handled by DTC)
|
||||
* tx_num -
|
||||
* buffer size
|
||||
* Return Value : status -
|
||||
* MD_OK or MD_ARGERROR
|
||||
***********************************************************************************************************************/
|
||||
MD_STATUS R_SCI1_Serial_Send(uint8_t * const tx_buf, uint16_t tx_num)
|
||||
{
|
||||
MD_STATUS status = MD_OK;
|
||||
|
||||
if (tx_num < 1U)
|
||||
{
|
||||
status = MD_ARGERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_sci1_tx_address = tx_buf;
|
||||
g_sci1_tx_count = tx_num;
|
||||
/* Set TXD1 pin */
|
||||
PORT1.PMR.BYTE |= 0x40U;
|
||||
SCI1.SCR.BIT.TIE = 1U;
|
||||
SCI1.SCR.BIT.TE = 1U;
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,307 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_sci.h
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for SCI module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
#ifndef SCI_H
|
||||
#define SCI_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions (Register bit)
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/*
|
||||
Serial mode register (SMR)
|
||||
*/
|
||||
/* Clock select (CKS) */
|
||||
#define _00_SCI_CLOCK_PCLK (0x00U) /* PCLK */
|
||||
#define _01_SCI_CLOCK_PCLK_4 (0x01U) /* PCLK/4 */
|
||||
#define _02_SCI_CLOCK_PCLK_16 (0x02U) /* PCLK/16 */
|
||||
#define _03_SCI_CLOCK_PCLK_64 (0x03U) /* PCLK/64 */
|
||||
/* Multi-processor Mode (MP) */
|
||||
#define _00_SCI_MULTI_PROCESSOR_DISABLE (0x00U) /* Disable multiprocessor mode */
|
||||
#define _04_SCI_MULTI_PROCESSOR_ENABLE (0x04U) /* Enable multiprocessor mode */
|
||||
/* Stop bit length (STOP) */
|
||||
#define _00_SCI_STOP_1 (0x00U) /* 1 stop bit length */
|
||||
#define _08_SCI_STOP_2 (0x08U) /* 2 stop bits length */
|
||||
/* Parity mode (PM) */
|
||||
#define _00_SCI_PARITY_EVEN (0x00U) /* Parity even */
|
||||
#define _10_SCI_PARITY_ODD (0x10U) /* Parity odd */
|
||||
/* Parity enable (PE) */
|
||||
#define _00_SCI_PARITY_DISABLE (0x00U) /* Parity disable */
|
||||
#define _20_SCI_PARITY_ENABLE (0x20U) /* Parity enable */
|
||||
/* Character length (CHR) */
|
||||
#define _00_SCI_DATA_LENGTH_8 (0x00U) /* Data length 8 bits */
|
||||
#define _40_SCI_DATA_LENGTH_7 (0x40U) /* Data length 7 bits */
|
||||
/* Communications mode (CM) */
|
||||
#define _00_SCI_ASYNCHRONOUS_MODE (0x00U) /* Asynchronous mode */
|
||||
#define _80_SCI_CLOCK_SYNCHRONOUS_MODE (0x80U) /* Clock synchronous mode */
|
||||
/* Base clock pulse (BCP) */
|
||||
#define _00_SCI_32_93_CLOCK_CYCLES (0x00U) /* 32 or 93 clock cycles */
|
||||
#define _04_SCI_64_128_CLOCK_CYCLES (0x04U) /* 64 or 128 clock cycles */
|
||||
#define _08_SCI_186_372_CLOCK_CYCLES (0x08U) /* 186 or 372 clock cycles */
|
||||
#define _0C_SCI_256_512_CLOCK_CYCLES (0x0CU) /* 256 or 512 clock cycles */
|
||||
/* Block transfer mode (BLK) */
|
||||
#define _00_SCI_BLK_TRANSFER_DISABLE (0x00U) /* Block transfer disable */
|
||||
#define _40_SCI_BLK_TRANSFER_ENABLE (0x40U) /* Block transfer enable */
|
||||
/* GSM mode (GSM) */
|
||||
#define _00_SCI_GSM_DISABLE (0x00U) /* Normal mode operation */
|
||||
#define _80_SCI_GSM_ENABLE (0x80U) /* GSM mode operation */
|
||||
|
||||
/*
|
||||
Serial control register (SCR)
|
||||
*/
|
||||
/* Clock enable (CKE) */
|
||||
#define _00_SCI_INTERNAL_SCK_UNUSED (0x00U) /* Internal clock selected, SCK pin unused */
|
||||
#define _01_SCI_INTERNAL_SCK_OUTPUT (0x01U) /* Internal clock selected, SCK pin as clock output */
|
||||
#define _02_SCI_EXTERNAL (0x02U) /* External clock selected */
|
||||
#define _03_SCI_EXTERNAL (0x03U) /* External clock selected */
|
||||
/* Transmit end interrupt enable (TEIE) */
|
||||
#define _00_SCI_TEI_INTERRUPT_DISABLE (0x00U) /* TEI interrupt request disable */
|
||||
#define _04_SCI_TEI_INTERRUPT_ENABLE (0x04U) /* TEI interrupt request enable */
|
||||
/* Multi-processor interrupt enable (MPIE) */
|
||||
#define _00_SCI_MP_INTERRUPT_NORMAL (0x00U) /* Normal reception */
|
||||
#define _08_SCI_MP_INTERRUPT_SPECIAL (0x08U) /* Multi-processor ID reception */
|
||||
/* Receive enable (RE) */
|
||||
#define _00_SCI_RECEIVE_DISABLE (0x00U) /* Disable receive mode */
|
||||
#define _10_SCI_RECEIVE_ENABLE (0x10U) /* Enable receive mode */
|
||||
/* Transmit enable (TE) */
|
||||
#define _00_SCI_TRANSMIT_DISABLE (0x00U) /* Disable transmit mode */
|
||||
#define _20_SCI_TRANSMIT_ENABLE (0x20U) /* Enable transmit mode */
|
||||
/* Receive interrupt enable (RIE) */
|
||||
#define _00_SCI_RXI_ERI_DISABLE (0x00U) /* Disable RXI and ERI interrupt requests */
|
||||
#define _40_SCI_RXI_ERI_ENABLE (0x40U) /* Enable RXI and ERI interrupt requests */
|
||||
/* Transmit interrupt enable (TIE) */
|
||||
#define _00_SCI_TXI_DISABLE (0x00U) /* Disable TXI interrupt requests */
|
||||
#define _80_SCI_TXI_ENABLE (0x80U) /* Enable TXI interrupt requests */
|
||||
|
||||
/*
|
||||
Serial status register (SSR)
|
||||
*/
|
||||
/* Multi-Processor bit transfer (MPBT) */
|
||||
#define _00_SCI_SET_DATA_TRANSFER (0x00U) /* Set data transmission cycles */
|
||||
#define _01_SCI_SET_ID_TRANSFER (0x01U) /* Set ID transmission cycles */
|
||||
/* Multi-Processor (MPB) */
|
||||
#define _00_SCI_DATA_TRANSFER (0x00U) /* In data transmission cycles */
|
||||
#define _02_SCI_ID_TRANSFER (0x02U) /* In ID transmission cycles */
|
||||
/* Transmit end flag (TEND) */
|
||||
#define _00_SCI_TRANSMITTING (0x00U) /* A character is being transmitted */
|
||||
#define _04_SCI_TRANSMIT_COMPLETE (0x04U) /* Character transfer has been completed */
|
||||
/* Parity error flag (PER) */
|
||||
#define _08_SCI_PARITY_ERROR (0x08U) /* A parity error has occurred */
|
||||
/* Framing error flag (FER) */
|
||||
#define _10_SCI_FRAME_ERROR (0x10U) /* A framing error has occurred */
|
||||
/* Overrun error flag (ORER) */
|
||||
#define _20_SCI_OVERRUN_ERROR (0x20U) /* An overrun error has occurred */
|
||||
|
||||
/*
|
||||
Smart card mode register (SCMR)
|
||||
*/
|
||||
/* Smart card interface mode select (SMIF) */
|
||||
#define _00_SCI_SERIAL_MODE (0x00U) /* Serial communications interface mode */
|
||||
#define _01_SCI_SMART_CARD_MODE (0x01U) /* Smart card interface mode */
|
||||
/* Transmitted / received data invert (SINV) */
|
||||
#define _00_SCI_DATA_INVERT_NONE (0x00U) /* Data is not inverted */
|
||||
#define _04_SCI_DATA_INVERTED (0x04U) /* Data is inverted */
|
||||
/* Transmitted / received data transfer direction (SDIR) */
|
||||
#define _00_SCI_DATA_LSB_FIRST (0x00U) /* Transfer data LSB first */
|
||||
#define _08_SCI_DATA_MSB_FIRST (0x08U) /* Transfer data MSB first */
|
||||
/* Base clock pulse 2 (BCP2) */
|
||||
#define _00_SCI_93_128_186_512_CLK (0x00U) /* 93, 128, 186, or 512 clock cycles */
|
||||
#define _80_SCI_32_64_256_372_CLK (0x80U) /* 32, 64, 256, or 372 clock cycles */
|
||||
#define _72_SCI_SCMR_DEFAULT (0x72U) /* Write default value of SCMR */
|
||||
|
||||
/*
|
||||
Serial extended mode register (SEMR)
|
||||
*/
|
||||
/* Asynchronous Mode Clock Source Select (ACS0) */
|
||||
#define _00_SCI_ASYNC_SOURCE_EXTERNAL (0x00U) /* External clock input */
|
||||
#define _01_SCI_ASYNC_SOURCE_TMR (0x01U) /* Logical AND of two clock cycles output from TMR */
|
||||
/* Asynchronous mode base clock select (ABCS) */
|
||||
#define _00_SCI_16_BASE_CLOCK (0x00U) /* Selects 16 base clock cycles for 1 bit period */
|
||||
#define _10_SCI_8_BASE_CLOCK (0x10U) /* Selects 8 base clock cycles for 1 bit period */
|
||||
/* Digital noise filter function enable (NFEN) */
|
||||
#define _00_SCI_NOISE_FILTER_DISABLE (0x00U) /* Noise filter is disabled */
|
||||
#define _20_SCI_NOISE_FILTER_ENABLE (0x20U) /* Noise filter is enabled */
|
||||
/* Asynchronous start bit edge detections select (RXDESEL) */
|
||||
#define _00_SCI_LOW_LEVEL_START_BIT (0x00U) /* Low level on RXDn pin selected as start bit */
|
||||
#define _80_SCI_FALLING_EDGE_START_BIT (0x80U) /* Falling edge on RXDn pin selected as start bit */
|
||||
|
||||
/*
|
||||
Noise filter setting register (SNFR)
|
||||
*/
|
||||
/* Noise filter clock select (NFCS) */
|
||||
#define _00_SCI_ASYNC_DIV_1 (0x00U) /* Clock signal divided by 1 is used with the noise filter */
|
||||
#define _01_SCI_IIC_DIV_1 (0x01U) /* Clock signal divided by 1 is used with the noise filter */
|
||||
#define _02_SCI_IIC_DIV_2 (0x02U) /* Clock signal divided by 2 is used with the noise filter */
|
||||
#define _03_SCI_IIC_DIV_4 (0x03U) /* Clock signal divided by 4 is used with the noise filter */
|
||||
#define _04_SCI_IIC_DIV_8 (0x04U) /* Clock signal divided by 8 is used with the noise filter */
|
||||
|
||||
/*
|
||||
I2C mode register 1 (SIMR1)
|
||||
*/
|
||||
/* Simple IIC mode select (IICM) */
|
||||
#define _00_SCI_SERIAL_SMART_CARD_MODE (0x00U) /* Serial or smart card mode */
|
||||
#define _01_SCI_IIC_MODE (0x01U) /* Simple IIC mode */
|
||||
|
||||
/*
|
||||
I2C mode register 2 (SIMR2)
|
||||
*/
|
||||
/* IIC interrupt mode select (IICINTM) */
|
||||
#define _00_SCI_ACK_NACK_INTERRUPTS (0x00U) /* Use ACK/NACK interrupts */
|
||||
#define _01_SCI_RX_TX_INTERRUPTS (0x01U) /* Use reception/transmission interrupts */
|
||||
/* Clock synchronization (IICCSC) */
|
||||
#define _00_SCI_NO_SYNCHRONIZATION (0x00U) /* No synchronization with the clock signal */
|
||||
#define _02_SCI_SYNCHRONIZATION (0x02U) /* Synchronization with the clock signal */
|
||||
/* ACK transmission data (IICACKT) */
|
||||
#define _00_SCI_ACK_TRANSMISSION (0x00U) /* ACK transmission */
|
||||
#define _20_SCI_NACK_TRANSMISSION (0x20U) /* NACK transmission and reception of ACK/NACK */
|
||||
|
||||
/*
|
||||
I2C mode register 3 (SIMR3)
|
||||
*/
|
||||
/* Start condition generation (IICSTAREQ) */
|
||||
#define _00_SCI_START_CONDITION_OFF (0x00U) /* Start condition is not generated */
|
||||
#define _01_SCI_START_CONDITION_ON (0x01U) /* Start condition is generated */
|
||||
/* Restart condition generation (IICRSTAREQ) */
|
||||
#define _00_SCI_RESTART_CONDITION_OFF (0x00U) /* Restart condition is not generated */
|
||||
#define _02_SCI_RESTART_CONDITION_ON (0x02U) /* Restart condition is generated */
|
||||
/* Stop condition generation (IICSTPREQ) */
|
||||
#define _00_SCI_STOP_CONDITION_OFF (0x00U) /* Stop condition is not generated */
|
||||
#define _04_SCI_STOP_CONDITION_ON (0x04U) /* Stop condition is generated */
|
||||
/* Issuing of start, restart, or sstop condition completed flag (IICSTIF) */
|
||||
#define _00_SCI_CONDITION_GENERATED (0x00U) /* No requests to generate conditions/conditions generated */
|
||||
#define _08_SCI_GENERATION_COMPLETED (0x08U) /* All request generation has been completed */
|
||||
/* SSDA output select (IICSDAS) */
|
||||
#define _00_SCI_SSDA_DATA_OUTPUT (0x00U) /* SSDA output is serial data output */
|
||||
#define _10_SCI_SSDA_START_RESTART_STOP_CONDITION (0x10U) /* SSDA output generates start, restart or stop condition */
|
||||
#define _20_SCI_SSDA_LOW_LEVEL (0x20U) /* SSDA output low level */
|
||||
#define _30_SCI_SSDA_HIGH_IMPEDANCE (0x30U) /* SSDA output high impedance */
|
||||
/* SSCL output select (IICSCLS) */
|
||||
#define _00_SCI_SSCL_CLOCK_OUTPUT (0x00U) /* SSCL output is serial clock output */
|
||||
#define _40_SCI_SSCL_START_RESTART_STOP_CONDITION (0x40U) /* SSCL output generates start, restart or stop condition */
|
||||
#define _80_SCI_SSCL_LOW_LEVEL (0x80U) /* SSCL output low level */
|
||||
#define _C0_SCI_SSCL_HIGH_IMPEDANCE (0xC0U) /* SSCL output high impedance */
|
||||
|
||||
/*
|
||||
I2C status register (SISR)
|
||||
*/
|
||||
/* ACK reception data flag (IICACKR) */
|
||||
#define _00_SCI_ACK_RECEIVED (0x00U) /* ACK received */
|
||||
#define _01_SCI_NACK_RECEIVED (0x01U) /* NACK received */
|
||||
|
||||
/*
|
||||
SPI mode register (SPMR)
|
||||
*/
|
||||
/* SS pin function enable (SSE) */
|
||||
#define _00_SCI_SS_PIN_DISABLE (0x00U) /* SS pin function disabled */
|
||||
#define _01_SCI_SS_PIN_ENABLE (0x01U) /* SS pin function enabled */
|
||||
/* CTS enable (CTSE) */
|
||||
#define _00_SCI_RTS (0x00U) /* RTS function is enabled */
|
||||
#define _02_SCI_CTS (0x02U) /* CTS function is disabled */
|
||||
/* Master slave select (MSS) */
|
||||
#define _00_SCI_SPI_MASTER (0x00U) /* Master mode */
|
||||
#define _04_SCI_SPI_SLAVE (0x04U) /* Slave mode */
|
||||
/* Mode fault flag (MFF) */
|
||||
#define _00_SCI_NO_MODE_FAULT (0x00U) /* No mode fault */
|
||||
#define _10_SCI_MODE_FAULT (0x10U) /* Mode fault */
|
||||
/* Clock polarity select (CKPOL) */
|
||||
#define _00_SCI_CLOCK_NOT_INVERTED (0x00U) /* Clock polarity is not inverted */
|
||||
#define _40_SCI_CLOCK_INVERTED (0x40U) /* Clock polarity is inverted */
|
||||
/* Clock phase select (CKPH) */
|
||||
#define _00_SCI_CLOCK_NOT_DELAYED (0x00U) /* Clock is not delayed */
|
||||
#define _80_SCI_CLOCK_DELAYED (0x80U) /* Clock is delayed */
|
||||
|
||||
/*
|
||||
Interrupt Source Priority Register n (IPRn)
|
||||
*/
|
||||
/* Interrupt Priority Level Select (IPR[3:0]) */
|
||||
#define _00_SCI_PRIORITY_LEVEL0 (0x00U) /* Level 0 (interrupt disabled) */
|
||||
#define _01_SCI_PRIORITY_LEVEL1 (0x01U) /* Level 1 */
|
||||
#define _02_SCI_PRIORITY_LEVEL2 (0x02U) /* Level 2 */
|
||||
#define _03_SCI_PRIORITY_LEVEL3 (0x03U) /* Level 3 */
|
||||
#define _04_SCI_PRIORITY_LEVEL4 (0x04U) /* Level 4 */
|
||||
#define _05_SCI_PRIORITY_LEVEL5 (0x05U) /* Level 5 */
|
||||
#define _06_SCI_PRIORITY_LEVEL6 (0x06U) /* Level 6 */
|
||||
#define _07_SCI_PRIORITY_LEVEL7 (0x07U) /* Level 7 */
|
||||
#define _08_SCI_PRIORITY_LEVEL8 (0x08U) /* Level 8 */
|
||||
#define _09_SCI_PRIORITY_LEVEL9 (0x09U) /* Level 9 */
|
||||
#define _0A_SCI_PRIORITY_LEVEL10 (0x0AU) /* Level 10 */
|
||||
#define _0B_SCI_PRIORITY_LEVEL11 (0x0BU) /* Level 11 */
|
||||
#define _0C_SCI_PRIORITY_LEVEL12 (0x0CU) /* Level 12 */
|
||||
#define _0D_SCI_PRIORITY_LEVEL13 (0x0DU) /* Level 13 */
|
||||
#define _0E_SCI_PRIORITY_LEVEL14 (0x0EU) /* Level 14 */
|
||||
#define _0F_SCI_PRIORITY_LEVEL15 (0x0FU) /* Level 15 (highest) */
|
||||
|
||||
/*
|
||||
Transfer status control value
|
||||
*/
|
||||
/* Simple IIC Transmit Receive Flag */
|
||||
#define _80_SCI_IIC_TRANSMISSION (0x80U)
|
||||
#define _00_SCI_IIC_RECEPTION (0x00U)
|
||||
/* Simple IIC Start Stop Flag */
|
||||
#define _80_SCI_IIC_START_CYCLE (0x80U)
|
||||
#define _00_SCI_IIC_STOP_CYCLE (0x00U)
|
||||
/* Multiprocessor Asynchronous Communication Flag */
|
||||
#define _80_SCI_ID_TRANSMISSION_CYCLE (0x80U)
|
||||
#define _00_SCI_DATA_TRANSMISSION_CYCLE (0x00U)
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
void R_SCI1_Create(void);
|
||||
void R_SCI1_Start(void);
|
||||
void R_SCI1_Stop(void);
|
||||
MD_STATUS R_SCI1_Serial_Send(uint8_t * const tx_buf, uint16_t tx_num);
|
||||
MD_STATUS R_SCI1_Serial_Receive(uint8_t * const rx_buf, uint16_t rx_num);
|
||||
static void r_sci1_callback_transmitend(void);
|
||||
static void r_sci1_callback_receiveend(void);
|
||||
static void r_sci1_callback_receiveerror(void);
|
||||
|
||||
/* Start user code for function. Do not edit comment generated here */
|
||||
|
||||
/* Some of the code in this file is generated using "Code Generator" for e2 studio.
|
||||
* Warnings exist in this module. */
|
||||
|
||||
/* Exported functions used to transmit a number of bytes and wait for completion */
|
||||
MD_STATUS R_SCI1_AsyncTransmit (uint8_t * const tx_buf, const uint16_t tx_num);
|
||||
|
||||
/* Character is used to receive key presses from PC terminal */
|
||||
extern uint8_t g_rx_char;
|
||||
|
||||
/* Flag used to control transmission to PC terminal */
|
||||
extern volatile uint8_t g_tx_flag;
|
||||
|
||||
/* End user code. Do not edit comment generated here */
|
||||
#endif
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_sci_user.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for SCI module.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_sci.h"
|
||||
/* Start user code for include. Do not edit comment generated here */
|
||||
#include "rskrx113def.h"
|
||||
//_RB_#include "r_cg_cmt.h"
|
||||
/* End user code. Do not edit comment generated here */
|
||||
#include "r_cg_userdefine.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
extern uint8_t * gp_sci1_tx_address; /* SCI1 send buffer address */
|
||||
extern uint16_t g_sci1_tx_count; /* SCI1 send data number */
|
||||
extern uint8_t * gp_sci1_rx_address; /* SCI1 receive buffer address */
|
||||
extern uint16_t g_sci1_rx_count; /* SCI1 receive data number */
|
||||
extern uint16_t g_sci1_rx_length; /* SCI1 receive data length */
|
||||
/* Start user code for global. Do not edit comment generated here */
|
||||
|
||||
/* Global used to receive a character from the PC terminal */
|
||||
uint8_t g_rx_char;
|
||||
|
||||
/* Flag used to control transmission to PC terminal */
|
||||
volatile uint8_t g_tx_flag = FALSE;
|
||||
|
||||
/* Flag used locally to detect transmission complete */
|
||||
static volatile uint8_t sci1_txdone;
|
||||
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: r_sci1_transmit_interrupt
|
||||
* Description : None
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
#if FAST_INTERRUPT_VECTOR == VECT_SCI1_TXI1
|
||||
#pragma interrupt r_sci1_transmit_interrupt(vect=VECT(SCI1,TXI1),fint)
|
||||
#else
|
||||
#pragma interrupt r_sci1_transmit_interrupt(vect=VECT(SCI1,TXI1))
|
||||
#endif
|
||||
static void r_sci1_transmit_interrupt(void)
|
||||
{
|
||||
if (g_sci1_tx_count > 0U)
|
||||
{
|
||||
SCI1.TDR = *gp_sci1_tx_address;
|
||||
gp_sci1_tx_address++;
|
||||
g_sci1_tx_count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCI1.SCR.BIT.TIE = 0U;
|
||||
SCI1.SCR.BIT.TEIE = 1U;
|
||||
}
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: r_sci1_transmitend_interrupt
|
||||
* Description : None
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
#if FAST_INTERRUPT_VECTOR == VECT_SCI1_TEI1
|
||||
#pragma interrupt r_sci1_transmitend_interrupt(vect=VECT(SCI1,TEI1),fint)
|
||||
#else
|
||||
#pragma interrupt r_sci1_transmitend_interrupt(vect=VECT(SCI1,TEI1))
|
||||
#endif
|
||||
static void r_sci1_transmitend_interrupt(void)
|
||||
{
|
||||
/* Set TXD1 pin */
|
||||
PORT1.PMR.BYTE &= 0xBFU;
|
||||
SCI1.SCR.BIT.TIE = 0U;
|
||||
SCI1.SCR.BIT.TE = 0U;
|
||||
SCI1.SCR.BIT.TEIE = 0U;
|
||||
|
||||
r_sci1_callback_transmitend();
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: r_sci1_receive_interrupt
|
||||
* Description : None
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
#if FAST_INTERRUPT_VECTOR == VECT_SCI1_RXI1
|
||||
#pragma interrupt r_sci1_receive_interrupt(vect=VECT(SCI1,RXI1),fint)
|
||||
#else
|
||||
#pragma interrupt r_sci1_receive_interrupt(vect=VECT(SCI1,RXI1))
|
||||
#endif
|
||||
static void r_sci1_receive_interrupt(void)
|
||||
{
|
||||
if (g_sci1_rx_length > g_sci1_rx_count)
|
||||
{
|
||||
*gp_sci1_rx_address = SCI1.RDR;
|
||||
gp_sci1_rx_address++;
|
||||
g_sci1_rx_count++;
|
||||
|
||||
if (g_sci1_rx_length == g_sci1_rx_count)
|
||||
{
|
||||
r_sci1_callback_receiveend();
|
||||
}
|
||||
}
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: r_sci1_receiveerror_interrupt
|
||||
* Description : None
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
#if FAST_INTERRUPT_VECTOR == VECT_SCI1_ERI1
|
||||
#pragma interrupt r_sci1_receiveerror_interrupt(vect=VECT(SCI1,ERI1),fint)
|
||||
#else
|
||||
#pragma interrupt r_sci1_receiveerror_interrupt(vect=VECT(SCI1,ERI1))
|
||||
#endif
|
||||
static void r_sci1_receiveerror_interrupt(void)
|
||||
{
|
||||
uint8_t err_type;
|
||||
|
||||
r_sci1_callback_receiveerror();
|
||||
|
||||
/* Clear overrun, framing and parity error flags */
|
||||
err_type = SCI1.SSR.BYTE;
|
||||
SCI1.SSR.BYTE = err_type & 0xC7U;
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: r_sci1_callback_transmitend
|
||||
* Description : This function is a callback function when SCI1 finishes transmission.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
static void r_sci1_callback_transmitend(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
sci1_txdone = TRUE;
|
||||
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: r_sci1_callback_receiveend
|
||||
* Description : This function is a callback function when SCI1 finishes reception.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
static void r_sci1_callback_receiveend(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* Check the contents of g_rx_char */
|
||||
if ('z' == g_rx_char)
|
||||
{
|
||||
/* Stop the timer used to control transmission to PC terminal*/
|
||||
//_RB_ R_CMT0_Stop();
|
||||
|
||||
/* Turn off LED0 and turn on LED1 to indicate serial transmission
|
||||
inactive */
|
||||
LED0 = LED_OFF;
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Start the timer used to control transmission to PC terminal*/
|
||||
//_RB_ R_CMT0_Start();
|
||||
|
||||
/* Turn on LED0 and turn off LED1 to indicate serial transmission
|
||||
active */
|
||||
LED0 = LED_ON;
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
|
||||
/* Set up SCI1 receive buffer again */
|
||||
R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);
|
||||
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: r_sci1_callback_receiveerror
|
||||
* Description : This function is a callback function when SCI1 reception encounters error.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
static void r_sci1_callback_receiveerror(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_SCI1_AsyncTransmit
|
||||
* Description : This function sends SCI1 data and waits for the transmit end flag.
|
||||
* Arguments : tx_buf -
|
||||
* transfer buffer pointer
|
||||
* tx_num -
|
||||
* buffer size
|
||||
* Return Value : status -
|
||||
* MD_OK or MD_ARGERROR
|
||||
***********************************************************************************************************************/
|
||||
MD_STATUS R_SCI1_AsyncTransmit (uint8_t * const tx_buf, const uint16_t tx_num)
|
||||
{
|
||||
MD_STATUS status = MD_OK;
|
||||
|
||||
/* clear the flag before initiating a new transmission */
|
||||
sci1_txdone = FALSE;
|
||||
|
||||
/* Send the data using the API */
|
||||
status = R_SCI1_Serial_Send(tx_buf, tx_num);
|
||||
|
||||
/* Wait for the transmit end flag */
|
||||
while (FALSE == sci1_txdone)
|
||||
{
|
||||
/* Wait */
|
||||
}
|
||||
return (status);
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* End of function R_SCI1_AsyncTransmit
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_stacksct.h
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Setting of Stack area.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
#ifndef _STACKSCT_H
|
||||
#define _STACKSCT_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions (Register bit)
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
#pragma stacksize su=0x100
|
||||
#pragma stacksize si=0x300
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_userdefine.h
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file includes user definition.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
#ifndef _USER_DEF_H
|
||||
#define _USER_DEF_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
User definitions
|
||||
***********************************************************************************************************************/
|
||||
#define FAST_INTERRUPT_VECTOR 0
|
||||
|
||||
/* Start user code for function. Do not edit comment generated here */
|
||||
#define TRUE (1)
|
||||
#define FALSE (0)
|
||||
/* End user code. Do not edit comment generated here */
|
||||
#endif
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_vect.h
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file contains definition of vector.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
#ifndef _VECT_H
|
||||
#define _VECT_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions (Register bit)
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
/* Undefined */
|
||||
#pragma interrupt (r_undefined_exception)
|
||||
void r_undefined_exception(void);
|
||||
|
||||
/* Reserved */
|
||||
#pragma interrupt (r_reserved_exception)
|
||||
void r_reserved_exception(void);
|
||||
|
||||
/* NMI */
|
||||
#pragma interrupt (r_nmi_exception)
|
||||
void r_nmi_exception(void);
|
||||
|
||||
/* BRK */
|
||||
#pragma interrupt (r_brk_exception(vect=0))
|
||||
void r_brk_exception(void);
|
||||
|
||||
/*;<<VECTOR DATA START (POWER ON RESET)>> */
|
||||
/*;Power On Reset PC */
|
||||
extern void PowerON_Reset(void);
|
||||
/*;<<VECTOR DATA END (POWER ON RESET)>> */
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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) 2015 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_vecttbl.c
|
||||
* Version : Code Generator for RX113 V1.02.01.02 [28 May 2015]
|
||||
* Device(s) : R5F51138AxFP
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file initializes the vector table.
|
||||
* Creation Date: 21/09/2015
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_vect.h"
|
||||
#include "r_cg_userdefine.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma section C FIXEDVECT
|
||||
|
||||
void (*const Fixed_Vectors[])(void) = {
|
||||
/*;0xffffffd0 Exception(Supervisor Instruction) */
|
||||
r_undefined_exception,
|
||||
/*;0xffffffd4 Reserved */
|
||||
r_undefined_exception,
|
||||
/*;0xffffffd8 Reserved */
|
||||
r_reserved_exception,
|
||||
/*;0xffffffdc Exception(Undefined Instruction) */
|
||||
r_undefined_exception,
|
||||
/*;0xffffffe0 Reserved */
|
||||
r_reserved_exception,
|
||||
/*;0xffffffe4 Reserved */
|
||||
r_reserved_exception,
|
||||
/*;0xffffffe8 Reserved */
|
||||
r_reserved_exception,
|
||||
/*;0xffffffec Reserved */
|
||||
r_reserved_exception,
|
||||
/*;0xfffffff0 Reserved */
|
||||
r_reserved_exception,
|
||||
/*;0xfffffff4 Reserved */
|
||||
r_reserved_exception,
|
||||
/*;0xfffffff8 NMI */
|
||||
r_nmi_exception,
|
||||
/*;0xfffffffc RESET */
|
||||
/*;<<VECTOR DATA START (POWER ON RESET)>> */
|
||||
/*;Power On Reset PC */
|
||||
/*(void*)*/ PowerON_Reset
|
||||
/*;<<VECTOR DATA END (POWER ON RESET)>> */
|
||||
};
|
||||
|
||||
/* MDE register (Single Chip Mode) */
|
||||
#pragma address _MDEreg=0xffffff80
|
||||
#ifdef __BIG
|
||||
/* Big endian*/
|
||||
const unsigned long _MDEreg = 0xfffffff8;
|
||||
#else
|
||||
/* Little endian */
|
||||
const unsigned long _MDEreg = 0xffffffff;
|
||||
#endif
|
||||
|
||||
/* Set option bytes */
|
||||
#pragma address OFS0_location = 0xFFFFFF8CUL
|
||||
#pragma address OFS1_location = 0xFFFFFF88UL
|
||||
volatile const uint32_t OFS0_location = 0xFFFFFFFFUL;
|
||||
volatile const uint32_t OFS1_location = 0xFFFFFFFFUL;
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* ID codes (Default) */
|
||||
#pragma address id_code=0xffffffa0
|
||||
const unsigned long id_code[4] = {
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
};
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue