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

📄 pcu.h

📁 arm(str710)usb功能的实现
💻 H
字号:
/****************************************Copyright (c)**************************************************
**                                      
**                                          STR710 development team
**                                          
**
**                                 http://www.appchip.com
**
**--------------文件信息--------------------------------------------------------------------------------
** 文 件 名: pcu.h
** 创 建 人: lhl
** 创建日期: 2006年5月10日
** 描    述: 该文件包含了所有pcu(电源管理)功能函数原型与所需要的常量
**
**--------------历史版本--------------------------------------------------------------------------------
** 创 建 人: lhl
** 版    本: V1.0
** 日   期: 2006年5月10日
** 描   述: 原始版本
**
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
#ifndef __PCU_H
#define __PCU_H

#include "types.h"
#include "str710.h"
#include "cpu_cfg.h"

#if EN_ARM_PCU > 0		//决定是否编译该文件

/************************************** 宏定义,常量定义 ******************************************/

#define PCU_VROK_MASK       0x1000	    //VR_OK:Voltage Regulator OK
#define PCU_MVR_MASK        0x0008      //Main Voltage Regulator
#define PCU_LPR_MASK        0x0020      //Low Power Voltage Regulator
#define PCU_WREN_MASK       0x8000      //PCU register Write Enable Bit
#define PCU_LVD_MASK        0x0100      //Low Voltage Detector
#define PCU_PWRDWN_MASK     0x0040      //Power Down Flag
#define PCU_WFI_CKSEL_MASK  0x00000002  //WFI Mode Clock Selection Bit
#define PCU_EN_HALT_MASK    0x00000800  //Halt Mode Enable Bit
#define PCU_HALT_MASK       0x0002      //Halt Mode Flag
#define PCU_STOP_EN_MASK    0x00000400  //Stop Mode Enable Bit
#define PCU_LPRWFI_MASK     0x0010      //Low Power Regulator in Wait For interrupt Mode
#define PCU_LPOWFI_MASK     0x00000001  //Low Power Mode in Wait For interrupt Mode
#define PCU_SRESEN_MASK     0x00000001  //Software Reset Enable

/**************************************  枚举类型定义  *******************************************/
typedef enum
{
  PCU_WREN = 0x8000,
  PCU_VROK = 0x1000
} PCU_FLAGS_T;

typedef enum		//Main Voltage Regulator的状态类型
{
  PCU_STABLE,
  PCU_UNSTABLE
} PCU_VR_STATUS_T;

typedef enum
{
  PCU_MVR = 0x0008,
  PCU_LPR = 0x0020
} PCU_VR_T;

typedef enum
{
  WFI_CLOCK2_16,
  WFI_EXTERNAL
} WFI_CLOCKS_T;

typedef enum
{
  PCU_SLOW,
  PCU_STOP,
  PCU_STANDBY
} LPM_MODES_T;

/************************************** 结构体类型定义  ******************************************/

/********************************** 全局外部函数原型声明 *****************************************/

/*********************************************************************************************************
;** 函数名称: PCU_GetMVRStatus
;** 功能描述: 检查Main Voltage Regulator的状态 
;** 
;** 参    数: 无
;**  
;** 返 回 值: STABLE, UNSTABLE
;**         
;** 作   者: lhl
;** 日   期: 2006年5月10日
;**-------------------------------------------------------------------------------------------------------
;** 修 改 人: 
;** 日   期: 
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
inline PCU_VR_STATUS_T  PCU_GetMVRStatus(void)
{
	return (PCU_PWRCR & PCU_VROK_MASK) == 0x00 ? PCU_UNSTABLE : PCU_STABLE;
}
/*********************************************************************************************************
;** 函数名称: PCU_GetFlagStatus
;** 功能描述: 获得PCU寄存器的标志 
;** 
;** 参    数: 无
;**  
;** 返 回 值: RESET, SET
;**         
;** 作   者: lhl
;** 日   期: 2006年5月10日
;**-------------------------------------------------------------------------------------------------------
;** 修 改 人: 
;** 日   期: 
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
inline FLAG_STATUS_T PCU_GetFlagStatus(PCU_FLAGS_T Xflag)
{
	return ( PCU_PWRCR & Xflag ) == 0x00 ? RESET : SET;
}

/*********************************************************************************************************
;** 函数名称: PCU_VRConfig
;** 功能描述: This routine is used to configure PCU voltage regultors
;** 
;** 参    数: Xvr: MVR:Main voltage Regulator  
;**           LPR: Low Power Regulator
;**           new_status:ENABLE : Enable the Voltage Regulator
;**           			DISABLE: Disable ( ByPass ) the VR
;**  
;** 返 回 值: 无
;**         
;** 作   者: lhl
;** 日   期: 2006年5月10日
;**-------------------------------------------------------------------------------------------------------
;** 修 改 人: 
;** 日   期: 
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
void PCU_VRConfig(PCU_VR_T  Xvr, CONFIG_STATUS_T  new_status);

/*********************************************************************************************************
;** 函数名称: PCU_GetVRStatus
;** 功能描述: This routine is used to get the PCU voltage regultors status
;** 
;** 参    数: MVR : Main voltage Regulator
;**           LPR : Low Power Regulator
;**  
;** 返 回 值:       ENABLE : Enable the Voltage Regulator
;**                 DISABLE: Disable ( ByPass ) the VR
;**         
;** 作   者: lhl
;** 日   期: 2006年5月10日
;**-------------------------------------------------------------------------------------------------------
;** 修 改 人: 
;** 日   期: 
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
inline CONFIG_STATUS_T PCU_GetVRStatus(PCU_VR_T  xVR)
{
	return ( PCU_PWRCR & xVR ) == 0  ? ENABLE : DISABLE;
}
/*********************************************************************************************************
;** 函数名称: PCU_LVDDisable
;** 功能描述: This routine is used to disable the Low Voltage Detector.
;** 
;** 参    数: 无
;**  
;** 返 回 值: 无
;**         
;** 作   者: lhl
;** 日   期: 2006年5月10日
;**-------------------------------------------------------------------------------------------------------
;** 修 改 人: 
;** 日   期: 
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
inline void PCU_LVDDisable (void)
{
	PCU_PWRCR |= PCU_WREN_MASK;	// Unlock Power Control Register
	PCU_PWRCR |= PCU_LVD_MASK;	// Set the LVD DIS Flag
}

/*********************************************************************************************************
;** 函数名称: PCU_GetLVDStatus
;** 功能描述: This routine is used to get the LVD new status.
;** 
;** 参    数: 无
;**  
;** 返 回 值: ENABLE, DISABLE
;**         
;** 作   者: lhl
;** 日   期: 2006年5月10日
;**-------------------------------------------------------------------------------------------------------
;** 修 改 人: 
;** 日   期: 
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
inline CONFIG_STATUS_T PCU_GetLVDStatus(void)
{
	return ( PCU_PWRCR & PCU_LVD_MASK) == 0 ? ENABLE : DISABLE;
}

/*********************************************************************************************************
;** 函数名称: PCU_WFIEnter
;** 功能描述: This routine is used to force the Device to enter in WFI mode
;** 
;** 参    数: Xclock: CLOCK2_16 : Clock2_16 as system clock for WFI mode
;**                   EXTERNAL  : external clock as system clock for WFI mode
;**
;**           Xlpr  : ENABLE : Enable Low Power Regulator during Wait For Interrupt Mode
;**                   DISABLE: Disable Low Power Regulator during Wait For Interrupt Mode

;**           Xlpm  : Enable Low Power Mode during Wait For Interrupt Mode
;**           		  DISABLE: Disable Low Power Mode during Wait For Interrupt Mode
;**  
;** 返 回 值: 无
;**         
;** 作   者: lhl
;** 日   期: 2006年5月10日
;**-------------------------------------------------------------------------------------------------------
;** 修 改 人: 
;** 日   期: 
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
void PCU_WFIEnter(WFI_CLOCKS_T Xclock, CONFIG_STATUS_T Xlpr, CONFIG_STATUS_T Xlpm);

/*********************************************************************************************************
;** 函数名称: PCU_LPMEnter
;** 功能描述: This routine is used to force the device to enter in low power modes
;** 
;** 参    数: Xmode: PCU_SLOW : Slow Mode 
;**           	     PCU_STOP : Stop Mode
;**                  PCU_STANDBY : StandBy Mode
;**  
;** 返 回 值: 无
;**         
;** 作   者: lhl
;** 日   期: 2006年5月10日
;**-------------------------------------------------------------------------------------------------------
;** 修 改 人: 
;** 日   期: 
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
void PCU_LPMEnter (LPM_MODES_T Xmode);

#endif  //EN_ARM_PCU > 0
#endif	// __PCU_H

/****************************************end of file*******************************************/

⌨️ 快捷键说明

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