mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-04 13:23:50 -04:00
Update the RX MDK demo to include the web server. Minor tidy up to the RDK version too.
This commit is contained in:
parent
2fca46e3e4
commit
23ca0009e3
37 changed files with 6883 additions and 391 deletions
|
@ -27,12 +27,12 @@
|
|||
******************************************************************************
|
||||
* Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* File Name : hwsetup.c
|
||||
* Version : 1.00
|
||||
* File Name : hwsetup.c
|
||||
* Version : 1.00
|
||||
* Description : Power up hardware initializations
|
||||
******************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 15.02.2010 1.00 First Release
|
||||
* : 15.02.2010 1.00 First Release
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
@ -41,8 +41,7 @@ Includes <System Includes> , "Project Includes"
|
|||
******************************************************************************/
|
||||
#include <stdint.h>
|
||||
#include "iodefine.h"
|
||||
#include "rskrx62ndef.h"
|
||||
// #include "lcd.h" Uncomment this if an LCD is present.
|
||||
#include "r_ether.h"
|
||||
|
||||
/******************************************************************************
|
||||
Typedef definitions
|
||||
|
@ -63,54 +62,168 @@ Exported global variables and functions (to be accessed by other files)
|
|||
/******************************************************************************
|
||||
Private global variables and functions
|
||||
******************************************************************************/
|
||||
void io_set_cpg(void);
|
||||
void ConfigurePortPins(void);
|
||||
void EnablePeripheralModules(void);
|
||||
|
||||
/******************************************************************************
|
||||
* Function Name: HardwareSetup
|
||||
* Description : This function does initial setting for CPG port pins used in
|
||||
* : the Demo including the MII pins of the Ethernet PHY connection.
|
||||
* Arguments : none
|
||||
* : the Demo including the MII pins of the Ethernet PHY connection.
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
******************************************************************************/
|
||||
void HardwareSetup(void)
|
||||
{
|
||||
/* CPG setting */
|
||||
io_set_cpg();
|
||||
|
||||
uint32_t sckcr = 0;
|
||||
/* Setup the port pins */
|
||||
ConfigurePortPins();
|
||||
|
||||
/* Configure system clocks based on header */
|
||||
sckcr += (ICLK_MUL==8) ? (0ul << 24) : (ICLK_MUL==4) ? (1ul << 24) : (ICLK_MUL==2) ? (2ul << 24) : (3ul << 24);
|
||||
sckcr += (BCLK_MUL==8) ? (0ul << 16) : (BCLK_MUL==4) ? (1ul << 16) : (BCLK_MUL==2) ? (2ul << 16) : (3ul << 16);
|
||||
sckcr += (PCLK_MUL==8) ? (0ul << 8) : (PCLK_MUL==4) ? (1ul << 8) : (PCLK_MUL==2) ? (2ul << 8) : (3ul << 8);
|
||||
SYSTEM.SCKCR.LONG = sckcr;
|
||||
/* Enables peripherals */
|
||||
EnablePeripheralModules();
|
||||
|
||||
#if INCLUDE_LCD == 1
|
||||
/* Initialize display */
|
||||
InitialiseDisplay();
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Function Name: EnablePeripheralModules
|
||||
* Description : Enables Peripheral Modules before use
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
******************************************************************************/
|
||||
void EnablePeripheralModules(void)
|
||||
{
|
||||
/* Module standby clear */
|
||||
SYSTEM.MSTPCRB.BIT.MSTPB15 = 0; /* EtherC, EDMAC */
|
||||
SYSTEM.MSTPCRA.BIT.MSTPA15 = 0; /* CMT0 */
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Function Name: ConfigurePortPins
|
||||
* Description : Configures port pins.
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
******************************************************************************/
|
||||
void ConfigurePortPins(void)
|
||||
{
|
||||
/* Port pins default to inputs. To ensure safe initialisation set the pin states
|
||||
before changing the data direction registers. This will avoid any unintentional
|
||||
state changes on the external ports.
|
||||
Many peripheral modules will override the setting of the port registers. Ensure
|
||||
that the state is safe for external devices if the internal peripheral module is
|
||||
disabled or powered down. */
|
||||
|
||||
/* ==== MII/RMII Pins setting ==== */
|
||||
/*--------------------------------------*/
|
||||
/* Port Function Control Register */
|
||||
/*--------------------------------------*/
|
||||
#if ETH_MODE_SEL == ETH_MII_MODE
|
||||
/* EE=1, PHYMODE=1, ENETE3=1, ENETE2=0, ENETE1=1, ENETE0=0 (Ethernet) */
|
||||
IOPORT.PFENET.BYTE = 0x9A;
|
||||
#endif /* ETH_MODE_SEL */
|
||||
#if ETH_MODE_SEL == ETH_RMII_MODE
|
||||
/* EE=1, PHYMODE=0, ENETE3=0, ENETE2=0, ENETE1=1, ENETE0=0 (Ethernet) */
|
||||
IOPORT.PFENET.BYTE = 0x82;
|
||||
#endif /* ETH_MODE_SEL */
|
||||
/*-------------------------------------------*/
|
||||
/* Input Buffer Control Register (ICR) */
|
||||
/*-------------------------------------------*/
|
||||
#if ETH_MODE_SEL == ETH_MII_MODE
|
||||
/* P54=1 Set ET_LINKSTA input */
|
||||
PORT5.ICR.BIT.B4 = 1;
|
||||
/* P71=1 Set ET_MDIO input */
|
||||
PORT7.ICR.BIT.B1 = 1;
|
||||
/* P74=1 Set ET_ERXD1 input */
|
||||
PORT7.ICR.BIT.B4 = 1;
|
||||
/* P75=1 Set ET_ERXD0 input */
|
||||
PORT7.ICR.BIT.B5 = 1;
|
||||
/* P76=1 Set ET_RX_CLK input */
|
||||
PORT7.ICR.BIT.B6 = 1;
|
||||
/* P77=1 Set ET_RX_ER input */
|
||||
PORT7.ICR.BIT.B7 = 1;
|
||||
/* P83=1 Set ET_CRS input */
|
||||
PORT8.ICR.BIT.B3 = 1;
|
||||
/* PC0=1 Set ET_ERXD3 input */
|
||||
PORTC.ICR.BIT.B0 = 1;
|
||||
/* PC1=1 Set ET_ERXD2 input */
|
||||
PORTC.ICR.BIT.B1 = 1;
|
||||
/* PC2=1 Set ET_RX_DV input */
|
||||
PORTC.ICR.BIT.B2 = 1;
|
||||
/* PC4=1 Set EX_TX_CLK input */
|
||||
PORTC.ICR.BIT.B4 = 1;
|
||||
/* PC7=1 Set ET_COL input */
|
||||
PORTC.ICR.BIT.B7 = 1;
|
||||
#endif /* ETH_MODE_SEL */
|
||||
#if ETH_MODE_SEL == ETH_RMII_MODE
|
||||
/* P54=1 Set ET_LINKSTA input */
|
||||
PORT5.ICR.BIT.B4 = 1;
|
||||
/* P71=1 Set ET_MDIO input */
|
||||
PORT7.ICR.BIT.B1 = 1;
|
||||
/* P74=1 Set RMII_RXD1 input */
|
||||
PORT7.ICR.BIT.B4 = 1;
|
||||
/* P75=1 Set RMII_RXD0 input */
|
||||
PORT7.ICR.BIT.B5 = 1;
|
||||
/* P76=1 Set REF50CLK input */
|
||||
PORT7.ICR.BIT.B6 = 1;
|
||||
/* P77=1 Set RMII_RX_ER input */
|
||||
PORT7.ICR.BIT.B7 = 1;
|
||||
/* P83=1 Set RMII_CRS_DV input */
|
||||
PORT8.ICR.BIT.B3 = 1;
|
||||
#endif /* ETH_MODE_SEL */
|
||||
|
||||
/* Configure LED 0-5 pin settings */
|
||||
PORT0.DR.BIT.B2 = 1;
|
||||
PORT0.DR.BIT.B3 = 1;
|
||||
PORT0.DR.BIT.B5 = 1;
|
||||
PORT3.DR.BIT.B4 = 1;
|
||||
PORT6.DR.BIT.B0 = 1;
|
||||
PORT7.DR.BIT.B3 = 1;
|
||||
PORT0.DDR.BIT.B2 = 1;
|
||||
PORT0.DDR.BIT.B3 = 1;
|
||||
PORT0.DDR.BIT.B5 = 1;
|
||||
PORT3.DDR.BIT.B4 = 1;
|
||||
PORT6.DDR.BIT.B0 = 1;
|
||||
PORT7.DDR.BIT.B3 = 1;
|
||||
|
||||
/* Configure SW 1-3 pin settings */
|
||||
PORT0.DDR.BIT.B0 = 0;
|
||||
PORT0.DDR.BIT.B1 = 0;
|
||||
PORT0.DDR.BIT.B7 = 0;
|
||||
PORT0.ICR.BIT.B0 = 1;
|
||||
PORT0.ICR.BIT.B1 = 1;
|
||||
PORT0.ICR.BIT.B7 = 1;
|
||||
|
||||
#if INCLUDE_LCD == 1
|
||||
/* Set LCD pins as outputs */
|
||||
/* LCD-RS */
|
||||
PORT8.DDR.BIT.B4 = 1;
|
||||
/* LCD-EN */
|
||||
PORT8.DDR.BIT.B5 = 1;
|
||||
/*LCD-data */
|
||||
PORT9.DDR.BYTE = 0xF0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Function Name: io_set_cpg
|
||||
* Description : Sets up operating speed
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
******************************************************************************/
|
||||
void io_set_cpg(void)
|
||||
{
|
||||
/* Set CPU PLL operating frequencies. Changes to the peripheral clock will require
|
||||
changes to the debugger and flash kernel BRR settings. */
|
||||
|
||||
/* ==== CPG setting ==== */
|
||||
SYSTEM.SCKCR.LONG = 0x00020100; /* Clockin = 12MHz */
|
||||
/* I Clock = 96MHz, B Clock = 24MHz, */
|
||||
/* P Clock = 48MHz */
|
||||
|
||||
/* Configure LED 0-5 pins as outputs */
|
||||
LED0 = LED_OFF;
|
||||
LED1 = LED_OFF;
|
||||
LED2 = LED_OFF;
|
||||
LED3 = LED_OFF;
|
||||
LED4 = LED_OFF;
|
||||
LED5 = LED_OFF;
|
||||
LED0_DDR = 1;
|
||||
LED1_DDR = 1;
|
||||
LED2_DDR = 1;
|
||||
LED3_DDR = 1;
|
||||
LED4_DDR = 1;
|
||||
LED5_DDR = 1;
|
||||
|
||||
/* Configure SW 1-3 pins as inputs */
|
||||
SW1_DDR = 0;
|
||||
SW2_DDR = 0;
|
||||
SW3_DDR = 0;
|
||||
SW1_ICR = 1;
|
||||
SW2_ICR = 1;
|
||||
SW3_ICR = 1;
|
||||
|
||||
|
||||
/* Configure LCD pins as outputs - uncomment this if an LCD is present.
|
||||
LCD_RS_DDR = 1;
|
||||
LCD_EN_DDR = 1;
|
||||
LCD_DATA_DDR = 0xF0; */
|
||||
|
||||
/* Initialize display - uncomment this if an LCD is present.
|
||||
InitialiseDisplay(); */
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ void PowerON_Reset_PC(void)
|
|||
|
||||
_INITSCT();
|
||||
|
||||
_INIT_IOLIB(); // Use SIM I/O
|
||||
// _INIT_IOLIB(); // Use SIM I/O
|
||||
|
||||
// errno=0; // Remove the comment when you use errno
|
||||
// srand((_UINT)1); // Remove the comment when you use rand()
|
||||
|
@ -108,7 +108,7 @@ void PowerON_Reset_PC(void)
|
|||
|
||||
main();
|
||||
|
||||
_CLOSEALL(); // Use SIM I/O
|
||||
// _CLOSEALL(); // Use SIM I/O
|
||||
|
||||
// _CALL_END(); // Remove the comment when you use global class object
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue