cs_a.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_CSA_A_H__
00002 #define __MSP430WARE_CSA_A_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_CS_A__
00012 
00013 //*****************************************************************************
00014 //
00015 //The following are values that can be passed to the CSA_clockSignalInit() API
00016 //as the selectedClockSignal parameter.
00017 //
00018 //*****************************************************************************
00019 #define CSA_ACLK                0x01
00020 #define CSA_MCLK                0x02
00021 #define CSA_SMCLK               0x04
00022 
00023 //*****************************************************************************
00024 //
00025 //The following along with CSA_ACLK, CSA_MCLK, CSA_SMCLK may be passed to the
00026 //CSA_clockRequestEnable() and CSA_clockRequestDisable() API
00027 //as the selectClock parameter.
00028 //
00029 //*****************************************************************************
00030 #define CSA_MODOSC              MODCLKREQEN
00031 
00032 //*****************************************************************************
00033 //
00034 //The following are values that can be passed to the CSA_clockSignalInit() API
00035 //as the clockSource parameter. CSA_VLOCLK_SELECT may not be used for
00036 //selectedClockSignal CSA_FLLREF
00037 //
00038 //*****************************************************************************
00039 #define CSA_VLOCLK_SELECT        SELM__VLOCLK
00040 #define CSA_DCOCLK_SELECT        SELM__DCOCLK
00041 #define CSA_LFXTCLK_SELECT              SELM__LFXTCLK
00042 #define CSA_HFXTCLK_SELECT              SELM__HFXTCLK
00043 #define CSA_LFMODOSC_SELECT             SELM__LFMODOSC
00044 #define CSA_MODOSC_SELECT               SELM__MODOSC
00045 
00046 //*****************************************************************************
00047 //
00048 //The following are values that can be passed to the CSA_clockSignalInit() API
00049 //as the clockSourceDivider parameter.
00050 //
00051 //*****************************************************************************
00052 #define CSA_CLOCK_DIVIDER_1     DIVM__1
00053 #define CSA_CLOCK_DIVIDER_2     DIVM__2
00054 #define CSA_CLOCK_DIVIDER_4     DIVM__4
00055 #define CSA_CLOCK_DIVIDER_8     DIVM__8
00056 #define CSA_CLOCK_DIVIDER_16    DIVM__16
00057 #define CSA_CLOCK_DIVIDER_32    DIVM__32
00058 
00059 
00060 //*****************************************************************************
00061 //
00062 //The following are values that can be passed to the CSA_LFXTStart(),
00063 //CSA_LFXTStartWithTimeout(), as the lfxtdrive parameter.
00064 //
00065 //*****************************************************************************
00066 #define CSA_LFXT_DRIVE0 LFXTDRIVE_0
00067 #define CSA_LFXT_DRIVE1 LFXTDRIVE_1
00068 #define CSA_LFXT_DRIVE2 LFXTDRIVE_2
00069 #define CSA_LFXT_DRIVE3 LFXTDRIVE_3
00070 
00071 
00072 //*****************************************************************************
00073 //
00074 //The following are values that can be passed to the CSA_SetDCOFreq() API
00075 //as the dcorsel parameter.
00076 //
00077 //*****************************************************************************
00078 #define CSA_DCORSEL_0   0x00
00079 #define CSA_DCORSEL_1   DCORSEL
00080 
00081 
00082 //*****************************************************************************
00083 //
00084 //The following are values that can be passed to the CSA_SetDCOFreq() API
00085 //as the dcofsel parameter.
00086 //
00087 //*****************************************************************************
00088 #define CSA_DCOFSEL_0   DCOFSEL_0
00089 #define CSA_DCOFSEL_1   DCOFSEL_1
00090 #define CSA_DCOFSEL_2   DCOFSEL_2
00091 #define CSA_DCOFSEL_3   DCOFSEL_3
00092 #define CSA_DCOFSEL_4   DCOFSEL_4
00093 #define CSA_DCOFSEL_5   DCOFSEL_5
00094 #define CSA_DCOFSEL_6   DCOFSEL_6
00095 
00096 //*****************************************************************************
00097 //
00098 //FOR FR57xx DEVICES. The following are values can be passed to CSA_XT2_Start
00099 //and CSA_XT2_StartWithTimeOut as the hfxtdtive parameter.
00100 //
00101 //*****************************************************************************
00102 #define CSA_HFXTDRIVE_4MHZ_8MHZ       HFXTDRIVE_0
00103 #define CSA_HFXTDRIVE_8MHZ_16MHZ      HFXTDRIVE_1
00104 #define CSA_HFXTDRIVE_16MHZ_24MHZ     HFXTDRIVE_2
00105 #define CSA_HFXTDRIVE_24MHZ_32MHZ     HFXTDRIVE_3
00106 
00107 
00108 //*****************************************************************************
00109 //
00110 // The following are values can be passed to CSA_HFXT_Start
00111 //and CSA_HFXT_StartWithTimeOut as the hfxtdtive parameter.
00112 //
00113 //*****************************************************************************
00114 #define CSA_HFXTDRIVE_0     HFXTDRIVE_0
00115 #define CSA_HFXTDRIVE_1     HFXTDRIVE_1
00116 #define CSA_HFXTDRIVE_2     HFXTDRIVE_2
00117 #define CSA_HFXTDRIVE_3     HFXTDRIVE_3
00118 
00119 
00120 //*****************************************************************************
00121 //
00122 //The following are values that can be passed to the CSA_faultFlagStatus() and
00123 //CSA_clearFaultFlag API as the mask parameter.
00124 //
00125 //*****************************************************************************
00126 #define CSA_XT2OFFG   XT2OFFG
00127 #define CSA_XT1OFFG   XT1OFFG
00128 
00129 //*****************************************************************************
00130 //
00131 //FOR WOLVERINE DEVICES. The following are values that can be passed to the
00132 //CSA_faultFlagStatus and CSA_clearFaultFlag as the mask parameter.
00133 //
00134 //*****************************************************************************
00135 #define CSA_LFXTOFFG            LFXTOFFG
00136 #define CSA_HFXTOFFG            HFXTOFFG
00137 
00138 //*****************************************************************************
00139 //
00140 //FOR FR57xx devices. The following are values that can be passed to the
00141 // CSA_LFXT1Start() and CSA_LFXT1StartWithTimeout() API as the lfxtdrive parameter.
00142 //
00143 //*****************************************************************************
00144 #define CSA_XT1DRIVE_0  XT1DRIVE_0
00145 #define CSA_XT1DRIVE_1  XT1DRIVE_1
00146 #define CSA_XT1DRIVE_2  XT1DRIVE_2
00147 #define CSA_XT1DRIVE_3  XT1DRIVE_3
00148 
00149 //*****************************************************************************
00150 //
00151 //FOR FR57xx devices. The following are values that can be passed to the
00152 // CSA_LFXT1Start() and CSA_LFXT1StartWithTimeout() API as the lfxtdrive parameter.
00153 //
00154 //*****************************************************************************
00155 #define CSA_LFXTDRIVE_0 LFXTDRIVE_0
00156 #define CSA_LFXTDRIVE_1 LFXTDRIVE_1
00157 #define CSA_LFXTDRIVE_2 LFXTDRIVE_2
00158 #define CSA_LFXTDRIVE_3 LFXTDRIVE_3
00159 
00160 //*****************************************************************************
00161 //
00162 //Internal very low power VLOCLK, low frequency oscillator with
00163 //10 kHz typical frequency
00164 //Internal low-power oscillator MODCLK with 5 MHz typical 
00165 //frequency and LFMODCLK is MODCLK divided by 128.
00166 //
00167 //
00168 //*****************************************************************************
00169 #define CSA_VLOCLK_FREQUENCY    10000
00170 #define CSA_MODCLK_FREQUENCY    5000000
00171 #define CSA_LFMODCLK_FREQUENCY  39062
00172 
00173 
00174 //*****************************************************************************
00175 //
00176 //The following value is used by CSA_XT1Start, CSA_bypassXT1,
00177 //CSA_XT1StartWithTimeout, CSA_bypassXT1WithTimeout on FR57xx devices to properly
00178 //set the XTS bit. This frequnecy threshold is specified in the FR5xx
00179 //User's Guide
00180 //
00181 //*****************************************************************************
00182 
00183 #define LFXT_FREQUENCY_THRESHOLD                50000
00184 
00185 
00186 //*****************************************************************************
00187 //
00188 //The following value is used by CSA_getACLK, CSA_getSMCLK, CSA_getMCLK to
00189 //determine the operating frequency based on the available DCO frequencies for
00190 //FR58xx_FR59xx devices
00191 //
00192 //*****************************************************************************
00193 #define CSA_DCO_FREQ_1  1000000
00194 #define CSA_DCO_FREQ_2  2670000
00195 #define CSA_DCO_FREQ_3  3330000
00196 #define CSA_DCO_FREQ_4  4000000
00197 #define CSA_DCO_FREQ_5  5330000
00198 #define CSA_DCO_FREQ_6  6670000
00199 #define CSA_DCO_FREQ_7  8000000
00200 #define CSA_DCO_FREQ_8  16000000
00201 
00202 //*****************************************************************************
00203 //
00204 //Prototypes for the APIs.
00205 //
00206 //*****************************************************************************
00207 extern void
00208 CSA_setExternalClockSource (unsigned int baseaddress,
00209     unsigned long LFXT_LFXT_CLK_frequency,
00210     unsigned long HFXT_HFXT_CLK_frequency
00211     );
00212 extern void
00213 CSA_clockSignalInit ( unsigned int baseaddress,
00214     unsigned char selectedClockSignal,
00215     unsigned int clockSource,
00216     unsigned int clockSourceDivider
00217     );
00218 
00219 extern void
00220 CSA_XT1Start ( unsigned int baseAddress,
00221     unsigned int lfxtdrive
00222     );
00223 
00224 extern void
00225 CSA_LFXTStart(
00226                 unsigned int baseAddress,
00227             unsigned int lfxtdrive
00228                 );
00229 
00230 extern void
00231 CSA_bypassXT1 ( unsigned int baseAddress
00232     );
00233 
00234 extern void
00235 CSA_bypassLFXT ( unsigned int baseAddress
00236     );
00237 
00238 
00239 extern unsigned short
00240 CSA_bypassXT1WithTimeout (
00241     unsigned int baseAddress,
00242     unsigned long timeout
00243     );
00244 
00245 extern unsigned short
00246 CSA_bypassLFXTWithTimeout (
00247     unsigned int baseAddress,
00248     unsigned long timeout
00249     );
00250 
00251 extern unsigned short
00252 CSA_XT1StartWithTimeout (
00253     unsigned int baseAddress,
00254     unsigned int lfxtdrive,
00255     unsigned long timeout
00256     );
00257 
00258 unsigned short
00259 CSA_LFXTStartWithTimeout(
00260                 unsigned int baseAddress,
00261             unsigned int lfxtdrive,
00262             unsigned long timeout
00263                 );
00264 
00265 extern void
00266 CSA_XT1Off (unsigned int baseAddress);
00267 
00268 extern void
00269 CSA_LFXTOff (unsigned int baseAddress);
00270 
00271 extern void CSA_XT2Start (  unsigned int baseAddress,
00272     unsigned int hfxtdtive
00273     );
00274 
00275 extern void CSA_HFXTStart (  unsigned int baseAddress,
00276     unsigned int hfxtdtive
00277     );
00278 
00279 extern void CSA_bypassXT2 (  unsigned int baseAddress );
00280 
00281 extern void CSA_bypassHFXT (  unsigned int baseAddress );
00282 
00283 extern unsigned short
00284 CSA_XT2StartWithTimeout ( unsigned int baseAddress,
00285     unsigned int hfxtdtive,
00286     unsigned long timeout
00287     );
00288 
00289 extern unsigned short
00290 CSA_HFXTStartWithTimeout ( unsigned int baseAddress,
00291     unsigned int hfxtdrive,
00292     unsigned long timeout
00293     );
00294 
00295 extern unsigned short
00296 CSA_bypassXT2WithTimeout ( unsigned int baseAddress,
00297     unsigned long timeout
00298     );
00299 
00300 extern unsigned short
00301 CSA_bypassHFXTWithTimeout ( unsigned int baseAddress,
00302     unsigned long timeout
00303     );
00304 
00305 extern void
00306 CSA_XT2Off (unsigned int baseAddress);
00307 
00308 extern void
00309 CSA_HFXTOff (unsigned int baseAddress);
00310 
00311 
00312 extern void CSA_enableClockRequest (    unsigned int baseAddress,
00313     unsigned char selectClock
00314     );
00315 extern void CSA_disableClockRequest (
00316     unsigned int baseAddress,
00317     unsigned char selectClock
00318     );
00319 extern unsigned char CSA_faultFlagStatus (
00320     unsigned int baseAddress,
00321     unsigned char mask
00322     );
00323 
00324 extern void CSA_clearFaultFlag (
00325     unsigned int baseAddress,
00326     unsigned char mask
00327     );
00328 
00329 extern unsigned long
00330 CSA_getACLK (
00331                 unsigned int baseAddress);
00332 
00333 extern unsigned long
00334 CSA_getSMCLK (
00335                 unsigned int baseAddress);
00336 
00337 extern unsigned long
00338 CSA_getMCLK (
00339                 unsigned int baseAddress);
00340 
00341 extern unsigned int
00342 CSA_clearAllOscFlagsWithTimeout(
00343                 unsigned int baseAddress,
00344         unsigned long timeout);
00345 
00346 extern void
00347 CSA_VLOoff(unsigned int baseAddress);
00348 
00349 extern void
00350 CSA_setDCOFreq(
00351                 unsigned int baseAddress,
00352                 unsigned int dcorsel,
00353                 unsigned int dcofsel);
00354 
00355 #endif

Copyright 2012, Texas Instruments Incorporated