ucs.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_UCS_H__
00002 #define __MSP430WARE_UCS_H__
00003 
00004 //*****************************************************************************
00005 //
00006 //The following are the defines to include the required modules for this
00007 //peripheral in msp430xgeneric.h file
00008 //
00009 //*****************************************************************************
00010 #define __MSP430_HAS_SFR__
00011 #define __MSP430_HAS_UCS__
00012 
00013 //*****************************************************************************
00014 //
00015 //The following are values that can be passed to the UCS_clockSignalInit() API
00016 //as the selectedClockSignal parameter.
00017 //
00018 //*****************************************************************************
00019 #define UCS_ACLK                0x01
00020 #define UCS_MCLK                0x02
00021 #define UCS_SMCLK               0x04
00022 #define UCS_FLLREF              0x08
00023 
00024 //*****************************************************************************
00025 //
00026 //The following along with UCS_ACLK, UCS_MCLK, UCS_SMCLK may be passed to the
00027 //UCS_clockRequestEnable() and UCS_clockRequestDisable() API
00028 //as the selectClock parameter.
00029 //
00030 //*****************************************************************************
00031 #define UCS_MODOSC              MODOSCREQEN
00032 
00033 //*****************************************************************************
00034 //
00035 //The following are values that can be passed to the UCS_clockSignalInit() API
00036 //as the clockSource parameter. UCS_VLOCLK_SELECT may not be used for
00037 //selectedClockSignal UCS_FLLREF
00038 //
00039 //*****************************************************************************
00040 #define UCS_XT1CLK_SELECT        SELM__XT1CLK
00041 #define UCS_VLOCLK_SELECT        SELM__VLOCLK
00042 #define UCS_REFOCLK_SELECT       SELM__REFOCLK
00043 #define UCS_DCOCLK_SELECT        SELM__DCOCLK
00044 #define UCS_DCOCLKDIV_SELECT     SELM__DCOCLKDIV
00045 #define UCS_XT2CLK_SELECT        SELM__XT2CLK
00046 
00047 //*****************************************************************************
00048 //
00049 //The following are values that can be passed to the UCS_clockSignalInit() API
00050 //as the clockSourceDivider parameter.
00051 //
00052 //*****************************************************************************
00053 #define UCS_CLOCK_DIVIDER_1     DIVM__1
00054 #define UCS_CLOCK_DIVIDER_2     DIVM__2
00055 #define UCS_CLOCK_DIVIDER_4     DIVM__4
00056 #define UCS_CLOCK_DIVIDER_8     DIVM__8
00057 #define UCS_CLOCK_DIVIDER_12    DIVM__32
00058 #define UCS_CLOCK_DIVIDER_16    DIVM__16
00059 #define UCS_CLOCK_DIVIDER_32    DIVM__32
00060 
00061 //*****************************************************************************
00062 //
00063 //The following are values that can be passed to the UCS_LFXT1Start(),
00064 //UCS_HFXT1Start(), UCS_LFXT1StartWithTimeout(), UCS_HFXT1StartWithTimeout()
00065 //as the xt1drive parameter.
00066 //
00067 //*****************************************************************************
00068 #define UCS_XT1_DRIVE0  XT1DRIVE_0
00069 #define UCS_XT1_DRIVE1  XT1DRIVE_1
00070 #define UCS_XT1_DRIVE2  XT1DRIVE_2
00071 #define UCS_XT1_DRIVE3  XT1DRIVE_3
00072 
00073 //*****************************************************************************
00074 //
00075 //The following are values that can be passed to the UCS_XT1_Start() API
00076 //as the highOrLowFrequency parameter.
00077 //
00078 //*****************************************************************************
00079 #define UCS_XT1_HIGH_FREQUENCY  XTS
00080 #define UCS_XT1_LOW_FREQUENCY   0x00
00081 
00082 //*****************************************************************************
00083 //
00084 //The following are values that can be passed to the UCS_XT2_Start() API
00085 //as the xt2drive parameter.
00086 //
00087 //*****************************************************************************
00088 #define UCS_XT2DRIVE_4MHZ_8MHZ       XT2DRIVE_0
00089 #define UCS_XT2DRIVE_8MHZ_16MHZ      XT2DRIVE_1
00090 #define UCS_XT2DRIVE_16MHZ_24MHZ     XT2DRIVE_2
00091 #define UCS_XT2DRIVE_24MHZ_32MHZ     XT2DRIVE_3
00092 
00093 //*****************************************************************************
00094 //
00095 //The following are values that can be passed to the UCS_faultFlagStatus() and
00096 //UCS_clearFaultFlag API as the mask parameter.
00097 //
00098 //*****************************************************************************
00099 #define UCS_XT2OFFG     XT2OFFG
00100 #define UCS_XT1HFOFFG   XT1HFOFFG
00101 #define UCS_XT1LFOFFG   XT1LFOFFG
00102 #define UCS_DCOFFG      DCOFFG
00103 
00104 //*****************************************************************************
00105 //
00106 //The following are values that can be passed to the UCS_LFXT1Start() and
00107 //UCS_LFXT1StartWithTimeout() API as the xcap parameter.
00108 //
00109 //*****************************************************************************
00110 #define UCS_XCAP_0  XCAP_0
00111 #define UCS_XCAP_1  XCAP_1
00112 #define UCS_XCAP_2  XCAP_2
00113 #define UCS_XCAP_3  XCAP_3
00114 
00115 //*****************************************************************************
00116 //
00117 //Internal very low power VLOCLK, low frequency oscillator with
00118 //10 kHz typical frequency
00119 //
00120 //*****************************************************************************
00121 #define UCS_VLOCLK_FREQUENCY    10000
00122 
00123 //*****************************************************************************
00124 //
00125 //Internal, trimmed, low-frequency oscillator with 32768 Hz typical frequency
00126 //
00127 //*****************************************************************************
00128 #define UCS_REFOCLK_FREQUENCY   32768
00129 
00130 //*****************************************************************************
00131 //
00132 //Prototypes for the APIs.
00133 //
00134 //*****************************************************************************
00135 extern void
00136 UCS_setExternalClockSource (unsigned int baseaddress,
00137     unsigned long XT1CLK_frequency,
00138     unsigned long XT2CLK_frequency
00139     );
00140 extern void
00141 UCS_clockSignalInit ( unsigned int baseaddress,
00142     unsigned char selectedClockSignal,
00143     unsigned int clockSource,
00144     unsigned char clockSourceDivider
00145     );
00146 extern void
00147 UCS_LFXT1Start ( unsigned int baseAddress,
00148     unsigned int xt1drive,
00149     unsigned char xcap
00150     );
00151 extern void
00152 UCS_HFXT1Start (
00153     unsigned int baseAddress,
00154     unsigned int xt1drive
00155     );
00156 extern void
00157 UCS_bypassXT1 ( unsigned int baseAddress,
00158     unsigned char highOrLowFrequency
00159     );
00160 extern unsigned short
00161 UCS_bypassXT1WithTimeout (
00162     unsigned int baseAddress,
00163     unsigned char highOrLowFrequency,
00164     unsigned int timeout
00165     );
00166 extern void
00167 UCS_XT1Off (unsigned int baseAddress);
00168 
00169 extern unsigned short
00170 UCS_LFXT1StartWithTimeout (
00171     unsigned int baseAddress,
00172     unsigned int xt1drive,
00173     unsigned char xcap,
00174     unsigned int timeout
00175     );
00176 extern unsigned short
00177 UCS_HFXT1StartWithTimeout (  unsigned int baseAddress,
00178     unsigned int xt1drive,
00179     unsigned int timeout
00180     );
00181 
00182 extern void UCS_XT2Start (  unsigned int baseAddress,
00183     unsigned int xt2drive
00184     );
00185 extern void UCS_bypassXT2 (  unsigned int baseAddress );
00186 
00187 extern unsigned short
00188 UCS_XT2StartWithTimeout ( unsigned int baseAddress,
00189     unsigned int xt2drive,
00190     unsigned int timeout
00191     );
00192 extern unsigned short
00193 UCS_bypassXT2WithTimeout ( unsigned int baseAddress,
00194     unsigned int timeout
00195     );
00196 extern void
00197 UCS_XT2Off (unsigned int baseAddress);
00198 
00199 extern void
00200 UCS_XT2Start (  unsigned int baseAddress,
00201     unsigned int xt2drive
00202     );
00203 extern void
00204 UCS_initFLL ( unsigned int baseAddress,
00205     unsigned int fsystem,
00206     unsigned int ratio
00207     );
00208 extern void UCS_initFLLSettle (    unsigned int baseAddress,
00209     unsigned int fsystem,
00210     unsigned int ratio
00211     );
00212 
00213 extern void UCS_enableClockRequest (    unsigned int baseAddress,
00214     unsigned char selectClock
00215     );
00216 extern void UCS_disableClockRequest (
00217     unsigned int baseAddress,
00218     unsigned char selectClock
00219     );
00220 extern unsigned char UCS_faultFlagStatus (
00221     unsigned int baseAddress,
00222     unsigned char mask
00223     );
00224 
00225 extern void UCS_clearFaultFlag (
00226     unsigned int baseAddress,
00227     unsigned char mask
00228     );
00229 extern void UCS_SMCLKOff (unsigned int baseAddress);
00230 
00231 extern void UCS_SMCLKOn (unsigned int baseAddress);
00232 extern unsigned long UCS_getACLK (unsigned int baseAddress);
00233 extern unsigned long UCS_getSMCLK (unsigned int baseAddress);
00234 extern unsigned long UCS_getMCLK (unsigned int baseAddress);
00235 extern unsigned int UCS_clearAllOscFlagsWithTimeout(unsigned int baseAddress, 
00236                                              unsigned int timeout);
00237        
00238 
00239 #endif

Copyright 2012, Texas Instruments Incorporated