55 #include <ti/devices/msp432p4xx/inc/msp.h>
62 #define CS_CLOCK_DIVIDER_1 CS_CTL1_DIVS_0
63 #define CS_CLOCK_DIVIDER_2 CS_CTL1_DIVS_1
64 #define CS_CLOCK_DIVIDER_4 CS_CTL1_DIVS_2
65 #define CS_CLOCK_DIVIDER_8 CS_CTL1_DIVS_3
66 #define CS_CLOCK_DIVIDER_16 CS_CTL1_DIVS_4
67 #define CS_CLOCK_DIVIDER_32 CS_CTL1_DIVS_5
68 #define CS_CLOCK_DIVIDER_64 CS_CTL1_DIVS_6
69 #define CS_CLOCK_DIVIDER_128 CS_CTL1_DIVS_7
71 #define CS_LFXTCLK_SELECT CS_CTL1_SELM_0
72 #define CS_HFXTCLK_SELECT CS_CTL1_SELM_5
73 #define CS_VLOCLK_SELECT CS_CTL1_SELM_1
74 #define CS_REFOCLK_SELECT CS_CTL1_SELM_2
75 #define CS_DCOCLK_SELECT CS_CTL1_SELM_3
76 #define CS_MODOSC_SELECT CS_CTL1_SELM_4
81 #define CS_ACLK_DIV_BITPOS 0x04
82 #define CS_MCLK_DIV_BITPOS 0x0C
83 #define CS_SMCLK_DIV_BITPOS 0x00
84 #define CS_HSMCLK_DIV_BITPOS 0x08
87 #define CS_ACLK_SRC_BITPOS 0x08
88 #define CS_MCLK_SRC_BITPOS 0x00
89 #define CS_SMCLK_SRC_BITPOS 0x04
90 #define CS_HSMCLK_SRC_BITPOS 0x04
93 #define CS_REFO_32KHZ 0x00
94 #define CS_REFO_128KHZ 0x01
97 #define CS_VLOCLK_FREQUENCY 10000
98 #define CS_MODCLK_FREQUENCY 24000000
101 #define CS_LFXT_FAULT CS_IE_LFXTIE
102 #define CS_HFXT_FAULT CS_IE_HFXTIE
103 #define CS_DCO_OPEN_FAULT CS_IE_DCOR_OPNIE
104 #define CS_STARTCOUNT_LFXT_FAULT CS_IE_FCNTLFIE
105 #define CS_STARTCOUNT_HFXT_FAULT CS_IE_FCNTHFIE
106 #define CS_DCO_SHORT_FAULT CS_IFG_DCOR_SHTIFG
108 #define CS_HFXT_DRIVE CS_CTL2_HFXTDRIVE
109 #define CS_HFXT_BYPASS CS_CTL2_HFXTBYPASS
111 #define CS_LFXT_DRIVE0 CS_CTL2_LFXTDRIVE_0
112 #define CS_LFXT_DRIVE1 CS_CTL2_LFXTDRIVE_1
113 #define CS_LFXT_DRIVE2 CS_CTL2_LFXTDRIVE_2
114 #define CS_LFXT_DRIVE3 CS_CTL2_LFXTDRIVE_3
115 #define CS_LFXT_BYPASS CS_CTL2_LFXTBYPASS
117 #define CS_ACLK CS_CLKEN_ACLK_EN
118 #define CS_MCLK CS_CLKEN_MCLK_EN
119 #define CS_SMCLK CS_CLKEN_SMCLK_EN
120 #define CS_HSMCLK CS_CLKEN_HSMCLK_EN
121 #define CS_BCLK CS_STAT_BCLK_READY
123 #define CS_LFXTCLK 0x01
125 #define CS_1MHZ 1000000
126 #define CS_15MHZ 1500000
127 #define CS_3MHZ 3000000
128 #define CS_4MHZ 4000000
129 #define CS_6MHZ 6000000
130 #define CS_8MHZ 8000000
131 #define CS_12MHZ 12000000
132 #define CS_16MHZ 16000000
133 #define CS_24MHZ 24000000
134 #define CS_32MHZ 32000000
135 #define CS_40MHZ 40000000
136 #define CS_48MHZ 48000000
138 #define CS_DCO_FREQUENCY_1_5 CS_CTL0_DCORSEL_0
139 #define CS_DCO_FREQUENCY_3 CS_CTL0_DCORSEL_1
140 #define CS_DCO_FREQUENCY_6 CS_CTL0_DCORSEL_2
141 #define CS_DCO_FREQUENCY_12 CS_CTL0_DCORSEL_3
142 #define CS_DCO_FREQUENCY_24 CS_CTL0_DCORSEL_4
143 #define CS_DCO_FREQUENCY_48 CS_CTL0_DCORSEL_5
145 #define CS_HFXT_FAULT_COUNTER 0x01
146 #define CS_LFXT_FAULT_COUNTER 0x02
148 #define CS_FAULT_COUNTER_4096_CYCLES CS_CTL3_FCNTLF_0
149 #define CS_FAULT_COUNTER_8192_CYCLES CS_CTL3_FCNTLF_1
150 #define CS_FAULT_COUNTER_16384_CYCLES CS_CTL3_FCNTLF_2
151 #define CS_FAULT_COUNTER_32768_CYCLES CS_CTL3_FCNTLF_3
153 #define CS_OVER32MHZ 0x01
154 #define CS_UNDER32MHZ 0x02
171 uint32_t hfxt_XT_CLK_frequency);
220 uint32_t clockSource, uint32_t clockSourceDivider);
531 uint_fast8_t freqRange);
637 uint_fast8_t countValue);
uint32_t CS_getHSMCLK(void)
Definition: cs.c:801
void CS_initClockSignal(uint32_t selectedClockSignal, uint32_t clockSource, uint32_t clockSourceDivider)
Definition: cs.c:212
uint32_t CS_getACLK(void)
Definition: cs.c:811
void CS_enableFaultCounter(uint_fast8_t counterSelect)
Definition: cs.c:842
void CS_setExternalClockSourceFrequency(uint32_t lfxt_XT_CLK_frequency, uint32_t hfxt_XT_CLK_frequency)
Definition: cs.c:205
void CS_setReferenceOscillatorFrequency(uint8_t referenceFrequency)
Definition: cs.c:513
void CS_enableInterrupt(uint32_t flags)
Definition: cs.c:927
void CS_disableDCOExternalResistor(void)
Definition: cs.c:568
void CS_enableDCOExternalResistor(void)
Definition: cs.c:528
void CS_clearInterruptFlag(uint32_t flags)
Definition: cs.c:959
bool CS_startHFXTWithTimeout(bool bypassMode, uint32_t timeout)
Definition: cs.c:340
void CS_unregisterInterrupt(void)
Definition: cs.c:983
uint32_t CS_getInterruptStatus(void)
Definition: cs.c:949
uint32_t CS_getBCLK(void)
Definition: cs.c:793
bool CS_startHFXT(bool bypassMode)
Definition: cs.c:335
void CS_setDCOExternalResistorCalibration(uint_fast8_t uiCalData, uint_fast8_t freqRange)
Definition: cs.c:539
void CS_registerInterrupt(void(*intHandler)(void))
Definition: cs.c:970
void CS_enableClockRequest(uint32_t selectClock)
Definition: cs.c:483
void CS_startFaultCounter(uint_fast8_t counterSelect, uint_fast8_t countValue)
Definition: cs.c:902
void CS_disableInterrupt(uint32_t flags)
Definition: cs.c:938
uint32_t CS_getMCLK(void)
Definition: cs.c:832
void CS_setDCOFrequency(uint32_t dcoFrequency)
Definition: cs.c:695
bool CS_startLFXT(uint32_t xtDrive)
Definition: cs.c:409
void CS_setDCOCenteredFrequency(uint32_t dcoFreq)
Definition: cs.c:579
uint32_t CS_getEnabledInterruptStatus(void)
Definition: cs.c:954
void CS_disableClockRequest(uint32_t selectClock)
Definition: cs.c:498
void CS_resetFaultCounter(uint_fast8_t counterSelect)
Definition: cs.c:882
uint32_t CS_getDCOFrequency(void)
Definition: cs.c:620
bool CS_startLFXTWithTimeout(uint32_t xtDrive, uint32_t timeout)
Definition: cs.c:414
void CS_tuneDCOFrequency(int16_t tuneParameter)
Definition: cs.c:598
uint32_t CS_getSMCLK(void)
Definition: cs.c:821
void CS_disableFaultCounter(uint_fast8_t counterSelect)
Definition: cs.c:862