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

📄 pwr_configuration.h

📁 freescale的基于802.15.4的无线通讯例程
💻 H
📖 第 1 页 / 共 2 页
字号:
/************************************************************************************
* Function to handle/set the different power down states.
*
*
* (c) Copyright 2005, Freescale Semiconductor, Inc. All rights reserved.
*
* Freescale Confidential Proprietary
* Digianswer Confidential
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale.
*
***********************************************************************************/
#ifndef _PWR_CONFIG_H_
#define _PWR_CONFIG_H_

#include "PortConfig.h"

/************************************************************************************
*************************************************************************************
* Module configuration constants
*************************************************************************************
************************************************************************************/

#ifndef gMacStandAlone_d
#define gMacStandAlone_d 0
#endif /*gMacStandAlone_d*/

//-----------------------------------------------------------------------------
// To enable/disable all of the code in this PWR/PWRLib files.
//   TRUE =  1: Use PowerDown functions (Normal)
//   FALSE = 0: Don't use PowerDown. Will cut variables and code out. But
//     functions still exist. Useful for debugging and test purposes
#define cPWR_UsePowerDownMode                   1


//-----------------------------------------------------------------------------
// Version of the MAC used in project. Following possibilities exist:
//   1.05  Old version where ie. Radio OFF, AcomaDoze etc. are unsupported and
//         it will generally give poor results. Please upgrade if possible.
//   1.06  New version with full functionality (Normal and best)
#define cPWR_MACVersionUsed                     1.06


//-----------------------------------------------------------------------------
// The way that DeepSleep mode are handled. Following possibilities exist:
//   0: No DeepSleep done, but PTC application can set modes
//   1: Ext. KBI int wakeup
//   2: RTI timer wakeup every 1024mS +-30%
//   3: Ext. KBI int and RTI timer wakeup every 1024mS +-30%
//  30: Test of some stack code (Not good or valid anymore)
//  31: Test as #3 but power down only done once
//  33: Test of MCU Wait
//  34: Test of MCU Stop3
//  35: Test of MCU Stop2
//  36: Test of MCU Stop1
//  37: Test of RADIO Doze without clkout
//  38: Test of RADIO AcomaDoze without clkout
//  39: Test of RADIO Hibernate
//  40: Test of RADIO Off
#define cPWR_DeepSleepMode                      3


//-----------------------------------------------------------------------------
// The way that Sleep mode are handled. Following possibilities exist:
//   0: No Sleep done, but PTC application can set modes
//   1: Doze mode on RADIO with clock enabled (MAC 1.06 only) and WAIT on MCU
#define cPWR_SleepMode                          1


//-----------------------------------------------------------------------------
// The distance between RTI interrupts when enabled and in Stop2/3
// Following possibilities exist:  cSRTISC_IntDisabled,
// cSRTISC_Int0008ms, cSRTISC_Int0032ms, cSRTISC_Int0064ms, cSRTISC_Int0128ms,
// cSRTISC_Int0256ms, cSRTISC_Int0512ms, cSRTISC_Int1024ms
#define cPWR_RTITickTime                        7


//-----------------------------------------------------------------------------
// This number multiplied with the above cPWR_RTITickTime time gives the time
// to DeepSleep
#define cPWR_RTITicks                    3


//-----------------------------------------------------------------------------
// Enabling of external call to a procedure each time that DeepSleep are exited
//   0: Don't call any functions after DeepSleep (MAC)
//   1: Call a function after DeepSleep (Stack)
#define cPWR_CallWakeupStackProcAfterDeepSleep  1


//-----------------------------------------------------------------------------
// The extra function to call every time RTI clock run's out. Used by Stack.
#if (cPWR_CallWakeupStackProcAfterDeepSleep == 0)
  #define cPWR_DeepSleepWakeupStackProc         ;
#else
  extern void                                   DeepSleepWakeupStackProc(void);
  #define cPWR_DeepSleepWakeupStackProc         DeepSleepWakeupStackProc();  
#endif


//-----------------------------------------------------------------------------
// KBI interrupt vector and initialization enable
//   TRUE = 1: KBI interrupt vector used and KBI registers are initialized in PWRLIB(Normal)
//   FALSE= 0: KBI interrupt vector and init has to be done externally
#define cPWR_KBIInitAndVectorEnable            1


//-----------------------------------------------------------------------------
// Select if the KBI interrupt has to be enabled or disabled if the define:
// cPWR_KBIInitAndVectorEnable are TRUE
//   TRUE = 1: Also use KBI interrupt to wakeup
//   FALSE= 0: Don't use KBI int. on PTAx pins
#define cPWR_KBIWakeupEnable                   1


//-----------------------------------------------------------------------------
// Setting up the port settings when entering and exiting PowerDown
//   0: No change done to IO when entering PD (Debug)
//   1: Setup all ports (Most as outputs) when entering PD. Restoring all
//      ports using saved values. Uses 21 bytes in RAM. (Safest)
//   2: Setup all ports (Most as outputs) when entering PD (Normal). Restoring
//      all ports. Only Data part from saved values restored from preset values.
//      Uses only 7 bytes in RAM. (Normal).
#define cPWR_SetupIOWhenInPD                    0


//-----------------------------------------------------------------------------
// Whether to setup RADIO SPI port as I/O when entering PD mode
//   TRUE =  1: Use the SPI pins as outputs under PD (Normal)
//   FALSE = 0: Don't
#define cPWR_UseSPIDisable                      0


//-----------------------------------------------------------------------------
// On EVB (DIG528-2) an connector J107 can be used for debugging
//   FALSE = 0: No debug info on J107. Normal customer version. (Normal)
//   TRUE =  1: Use J107 as DEBUG port. Debug status are valid also during PD.
//   Note: A small glitch can occour when going in/out of PD.
//   J107.1  : RTI Running
//   J107.2  : PWR_CheckForAndEnterNewPowerState called/active
//   J107.3  : Available
//   J107.4  : Available
//   J107.5  : Available
//   J107.6  : Available
//   J107.7  : Available
//   J107.8  : MCU Wait called/active
//   J107.9  : MCU Stop2 called/active
//   J107.10 : MCU Stop3 called/active
#define cPWR_UseDebugOutputs                    0


//-----------------------------------------------------------------------------
// As a service to Application this variable can be created and updated
//   TRUE =  1: Use/update the PWRLib_RADIOStatus variable (Debug/Application)
//   FALSE = 0: Don't (Normal)
#define cPWR_UseRADIOStatus                     0


//-----------------------------------------------------------------------------
// As a service to Application this variable can be created and updated
//   TRUE =  1: Use/update the MCU_Status variable (Debug/Application)
//   FALSE = 0: Don't (Normal)
#define cPWR_UseMCUStatus                       0


//-----------------------------------------------------------------------------
// Whether to run RTI from internal or external oscillator
//   TRUE =  1: Use external clock for RTI timer (Untested)
//   FALSE = 0: Uses internal clock (Normal)
#define cPWR_RTIFromExternalClock               0


//-----------------------------------------------------------------------------
// The use of Low Voltage detection has the following possibilities:
//   0: Don't use Low voltage detection at all (Normal)
//   1: Use polled => Check made each time the function is called.
//   2: RTI timer used for handling when to poll LVD, according
//      to the cPWR_LVD_Ticks constant (Normal)
#define cPWR_LVD_Enable                         0


//-----------------------------------------------------------------------------
// How often to check the LVD level when cPWR_LVD_Enable == 2
// This is the number of RTI interrupts before voltage is checked (Consumes
// current and time)
#define cPWR_LVD_Ticks                          3600


//-----------------------------------------------------------------------------
// A counter value to control LEVEL 2. The value will be decremented whenever
// PWR_NODEPOWER_LEVEL_66 is valid. System will change to PWR_NODEPOWER_LEVEL_50
// when the counter reaches 0. MUST BE ADJUSTED ACCORDING TO HOW OFTEN THE LVD
// is polled (cPWR_LVD_LEVEL_50_Ticks * cPWR_LVD_Ticks * cPWR_RTITickTime).
#define cPWR_LVD_LEVEL_50_Ticks                 10


//-----------------------------------------------------------------------------
// Definitions for KBI interrupt setup (KBI1SC)
//                              .--------- KBEDG7    : 1:Rising edges/high. 0:Falling edge/low level
//                              |.-------- KBEDG6    : 1:Rising edges/high. 0:Falling edge/low level
//                              ||.------- KBEDG5    : 1:Rising edges/high. 0:Falling edge/low level
//                              |||.------ KBEDG4    : 1:Rising edges/high. 0:Falling edge/low level
//                              ||||.----- KBF       : Keyboard Int. status Flag (Readable only)
//                              |||||.---- KBACK     : Keyboard Int. Acknowledge (Writable only)
//                              ||||||.--- KBIE      : Keyboard Int. Enable
//                              |||||||.-- KBIMOD    : Keyboard Detection Mode. 1:Edge and level, 0:Edge
#define cKBI1SC               0b00000010                    // Enable Edge triggered interrupts from KBI
#define cKBI1SC_Ack           0b00000100                    // Acknowledge of int


#if (cPWR_KBIWakeupEnable)
  //-----------------------------------------------------------------------------
  // Definitions for KBI input selection if used (KBI1PE)
  //                            .--------- KBIPE7    : Enable KPI on PTA7
  //                            |.-------- KBIPE6    : Enable KPI on PTA6
  //                            ||.------- KBIPE5    : Enable KPI on PTA5
  //                            |||.------ KBIPE4    : Enable KPI on PTA4
  //                            ||||.----- KBIPE3    : Enable KPI on PTA3
  //                            |||||.---- KBIPE2    : Enable KPI on PTA2
  //                            ||||||.--- KBIPE1    : Enable KPI on PTA1
  //                            |||||||.-- KBIPE0    : Enable KPI on PTA1
  #if (gMacStandAlone_d==1)
    #define cKBI1PE         mSWITCH_MASK                    // All PTA0 to PTA7 will interrupt
  #else /*gMacStandAlone_d*/ 

⌨️ 快捷键说明

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