]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RX600_RX63N-RSK_Renesas/RTOSDemo/Renesas-Files/board/rskrx63n/hwsetup.c
Add FreeRTOS-Plus directory.
[freertos] / FreeRTOS / Demo / RX600_RX63N-RSK_Renesas / RTOSDemo / Renesas-Files / board / rskrx63n / hwsetup.c
diff --git a/FreeRTOS/Demo/RX600_RX63N-RSK_Renesas/RTOSDemo/Renesas-Files/board/rskrx63n/hwsetup.c b/FreeRTOS/Demo/RX600_RX63N-RSK_Renesas/RTOSDemo/Renesas-Files/board/rskrx63n/hwsetup.c
new file mode 100644 (file)
index 0000000..a72bd3f
--- /dev/null
@@ -0,0 +1,161 @@
+/***********************************************************************************************************************\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       : hwsetup.c\r
+* Device(s)    : RX\r
+* H/W Platform : RSK+RX63N\r
+* Description  : Defines the initialisation routines used each time the MCU is restarted.\r
+***********************************************************************************************************************/\r
+/***********************************************************************************************************************\r
+* History : DD.MM.YYYY Version  Description\r
+*         : 22.11.2011 1.00     First Release\r
+***********************************************************************************************************************/\r
+\r
+/***********************************************************************************************************************\r
+Includes   <System Includes> , "Project Includes"\r
+***********************************************************************************************************************/\r
+/* I/O Register and board definitions */\r
+#include "platform.h"\r
+/* Contains delcarations for the functions defined in this file */
+#include "hwsetup.h"\r
+\r
+/***********************************************************************************************************************\r
+Private global variables and functions\r
+***********************************************************************************************************************/\r
+/* MCU I/O port configuration function delcaration */
+static void output_ports_configure(void);\r
+
+/* Interrupt configuration function delcaration */
+static void interrupts_configure(void);\r
+
+/* MCU peripheral module configuration function declaration */
+static void peripheral_modules_enable(void);
+
+
+/***********************************************************************************************************************\r
+* Function name: hardware_setup\r
+* Description  : Contains setup functions called at device restart\r
+* Arguments    : none\r
+* Return value : none\r
+***********************************************************************************************************************/\r
+void hardware_setup(void)
+{
+    output_ports_configure();
+    interrupts_configure();
+    peripheral_modules_enable();
+}
+
+/***********************************************************************************************************************\r
+* Function name: output_ports_configure
+* Description  : Configures the port and pin direction settings, and sets the pin outputs to a safe level.\r
+* Arguments    : none\r
+* Return value : none\r
+***********************************************************************************************************************/\r
+void output_ports_configure(void)
+{
+    SYSTEM.PRCR.WORD = 0xA50B;                 /* Protect off */\r
+    MPC.PWPR.BIT.B0WI = 0 ;                    /* Unlock protection register */\r
+    MPC.PWPR.BIT.PFSWE = 1 ;                   /* Unlock MPC registers */\r
+\r
+    /* Enable LEDs. */\r
+    /* Start with LEDs off. */\r
+    LED0 = LED_OFF;\r
+    LED1 = LED_OFF;\r
+    LED2 = LED_OFF;\r
+    LED3 = LED_OFF;\r
+\r
+    /* Set LED pins as outputs. */\r
+    LED0_PDR = 1;\r
+    LED1_PDR = 1;\r
+    LED2_PDR = 1;\r
+    LED3_PDR = 1;\r
+\r
+    /* Enable switches. */\r
+    /* Set pins as inputs. */\r
+    SW1_PDR = 0;\r
+    SW2_PDR = 0;\r
+    SW3_PDR = 0;\r
+\r
+    /* Set port mode registers for switches. */\r
+    SW1_PMR = 0;\r
+    SW2_PMR = 0;\r
+    SW3_PMR = 0;\r
+    \r
+    /* Initialize RSPI pins that are used with on-board SPI flash. */\r
+    /* Set pin outputs to low to begin with. */\r
+    PORT2.PODR.BIT.B7 = 0x00;    /* RSPCKB */\r
+    PORT2.PODR.BIT.B6 = 0x00;    /* MOSIB */\r
+    PORT3.PODR.BIT.B0 = 0x00;    /* MISOB */\r
+    PORT3.PODR.BIT.B1 = 0x00;    /* SSLB0 */\r
+    \r
+    /* All GPIO for now */\r
+    PORT2.PMR.BIT.B7 = 0x00;    \r
+    PORT2.PMR.BIT.B6 = 0x00;    \r
+    PORT3.PMR.BIT.B0 = 0x00;\r
+    PORT3.PMR.BIT.B1 = 0x00;\r
+\r
+    /* Unlock MPC registers to enable writing to them. */\r
+    MPC.PWPR.BIT.B0WI = 0 ;     /* Unlock protection register */\r
+    MPC.PWPR.BIT.PFSWE = 1 ;    /* Unlock MPC registers */\r
+        \r
+    /* Set MPC for RSPI pins */\r
+    MPC.P27PFS.BYTE = 0x0D;    \r
+    MPC.P26PFS.BYTE = 0x0D;    \r
+    MPC.P30PFS.BYTE = 0x0D;    \r
+    \r
+    /* RSPI pins assigned to RSPI peripheral. */\r
+    PORT2.PMR.BIT.B7 = 1;    \r
+    PORT2.PMR.BIT.B6 = 1;    \r
+    PORT3.PMR.BIT.B0 = 1;\r
+    PORT3.PMR.BIT.B1 = 1;    \r
+    \r
+    /* RSPCKB is output. */\r
+    PORT2.PDR.BIT.B7 = 1;\r
+    /* MOSIB is output. */\r
+    PORT2.PDR.BIT.B6 = 1;\r
+    /* MISOB is input. */\r
+    PORT3.PDR.BIT.B0 = 0;\r
+    /* SSLB0 is output. */\r
+    PORT3.PDR.BIT.B1 = 1;\r
+    \r
+    /* Configure the pin connected to the ADC Pot as an input */\r
+    PORT4.PDR.BIT.B0 = 0;\r
+}
+
+/***********************************************************************************************************************\r
+* Function name: interrupts_configure\r
+* Description  : Configures interrupts used\r
+* Arguments    : none\r
+* Return value : none\r
+***********************************************************************************************************************/\r
+void interrupts_configure(void)
+{\r
+    /* Add code here to setup additional interrupts */\r
+}
+
+/***********************************************************************************************************************\r
+* Function name: peripheral_modules_enable\r
+* Description  : Enables and configures peripheral devices on the MCU\r
+* Arguments    : none\r
+* Return value : none\r
+***********************************************************************************************************************/\r
+void peripheral_modules_enable(void)
+{
+    /* Add code here to enable peripherals used by the application */
+}