cs.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_CS_H__
00002 #define __MSP430WARE_CS_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__
00012 
00013 //*****************************************************************************
00014 //
00015 //The following are values that can be passed to the CS_clockSignalInit() API
00016 //as the selectedClockSignal parameter.
00017 //
00018 //*****************************************************************************
00019 #define CS_ACLK                0x01
00020 #define CS_MCLK                0x02
00021 #define CS_SMCLK               0x04
00022 
00023 //*****************************************************************************
00024 //
00025 //The following along with CS_ACLK, CS_MCLK, CS_SMCLK may be passed to the
00026 //CS_clockRequestEnable() and CS_clockRequestDisable() API
00027 //as the selectClock parameter.
00028 //
00029 //*****************************************************************************
00030 #define CS_MODOSC              MODCLKREQEN
00031 
00032 //*****************************************************************************
00033 //
00034 //The following are values that can be passed to the CS_clockSignalInit() API
00035 //as the clockSource parameter. CS_VLOCLK_SELECT may not be used for
00036 //selectedClockSignal CS_FLLREF
00037 //
00038 //*****************************************************************************
00039 #define CS_XT1CLK_SELECT        SELM__XT1CLK
00040 #define CS_VLOCLK_SELECT        SELM__VLOCLK
00041 #define CS_DCOCLK_SELECT        SELM__DCOCLK
00042 #define CS_XT2CLK_SELECT        SELM__XT2CLK
00043 #define CS_MODOSC_SELECT                SELM__MODOSC
00044 
00045 //*****************************************************************************
00046 //
00047 //The following are values that can be passed to the CS_clockSignalInit() API
00048 //as the clockSourceDivider parameter.
00049 //
00050 //*****************************************************************************
00051 #define CS_CLOCK_DIVIDER_1     DIVM__1
00052 #define CS_CLOCK_DIVIDER_2     DIVM__2
00053 #define CS_CLOCK_DIVIDER_4     DIVM__4
00054 #define CS_CLOCK_DIVIDER_8     DIVM__8
00055 #define CS_CLOCK_DIVIDER_16    DIVM__16
00056 #define CS_CLOCK_DIVIDER_32    DIVM__32
00057 
00058 //*****************************************************************************
00059 //
00060 //The following are values that can be passed to the CS_LFXT1Start(),
00061 //CS_HFXT1Start(), CS_LFXT1StartWithTimeout(), CS_HFXT1StartWithTimeout()
00062 //as the xt1drive parameter.
00063 //
00064 //*****************************************************************************
00065 #define CS_XT1_DRIVE0   XT1DRIVE_0
00066 #define CS_XT1_DRIVE1   XT1DRIVE_1
00067 #define CS_XT1_DRIVE2   XT1DRIVE_2
00068 #define CS_XT1_DRIVE3   XT1DRIVE_3
00069 
00070 //*****************************************************************************
00071 //
00072 //The following are values that can be passed to the CS_SetDCOFreq() API
00073 //as the dcorsel parameter.
00074 //
00075 //*****************************************************************************
00076 #define CS_DCORSEL_0    DCOFSEL_0
00077 #define CS_DCORSEL_1    DCORSEL
00078 
00079 
00080 //*****************************************************************************
00081 //
00082 //The following are values that can be passed to the CS_SetDCOFreq() API
00083 //as the dcofsel parameter.
00084 //
00085 //*****************************************************************************
00086 #define CS_DCOFSEL_0    DCOFSEL_0
00087 #define CS_DCOFSEL_1    DCOFSEL_1
00088 #define CS_DCOFSEL_2    DCOFSEL_2
00089 #define CS_DCOFSEL_3    DCOFSEL_3
00090 
00091 //*****************************************************************************
00092 //
00093 //FOR FR57xx DEVICES. The following are values can be passed to CS_XT2_Start
00094 //and CS_XT2_StartWithTimeOut as the xt2drive parameter.
00095 //
00096 //*****************************************************************************
00097 #define CS_XT2DRIVE_4MHZ_8MHZ       XT2DRIVE_0
00098 #define CS_XT2DRIVE_8MHZ_16MHZ      XT2DRIVE_1
00099 #define CS_XT2DRIVE_16MHZ_24MHZ     XT2DRIVE_2
00100 #define CS_XT2DRIVE_24MHZ_32MHZ     XT2DRIVE_3
00101 
00102 //*****************************************************************************
00103 //
00104 //The following are values that can be passed to the CS_faultFlagStatus() and
00105 //CS_clearFaultFlag API as the mask parameter.
00106 //
00107 //*****************************************************************************
00108 #define CS_XT2OFFG   XT2OFFG
00109 #define CS_XT1OFFG   XT1OFFG
00110 
00111 //*****************************************************************************
00112 //
00113 //The following are values that can be passed to the
00114 // CS_LFXT1Start() and CS_LFXT1StartWithTimeout() API as the xt1drive parameter.
00115 //
00116 //*****************************************************************************
00117 #define CS_XT1DRIVE_0   XT1DRIVE_0
00118 #define CS_XT1DRIVE_1   XT1DRIVE_1
00119 #define CS_XT1DRIVE_2   XT1DRIVE_2
00120 #define CS_XT1DRIVE_3   XT1DRIVE_3
00121 
00122 //*****************************************************************************
00123 //
00124 //Internal very low power VLOCLK, low frequency oscillator with
00125 //10 kHz typical frequency
00126 //Internal low-power oscillator MODCLK with 5 MHz typical 
00127 //frequency and LFMODCLK is MODCLK divided by 128.
00128 //
00129 //
00130 //*****************************************************************************
00131 #define CS_VLOCLK_FREQUENCY     10000
00132 #define CS_MODCLK_FREQUENCY     5000000
00133 #define CS_LFMODCLK_FREQUENCY   39062
00134 
00135 //*****************************************************************************
00136 //
00137 //The following value is used by CS_XT1Start, CS_bypassXT1,
00138 //CS_XT1StartWithTimeout, CS_bypassXT1WithTimeout on FR57xx devices to properly
00139 //set the XTS bit. This frequnecy threshold is specified in the FR5xx
00140 //User's Guide
00141 //
00142 //*****************************************************************************
00143 
00144 #define XT1_FREQUENCY_THRESHOLD         50000
00145 
00146 
00147 //*****************************************************************************
00148 //
00149 //The following value is used by CS_getACLK, CS_getSMCLK, CS_getMCLK to
00150 //determine the operating frequency based on the available DCO frequencies for
00151 //FR57xx devices
00152 //
00153 //*****************************************************************************
00154 #define CS_DCO_FREQ_1   5330000
00155 #define CS_DCO_FREQ_2   6670000
00156 #define CS_DCO_FREQ_3   8000000
00157 #define CS_DCO_FREQ_4   16000000
00158 #define CS_DCO_FREQ_5   20000000
00159 #define CS_DCO_FREQ_6   24000000
00160 
00161 //*****************************************************************************
00162 //
00163 //Prototypes for the APIs.
00164 //
00165 //*****************************************************************************
00166 extern void
00167 CS_setExternalClockSource (unsigned int baseaddress,
00168     unsigned long XT1_LFXT_CLK_frequency,
00169     unsigned long XT2_HFXT_CLK_frequency
00170     );
00171 extern void
00172 CS_clockSignalInit ( unsigned int baseaddress,
00173     unsigned char selectedClockSignal,
00174     unsigned int clockSource,
00175     unsigned int clockSourceDivider
00176     );
00177 
00178 extern void
00179 CS_XT1Start ( unsigned int baseAddress,
00180     unsigned int xt1drive
00181     );
00182 
00183 extern void
00184 CS_bypassXT1 ( unsigned int baseAddress
00185     );
00186 
00187 extern unsigned short
00188 CS_bypassXT1WithTimeout (
00189     unsigned int baseAddress,
00190     unsigned long timeout
00191     );
00192 
00193 extern unsigned short
00194 CS_XT1StartWithTimeout (
00195     unsigned int baseAddress,
00196     unsigned int xt1drive,
00197     unsigned long timeout
00198     );
00199 extern void
00200 CS_XT1Off (unsigned int baseAddress);
00201 
00202 extern void CS_XT2Start (  unsigned int baseAddress,
00203     unsigned int xt2drive
00204     );
00205 
00206 extern void CS_bypassXT2 (  unsigned int baseAddress );
00207 
00208 extern unsigned short
00209 CS_XT2StartWithTimeout ( unsigned int baseAddress,
00210     unsigned int xt2drive,
00211     unsigned long timeout
00212     );
00213 
00214 extern unsigned short
00215 CS_bypassXT2WithTimeout ( unsigned int baseAddress,
00216     unsigned long timeout
00217     );
00218 
00219 extern void
00220 CS_XT2Off (unsigned int baseAddress);
00221 
00222 extern void CS_enableClockRequest (    unsigned int baseAddress,
00223     unsigned char selectClock
00224     );
00225 extern void CS_disableClockRequest (
00226     unsigned int baseAddress,
00227     unsigned char selectClock
00228     );
00229 extern unsigned char CS_faultFlagStatus (
00230     unsigned int baseAddress,
00231     unsigned char mask
00232     );
00233 
00234 extern void CS_clearFaultFlag (
00235     unsigned int baseAddress,
00236     unsigned char mask
00237     );
00238 
00239 extern unsigned long
00240 CS_getACLK (
00241                 unsigned int baseAddress);
00242 
00243 extern unsigned long
00244 CS_getSMCLK (
00245                 unsigned int baseAddress);
00246 
00247 extern unsigned long
00248 CS_getMCLK (
00249                 unsigned int baseAddress);
00250 
00251 extern unsigned int
00252 CS_clearAllOscFlagsWithTimeout(
00253                 unsigned int baseAddress,
00254         unsigned long timeout);
00255 
00256 extern void
00257 CS_setDCOFreq(
00258                 unsigned int baseAddress,
00259                 unsigned int dcorsel,
00260                 unsigned int dcofsel);
00261 
00262 #endif

Copyright 2012, Texas Instruments Incorporated