mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-01 11:53:53 -04:00
Start to create an RX64M demo.
This commit is contained in:
parent
9bd5e5cf03
commit
b17ab311af
29 changed files with 21569 additions and 0 deletions
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to distribute
|
||||
>>! a combined work that includes FreeRTOS without being obliged to provide
|
||||
>>! the source code for proprietary components outside of the FreeRTOS
|
||||
>>! kernel.
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/* Prevent Renesas headers redefining some stdint.h types. */
|
||||
#define __TYPEDEF__ 1
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( 120000000UL ) /*_RB_ guess*/
|
||||
#define configPERIPHERAL_CLOCK_HZ ( 60000000UL ) /*_RB_ guess*/
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 140 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 45 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( 3 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* The interrupt priority used by the kernel itself for the tick interrupt and
|
||||
the pended interrupt. This would normally be the lowest priority. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
|
||||
/* The maximum interrupt priority from which FreeRTOS API calls can be made.
|
||||
Interrupts that use a priority above this will not be effected by anything the
|
||||
kernel is doing. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||
|
||||
/* The peripheral used to generate the tick interrupt is configured as part of
|
||||
the application code. This constant should be set to the vector number of the
|
||||
peripheral chosen. As supplied this is CMT0. */
|
||||
#define configTICK_VECTOR _CMT0_CMI0
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
|
||||
void vAssertCalled( void );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()
|
||||
|
||||
/* Override some of the priorities set in the common demo tasks. This is
|
||||
required to ensure flase positive timing errors are not reported. */
|
||||
#define bktPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )
|
||||
#define bktSECONDARY_PRIORITY ( configMAX_PRIORITIES - 4 )
|
||||
#define intqHIGHER_PRIORITY ( configMAX_PRIORITIES - 3 )
|
||||
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Ethernet configuration.
|
||||
*-----------------------------------------------------------*/
|
||||
|
||||
/* MAC address configuration. */
|
||||
#define configMAC_ADDR0 0x00
|
||||
#define configMAC_ADDR1 0x12
|
||||
#define configMAC_ADDR2 0x13
|
||||
#define configMAC_ADDR3 0x10
|
||||
#define configMAC_ADDR4 0x15
|
||||
#define configMAC_ADDR5 0x11
|
||||
|
||||
/* IP address configuration. */
|
||||
#define configIP_ADDR0 192
|
||||
#define configIP_ADDR1 168
|
||||
#define configIP_ADDR2 0
|
||||
#define configIP_ADDR3 200
|
||||
|
||||
/* Netmask configuration. */
|
||||
#define configNET_MASK0 255
|
||||
#define configNET_MASK1 255
|
||||
#define configNET_MASK2 255
|
||||
#define configNET_MASK3 0
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
198
FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/ParTest.c
Normal file
198
FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/ParTest.c
Normal file
|
@ -0,0 +1,198 @@
|
|||
/*
|
||||
FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to distribute
|
||||
>>! a combined work that includes FreeRTOS without being obliged to provide
|
||||
>>! the source code for proprietary components outside of the FreeRTOS
|
||||
>>! kernel.
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Simple IO routines to control the LEDs.
|
||||
*-----------------------------------------------------------*/
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Demo includes. */
|
||||
#include "partest.h"
|
||||
|
||||
/* Hardware specifics. */
|
||||
//#include "iodefine.h"
|
||||
|
||||
#define partestNUM_LEDS ( 4 )
|
||||
|
||||
long lParTestGetLEDState( unsigned long ulLED );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestInitialise( void )
|
||||
{
|
||||
/* Port pin configuration is done by the low level set up prior to this
|
||||
function being called. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestSetLED( unsigned long ulLED, signed long xValue )
|
||||
{
|
||||
#if 0
|
||||
if( ulLED < partestNUM_LEDS )
|
||||
{
|
||||
if( xValue != 0 )
|
||||
{
|
||||
/* Turn the LED on. */
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
switch( ulLED )
|
||||
{
|
||||
case 0: LED0 = LED_ON;
|
||||
break;
|
||||
case 1: LED1 = LED_ON;
|
||||
break;
|
||||
case 2: LED2 = LED_ON;
|
||||
break;
|
||||
case 3: LED3 = LED_ON;
|
||||
break;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Turn the LED off. */
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
switch( ulLED )
|
||||
{
|
||||
case 0: LED0 = LED_OFF;
|
||||
break;
|
||||
case 1: LED1 = LED_OFF;
|
||||
break;
|
||||
case 2: LED2 = LED_OFF;
|
||||
break;
|
||||
case 3: LED3 = LED_OFF;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestToggleLED( unsigned long ulLED )
|
||||
{
|
||||
#if 0
|
||||
if( ulLED < partestNUM_LEDS )
|
||||
{
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if( lParTestGetLEDState( ulLED ) != 0x00 )
|
||||
{
|
||||
vParTestSetLED( ulLED, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
vParTestSetLED( ulLED, 1 );
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
long lParTestGetLEDState( unsigned long ulLED )
|
||||
{
|
||||
long lReturn = pdTRUE;
|
||||
#if 0
|
||||
if( ulLED < partestNUM_LEDS )
|
||||
{
|
||||
switch( ulLED )
|
||||
{
|
||||
case 0 : if( LED0 != 0 )
|
||||
{
|
||||
lReturn = pdFALSE;
|
||||
}
|
||||
break;
|
||||
case 1 : if( LED1 != 0 )
|
||||
{
|
||||
lReturn = pdFALSE;
|
||||
}
|
||||
break;
|
||||
case 2 : if( LED2 != 0 )
|
||||
{
|
||||
lReturn = pdFALSE;
|
||||
}
|
||||
break;
|
||||
case 3 : if( LED3 != 0 )
|
||||
{
|
||||
lReturn = pdFALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return lReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_cgc.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for CGC module.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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)
|
||||
{
|
||||
/* Set main clock control registers */
|
||||
SYSTEM.MOFCR.BYTE = _00_CGC_MAINOSC_RESONATOR | _00_CGC_MAINOSC_UNDER24M;
|
||||
SYSTEM.MOSCWTCR.BYTE = _52_CGC_MOSCWTCR_VALUE;
|
||||
|
||||
/* 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 */
|
||||
SYSTEM.SCKCR.LONG = _00000001_CGC_PCLKD_DIV_2 | _00000010_CGC_PCLKC_DIV_2 | _00000100_CGC_PCLKB_DIV_2 |
|
||||
_00001000_CGC_PCLKA_DIV_2 | _00010000_CGC_BCLK_DIV_2 | _01000000_CGC_ICLK_DIV_2 |
|
||||
_10000000_CGC_FCLK_DIV_2;
|
||||
|
||||
/* Set PLL circuit */
|
||||
SYSTEM.PLLCR2.BIT.PLLEN = 0U;
|
||||
SYSTEM.PLLCR.BIT.PLLSRCSEL = 0U;
|
||||
SYSTEM.PLLCR.WORD = _0001_CGC_PLL_FREQ_DIV_2 | _1300_CGC_PLL_FREQ_MUL_10_0;
|
||||
|
||||
/* Wait for PLL wait counter overflow */
|
||||
while (1U != SYSTEM.OSCOVFSR.BIT.PLOVF);
|
||||
|
||||
|
||||
/* Disable sub-clock */
|
||||
SYSTEM.SOSCCR.BIT.SOSTP = 1U;
|
||||
|
||||
/* Wait for the register modification to complete */
|
||||
while (1U != SYSTEM.SOSCCR.BIT.SOSTP);
|
||||
|
||||
/* Set LOCO */
|
||||
SYSTEM.LOCOCR.BIT.LCSTP = 0U;
|
||||
|
||||
/* Set UCLK */
|
||||
SYSTEM.SCKCR2.WORD = _0020_CGC_UCLK_DIV_3;
|
||||
|
||||
/* Set SDCLK */
|
||||
SYSTEM.SCKCR.BIT.PSTOP0 = 1U;
|
||||
|
||||
/* Set clock source */
|
||||
SYSTEM.SCKCR3.WORD = _0400_CGC_CLOCKSOURCE_PLL;
|
||||
}
|
||||
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
|
@ -0,0 +1,230 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_cgc.h
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for CGC module.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
#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 C (PCLKC) */
|
||||
#define _00000000_CGC_PCLKC_DIV_1 (0x00000000UL) /* x1 */
|
||||
#define _00000010_CGC_PCLKC_DIV_2 (0x00000010UL) /* x1/2 */
|
||||
#define _00000020_CGC_PCLKC_DIV_4 (0x00000020UL) /* x1/4 */
|
||||
#define _00000030_CGC_PCLKC_DIV_8 (0x00000030UL) /* x1/8 */
|
||||
#define _00000040_CGC_PCLKC_DIV_16 (0x00000040UL) /* x1/16 */
|
||||
#define _00000050_CGC_PCLKC_DIV_32 (0x00000050UL) /* x1/32 */
|
||||
#define _00000060_CGC_PCLKC_DIV_64 (0x00000060UL) /* 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 */
|
||||
/* Peripheral Module Clock A (PCLKA) */
|
||||
#define _00000000_CGC_PCLKA_DIV_1 (0x00000000UL) /* x1 */
|
||||
#define _00001000_CGC_PCLKA_DIV_2 (0x00001000UL) /* x1/2 */
|
||||
#define _00002000_CGC_PCLKA_DIV_4 (0x00002000UL) /* x1/4 */
|
||||
#define _00003000_CGC_PCLKA_DIV_8 (0x00003000UL) /* x1/8 */
|
||||
#define _00004000_CGC_PCLKA_DIV_16 (0x00004000UL) /* x1/16 */
|
||||
#define _00005000_CGC_PCLKA_DIV_32 (0x00005000UL) /* x1/32 */
|
||||
#define _00006000_CGC_PCLKA_DIV_64 (0x00006000UL) /* x1/64 */
|
||||
/* External Bus Clock (BCLK) */
|
||||
#define _00000000_CGC_BCLK_DIV_1 (0x00000000UL) /* x1 */
|
||||
#define _00010000_CGC_BCLK_DIV_2 (0x00010000UL) /* x1/2 */
|
||||
#define _00020000_CGC_BCLK_DIV_4 (0x00020000UL) /* x1/4 */
|
||||
#define _00030000_CGC_BCLK_DIV_8 (0x00030000UL) /* x1/8 */
|
||||
#define _00040000_CGC_BCLK_DIV_16 (0x00040000UL) /* x1/16 */
|
||||
#define _00050000_CGC_BCLK_DIV_32 (0x00050000UL) /* x1/32 */
|
||||
#define _00060000_CGC_BCLK_DIV_64 (0x00060000UL) /* 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 2 (SCKCR2)
|
||||
*/
|
||||
#define _0010_CGC_UCLK_DIV_1 (0x0010U) /* x1/2 */
|
||||
#define _0020_CGC_UCLK_DIV_3 (0x0020U) /* x1/3 */
|
||||
#define _0030_CGC_UCLK_DIV_4 (0x0030U) /* x1/4 */
|
||||
#define _0040_CGC_UCLK_DIV_5 (0x0040U) /* x1/5 */
|
||||
|
||||
/*
|
||||
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_3 (0x0002U) /* x1/3 */
|
||||
/* Frequency Multiplication Factor Select (STC[5:0]) */
|
||||
#define _1300_CGC_PLL_FREQ_MUL_10_0 (0x1300U) /* x10.0 */
|
||||
#define _1400_CGC_PLL_FREQ_MUL_10_5 (0x1400U) /* x10.5 */
|
||||
#define _1500_CGC_PLL_FREQ_MUL_11_0 (0x1500U) /* x11.0 */
|
||||
#define _1600_CGC_PLL_FREQ_MUL_11_5 (0x1600U) /* x11.5 */
|
||||
#define _1700_CGC_PLL_FREQ_MUL_12_0 (0x1700U) /* x12.0 */
|
||||
#define _1800_CGC_PLL_FREQ_MUL_12_5 (0x1800U) /* x12.5 */
|
||||
#define _1900_CGC_PLL_FREQ_MUL_13_0 (0x1900U) /* x13.0 */
|
||||
#define _1A00_CGC_PLL_FREQ_MUL_13_5 (0x1A00U) /* x13.5 */
|
||||
#define _1B00_CGC_PLL_FREQ_MUL_14_0 (0x1B00U) /* x14.0 */
|
||||
#define _1C00_CGC_PLL_FREQ_MUL_14_5 (0x1C00U) /* x14.5 */
|
||||
#define _1D00_CGC_PLL_FREQ_MUL_15_0 (0x1D00U) /* x15.0 */
|
||||
#define _1E00_CGC_PLL_FREQ_MUL_15_5 (0x1E00U) /* x15.5 */
|
||||
#define _1F00_CGC_PLL_FREQ_MUL_16_0 (0x1F00U) /* x16.0 */
|
||||
#define _2000_CGC_PLL_FREQ_MUL_16_5 (0x2000U) /* x16.5 */
|
||||
#define _2100_CGC_PLL_FREQ_MUL_17_0 (0x2100U) /* x17.0 */
|
||||
#define _2200_CGC_PLL_FREQ_MUL_17_5 (0x2200U) /* x17.5 */
|
||||
#define _2300_CGC_PLL_FREQ_MUL_18_0 (0x2300U) /* x18.0 */
|
||||
#define _2400_CGC_PLL_FREQ_MUL_18_5 (0x2400U) /* x18.5 */
|
||||
#define _2500_CGC_PLL_FREQ_MUL_19_0 (0x2500U) /* x19.0 */
|
||||
#define _2600_CGC_PLL_FREQ_MUL_19_5 (0x2600U) /* x19.5 */
|
||||
#define _2700_CGC_PLL_FREQ_MUL_20_0 (0x2700U) /* x20.0 */
|
||||
#define _2800_CGC_PLL_FREQ_MUL_20_5 (0x2800U) /* x20.5 */
|
||||
#define _2900_CGC_PLL_FREQ_MUL_21_0 (0x2900U) /* x21.0 */
|
||||
#define _2A00_CGC_PLL_FREQ_MUL_21_5 (0x2A00U) /* x21.5 */
|
||||
#define _2B00_CGC_PLL_FREQ_MUL_22_0 (0x2B00U) /* x22.0 */
|
||||
#define _2C00_CGC_PLL_FREQ_MUL_22_5 (0x2C00U) /* x22.5 */
|
||||
#define _2D00_CGC_PLL_FREQ_MUL_23_0 (0x2D00U) /* x23.0 */
|
||||
#define _2E00_CGC_PLL_FREQ_MUL_23_5 (0x2E00U) /* x23.5 */
|
||||
#define _2F00_CGC_PLL_FREQ_MUL_24_0 (0x2F00U) /* x24.0 */
|
||||
#define _3000_CGC_PLL_FREQ_MUL_24_5 (0x3000U) /* x24.5 */
|
||||
#define _3100_CGC_PLL_FREQ_MUL_25_0 (0x3100U) /* x25.0 */
|
||||
#define _3200_CGC_PLL_FREQ_MUL_25_5 (0x3200U) /* x25.5 */
|
||||
#define _3300_CGC_PLL_FREQ_MUL_26_0 (0x3300U) /* x26.0 */
|
||||
#define _3400_CGC_PLL_FREQ_MUL_26_5 (0x3400U) /* x26.5 */
|
||||
#define _3500_CGC_PLL_FREQ_MUL_27_0 (0x3500U) /* x27.0 */
|
||||
#define _3600_CGC_PLL_FREQ_MUL_27_5 (0x3600U) /* x27.5 */
|
||||
#define _3700_CGC_PLL_FREQ_MUL_28_0 (0x3700U) /* x28.0 */
|
||||
#define _3800_CGC_PLL_FREQ_MUL_28_5 (0x3800U) /* x28.5 */
|
||||
#define _3900_CGC_PLL_FREQ_MUL_29_0 (0x3900U) /* x29.0 */
|
||||
#define _3A00_CGC_PLL_FREQ_MUL_29_5 (0x3A00U) /* x29.5 */
|
||||
#define _3B00_CGC_PLL_FREQ_MUL_30_0 (0x3B00U) /* x30.0 */
|
||||
|
||||
/*
|
||||
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 */
|
||||
|
||||
/*
|
||||
High-Speed On-Chip Oscillator Control Register 2 (HOCOCR2)
|
||||
*/
|
||||
/* HOCO Frequency Setting (HCFRQ[1:0]) */
|
||||
#define _00_CGC_HOCO_CLK_16 (0x00U) /* 16 MHz */
|
||||
#define _01_CGC_HOCO_CLK_18 (0x01U) /* 18 MHz */
|
||||
#define _02_CGC_HOCO_CLK_20 (0x02U) /* 20 MHz */
|
||||
|
||||
/*
|
||||
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 2 Switching (MODRV2[1:0]) */
|
||||
#define _00_CGC_MAINOSC_UNDER24M (0x00U) /* 20.1 to 24 MHz */
|
||||
#define _10_CGC_MAINOSC_UNDER20M (0x10U) /* 16.1 to 20 MHz */
|
||||
#define _20_CGC_MAINOSC_UNDER16M (0x20U) /* 8.1 to 16 MHz */
|
||||
#define _30_CGC_MAINOSC_EQUATE8M (0x30U) /* 8 MHz */
|
||||
/* Main Clock Oscillator Switch (MOSEL) */
|
||||
#define _00_CGC_MAINOSC_RESONATOR (0x00U) /* Resonator */
|
||||
#define _40_CGC_MAINOSC_EXTERNAL (0x40U) /* External oscillator input */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
#define _52_CGC_MOSCWTCR_VALUE (0x52U) /* Main Clock Oscillator Wait Time */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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,57 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_cgc_user.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for CGC module.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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,106 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_cmt.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for CMT module.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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_cmt.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_CMT0_Create
|
||||
* Description : This function initializes the CMT0 channel.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_CMT0_Create(void)
|
||||
{
|
||||
/* Disable CMI interrupt */
|
||||
IEN(CMT0, CMI0) = 0U;
|
||||
|
||||
/* Cancel CMT stop state in LPC */
|
||||
MSTP(CMT0) = 0U;
|
||||
|
||||
/* Set control registers */
|
||||
CMT0.CMCR.WORD = _0002_CMT_CMCR_CKS_PCLK128 | _0040_CMT_CMCR_CMIE_ENABLE;
|
||||
CMT0.CMCOR = _B71B_CMT0_CMCOR_VALUE;
|
||||
|
||||
/* Set CMI0 priority level */
|
||||
IPR(CMT0,CMI0) = _08_CMT_PRIORITY_LEVEL8;
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_CMT0_Start
|
||||
* Description : This function starts the CMT0 channel counter.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_CMT0_Start(void)
|
||||
{
|
||||
/* Enable CMI0 interrupt in ICU */
|
||||
IEN(CMT0,CMI0) = 1U;
|
||||
|
||||
/* Start CMT0 count */
|
||||
CMT.CMSTR0.BIT.STR0 = 1U;
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_CMT0_Stop
|
||||
* Description : This function stops the CMT0 channel counter.
|
||||
* Arguments : None
|
||||
* Return Value : None
|
||||
***********************************************************************************************************************/
|
||||
void R_CMT0_Stop(void)
|
||||
{
|
||||
/* Disable CMI0 interrupt in ICU */
|
||||
IEN(CMT0,CMI0) = 0U;
|
||||
|
||||
/* Stop CMT0 count */
|
||||
CMT.CMSTR0.BIT.STR0 = 0U;
|
||||
}
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
|
@ -0,0 +1,91 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_cmt.h
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements device driver for CMT module.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
#ifndef CMT_H
|
||||
#define CMT_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions (Register bit)
|
||||
***********************************************************************************************************************/
|
||||
/*
|
||||
Compare Match Timer Control Register (CMCR)
|
||||
*/
|
||||
/* Clock Select (CKS[1:0]) */
|
||||
#define _0000_CMT_CMCR_CKS_PCLK8 (0x0000U) /* PCLK/8 */
|
||||
#define _0001_CMT_CMCR_CKS_PCLK32 (0x0001U) /* PCLK/32 */
|
||||
#define _0002_CMT_CMCR_CKS_PCLK128 (0x0002U) /* PCLK/128 */
|
||||
#define _0003_CMT_CMCR_CKS_PCLK512 (0x0003U) /* PCLK/512 */
|
||||
/* Compare Match Interrupt Enable (CMIE) */
|
||||
#define _0000_CMT_CMCR_CMIE_DISABLE (0x0000U) /* Compare match interrupt (CMIn) disabled */
|
||||
#define _0040_CMT_CMCR_CMIE_ENABLE (0x0040U) /* Compare match interrupt (CMIn) enabled */
|
||||
|
||||
/*
|
||||
Interrupt Source Priority Register n (IPRn)
|
||||
*/
|
||||
/* Interrupt Priority Level Select (IPR[3:0]) */
|
||||
#define _00_CMT_PRIORITY_LEVEL0 (0x00U) /* Level 0 (interrupt disabled) */
|
||||
#define _01_CMT_PRIORITY_LEVEL1 (0x01U) /* Level 1 */
|
||||
#define _02_CMT_PRIORITY_LEVEL2 (0x02U) /* Level 2 */
|
||||
#define _03_CMT_PRIORITY_LEVEL3 (0x03U) /* Level 3 */
|
||||
#define _04_CMT_PRIORITY_LEVEL4 (0x04U) /* Level 4 */
|
||||
#define _05_CMT_PRIORITY_LEVEL5 (0x05U) /* Level 5 */
|
||||
#define _06_CMT_PRIORITY_LEVEL6 (0x06U) /* Level 6 */
|
||||
#define _07_CMT_PRIORITY_LEVEL7 (0x07U) /* Level 7 */
|
||||
#define _08_CMT_PRIORITY_LEVEL8 (0x08U) /* Level 8 */
|
||||
#define _09_CMT_PRIORITY_LEVEL9 (0x09U) /* Level 9 */
|
||||
#define _0A_CMT_PRIORITY_LEVEL10 (0x0AU) /* Level 10 */
|
||||
#define _0B_CMT_PRIORITY_LEVEL11 (0x0BU) /* Level 11 */
|
||||
#define _0C_CMT_PRIORITY_LEVEL12 (0x0CU) /* Level 12 */
|
||||
#define _0D_CMT_PRIORITY_LEVEL13 (0x0DU) /* Level 13 */
|
||||
#define _0E_CMT_PRIORITY_LEVEL14 (0x0EU) /* Level 14 */
|
||||
#define _0F_CMT_PRIORITY_LEVEL15 (0x0FU) /* Level 15 (highest) */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
/* Compare Match Timer Constant Register (CMCOR) */
|
||||
#define _B71B_CMT0_CMCOR_VALUE (0xB71BU)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
void R_CMT0_Create(void);
|
||||
void R_CMT0_Start(void);
|
||||
void R_CMT0_Stop(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,89 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_dbsct.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Setting of B.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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,93 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_hardware_setup.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements system initializing function.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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_cmt.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 = 0xA50BU;
|
||||
|
||||
/* Enable writing to MPC pin function control registers */
|
||||
MPC.PWPR.BIT.B0WI = 0U;
|
||||
MPC.PWPR.BIT.PFSWE = 1U;
|
||||
|
||||
/* Set peripheral settings */
|
||||
R_CGC_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,111 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_intprg.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Setting of B.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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 */
|
||||
}
|
||||
|
||||
/* ICU GROUPBE0 */
|
||||
void r_icua_group_be0_interrupt(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* ICU GROUPBL0 */
|
||||
void r_icua_group_bl0_interrupt(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* ICU GROUPBL1 */
|
||||
void r_icua_group_bl1_interrupt(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* ICU GROUPAL0 */
|
||||
void r_icua_group_al0_interrupt(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
|
||||
/* ICU GROUPAL1 */
|
||||
void r_icua_group_al1_interrupt(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 */
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,99 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_macrodriver.h
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file implements general head file.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
#ifndef MODULEID_H
|
||||
#define MODULEID_H
|
||||
/***********************************************************************************************************************
|
||||
Includes
|
||||
***********************************************************************************************************************/
|
||||
#include "r_cg_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__
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed long int32_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef unsigned short MD_STATUS;
|
||||
#define __TYPEDEF__
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global functions
|
||||
***********************************************************************************************************************/
|
||||
void HardwareSetup(void);
|
||||
void R_Systeminit(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,96 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_resetprg.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Reset program.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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"));
|
||||
|
||||
#ifdef __ROZ /* Initialize FPSW */
|
||||
#define _ROUND 0x00000001 /* Let FPSW RMbits=01 (round to zero) */
|
||||
#else
|
||||
#define _ROUND 0x00000000 /* Let FPSW RMbits=00 (round to nearest) */
|
||||
#endif
|
||||
#ifdef __DOFF
|
||||
#define _DENOM 0x00000100 /* Let FPSW DNbit=1 (denormal as zero) */
|
||||
#else
|
||||
#define _DENOM 0x00000000 /* Let FPSW DNbit=0 (denormal as is) */
|
||||
#endif
|
||||
|
||||
set_fpsw(FPSW_init | _ROUND | _DENOM);
|
||||
|
||||
_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,91 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_sbrk.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Program of sbrk.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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,53 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_sbrk.h
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Header file of sbrk file.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
#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,55 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_stacksct.h
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : Setting of Stack area.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
#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,43 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_userdefine.h
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file includes user definition.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
#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 */
|
||||
/* End user code. Do not edit comment generated here */
|
||||
#endif
|
|
@ -0,0 +1,88 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_vect.h
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file contains definition of vector.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
#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);
|
||||
|
||||
/* ICU GROUPBE0 */
|
||||
#pragma interrupt (r_icua_group_be0_interrupt(vect=106))
|
||||
void r_icua_group_be0_interrupt(void);
|
||||
|
||||
/* ICU GROUPBL0 */
|
||||
#pragma interrupt (r_icua_group_bl0_interrupt(vect=110))
|
||||
void r_icua_group_bl0_interrupt(void);
|
||||
|
||||
/* ICU GROUPBL1 */
|
||||
#pragma interrupt (r_icua_group_bl1_interrupt(vect=111))
|
||||
void r_icua_group_bl1_interrupt(void);
|
||||
|
||||
/* ICU GROUPAL0 */
|
||||
#pragma interrupt (r_icua_group_al0_interrupt(vect=112))
|
||||
void r_icua_group_al0_interrupt(void);
|
||||
|
||||
/* ICU GROUPAL1 */
|
||||
#pragma interrupt (r_icua_group_al1_interrupt(vect=113))
|
||||
void r_icua_group_al1_interrupt(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,103 @@
|
|||
/***********************************************************************************************************************
|
||||
* 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 WARRANTIES REGARDING
|
||||
* 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) 2013 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_cg_vecttbl.c
|
||||
* Version : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]
|
||||
* Device(s) : R5F564MLHxFC
|
||||
* Tool-Chain : CCRX
|
||||
* Description : This file initializes the vector table.
|
||||
* Creation Date: 07/02/2014
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
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 Exception(Floating Point) */
|
||||
r_undefined_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)>> */
|
||||
};
|
||||
|
||||
/* ID codes (Default) */
|
||||
#pragma address id_code=0xffffffa0
|
||||
const unsigned long id_code[4] = {
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
};
|
||||
|
||||
/* 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
|
||||
|
||||
/* Start user code for adding. Do not edit comment generated here */
|
||||
/* End user code. Do not edit comment generated here */
|
275
FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c
Normal file
275
FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c
Normal file
|
@ -0,0 +1,275 @@
|
|||
/*
|
||||
FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to distribute
|
||||
>>! a combined work that includes FreeRTOS without being obliged to provide
|
||||
>>! the source code for proprietary components outside of the FreeRTOS
|
||||
>>! kernel.
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* This project provides two demo applications. A simple blinky style project,
|
||||
* and a more comprehensive test and demo application. The
|
||||
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to
|
||||
* select between the two. The simply blinky demo is implemented and described
|
||||
* in main_blinky.c. The more comprehensive test and demo application is
|
||||
* implemented and described in main_full.c.
|
||||
*
|
||||
* This file implements the code that is not demo specific, including the
|
||||
* hardware setup and FreeRTOS hook functions.
|
||||
*
|
||||
* ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON
|
||||
* THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO
|
||||
* APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!
|
||||
*
|
||||
*/
|
||||
|
||||
/* Scheduler include files. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* Standard demo includes. */
|
||||
//#include "partest.h"
|
||||
//#include "TimerDemo.h"
|
||||
//#include "QueueOverwrite.h"
|
||||
//#include "EventGroupsDemo.h"
|
||||
|
||||
/* Renesas includes. */
|
||||
#include "r_cg_macrodriver.h"
|
||||
//#include "r_cg_cgc.h"
|
||||
//#include "r_cg_cmt.h"
|
||||
//#include "r_cg_userdefine.h"
|
||||
|
||||
/* 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;
|
||||
|
||||
|
||||
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
|
||||
or 0 to run the more comprehensive test and demo application. */
|
||||
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Configure the hardware as necessary to run this demo.
|
||||
*/
|
||||
static void prvSetupHardware( void );
|
||||
|
||||
/*
|
||||
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
|
||||
* main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
|
||||
*/
|
||||
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1
|
||||
extern void main_blinky( void );
|
||||
#else
|
||||
extern void main_full( void );
|
||||
#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */
|
||||
|
||||
/*
|
||||
* The Xilinx projects use a BSP that do not allow the start up code to be
|
||||
* altered easily. Therefore the vector table used by FreeRTOS is defined in
|
||||
* FreeRTOS_asm_vectors.S, which is part of this project. Switch to use the
|
||||
* FreeRTOS vector table.
|
||||
*/
|
||||
extern void vPortInstallFreeRTOSVectorTable( void );
|
||||
|
||||
/* Prototypes for the standard FreeRTOS callback/hook functions implemented
|
||||
within this file. */
|
||||
void vApplicationMallocFailedHook( void );
|
||||
void vApplicationIdleHook( void );
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
|
||||
void vApplicationTickHook( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Configure the hardware ready to run the demo. */
|
||||
prvSetupHardware();
|
||||
|
||||
/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
|
||||
of this file. */
|
||||
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
|
||||
{
|
||||
main_blinky();
|
||||
}
|
||||
#else
|
||||
{
|
||||
main_full();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Don't expect to reach here. */
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* Called if a call to pvPortMalloc() fails because there is insufficient
|
||||
free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
||||
internally by FreeRTOS API functions that create tasks, queues, software
|
||||
timers, and semaphores. The size of the FreeRTOS heap is set by the
|
||||
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
/* Run time stack overflow checking is performed if
|
||||
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
function is called if a stack overflow is detected. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
volatile size_t xFreeHeapSpace;
|
||||
|
||||
/* This is just a trivial example of an idle hook. It is called on each
|
||||
cycle of the idle task. It must *NOT* attempt to block. In this case the
|
||||
idle task just queries the amount of FreeRTOS heap that remains. See the
|
||||
memory management section on the http://www.FreeRTOS.org web site for memory
|
||||
management options. If there is a lot of heap memory free then the
|
||||
configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up
|
||||
RAM. */
|
||||
xFreeHeapSpace = xPortGetFreeHeapSize();
|
||||
|
||||
/* Remove compiler warning about xFreeHeapSpace being set but never used. */
|
||||
( void ) xFreeHeapSpace;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
|
||||
{
|
||||
/* The full demo includes a software timer demo/test that requires
|
||||
prodding periodically from the tick interrupt. */
|
||||
vTimerPeriodicISRTests();
|
||||
|
||||
/* Call the periodic queue overwrite from ISR demo. */
|
||||
vQueueOverwritePeriodicISRDemo();
|
||||
|
||||
/* Call the periodic event group from ISR demo. */
|
||||
vPeriodicEventGroupsProcessing();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( void )
|
||||
{
|
||||
volatile unsigned long ul = 0;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* Use the debugger to set ul to a non-zero value in order to step out
|
||||
of this function to determine why it was called. */
|
||||
while( ul == 0 )
|
||||
{
|
||||
portNOP();
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The RX port uses this callback function to configure its tick interrupt.
|
||||
This allows the application to choose the tick interrupt source. */
|
||||
void vApplicationSetupTimerInterrupt( void )
|
||||
{
|
||||
/* Enable compare match timer 0. */
|
||||
MSTP( CMT0 ) = 0;
|
||||
|
||||
/* Interrupt on compare match. */
|
||||
CMT0.CMCR.BIT.CMIE = 1;
|
||||
|
||||
/* Set the compare match value. */
|
||||
CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );
|
||||
|
||||
/* Divide the PCLK by 8. */
|
||||
CMT0.CMCR.BIT.CKS = 0;
|
||||
|
||||
/* Enable the interrupt... */
|
||||
_IEN( _CMT0_CMI0 ) = 1;
|
||||
|
||||
/* ...and set its priority to the application defined kernel priority. */
|
||||
_IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;
|
||||
|
||||
/* Start the timer. */
|
||||
CMT.CMSTR0.BIT.STR0 = 1;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to distribute
|
||||
>>! a combined work that includes FreeRTOS without being obliged to provide
|
||||
>>! the source code for proprietary components outside of the FreeRTOS
|
||||
>>! kernel.
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* NOTE 1: This project provides two demo applications. A simple blinky style
|
||||
* project, and a more comprehensive test and demo application. The
|
||||
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
|
||||
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
|
||||
* in main.c. This file implements the simply blinky style version.
|
||||
*
|
||||
* NOTE 2: This file only contains the source code that is specific to the
|
||||
* basic demo. Generic functions, such FreeRTOS hook functions, and functions
|
||||
* required to configure the hardware are defined in main.c.
|
||||
******************************************************************************
|
||||
*
|
||||
* main_blinky() creates one queue, and two tasks. It then starts the
|
||||
* scheduler.
|
||||
*
|
||||
* The Queue Send Task:
|
||||
* The queue send task is implemented by the prvQueueSendTask() function in
|
||||
* this file. prvQueueSendTask() sits in a loop that causes it to repeatedly
|
||||
* block for 200 milliseconds, before sending the value 100 to the queue that
|
||||
* was created within main_blinky(). Once the value is sent, the task loops
|
||||
* back around to block for another 200 milliseconds...and so on.
|
||||
*
|
||||
* The Queue Receive Task:
|
||||
* The queue receive task is implemented by the prvQueueReceiveTask() function
|
||||
* in this file. prvQueueReceiveTask() sits in a loop where it repeatedly
|
||||
* blocks on attempts to read data from the queue that was created within
|
||||
* main_blinky(). When data is received, the task checks the value of the
|
||||
* data, and if the value equals the expected 100, toggles an LED. The 'block
|
||||
* time' parameter passed to the queue receive function specifies that the
|
||||
* task should be held in the Blocked state indefinitely to wait for data to
|
||||
* be available on the queue. The queue receive task will only leave the
|
||||
* Blocked state when the queue send task writes to the queue. As the queue
|
||||
* send task writes to the queue every 200 milliseconds, the queue receive
|
||||
* task leaves the Blocked state every 200 milliseconds, and therefore toggles
|
||||
* the LED every 200 milliseconds.
|
||||
*/
|
||||
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* Standard demo includes. */
|
||||
#include "partest.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
|
||||
/* The rate at which data is sent to the queue. The 200ms value is converted
|
||||
to ticks using the portTICK_PERIOD_MS constant. */
|
||||
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS )
|
||||
|
||||
/* The number of items the queue can hold. This is 1 as the receive task
|
||||
will remove items as they are added, meaning the send task should always find
|
||||
the queue empty. */
|
||||
#define mainQUEUE_LENGTH ( 1 )
|
||||
|
||||
/* The LED toggled by the Rx task. */
|
||||
#define mainTASK_LED ( 0 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* The tasks as described in the comments at the top of this file.
|
||||
*/
|
||||
static void prvQueueReceiveTask( void *pvParameters );
|
||||
static void prvQueueSendTask( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Called by main() to create the simply blinky style application if
|
||||
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
|
||||
*/
|
||||
void main_blinky( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The queue used by both tasks. */
|
||||
static QueueHandle_t xQueue = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void main_blinky( void )
|
||||
{
|
||||
/* Create the queue. */
|
||||
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
|
||||
if( xQueue != NULL )
|
||||
{
|
||||
/* Start the two tasks as described in the comments at the top of this
|
||||
file. */
|
||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||
NULL, /* The parameter passed to the task - not used in this case. */
|
||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||
|
||||
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Start the tasks and timer running. */
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
line will never be reached. If the following line does execute, then
|
||||
there was either insufficient FreeRTOS heap memory available for the idle
|
||||
and/or timer tasks to be created, or vTaskStartScheduler() was called from
|
||||
User mode. See the memory management section on the FreeRTOS web site for
|
||||
more details on the FreeRTOS heap http://www.freertos.org/a00111.html. The
|
||||
mode from which main() is called is set in the C start up code and must be
|
||||
a privileged mode (not user mode). */
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueSendTask( void *pvParameters )
|
||||
{
|
||||
TickType_t xNextWakeTime;
|
||||
const unsigned long ulValueToSend = 100UL;
|
||||
|
||||
/* Remove compiler warning about unused parameter. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Initialise xNextWakeTime - this only needs to be done once. */
|
||||
xNextWakeTime = xTaskGetTickCount();
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Place this task in the blocked state until it is time to run again. */
|
||||
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
|
||||
|
||||
/* Send to the queue - causing the queue receive task to unblock and
|
||||
toggle the LED. 0 is used as the block time so the sending operation
|
||||
will not block - it shouldn't need to block as the queue should always
|
||||
be empty at this point in the code. */
|
||||
xQueueSend( xQueue, &ulValueToSend, 0U );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueReceiveTask( void *pvParameters )
|
||||
{
|
||||
unsigned long ulReceivedValue;
|
||||
const unsigned long ulExpectedValue = 100UL;
|
||||
|
||||
/* Remove compiler warning about unused parameter. */
|
||||
( void ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait until something arrives in the queue - this task will block
|
||||
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
|
||||
FreeRTOSConfig.h. */
|
||||
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
|
||||
|
||||
/* To get here something must have been received from the queue, but
|
||||
is it the expected value? If it is, toggle the LED. */
|
||||
if( ulReceivedValue == ulExpectedValue )
|
||||
{
|
||||
vParTestToggleLED( mainTASK_LED );
|
||||
ulReceivedValue = 0U;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue