]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RX600_RX63N-RSK_Renesas/RTOSDemo/Renesas-Files/board/rskrx63n/resetprg.c
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / RX600_RX63N-RSK_Renesas / RTOSDemo / Renesas-Files / board / rskrx63n / resetprg.c
diff --git a/FreeRTOS/Demo/RX600_RX63N-RSK_Renesas/RTOSDemo/Renesas-Files/board/rskrx63n/resetprg.c b/FreeRTOS/Demo/RX600_RX63N-RSK_Renesas/RTOSDemo/Renesas-Files/board/rskrx63n/resetprg.c
deleted file mode 100644 (file)
index a8d08b9..0000000
+++ /dev/null
@@ -1,409 +0,0 @@
-/***********************************************************************************************************************\r
-* DISCLAIMER\r
-* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No \r
-* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all \r
-* applicable laws, including copyright laws. \r
-* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING\r
-* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, \r
-* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM \r
-* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES \r
-* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS \r
-* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
-* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of \r
-* this software. By using this software, you agree to the additional terms and conditions found by accessing the \r
-* following link:\r
-* http://www.renesas.com/disclaimer \r
-*\r
-* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.    \r
-***********************************************************************************************************************/\r
-/***********************************************************************************************************************\r
-* File Name       : resetprg.c\r
-* Device(s)    : RX63x\r
-* Description  : Defines post-reset routines that are used to configure the MCU prior to the main program starting. \r
-*                This is were the program counter starts on power-up or reset.\r
-***********************************************************************************************************************/\r
-/***********************************************************************************************************************\r
-* History : DD.MM.YYYY Version  Description\r
-*         : 26.10.2011 1.00     First Release\r
-*         : 13.03.2012 1.10     Stack sizes are now defined in r_bsp_config.h. Because of this the #include for \r
-*                               stacksct.h was removed. Settings for SCKCR are now set in r_bsp_config.h and used here\r
-*                               to setup clocks based on user settings.\r
-***********************************************************************************************************************/\r
-\r
-/***********************************************************************************************************************\r
-Includes   <System Includes> , "Project Includes"\r
-***********************************************************************************************************************/
-/* Defines machine level functions used in this file */
-#include    <machine.h>
-/* Defines MCU configuration functions used in this file */
-#include    <_h_c_lib.h>
-/* Defines standard variable types used in this file */
-#include    <stdbool.h>
-#include    <stdint.h>\r
-\r
-/* This macro is here so that the stack will be declared here. This is used to prevent multiplication of stack size. */\r
-#define     BSP_DECLARE_STACK\r
-/* Define the target platform */\r
-#include    "platform.h"\r
-\r
-/***********************************************************************************************************************\r
-Macro definitions\r
-***********************************************************************************************************************/
-#define PSW_init  (0x00030000)
-#define FPSW_init (0x00000100)
-
-/***********************************************************************************************************************
-Pre-processor Directives
-***********************************************************************************************************************/
-/* Declare the contents of the function 'Change_PSW_PM_to_UserMode' as
-   assembler to the compiler */
-#pragma inline_asm Change_PSW_PM_to_UserMode
-\r
-/* Set this as the entry point from a power-on reset */
-#pragma entry PowerON_Reset_PC\r
-\r
-/***********************************************************************************************************************
-External function Prototypes
-***********************************************************************************************************************/
-/* Functions to setup I/O library */
-extern void _INIT_IOLIB(void);\r
-extern void _CLOSEALL(void);\r
-
-/***********************************************************************************************************************\r
-Private global variables and functions\r
-***********************************************************************************************************************/
-/* Power-on reset function declaration */
-void PowerON_Reset_PC(void);\r
-\r
-#if RUN_IN_USER_MODE==1\r
-    #if __RENESAS_VERSION__ < 0x01010000\r
-    /* MCU usermode switcher function declaration */
-    static void Change_PSW_PM_to_UserMode(void);\r
-    #endif
-#endif\r
-
-/* Main program function delcaration */
-void main(void);
-static void operating_frequency_set(void);
-\r
-/***********************************************************************************************************************\r
-* Function name: PowerON_Reset_PC\r
-* Description  : This function is the MCU's entry point from a power-on reset.\r
-*                The following steps are taken in the startup code:\r
-*                1. The User Stack Pointer (USP) and Interrupt Stack Pointer (ISP) are both set immediately after entry \r
-*                   to this function. The USP and ISP stack sizes are set in the file stacksct.h.\r
-*                   Default sizes are USP=4K and ISP=1K.\r
-*                2. The interrupt vector base register is set to point to the beginning of the relocatable interrupt \r
-*                   vector table.\r
-*                3. The MCU is setup for floating point operations by setting the initial value of the Floating Point \r
-*                   Status Word (FPSW).\r
-*                4. The MCU operating frequency is set by configuring the Clock Generation Circuit (CGC) in\r
-*                   operating_frequency_set.\r
-*                5. Calls are made to functions to setup the C runtime environment which involves initializing all \r
-*                   initialed data, zeroing all uninitialized variables, and configuring STDIO if used\r
-*                   (calls to _INITSCT and _INIT_IOLIB).\r
-*                6. Board-specific hardware setup, including configuring I/O pins on the MCU, in hardware_setup.\r
-*                7. Global interrupts are enabled by setting the I bit in the Program Status Word (PSW), and the stack \r
-*                   is switched from the ISP to the USP.  The initial Interrupt Priority Level is set to zero, enabling \r
-*                   any interrupts with a priority greater than zero to be serviced.\r
-*                8. The processor is optionally switched to user mode.  To run in user mode, set the macro \r
-*                   RUN_IN_USER_MODE above to a 1.\r
-*                9. The bus error interrupt is enabled to catch any accesses to invalid or reserved areas of memory.\r
-*\r
-*                Once this initialization is complete, the user's main() function is called.  It should not return.\r
-* Arguments    : none\r
-* Return value : none\r
-***********************************************************************************************************************/\r
-void PowerON_Reset_PC(void)
-{\r
-    /* Stack pointers are setup prior to calling this function - see comments above */    \r
-    
-    /* Initialise the MCU processor word */
-#if __RENESAS_VERSION__ >= 0x01010000    
-    set_intb((void *)__sectop("C$VECT"));
-#else
-    set_intb((unsigned long)__sectop("C$VECT"));
-#endif    \r
-\r
-    /* Initialize FPSW for floating-point operations */\r
-#ifdef __ROZ\r
-#define _ROUND 0x00000001  /* Let FPSW RMbits=01 (round to zero) */\r
-#else \r
-#define _ROUND 0x00000000  /* Let FPSW RMbits=00 (round to nearest) */\r
-#endif \r
-#ifdef __DOFF \r
-#define _DENOM 0x00000100  /* Let FPSW DNbit=1 (denormal as zero) */\r
-#else \r
-#define _DENOM 0x00000000  /* Let FPSW DNbit=0 (denormal as is) */\r
-#endif 
-    set_fpsw(FPSW_init | _ROUND | _DENOM); \r
-    \r
-    /* Switch to high-speed operation */\r
-    operating_frequency_set();
-
-    /* Initialize C runtime environment */
-    _INITSCT();
-\r
-    /* Comment this out if not using I/O lib\r
-    _INIT_IOLIB(); */\r
-
-    /* Configure the MCU and YRDK hardware */
-    hardware_setup();
-
-    /* Change the MCU's usermode from supervisor to user */        
-    nop();
-    set_psw(PSW_init);      
-#if RUN_IN_USER_MODE==1\r
-    /* Use chg_pmusr() intrinsic if possible. */\r
-    #if __RENESAS_VERSION__ >= 0x01010000
-    chg_pmusr() ;\r
-    #else\r
-    Change_PSW_PM_to_UserMode();\r
-    #endif
-#endif\r
-\r
-\r
-    /* Enable the bus error interrupt to catch accesses to illegal/reserved areas of memory */\r
-    /* The ISR for this interrupt can be found in vecttbl.c in the function "bus_error_isr" */\r
-    /* Clear any pending interrupts */\r
-    IR(BSC,BUSERR) = 0;\r
-    /* Make this the highest priority interrupt (adjust as necessary for your application */\r
-    IPR(BSC,BUSERR) = 0x0F; \r
-    /* Enable the interrupt in the ICU*/\r
-    IEN(BSC,BUSERR) = 1; \r
-    /* Enable illegal address interrupt in the BSC */\r
-    BSC.BEREN.BIT.IGAEN = 1;\r
-\r
-    /* Call the main program function (should not return) */
-    main();\r
-    \r
-    /* Comment this out if not using I/O lib - cleans up open files */\r
-    _CLOSEALL();
-
-    while(1)\r
-    {\r
-        /* Infinite loop. Put a breakpoint here if you want to catch an exit of main(). */\r
-    }\r
-}\r
-\r
-/***********************************************************************************************************************\r
-* Function name: operating_frequency_set\r
-* Description  : Configures the clock settings for each of the device clocks\r
-* Arguments    : none\r
-* Return value : none\r
-***********************************************************************************************************************/\r
-void operating_frequency_set(void)
-{
-    /* Used for constructing value to write to SCKCR register. */\r
-    uint32_t temp_clock = 0;\r
-    
-    /* \r
-    Clock Description              Frequency\r
-    ----------------------------------------\r
-    Input Clock Frequency............  12 MHz\r
-    PLL frequency (x16).............. 192 MHz\r
-    Internal Clock Frequency.........  96 MHz    \r
-    Peripheral Clock Frequency.......  48 MHz\r
-    USB Clock Frequency..............  48 MHz\r
-    External Bus Clock Frequency.....  24 MHz */\r
-\r
-       volatile unsigned int i;\r
-\r
-    /* Protect off. */\r
-    SYSTEM.PRCR.WORD = 0xA50B;                 \r
-       \r
-    /* Uncomment if not using sub-clock */\r
-       //SYSTEM.SOSCCR.BYTE = 0x01;          /* stop sub-clock */\r
-    SYSTEM.SOSCCR.BYTE = 0x00;                 /* Enable sub-clock for RTC */\r
-\r
-    /* Wait 131,072 cycles * 12 MHz = 10.9 ms */\r
-    SYSTEM.MOSCWTCR.BYTE = 0x0D;               \r
-\r
-    /* PLL wait is 4,194,304 cycles (default) * 192 MHz (12 MHz * 16) = 20.1 ms*/\r
-    SYSTEM.PLLWTCR.BYTE = 0x0F;                        \r
-\r
-    /* Set PLL Input Divisor. */\r
-    SYSTEM.PLLCR.BIT.PLIDIV = PLL_DIV >> 1;\r
-\r
-    /* Set PLL Multiplier. */\r
-    SYSTEM.PLLCR.BIT.STC = PLL_MUL - 1;\r
-\r
-    /* EXTAL ON */\r
-    SYSTEM.MOSCCR.BYTE = 0x00;                 \r
-\r
-    /* PLL ON */\r
-    SYSTEM.PLLCR2.BYTE = 0x00;                 \r
-\r
-       for(i = 0;i< 0x168;i++)             \r
-    {\r
-        /* Wait over 12ms */\r
-        nop() ;\r
-       }\r
-\r
-    /* Figure out setting for FCK bits. */\r
-#if   FCK_DIV == 1\r
-    /* Do nothing since FCK bits should be 0. */\r
-#elif FCK_DIV == 2\r
-    temp_clock |= 0x10000000;\r
-#elif FCK_DIV == 4\r
-    temp_clock |= 0x20000000;\r
-#elif FCK_DIV == 8\r
-    temp_clock |= 0x30000000;\r
-#elif FCK_DIV == 16\r
-    temp_clock |= 0x40000000;\r
-#elif FCK_DIV == 32\r
-    temp_clock |= 0x50000000;\r
-#elif FCK_DIV == 64\r
-    temp_clock |= 0x60000000;\r
-#else\r
-    #error "Error! Invalid setting for FCK_DIV in r_bsp_config.h"\r
-#endif\r
-\r
-    /* Figure out setting for ICK bits. */\r
-#if   ICK_DIV == 1\r
-    /* Do nothing since ICK bits should be 0. */\r
-#elif ICK_DIV == 2\r
-    temp_clock |= 0x01000000;\r
-#elif ICK_DIV == 4\r
-    temp_clock |= 0x02000000;\r
-#elif ICK_DIV == 8\r
-    temp_clock |= 0x03000000;\r
-#elif ICK_DIV == 16\r
-    temp_clock |= 0x04000000;\r
-#elif ICK_DIV == 32\r
-    temp_clock |= 0x05000000;\r
-#elif ICK_DIV == 64\r
-    temp_clock |= 0x06000000;\r
-#else\r
-    #error "Error! Invalid setting for ICK_DIV in r_bsp_config.h"\r
-#endif\r
-\r
-    /* SDCLK Pin Output and BCLK Pin Output are disabled by default. */\r
-    temp_clock |= 0x00C00000;\r
-\r
-    /* Figure out setting for BCK bits. */\r
-#if   BCK_DIV == 1\r
-    /* Do nothing since BCK bits should be 0. */\r
-#elif BCK_DIV == 2\r
-    temp_clock |= 0x00010000;\r
-#elif BCK_DIV == 4\r
-    temp_clock |= 0x00020000;\r
-#elif BCK_DIV == 8\r
-    temp_clock |= 0x00030000;\r
-#elif BCK_DIV == 16\r
-    temp_clock |= 0x00040000;\r
-#elif BCK_DIV == 32\r
-    temp_clock |= 0x00050000;\r
-#elif BCK_DIV == 64\r
-    temp_clock |= 0x00060000;\r
-#else\r
-    #error "Error! Invalid setting for BCK_DIV in r_bsp_config.h"\r
-#endif\r
-\r
-    /* Figure out setting for PCKA bits. */\r
-#if   PCKA_DIV == 1\r
-    /* Do nothing since PCKA bits should be 0. */\r
-#elif PCKA_DIV == 2\r
-    temp_clock |= 0x00001000;\r
-#elif PCKA_DIV == 4\r
-    temp_clock |= 0x00002000;\r
-#elif PCKA_DIV == 8\r
-    temp_clock |= 0x00003000;\r
-#elif PCKA_DIV == 16\r
-    temp_clock |= 0x00004000;\r
-#elif PCKA_DIV == 32\r
-    temp_clock |= 0x00005000;\r
-#elif PCKA_DIV == 64\r
-    temp_clock |= 0x00006000;\r
-#else\r
-    #error "Error! Invalid setting for PCKA_DIV in r_bsp_config.h"\r
-#endif\r
-\r
-    /* Figure out setting for PCKB bits. */\r
-#if   PCKB_DIV == 1\r
-    /* Do nothing since PCKB bits should be 0. */\r
-#elif PCKB_DIV == 2\r
-    temp_clock |= 0x00000100;\r
-#elif PCKB_DIV == 4\r
-    temp_clock |= 0x00000200;\r
-#elif PCKB_DIV == 8\r
-    temp_clock |= 0x00000300;\r
-#elif PCKB_DIV == 16\r
-    temp_clock |= 0x00000400;\r
-#elif PCKB_DIV == 32\r
-    temp_clock |= 0x00000500;\r
-#elif PCKB_DIV == 64\r
-    temp_clock |= 0x00000600;\r
-#else\r
-    #error "Error! Invalid setting for PCKB_DIV in r_bsp_config.h"\r
-#endif\r
-\r
-    /* Bottom byte of SCKCR register must be set to 0x11 */\r
-    temp_clock |= 0x00000011;\r
-\r
-    /* Set SCKCR register. */\r
-    SYSTEM.SCKCR.LONG = temp_clock;\r
-    \r
-    /* Re-init temp_clock to use to set SCKCR2. */\r
-    temp_clock = 0;\r
-\r
-    /* Figure out setting for IEBCK bits. */\r
-#if   IEBCK_DIV == 2\r
-    temp_clock |= 0x00000001;\r
-#elif IEBCK_DIV == 4\r
-    temp_clock |= 0x00000002;\r
-#elif IEBCK_DIV == 6\r
-    temp_clock |= 0x0000000C;\r
-#elif IEBCK_DIV == 8\r
-    temp_clock |= 0x00000003;\r
-#elif IEBCK_DIV == 16\r
-    temp_clock |= 0x00000004;\r
-#elif IEBCK_DIV == 32\r
-    temp_clock |= 0x00000005;\r
-#elif IEBCK_DIV == 64\r
-    temp_clock |= 0x00000006;\r
-#else\r
-    #error "Error! Invalid setting for IEBCK_DIV in r_bsp_config.h"\r
-#endif\r
-\r
-    /* Figure out setting for UCK bits. */\r
-#if   UCK_DIV == 3\r
-    temp_clock |= 0x00000020;\r
-#elif UCK_DIV == 4\r
-    temp_clock |= 0x00000030;\r
-#else\r
-    #error "Error! Invalid setting for UCK_DIV in r_bsp_config.h"\r
-#endif\r
-\r
-    /* Set SCKCR2 register. */\r
-    SYSTEM.SCKCR2.WORD = (uint16_t)temp_clock;\r
-\r
-    /* Choose clock source. Default for r_bsp_config.h is PLL. */\r
-    SYSTEM.SCKCR3.WORD = ((uint16_t)CLOCK_SOURCE) << 8;\r
-\r
-    /* Protect on. */\r
-    SYSTEM.PRCR.WORD = 0xA500;                 
-}
-\r
-/***********************************************************************************************************************\r
-* Function name: Change_PSW_PM_to_UserMode\r
-* Description  : Assembler function, used to change the MCU's usermode from supervisor to user.\r
-* Arguments    : none\r
-* Return value : none\r
-***********************************************************************************************************************/\r
-#if RUN_IN_USER_MODE==1\r
-    #if __RENESAS_VERSION__ < 0x01010000
-static void Change_PSW_PM_to_UserMode(void)
-{
-    MVFC   PSW,R1
-    OR     #00100000h,R1
-    PUSH.L R1
-    MVFC   PC,R1
-    ADD    #10,R1
-    PUSH.L R1
-    RTE
-    NOP
-    NOP
-}\r
-    #endif
-#endif
\ No newline at end of file