⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hwsetup.c

📁 Data logger Power transision function switch among different power modes based on new Renesus microc
💻 C
字号:
/***********************************************************************************
FILE NAME  		hwsetup.c
DESCRIPTION		Hardware Setup functions.
		Initialise the RSK hardware.

Copyright   : 2006 Renesas Technology Europe Ltd.
Copyright   : 2006 Renesas Technology Corporation.
All Rights Reserved
***********************************************************************************/

/***********************************************************************************
Revision History
DD.MM.YYYY OSO-UID Description
24.05.2006 RTE-VNA First Release
***********************************************************************************/

/***********************************************************************************
System Includes
***********************************************************************************/
/*	Following header file provides access to intrinsic functions to control interrupt
	levels. */
#include <machine.h>

/***********************************************************************************
User Includes
***********************************************************************************/
/*	Following header file provides a structure to access all of the device registers. */
#include "iodefine.h"
/*	Following header file provides common defines for widely used items. */
#include "rsk38347def.h"
/*	Following header file provides prototype for hardware setup function. */
#include "hwsetup.h"

/***********************************************************************************
User Program Code Prototypes
***********************************************************************************/
/*	These functions are private so their prototypes are defined locally.	*/
static void ConfigureOperatingFrequency(void);
static void EnablePeripheralModules(void);
static void ConfigurePortPins(void);

/***********************************************************************************
User Program Code
***********************************************************************************/

/***********************************************************************************
Function Name : HardwareSetup
Description   :	Sets up the hardware.
		This function makes a call to initialisation functions to configure the CPU
		operating frequency, port pins & relevant on-chip modules (i.e. such as ADC,
		timer etc.) in order to setup the RSK for the main application.
Parameters    :	none
Return value  :	none
***********************************************************************************/
void HardwareSetup(void)
{    
	ConfigureOperatingFrequency();
	ConfigurePortPins();
	EnablePeripheralModules();
//	ConfigureInterrupts();
}
/***********************************************************************************
End of function HardwareSetup
***********************************************************************************/

/***********************************************************************************
Function Name : ConfigureOperatingFrequency
Description	  : Sets up CPU operating speed.
		This function configures the CPU operating frequency. 
Parameters	  : none
Return value  : none
***********************************************************************************/
void ConfigureOperatingFrequency(void)
{
/* Set CPU operating frequencies. */
	/* The CPU frequency is set to the system clock (oscillator freq./2) following
	   to reset. */
}
/***********************************************************************************
End of function ConfigureOperatingFrequency
***********************************************************************************/

/***********************************************************************************
Function Name : ConfigurePortPins
Description	  : Configures port pins of the MCU.
		This function configures the port pins so that it can be used by the 
		respective modules. It also configures the unused port pins as output low.
Parameters	  : 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. */

/* General device configuration */
	/* Settings for E8 debug module(Port 2). Configure unused port pins of port 2
	   as output low. */
	IO.PCR2 |= 0xF1;
	IO.PDR2.BYTE &= 0x70;

/* Switch Port configuration. */
	/* All pins are inputs by default. */

/*	LED & IRQ port configuration	*/
	/*	All LED pins are configured as output low & IRQ pins as inputs. Unused pins
		from port 1 & port 3 are made as output low. */	
	IO.PCR1 = 0x47;
	IO.PMR1.BYTE = 0xBC;
	IO.PDR1.BYTE = 0x43;
	
	IO.PMR3.BYTE = 0x09;
	IO.PCR3 = 0xFF;
	IO.PDR3.BYTE = 0x02;

/* Settings for SCI3_2 pins */
	/* RX <- input, TX <- output & CLK <- output. */
	IO.PCR4 = 0xFD;

/* Settings for LCD */
	/* All segment & COMMON pins are configures as output low. */
	pc5=pc6=pc7=pc8=pc9=pca=0xFF;
	p5=p6=p7=p8=p9=pa=0x00;

	/*	No need to configure Ports B & C as both are 'Input Only' ports.	*/
}
/***********************************************************************************
End of function ConfigurePortPins
***********************************************************************************/

/***********************************************************************************
Function Name : EnablePeripheralModules
Description   : Enables Peripheral Modules before use.
		This function enables the on-chip modules used by the main application.
Parameters	  : none
Return value  : none
***********************************************************************************/
void EnablePeripheralModules(void)
{
	/*	All modules are active following to reset.	*/
}
/***********************************************************************************
End of function EnablePeripheralModules
***********************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -