2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
8 * o Redistributions of source code must retain the above copyright notice, this list
9 * of conditions and the following disclaimer.
11 * o Redistributions in binary form must reproduce the above copyright notice, this
12 * list of conditions and the following disclaimer in the documentation and/or
13 * other materials provided with the distribution.
15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include "fsl_device_registers.h"
35 #include "fsl_sim_hal_K22F51212.h"
36 #include "fsl_sim_hal.h"
38 /*******************************************************************************
40 ******************************************************************************/
42 /*! @brief CLOCK name config table for K64*/
43 const clock_name_config_t kClockNameConfigTable
[] = {
44 {false, kSystemClock
, kClockDividerOutdiv1
},
45 {false, kSystemClock
, kClockDividerOutdiv1
},
46 {false, kSystemClock
, kClockDividerOutdiv1
},
47 {false, kSystemClock
, kClockDividerOutdiv2
},
48 {false, kSystemClock
, kClockDividerOutdiv3
},
49 {false, kSystemClock
, kClockDividerOutdiv4
}
52 /*******************************************************************************
54 ******************************************************************************/
56 /*FUNCTION**********************************************************************
58 * Function Name : SIM_HAL_EnableDmaClock
59 * Description : Enable the clock for DMA module
60 * This function enables the clock for DMA moudle
62 *END**************************************************************************/
63 void SIM_HAL_EnableDmaClock(uint32_t baseAddr
, uint32_t instance
)
65 BW_SIM_SCGC7_DMA(baseAddr
, 1);
68 /*FUNCTION**********************************************************************
70 * Function Name : SIM_HAL_DisableDmaClock
71 * Description : Disable the clock for DMA module
72 * This function disables the clock for DMA moudle
74 *END**************************************************************************/
75 void SIM_HAL_DisableDmaClock(uint32_t baseAddr
, uint32_t instance
)
77 BW_SIM_SCGC7_DMA(baseAddr
, 0);
80 /*FUNCTION**********************************************************************
82 * Function Name : SIM_HAL_GetDmaGateCmd
83 * Description : Get the the clock gate state for DMA module
84 * This function will get the clock gate state for DMA moudle
86 *END**************************************************************************/
87 bool SIM_HAL_GetDmaGateCmd(uint32_t baseAddr
, uint32_t instance
)
89 return BR_SIM_SCGC7_DMA(baseAddr
);
92 /*FUNCTION**********************************************************************
94 * Function Name : SIM_HAL_EnableDmamuxClock
95 * Description : Enable the clock for DMAMUX module
96 * This function enables the clock for DMAMUX moudle
98 *END**************************************************************************/
99 void SIM_HAL_EnableDmamuxClock(uint32_t baseAddr
, uint32_t instance
)
101 BW_SIM_SCGC6_DMAMUX(baseAddr
, 1);
104 /*FUNCTION**********************************************************************
106 * Function Name : SIM_HAL_DisableDmamuxClock
107 * Description : Disable the clock for DMAMUX module
108 * This function disables the clock for DMAMUX moudle
110 *END**************************************************************************/
111 void SIM_HAL_DisableDmamuxClock(uint32_t baseAddr
, uint32_t instance
)
113 BW_SIM_SCGC6_DMAMUX(baseAddr
, 0);
116 /*FUNCTION**********************************************************************
118 * Function Name : SIM_HAL_GetDmamuxGateCmd
119 * Description : Get the the clock gate state for DMAMUX module
120 * This function will get the clock gate state for DMAMUX moudle
122 *END**************************************************************************/
123 bool SIM_HAL_GetDmamuxGateCmd(uint32_t baseAddr
, uint32_t instance
)
125 return BR_SIM_SCGC6_DMAMUX(baseAddr
);
128 /*FUNCTION**********************************************************************
130 * Function Name : SIM_HAL_EnablePortClock
131 * Description : Enable the clock for PORT module
132 * This function enables the clock for PORT moudle
134 *END**************************************************************************/
135 void SIM_HAL_EnablePortClock(uint32_t baseAddr
, uint32_t instance
)
140 BW_SIM_SCGC5_PORTA(baseAddr
, 1);
143 BW_SIM_SCGC5_PORTB(baseAddr
, 1);
146 BW_SIM_SCGC5_PORTC(baseAddr
, 1);
149 BW_SIM_SCGC5_PORTD(baseAddr
, 1);
152 BW_SIM_SCGC5_PORTE(baseAddr
, 1);
159 /*FUNCTION**********************************************************************
161 * Function Name : SIM_HAL_DisablePortClock
162 * Description : Disable the clock for PORT module
163 * This function disables the clock for PORT moudle
165 *END**************************************************************************/
166 void SIM_HAL_DisablePortClock(uint32_t baseAddr
, uint32_t instance
)
171 BW_SIM_SCGC5_PORTA(baseAddr
, 0);
174 BW_SIM_SCGC5_PORTB(baseAddr
, 0);
177 BW_SIM_SCGC5_PORTC(baseAddr
, 0);
180 BW_SIM_SCGC5_PORTD(baseAddr
, 0);
183 BW_SIM_SCGC5_PORTE(baseAddr
, 0);
190 /*FUNCTION**********************************************************************
192 * Function Name : SIM_HAL_GetPortGateCmd
193 * Description : Get the the clock gate state for PORT module
194 * This function will get the clock gate state for PORT moudle.
196 *END**************************************************************************/
197 bool SIM_HAL_GetPortGateCmd(uint32_t baseAddr
, uint32_t instance
)
199 bool retValue
= false;
204 retValue
= BR_SIM_SCGC5_PORTA(baseAddr
);
207 retValue
= BR_SIM_SCGC5_PORTB(baseAddr
);
210 retValue
= BR_SIM_SCGC5_PORTC(baseAddr
);
213 retValue
= BR_SIM_SCGC5_PORTD(baseAddr
);
216 retValue
= BR_SIM_SCGC5_PORTE(baseAddr
);
226 /*FUNCTION**********************************************************************
228 * Function Name : SIM_HAL_EnableEwmClock
229 * Description : Enable the clock for EWM module
230 * This function enables the clock for EWM moudle.
232 *END**************************************************************************/
233 void SIM_HAL_EnableEwmClock(uint32_t baseAddr
, uint32_t instance
)
235 BW_SIM_SCGC4_EWM(baseAddr
, 1);
238 /*FUNCTION**********************************************************************
240 * Function Name : SIM_HAL_DisableEwmClock
241 * Description : Disable the clock for EWM modul
242 * This function disables the clock for EWM moudle.
244 *END**************************************************************************/
245 void SIM_HAL_DisableEwmClock(uint32_t baseAddr
, uint32_t instance
)
247 BW_SIM_SCGC4_EWM(baseAddr
, 0);
250 /*FUNCTION**********************************************************************
252 * Function Name : SIM_HAL_GetEwmGateCmd
253 * Description : Get the the clock gate state for EWM module
254 * This function will get the clock gate state for EWM moudle.
256 *END**************************************************************************/
257 bool SIM_HAL_GetEwmGateCmd(uint32_t baseAddr
, uint32_t instance
)
259 return BR_SIM_SCGC4_EWM(baseAddr
);
262 /*FUNCTION**********************************************************************
264 * Function Name : SIM_HAL_EnableFlexbusClock
265 * Description : Enable the clock for FLEXBUS module
266 * This function enables the clock for FLEXBUS moudle.
268 *END**************************************************************************/
269 void SIM_HAL_EnableFlexbusClock(uint32_t baseAddr
, uint32_t instance
)
271 BW_SIM_SCGC7_FLEXBUS(baseAddr
, 1);
274 /*FUNCTION**********************************************************************
276 * Function Name : SIM_HAL_DisableFlexbusClock
277 * Description : Disable the clock for FLEXBUS module
278 * This function disables the clock for FLEXBUS moudle.
280 *END**************************************************************************/
281 void SIM_HAL_DisableFlexbusClock(uint32_t baseAddr
, uint32_t instance
)
283 BW_SIM_SCGC7_FLEXBUS(baseAddr
, 0);
286 /*FUNCTION**********************************************************************
288 * Function Name : SIM_HAL_GetFlexbusGateCmd
289 * Description : Get the the clock gate state for FLEXBUS module
290 * This function will get the clock gate state for FLEXBUS moudle.
292 *END**************************************************************************/
293 bool SIM_HAL_GetFlexbusGateCmd(uint32_t baseAddr
, uint32_t instance
)
295 return BR_SIM_SCGC7_FLEXBUS(baseAddr
);
298 /*FUNCTION**********************************************************************
300 * Function Name : SIM_HAL_EnableFtfClock
301 * Description : Enable the clock for FTF module
302 * This function enables the clock for FTF moudle.
304 *END**************************************************************************/
305 void SIM_HAL_EnableFtfClock(uint32_t baseAddr
, uint32_t instance
)
307 BW_SIM_SCGC6_FTF(baseAddr
, 1);
310 /*FUNCTION**********************************************************************
312 * Function Name : SIM_HAL_DisableFtfClock
313 * Description : Disable the clock for FTF module
314 * This function disables the clock for FTF moudle.
316 *END**************************************************************************/
317 void SIM_HAL_DisableFtfClock(uint32_t baseAddr
, uint32_t instance
)
319 BW_SIM_SCGC6_FTF(baseAddr
, 0);
322 /*FUNCTION**********************************************************************
324 * Function Name : SIM_HAL_GetFtfGateCmd
325 * Description : Get the the clock gate state for FTF module
326 * This function will get the clock gate state for FTF moudle.
328 *END**************************************************************************/
329 bool SIM_HAL_GetFtfGateCmd(uint32_t baseAddr
, uint32_t instance
)
331 return BR_SIM_SCGC6_FTF(baseAddr
);
334 /*FUNCTION**********************************************************************
336 * Function Name : SIM_HAL_EnableCrcClock
337 * Description : Enable the clock for CRC module
338 * This function enables the clock for CRC moudle.
340 *END**************************************************************************/
341 void SIM_HAL_EnableCrcClock(uint32_t baseAddr
, uint32_t instance
)
343 BW_SIM_SCGC6_CRC(baseAddr
, 1);
346 /*FUNCTION**********************************************************************
348 * Function Name : SIM_HAL_DisableCrcClock
349 * Description : Disable the clock for CRC module
350 * This function disables the clock for CRC moudle.
352 *END**************************************************************************/
353 void SIM_HAL_DisableCrcClock(uint32_t baseAddr
, uint32_t instance
)
355 BW_SIM_SCGC6_CRC(baseAddr
, 0);
358 /*FUNCTION**********************************************************************
360 * Function Name : SIM_HAL_GetCrcGateCmd
361 * Description : Get the the clock gate state for CRC module
362 * This function will get the clock gate state for CRC moudle.
364 *END**************************************************************************/
365 bool SIM_HAL_GetCrcGateCmd(uint32_t baseAddr
, uint32_t instance
)
367 return BR_SIM_SCGC6_CRC(baseAddr
);
370 /*FUNCTION**********************************************************************
372 * Function Name : SIM_HAL_EnableRngaClock
373 * Description : Enable the clock for RNGA module
374 * This function enables the clock for RNGA moudle.
376 *END**************************************************************************/
377 void SIM_HAL_EnableRngaClock(uint32_t baseAddr
, uint32_t instance
)
379 BW_SIM_SCGC6_RNGA(baseAddr
, 1);
382 /*FUNCTION**********************************************************************
384 * Function Name : SIM_HAL_DisableRngaClock
385 * Description : Disable the clock for RNGA module
386 * This function disables the clock for RNGA moudle.
388 *END**************************************************************************/
389 void SIM_HAL_DisableRngaClock(uint32_t baseAddr
, uint32_t instance
)
391 BW_SIM_SCGC6_RNGA(baseAddr
, 0);
394 /*FUNCTION**********************************************************************
396 * Function Name : SIM_HAL_GetRngaGateCmd
397 * Description : Get the the clock gate state for RNGA module
398 * This function will get the clock gate state for RNGA moudle.
400 *END**************************************************************************/
401 bool SIM_HAL_GetRngaGateCmd(uint32_t baseAddr
, uint32_t instance
)
403 return BR_SIM_SCGC6_RNGA(baseAddr
);
406 /*FUNCTION**********************************************************************
408 * Function Name : SIM_HAL_EnableAdcClock
409 * Description : Enable the clock for ADC module
410 * This function enables the clock for ADC moudle
412 *END**************************************************************************/
413 void SIM_HAL_EnableAdcClock(uint32_t baseAddr
, uint32_t instance
)
418 BW_SIM_SCGC6_ADC0(baseAddr
, 1);
421 BW_SIM_SCGC6_ADC1(baseAddr
, 1);
428 /*FUNCTION**********************************************************************
430 * Function Name : SIM_HAL_DisableAdcClock
431 * Description : Disable the clock for ADC module
432 * This function disables the clock for ADC moudle
434 *END**************************************************************************/
435 void SIM_HAL_DisableAdcClock(uint32_t baseAddr
, uint32_t instance
)
440 BW_SIM_SCGC6_ADC0(baseAddr
, 0);
443 BW_SIM_SCGC6_ADC1(baseAddr
, 0);
450 /*FUNCTION**********************************************************************
452 * Function Name : SIM_HAL_GetAdcGateCmd
453 * Description : Get the the clock gate state for ADC module
454 * This function will get the clock gate state for ADC moudle.
456 *END**************************************************************************/
457 bool SIM_HAL_GetAdcGateCmd(uint32_t baseAddr
, uint32_t instance
)
459 bool retValue
= false;
464 retValue
= BR_SIM_SCGC6_ADC0(baseAddr
);
467 retValue
= BR_SIM_SCGC6_ADC1(baseAddr
);
477 /*FUNCTION**********************************************************************
479 * Function Name : SIM_HAL_EnableCmpClock
480 * Description : Enable the clock for CMP module
481 * This function enables the clock for CMP moudle
483 *END**************************************************************************/
484 void SIM_HAL_EnableCmpClock(uint32_t baseAddr
, uint32_t instance
)
486 BW_SIM_SCGC4_CMP(baseAddr
, 1);
489 /*FUNCTION**********************************************************************
491 * Function Name : SIM_HAL_DisableCmpClock
492 * Description : Disable the clock for CMP module
493 * This function disables the clock for CMP moudle
495 *END**************************************************************************/
496 void SIM_HAL_DisableCmpClock(uint32_t baseAddr
, uint32_t instance
)
498 BW_SIM_SCGC4_CMP(baseAddr
, 0);
501 /*FUNCTION**********************************************************************
503 * Function Name : SIM_HAL_GetCmpGateCmd
504 * Description : Get the the clock gate state for CMP module
505 * This function will get the clock gate state for CMP moudle.
507 *END**************************************************************************/
508 bool SIM_HAL_GetCmpGateCmd(uint32_t baseAddr
, uint32_t instance
)
510 return BR_SIM_SCGC4_CMP(baseAddr
);
513 /*FUNCTION**********************************************************************
515 * Function Name : SIM_HAL_EnableDacClock
516 * Description : Enable the clock for DAC module
517 * This function enables the clock for DAC moudle
519 *END**************************************************************************/
520 void SIM_HAL_EnableDacClock(uint32_t baseAddr
, uint32_t instance
)
525 BW_SIM_SCGC6_DAC0(baseAddr
, 1);
528 BW_SIM_SCGC6_DAC1(baseAddr
, 1);
535 /*FUNCTION**********************************************************************
537 * Function Name : SIM_HAL_DisableDacClock
538 * Description : Disable the clock for DAC module
539 * This function disables the clock for DAC moudle
541 *END**************************************************************************/
542 void SIM_HAL_DisableDacClock(uint32_t baseAddr
, uint32_t instance
)
547 BW_SIM_SCGC6_DAC0(baseAddr
, 0);
550 BW_SIM_SCGC6_DAC1(baseAddr
, 0);
557 /*FUNCTION**********************************************************************
559 * Function Name : SIM_HAL_GetDacGateCmd
560 * Description : Get the the clock gate state for DAC module
561 * This function will get the clock gate state for DAC moudle.
563 *END**************************************************************************/
564 bool SIM_HAL_GetDacGateCmd(uint32_t baseAddr
, uint32_t instance
)
566 bool retValue
= false;
571 retValue
= BR_SIM_SCGC6_DAC0(baseAddr
);
574 retValue
= BR_SIM_SCGC6_DAC1(baseAddr
);
584 /*FUNCTION**********************************************************************
586 * Function Name : SIM_HAL_EnableVrefClock
587 * Description : Enable the clock for VREF module
588 * This function enables the clock for VREF moudle
590 *END**************************************************************************/
591 void SIM_HAL_EnableVrefClock(uint32_t baseAddr
, uint32_t instance
)
593 BW_SIM_SCGC4_VREF(baseAddr
, 1);
596 /*FUNCTION**********************************************************************
598 * Function Name : SIM_HAL_DisableVrefClock
599 * Description : Disable the clock for VREF module
600 * This function disables the clock for VREF moudle
602 *END**************************************************************************/
603 void SIM_HAL_DisableVrefClock(uint32_t baseAddr
, uint32_t instance
)
605 BW_SIM_SCGC4_VREF(baseAddr
, 0);
608 /*FUNCTION**********************************************************************
610 * Function Name : SIM_HAL_GetVrefGateCmd
611 * Description : Get the the clock gate state for VREF module
612 * This function will get the clock gate state for VREF moudle.
614 *END**************************************************************************/
615 bool SIM_HAL_GetVrefGateCmd(uint32_t baseAddr
, uint32_t instance
)
617 return BR_SIM_SCGC4_VREF(baseAddr
);
620 /*FUNCTION**********************************************************************
622 * Function Name : SIM_HAL_EnableSaiClock
623 * Description : Enable the clock for SAI module
624 * This function enables the clock for SAI moudle
626 *END**************************************************************************/
627 void SIM_HAL_EnableSaiClock(uint32_t baseAddr
, uint32_t instance
)
629 BW_SIM_SCGC6_I2S(baseAddr
, 1);
632 /*FUNCTION**********************************************************************
634 * Function Name : SIM_HAL_DisableSaiClock
635 * Description : Disable the clock for SAI module
636 * This function disables the clock for SAI moudle
638 *END**************************************************************************/
639 void SIM_HAL_DisableSaiClock(uint32_t baseAddr
, uint32_t instance
)
641 BW_SIM_SCGC6_I2S(baseAddr
, 0);
644 /*FUNCTION**********************************************************************
646 * Function Name : SIM_HAL_GetSaiGateCmd
647 * Description : Get the the clock gate state for SAI module
648 * This function will get the clock gate state for SAI moudle.
650 *END**************************************************************************/
651 bool SIM_HAL_GetSaiGateCmd(uint32_t baseAddr
, uint32_t instance
)
653 return BR_SIM_SCGC6_I2S(baseAddr
);
656 /*FUNCTION**********************************************************************
658 * Function Name : SIM_HAL_EnablePdbClock
659 * Description : Enable the clock for PDB module
660 * This function enables the clock for PDB moudle
662 *END**************************************************************************/
663 void SIM_HAL_EnablePdbClock(uint32_t baseAddr
, uint32_t instance
)
665 BW_SIM_SCGC6_PDB(baseAddr
, 1);
668 /*FUNCTION**********************************************************************
670 * Function Name : SIM_HAL_DisablePdbClock
671 * Description : Disable the clock for PDB module
672 * This function disables the clock for PDB moudle
674 *END**************************************************************************/
675 void SIM_HAL_DisablePdbClock(uint32_t baseAddr
, uint32_t instance
)
677 BW_SIM_SCGC6_PDB(baseAddr
, 0);
680 /*FUNCTION**********************************************************************
682 * Function Name : SIM_HAL_GetPdbGateCmd
683 * Description : Get the the clock gate state for PDB module
684 * This function will get the clock gate state for PDB moudle.
686 *END**************************************************************************/
687 bool SIM_HAL_GetPdbGateCmd(uint32_t baseAddr
, uint32_t instance
)
689 return BR_SIM_SCGC6_PDB(baseAddr
);
692 /*FUNCTION**********************************************************************
694 * Function Name : SIM_HAL_EnableFtmClock
695 * Description : Enable the clock for FTM module
696 * This function enables the clock for FTM moudle
698 *END**************************************************************************/
699 void SIM_HAL_EnableFtmClock(uint32_t baseAddr
, uint32_t instance
)
704 BW_SIM_SCGC6_FTM0(baseAddr
, 1);
707 BW_SIM_SCGC6_FTM1(baseAddr
, 1);
710 BW_SIM_SCGC6_FTM2(baseAddr
, 1);
713 BW_SIM_SCGC6_FTM3(baseAddr
, 1);
720 /*FUNCTION**********************************************************************
722 * Function Name : SIM_HAL_DisableFtmClock
723 * Description : Disable the clock for FTM module
724 * This function disables the clock for FTM moudle
726 *END**************************************************************************/
727 void SIM_HAL_DisableFtmClock(uint32_t baseAddr
, uint32_t instance
)
732 BW_SIM_SCGC6_FTM0(baseAddr
, 0);
735 BW_SIM_SCGC6_FTM1(baseAddr
, 0);
738 BW_SIM_SCGC6_FTM2(baseAddr
, 0);
741 BW_SIM_SCGC6_FTM3(baseAddr
, 0);
748 /*FUNCTION**********************************************************************
750 * Function Name : SIM_HAL_GetFtmGateCmd
751 * Description : Get the the clock gate state for FTM module
752 * This function will get the clock gate state for FTM moudle.
754 *END**************************************************************************/
755 bool SIM_HAL_GetFtmGateCmd(uint32_t baseAddr
, uint32_t instance
)
757 bool retValue
= false;
762 retValue
= BR_SIM_SCGC6_FTM0(baseAddr
);
765 retValue
= BR_SIM_SCGC6_FTM1(baseAddr
);
768 retValue
= BR_SIM_SCGC6_FTM2(baseAddr
);
771 retValue
= BR_SIM_SCGC6_FTM3(baseAddr
);
781 /*FUNCTION**********************************************************************
783 * Function Name : SIM_HAL_EnablePitClock
784 * Description : Enable the clock for PIT module
785 * This function enables the clock for PIT moudle
787 *END**************************************************************************/
788 void SIM_HAL_EnablePitClock(uint32_t baseAddr
, uint32_t instance
)
790 BW_SIM_SCGC6_PIT(baseAddr
, 1);
793 /*FUNCTION**********************************************************************
795 * Function Name : SIM_HAL_DisablePitClock
796 * Description : Disable the clock for PIT module
797 * This function disables the clock for PIT moudle
799 *END**************************************************************************/
800 void SIM_HAL_DisablePitClock(uint32_t baseAddr
, uint32_t instance
)
802 BW_SIM_SCGC6_PIT(baseAddr
, 0);
805 /*FUNCTION**********************************************************************
807 * Function Name : SIM_HAL_GetPitGateCmd
808 * Description : Get the the clock gate state for PIT module
809 * This function will get the clock gate state for PIT moudle.
811 *END**************************************************************************/
812 bool SIM_HAL_GetPitGateCmd(uint32_t baseAddr
, uint32_t instance
)
814 return BR_SIM_SCGC6_PIT(baseAddr
);
817 /*FUNCTION**********************************************************************
819 * Function Name : SIM_HAL_EnableLptimerClock
820 * Description : Enable the clock for LPTIMER module
821 * This function enables the clock for LPTIMER moudle
823 *END**************************************************************************/
824 void SIM_HAL_EnableLptimerClock(uint32_t baseAddr
, uint32_t instance
)
826 BW_SIM_SCGC5_LPTMR(baseAddr
, 1);
829 /*FUNCTION**********************************************************************
831 * Function Name : SIM_HAL_DisableLptimerClock
832 * Description : Disable the clock for LPTIMER module
833 * This function disables the clock for LPTIMER moudle
835 *END**************************************************************************/
836 void SIM_HAL_DisableLptimerClock(uint32_t baseAddr
, uint32_t instance
)
838 BW_SIM_SCGC5_LPTMR(baseAddr
, 0);
841 /*FUNCTION**********************************************************************
843 * Function Name : SIM_HAL_GetLptimerGateCmd
844 * Description : Get the the clock gate state for LPTIMER module
845 * This function will get the clock gate state for LPTIMER moudle.
847 *END**************************************************************************/
848 bool SIM_HAL_GetLptimerGateCmd(uint32_t baseAddr
, uint32_t instance
)
850 return BR_SIM_SCGC5_LPTMR(baseAddr
);
853 /*FUNCTION**********************************************************************
855 * Function Name : SIM_HAL_EnableRtcClock
856 * Description : Enable the clock for RTC module
857 * This function enables the clock for RTC moudle
859 *END**************************************************************************/
860 void SIM_HAL_EnableRtcClock(uint32_t baseAddr
, uint32_t instance
)
862 BW_SIM_SCGC6_RTC(baseAddr
, 1);
865 /*FUNCTION**********************************************************************
867 * Function Name : SIM_HAL_DisableRtcClock
868 * Description : Disable the clock for RTC module
869 * This function disables the clock for RTC moudle
871 *END**************************************************************************/
872 void SIM_HAL_DisableRtcClock(uint32_t baseAddr
, uint32_t instance
)
874 BW_SIM_SCGC6_RTC(baseAddr
, 0);
877 /*FUNCTION**********************************************************************
879 * Function Name : SIM_HAL_GetRtcGateCmd
880 * Description : Get the the clock gate state for RTC module
881 * This function will get the clock gate state for RTC moudle.
883 *END**************************************************************************/
884 bool SIM_HAL_GetRtcGateCmd(uint32_t baseAddr
, uint32_t instance
)
886 return BR_SIM_SCGC6_RTC(baseAddr
);
889 /*FUNCTION**********************************************************************
891 * Function Name : SIM_HAL_EnableUsbClock
892 * Description : Enable the clock for USBFS module
893 * This function enables the clock for USBFS moudle
895 *END**************************************************************************/
896 void SIM_HAL_EnableUsbClock(uint32_t baseAddr
, uint32_t instance
)
898 BW_SIM_SCGC4_USBOTG(baseAddr
, 1);
901 /*FUNCTION**********************************************************************
903 * Function Name : SIM_HAL_DisableUsbClock
904 * Description : Disable the clock for USBFS module
905 * This function disables the clock for USBFS moudle
907 *END**************************************************************************/
908 void SIM_HAL_DisableUsbClock(uint32_t baseAddr
, uint32_t instance
)
910 BW_SIM_SCGC4_USBOTG(baseAddr
, 0);
913 /*FUNCTION**********************************************************************
915 * Function Name : SIM_HAL_GetUsbGateCmd
916 * Description : Get the the clock gate state for USB module
917 * This function will get the clock gate state for USB moudle.
919 *END**************************************************************************/
920 bool SIM_HAL_GetUsbGateCmd(uint32_t baseAddr
, uint32_t instance
)
922 return BR_SIM_SCGC4_USBOTG(baseAddr
);
925 /*FUNCTION**********************************************************************
927 * Function Name : SIM_HAL_EnableSpiClock
928 * Description : Enable the clock for SPI module
929 * This function enables the clock for SPI moudle
931 *END**************************************************************************/
932 void SIM_HAL_EnableSpiClock(uint32_t baseAddr
, uint32_t instance
)
937 BW_SIM_SCGC6_SPI0(baseAddr
, 1);
940 BW_SIM_SCGC6_SPI1(baseAddr
, 1);
947 /*FUNCTION**********************************************************************
949 * Function Name : SIM_HAL_DisableSpiClock
950 * Description : Disable the clock for SPI module
951 * This function disables the clock for SPI moudle
953 *END**************************************************************************/
954 void SIM_HAL_DisableSpiClock(uint32_t baseAddr
, uint32_t instance
)
959 BW_SIM_SCGC6_SPI0(baseAddr
, 0);
962 BW_SIM_SCGC6_SPI1(baseAddr
, 0);
969 /*FUNCTION**********************************************************************
971 * Function Name : SIM_HAL_GetSpiGateCmd
972 * Description : Get the the clock gate state for SPI module
973 * This function will get the clock gate state for SPI moudle.
975 *END**************************************************************************/
976 bool SIM_HAL_GetSpiGateCmd(uint32_t baseAddr
, uint32_t instance
)
978 bool retValue
= false;
983 retValue
= BR_SIM_SCGC6_SPI0(baseAddr
);
986 retValue
= BR_SIM_SCGC6_SPI1(baseAddr
);
996 /*FUNCTION**********************************************************************
998 * Function Name : SIM_HAL_EnableI2cClock
999 * Description : Enable the clock for I2C module
1000 * This function enables the clock for I2C moudle
1002 *END**************************************************************************/
1003 void SIM_HAL_EnableI2cClock(uint32_t baseAddr
, uint32_t instance
)
1008 BW_SIM_SCGC4_I2C0(baseAddr
, 1);
1011 BW_SIM_SCGC4_I2C1(baseAddr
, 1);
1018 /*FUNCTION**********************************************************************
1020 * Function Name : SIM_HAL_DisableI2cClock
1021 * Description : Disable the clock for I2C module
1022 * This function disables the clock for I2C moudle
1024 *END**************************************************************************/
1025 void SIM_HAL_DisableI2cClock(uint32_t baseAddr
, uint32_t instance
)
1030 BW_SIM_SCGC4_I2C0(baseAddr
, 0);
1033 BW_SIM_SCGC4_I2C1(baseAddr
, 0);
1040 /*FUNCTION**********************************************************************
1042 * Function Name : SIM_HAL_GetI2cGateCmd
1043 * Description : Get the the clock gate state for I2C module
1044 * This function will get the clock gate state for I2C moudle.
1046 *END**************************************************************************/
1047 bool SIM_HAL_GetI2cGateCmd(uint32_t baseAddr
, uint32_t instance
)
1049 bool retValue
= false;
1054 retValue
= BR_SIM_SCGC4_I2C0(baseAddr
);
1057 retValue
= BR_SIM_SCGC4_I2C1(baseAddr
);
1067 /*FUNCTION**********************************************************************
1069 * Function Name : SIM_HAL_EnableUartClock
1070 * Description : Enable the clock for UART module
1071 * This function enables the clock for UART moudle
1073 *END**************************************************************************/
1074 void SIM_HAL_EnableUartClock(uint32_t baseAddr
, uint32_t instance
)
1079 BW_SIM_SCGC4_UART0(baseAddr
, 1);
1082 BW_SIM_SCGC4_UART1(baseAddr
, 1);
1085 BW_SIM_SCGC4_UART2(baseAddr
, 1);
1092 /*FUNCTION**********************************************************************
1094 * Function Name : SIM_HAL_DisableUartClock
1095 * Description : Disable the clock for UART module
1096 * This function disables the clock for UART moudle
1098 *END**************************************************************************/
1099 void SIM_HAL_DisableUartClock(uint32_t baseAddr
, uint32_t instance
)
1104 BW_SIM_SCGC4_UART0(baseAddr
, 0);
1107 BW_SIM_SCGC4_UART1(baseAddr
, 0);
1110 BW_SIM_SCGC4_UART2(baseAddr
, 0);
1117 /*FUNCTION**********************************************************************
1119 * Function Name : SIM_HAL_GetUartGateCmd
1120 * Description : Get the the clock gate state for UART module
1121 * This function will get the clock gate state for UART moudle.
1123 *END**************************************************************************/
1124 bool SIM_HAL_GetUartGateCmd(uint32_t baseAddr
, uint32_t instance
)
1126 bool retValue
= false;
1131 retValue
= BR_SIM_SCGC4_UART0(baseAddr
);
1134 retValue
= BR_SIM_SCGC4_UART1(baseAddr
);
1137 retValue
= BR_SIM_SCGC4_UART2(baseAddr
);
1148 /*FUNCTION**********************************************************************
1150 * Function Name : SIM_HAL_EnableLpuartClock
1151 * Description : Enable the clock for LPUART module
1152 * This function enables the clock for LPUART moudle
1154 *END**************************************************************************/
1155 void SIM_HAL_EnableLpuartClock(uint32_t baseAddr
, uint32_t instance
)
1157 BW_SIM_SCGC6_LPUART0(baseAddr
, 1);
1160 /*FUNCTION**********************************************************************
1162 * Function Name : SIM_HAL_DisableLpuartClock
1163 * Description : Disable the clock for LPUART module
1164 * This function disables the clock for LPUART moudle
1166 *END**************************************************************************/
1167 void SIM_HAL_DisableLpuartClock(uint32_t baseAddr
, uint32_t instance
)
1169 BW_SIM_SCGC6_LPUART0(baseAddr
, 0);
1172 /*FUNCTION**********************************************************************
1174 * Function Name : SIM_HAL_GetLpuartGateCmd
1175 * Description : Get the the clock gate state for LPUART module
1176 * This function will get the clock gate state for LPUART moudle.
1178 *END**************************************************************************/
1179 bool SIM_HAL_GetLpuartGateCmd(uint32_t baseAddr
, uint32_t instance
)
1181 return BR_SIM_SCGC6_LPUART0(baseAddr
);
1184 /*******************************************************************************
1186 ******************************************************************************/