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_K64F12.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_EnableMpuClock
229 * Description : Enable the clock for MPU module
230 * This function enables the clock for MPU moudle.
232 *END**************************************************************************/
233 void SIM_HAL_EnableMpuClock(uint32_t baseAddr
, uint32_t instance
)
235 BW_SIM_SCGC7_MPU(baseAddr
, 1);
238 /*FUNCTION**********************************************************************
240 * Function Name : SIM_HAL_DisableMpuClock
241 * Description : Disable the clock for MPU module.
242 * This function disables the clock for MPU moudle.
244 *END**************************************************************************/
245 void SIM_HAL_DisableMpuClock(uint32_t baseAddr
, uint32_t instance
)
247 BW_SIM_SCGC7_MPU(baseAddr
, 0);
250 /*FUNCTION**********************************************************************
252 * Function Name : SIM_HAL_GetMpuGateCmd
253 * Description : Get the the clock gate state for MPU module
254 * This function will get the clock gate state for MPU moudl.
256 *END**************************************************************************/
257 bool SIM_HAL_GetMpuGateCmd(uint32_t baseAddr
, uint32_t instance
)
259 return BR_SIM_SCGC7_MPU(baseAddr
);
262 /*FUNCTION**********************************************************************
264 * Function Name : SIM_HAL_EnableEwmClock
265 * Description : Enable the clock for EWM module
266 * This function enables the clock for EWM moudle.
268 *END**************************************************************************/
269 void SIM_HAL_EnableEwmClock(uint32_t baseAddr
, uint32_t instance
)
271 BW_SIM_SCGC4_EWM(baseAddr
, 1);
274 /*FUNCTION**********************************************************************
276 * Function Name : SIM_HAL_DisableEwmClock
277 * Description : Disable the clock for EWM modul
278 * This function disables the clock for EWM moudle.
280 *END**************************************************************************/
281 void SIM_HAL_DisableEwmClock(uint32_t baseAddr
, uint32_t instance
)
283 BW_SIM_SCGC4_EWM(baseAddr
, 0);
286 /*FUNCTION**********************************************************************
288 * Function Name : SIM_HAL_GetEwmGateCmd
289 * Description : Get the the clock gate state for EWM module
290 * This function will get the clock gate state for EWM moudle.
292 *END**************************************************************************/
293 bool SIM_HAL_GetEwmGateCmd(uint32_t baseAddr
, uint32_t instance
)
295 return BR_SIM_SCGC4_EWM(baseAddr
);
298 /*FUNCTION**********************************************************************
300 * Function Name : SIM_HAL_EnableFlexbusClock
301 * Description : Enable the clock for FLEXBUS module
302 * This function enables the clock for FLEXBUS moudle.
304 *END**************************************************************************/
305 void SIM_HAL_EnableFlexbusClock(uint32_t baseAddr
, uint32_t instance
)
307 BW_SIM_SCGC7_FLEXBUS(baseAddr
, 1);
310 /*FUNCTION**********************************************************************
312 * Function Name : SIM_HAL_DisableFlexbusClock
313 * Description : Disable the clock for FLEXBUS module
314 * This function disables the clock for FLEXBUS moudle.
316 *END**************************************************************************/
317 void SIM_HAL_DisableFlexbusClock(uint32_t baseAddr
, uint32_t instance
)
319 BW_SIM_SCGC7_FLEXBUS(baseAddr
, 0);
322 /*FUNCTION**********************************************************************
324 * Function Name : SIM_HAL_GetFlexbusGateCmd
325 * Description : Get the the clock gate state for FLEXBUS module
326 * This function will get the clock gate state for FLEXBUS moudle.
328 *END**************************************************************************/
329 bool SIM_HAL_GetFlexbusGateCmd(uint32_t baseAddr
, uint32_t instance
)
331 return BR_SIM_SCGC7_FLEXBUS(baseAddr
);
334 /*FUNCTION**********************************************************************
336 * Function Name : SIM_HAL_EnableFtfClock
337 * Description : Enable the clock for FTF module
338 * This function enables the clock for FTF moudle.
340 *END**************************************************************************/
341 void SIM_HAL_EnableFtfClock(uint32_t baseAddr
, uint32_t instance
)
343 BW_SIM_SCGC6_FTF(baseAddr
, 1);
346 /*FUNCTION**********************************************************************
348 * Function Name : SIM_HAL_DisableFtfClock
349 * Description : Disable the clock for FTF module
350 * This function disables the clock for FTF moudle.
352 *END**************************************************************************/
353 void SIM_HAL_DisableFtfClock(uint32_t baseAddr
, uint32_t instance
)
355 BW_SIM_SCGC6_FTF(baseAddr
, 0);
358 /*FUNCTION**********************************************************************
360 * Function Name : SIM_HAL_GetFtfGateCmd
361 * Description : Get the the clock gate state for FTF module
362 * This function will get the clock gate state for FTF moudle.
364 *END**************************************************************************/
365 bool SIM_HAL_GetFtfGateCmd(uint32_t baseAddr
, uint32_t instance
)
367 return BR_SIM_SCGC6_FTF(baseAddr
);
370 /*FUNCTION**********************************************************************
372 * Function Name : SIM_HAL_EnableCrcClock
373 * Description : Enable the clock for CRC module
374 * This function enables the clock for CRC moudle.
376 *END**************************************************************************/
377 void SIM_HAL_EnableCrcClock(uint32_t baseAddr
, uint32_t instance
)
379 BW_SIM_SCGC6_CRC(baseAddr
, 1);
382 /*FUNCTION**********************************************************************
384 * Function Name : SIM_HAL_DisableCrcClock
385 * Description : Disable the clock for CRC module
386 * This function disables the clock for CRC moudle.
388 *END**************************************************************************/
389 void SIM_HAL_DisableCrcClock(uint32_t baseAddr
, uint32_t instance
)
391 BW_SIM_SCGC6_CRC(baseAddr
, 0);
394 /*FUNCTION**********************************************************************
396 * Function Name : SIM_HAL_GetCrcGateCmd
397 * Description : Get the the clock gate state for CRC module
398 * This function will get the clock gate state for CRC moudle.
400 *END**************************************************************************/
401 bool SIM_HAL_GetCrcGateCmd(uint32_t baseAddr
, uint32_t instance
)
403 return BR_SIM_SCGC6_CRC(baseAddr
);
406 /*FUNCTION**********************************************************************
408 * Function Name : SIM_HAL_EnableRngaClock
409 * Description : Enable the clock for RNGA module
410 * This function enables the clock for RNGA moudle.
412 *END**************************************************************************/
413 void SIM_HAL_EnableRngaClock(uint32_t baseAddr
, uint32_t instance
)
415 BW_SIM_SCGC6_RNGA(baseAddr
, 1);
418 /*FUNCTION**********************************************************************
420 * Function Name : SIM_HAL_DisableRngaClock
421 * Description : Disable the clock for RNGA module
422 * This function disables the clock for RNGA moudle.
424 *END**************************************************************************/
425 void SIM_HAL_DisableRngaClock(uint32_t baseAddr
, uint32_t instance
)
427 BW_SIM_SCGC6_RNGA(baseAddr
, 0);
430 /*FUNCTION**********************************************************************
432 * Function Name : SIM_HAL_GetRngaGateCmd
433 * Description : Get the the clock gate state for RNGA module
434 * This function will get the clock gate state for RNGA moudle.
436 *END**************************************************************************/
437 bool SIM_HAL_GetRngaGateCmd(uint32_t baseAddr
, uint32_t instance
)
439 return BR_SIM_SCGC6_RNGA(baseAddr
);
442 /*FUNCTION**********************************************************************
444 * Function Name : SIM_HAL_EnableAdcClock
445 * Description : Enable the clock for ADC module
446 * This function enables the clock for ADC moudle
448 *END**************************************************************************/
449 void SIM_HAL_EnableAdcClock(uint32_t baseAddr
, uint32_t instance
)
454 BW_SIM_SCGC6_ADC0(baseAddr
, 1);
457 BW_SIM_SCGC3_ADC1(baseAddr
, 1);
464 /*FUNCTION**********************************************************************
466 * Function Name : SIM_HAL_DisableAdcClock
467 * Description : Disable the clock for ADC module
468 * This function disables the clock for ADC moudle
470 *END**************************************************************************/
471 void SIM_HAL_DisableAdcClock(uint32_t baseAddr
, uint32_t instance
)
476 BW_SIM_SCGC6_ADC0(baseAddr
, 0);
479 BW_SIM_SCGC3_ADC1(baseAddr
, 0);
486 /*FUNCTION**********************************************************************
488 * Function Name : SIM_HAL_GetAdcGateCmd
489 * Description : Get the the clock gate state for ADC module
490 * This function will get the clock gate state for ADC moudle.
492 *END**************************************************************************/
493 bool SIM_HAL_GetAdcGateCmd(uint32_t baseAddr
, uint32_t instance
)
495 bool retValue
= false;
500 retValue
= BR_SIM_SCGC6_ADC0(baseAddr
);
503 retValue
= BR_SIM_SCGC3_ADC1(baseAddr
);
513 /*FUNCTION**********************************************************************
515 * Function Name : SIM_HAL_EnableCmpClock
516 * Description : Enable the clock for CMP module
517 * This function enables the clock for CMP moudle
519 *END**************************************************************************/
520 void SIM_HAL_EnableCmpClock(uint32_t baseAddr
, uint32_t instance
)
522 BW_SIM_SCGC4_CMP(baseAddr
, 1);
525 /*FUNCTION**********************************************************************
527 * Function Name : SIM_HAL_DisableCmpClock
528 * Description : Disable the clock for CMP module
529 * This function disables the clock for CMP moudle
531 *END**************************************************************************/
532 void SIM_HAL_DisableCmpClock(uint32_t baseAddr
, uint32_t instance
)
534 BW_SIM_SCGC4_CMP(baseAddr
, 0);
537 /*FUNCTION**********************************************************************
539 * Function Name : SIM_HAL_GetCmpGateCmd
540 * Description : Get the the clock gate state for CMP module
541 * This function will get the clock gate state for CMP moudle.
543 *END**************************************************************************/
544 bool SIM_HAL_GetCmpGateCmd(uint32_t baseAddr
, uint32_t instance
)
546 return BR_SIM_SCGC4_CMP(baseAddr
);
549 /*FUNCTION**********************************************************************
551 * Function Name : SIM_HAL_EnableDacClock
552 * Description : Enable the clock for DAC module
553 * This function enables the clock for DAC moudle
555 *END**************************************************************************/
556 void SIM_HAL_EnableDacClock(uint32_t baseAddr
, uint32_t instance
)
561 BW_SIM_SCGC2_DAC0(baseAddr
, 1);
564 BW_SIM_SCGC2_DAC1(baseAddr
, 1);
571 /*FUNCTION**********************************************************************
573 * Function Name : SIM_HAL_DisableDacClock
574 * Description : Disable the clock for DAC module
575 * This function disables the clock for DAC moudle
577 *END**************************************************************************/
578 void SIM_HAL_DisableDacClock(uint32_t baseAddr
, uint32_t instance
)
583 BW_SIM_SCGC2_DAC0(baseAddr
, 0);
586 BW_SIM_SCGC2_DAC1(baseAddr
, 0);
593 /*FUNCTION**********************************************************************
595 * Function Name : SIM_HAL_GetDacGateCmd
596 * Description : Get the the clock gate state for DAC module
597 * This function will get the clock gate state for DAC moudle.
599 *END**************************************************************************/
600 bool SIM_HAL_GetDacGateCmd(uint32_t baseAddr
, uint32_t instance
)
602 bool retValue
= false;
607 retValue
= BR_SIM_SCGC2_DAC0(baseAddr
);
610 retValue
= BR_SIM_SCGC2_DAC1(baseAddr
);
620 /*FUNCTION**********************************************************************
622 * Function Name : SIM_HAL_EnableVrefClock
623 * Description : Enable the clock for VREF module
624 * This function enables the clock for VREF moudle
626 *END**************************************************************************/
627 void SIM_HAL_EnableVrefClock(uint32_t baseAddr
, uint32_t instance
)
629 BW_SIM_SCGC4_VREF(baseAddr
, 1);
632 /*FUNCTION**********************************************************************
634 * Function Name : SIM_HAL_DisableVrefClock
635 * Description : Disable the clock for VREF module
636 * This function disables the clock for VREF moudle
638 *END**************************************************************************/
639 void SIM_HAL_DisableVrefClock(uint32_t baseAddr
, uint32_t instance
)
641 BW_SIM_SCGC4_VREF(baseAddr
, 0);
644 /*FUNCTION**********************************************************************
646 * Function Name : SIM_HAL_GetVrefGateCmd
647 * Description : Get the the clock gate state for VREF module
648 * This function will get the clock gate state for VREF moudle.
650 *END**************************************************************************/
651 bool SIM_HAL_GetVrefGateCmd(uint32_t baseAddr
, uint32_t instance
)
653 return BR_SIM_SCGC4_VREF(baseAddr
);
656 /*FUNCTION**********************************************************************
658 * Function Name : SIM_HAL_EnableSaiClock
659 * Description : Enable the clock for SAI module
660 * This function enables the clock for SAI moudle
662 *END**************************************************************************/
663 void SIM_HAL_EnableSaiClock(uint32_t baseAddr
, uint32_t instance
)
665 BW_SIM_SCGC6_I2S(baseAddr
, 1);
668 /*FUNCTION**********************************************************************
670 * Function Name : SIM_HAL_DisableSaiClock
671 * Description : Disable the clock for SAI module
672 * This function disables the clock for SAI moudle
674 *END**************************************************************************/
675 void SIM_HAL_DisableSaiClock(uint32_t baseAddr
, uint32_t instance
)
677 BW_SIM_SCGC6_I2S(baseAddr
, 0);
680 /*FUNCTION**********************************************************************
682 * Function Name : SIM_HAL_GetSaiGateCmd
683 * Description : Get the the clock gate state for SAI module
684 * This function will get the clock gate state for SAI moudle.
686 *END**************************************************************************/
687 bool SIM_HAL_GetSaiGateCmd(uint32_t baseAddr
, uint32_t instance
)
689 return BR_SIM_SCGC6_I2S(baseAddr
);
692 /*FUNCTION**********************************************************************
694 * Function Name : SIM_HAL_EnablePdbClock
695 * Description : Enable the clock for PDB module
696 * This function enables the clock for PDB moudle
698 *END**************************************************************************/
699 void SIM_HAL_EnablePdbClock(uint32_t baseAddr
, uint32_t instance
)
701 BW_SIM_SCGC6_PDB(baseAddr
, 1);
704 /*FUNCTION**********************************************************************
706 * Function Name : SIM_HAL_DisablePdbClock
707 * Description : Disable the clock for PDB module
708 * This function disables the clock for PDB moudle
710 *END**************************************************************************/
711 void SIM_HAL_DisablePdbClock(uint32_t baseAddr
, uint32_t instance
)
713 BW_SIM_SCGC6_PDB(baseAddr
, 0);
716 /*FUNCTION**********************************************************************
718 * Function Name : SIM_HAL_GetPdbGateCmd
719 * Description : Get the the clock gate state for PDB module
720 * This function will get the clock gate state for PDB moudle.
722 *END**************************************************************************/
723 bool SIM_HAL_GetPdbGateCmd(uint32_t baseAddr
, uint32_t instance
)
725 return BR_SIM_SCGC6_PDB(baseAddr
);
728 /*FUNCTION**********************************************************************
730 * Function Name : SIM_HAL_EnableFtmClock
731 * Description : Enable the clock for FTM module
732 * This function enables the clock for FTM moudle
734 *END**************************************************************************/
735 void SIM_HAL_EnableFtmClock(uint32_t baseAddr
, uint32_t instance
)
740 BW_SIM_SCGC6_FTM0(baseAddr
, 1);
743 BW_SIM_SCGC6_FTM1(baseAddr
, 1);
746 BW_SIM_SCGC6_FTM2(baseAddr
, 1);
749 BW_SIM_SCGC3_FTM3(baseAddr
, 1);
756 /*FUNCTION**********************************************************************
758 * Function Name : SIM_HAL_DisableFtmClock
759 * Description : Disable the clock for FTM module
760 * This function disables the clock for FTM moudle
762 *END**************************************************************************/
763 void SIM_HAL_DisableFtmClock(uint32_t baseAddr
, uint32_t instance
)
768 BW_SIM_SCGC6_FTM0(baseAddr
, 0);
771 BW_SIM_SCGC6_FTM1(baseAddr
, 0);
774 BW_SIM_SCGC6_FTM2(baseAddr
, 0);
777 BW_SIM_SCGC3_FTM3(baseAddr
, 0);
784 /*FUNCTION**********************************************************************
786 * Function Name : SIM_HAL_GetFtmGateCmd
787 * Description : Get the the clock gate state for FTM module
788 * This function will get the clock gate state for FTM moudle.
790 *END**************************************************************************/
791 bool SIM_HAL_GetFtmGateCmd(uint32_t baseAddr
, uint32_t instance
)
793 bool retValue
= false;
798 retValue
= BR_SIM_SCGC6_FTM0(baseAddr
);
801 retValue
= BR_SIM_SCGC6_FTM1(baseAddr
);
804 retValue
= BR_SIM_SCGC6_FTM2(baseAddr
);
807 retValue
= BR_SIM_SCGC3_FTM3(baseAddr
);
817 /*FUNCTION**********************************************************************
819 * Function Name : SIM_HAL_EnablePitClock
820 * Description : Enable the clock for PIT module
821 * This function enables the clock for PIT moudle
823 *END**************************************************************************/
824 void SIM_HAL_EnablePitClock(uint32_t baseAddr
, uint32_t instance
)
826 BW_SIM_SCGC6_PIT(baseAddr
, 1);
829 /*FUNCTION**********************************************************************
831 * Function Name : SIM_HAL_DisablePitClock
832 * Description : Disable the clock for PIT module
833 * This function disables the clock for PIT moudle
835 *END**************************************************************************/
836 void SIM_HAL_DisablePitClock(uint32_t baseAddr
, uint32_t instance
)
838 BW_SIM_SCGC6_PIT(baseAddr
, 0);
841 /*FUNCTION**********************************************************************
843 * Function Name : SIM_HAL_GetPitGateCmd
844 * Description : Get the the clock gate state for PIT module
845 * This function will get the clock gate state for PIT moudle.
847 *END**************************************************************************/
848 bool SIM_HAL_GetPitGateCmd(uint32_t baseAddr
, uint32_t instance
)
850 return BR_SIM_SCGC6_PIT(baseAddr
);
853 /*FUNCTION**********************************************************************
855 * Function Name : SIM_HAL_EnableLptimerClock
856 * Description : Enable the clock for LPTIMER module
857 * This function enables the clock for LPTIMER moudle
859 *END**************************************************************************/
860 void SIM_HAL_EnableLptimerClock(uint32_t baseAddr
, uint32_t instance
)
862 BW_SIM_SCGC5_LPTMR(baseAddr
, 1);
865 /*FUNCTION**********************************************************************
867 * Function Name : SIM_HAL_DisableLptimerClock
868 * Description : Disable the clock for LPTIMER module
869 * This function disables the clock for LPTIMER moudle
871 *END**************************************************************************/
872 void SIM_HAL_DisableLptimerClock(uint32_t baseAddr
, uint32_t instance
)
874 BW_SIM_SCGC5_LPTMR(baseAddr
, 0);
877 /*FUNCTION**********************************************************************
879 * Function Name : SIM_HAL_GetLptimerGateCmd
880 * Description : Get the the clock gate state for LPTIMER module
881 * This function will get the clock gate state for LPTIMER moudle.
883 *END**************************************************************************/
884 bool SIM_HAL_GetLptimerGateCmd(uint32_t baseAddr
, uint32_t instance
)
886 return BR_SIM_SCGC5_LPTMR(baseAddr
);
889 /*FUNCTION**********************************************************************
891 * Function Name : SIM_HAL_EnableCmtClock
892 * Description : Enable the clock for CMT module
893 * This function enables the clock for CMT moudle
895 *END**************************************************************************/
896 void SIM_HAL_EnableCmtClock(uint32_t baseAddr
, uint32_t instance
)
898 BW_SIM_SCGC4_CMT(baseAddr
, 1);
901 /*FUNCTION**********************************************************************
903 * Function Name : SIM_HAL_DisableCmtClock
904 * Description : Disable the clock for CMT module
905 * This function disables the clock for CMT moudle
907 *END**************************************************************************/
908 void SIM_HAL_DisableCmtClock(uint32_t baseAddr
, uint32_t instance
)
910 BW_SIM_SCGC4_CMT(baseAddr
, 0);
913 /*FUNCTION**********************************************************************
915 * Function Name : SIM_HAL_GetCmtGateCmd
916 * Description : Get the the clock gate state for CMT module
917 * This function will get the clock gate state for CMT moudle.
919 *END**************************************************************************/
920 bool SIM_HAL_GetCmtGateCmd(uint32_t baseAddr
, uint32_t instance
)
922 return BR_SIM_SCGC4_CMT(baseAddr
);
925 /*FUNCTION**********************************************************************
927 * Function Name : SIM_HAL_EnableRtcClock
928 * Description : Enable the clock for RTC module
929 * This function enables the clock for RTC moudle
931 *END**************************************************************************/
932 void SIM_HAL_EnableRtcClock(uint32_t baseAddr
, uint32_t instance
)
934 BW_SIM_SCGC6_RTC(baseAddr
, 1);
937 /*FUNCTION**********************************************************************
939 * Function Name : SIM_HAL_DisableRtcClock
940 * Description : Disable the clock for RTC module
941 * This function disables the clock for RTC moudle
943 *END**************************************************************************/
944 void SIM_HAL_DisableRtcClock(uint32_t baseAddr
, uint32_t instance
)
946 BW_SIM_SCGC6_RTC(baseAddr
, 0);
949 /*FUNCTION**********************************************************************
951 * Function Name : SIM_HAL_GetRtcGateCmd
952 * Description : Get the the clock gate state for RTC module
953 * This function will get the clock gate state for RTC moudle.
955 *END**************************************************************************/
956 bool SIM_HAL_GetRtcGateCmd(uint32_t baseAddr
, uint32_t instance
)
958 return BR_SIM_SCGC6_RTC(baseAddr
);
961 /*FUNCTION**********************************************************************
963 * Function Name : SIM_HAL_EnableEnetClock
964 * Description : Enable the clock for ENET module
965 * This function enables the clock for ENET moudle
967 *END**************************************************************************/
968 void SIM_HAL_EnableEnetClock(uint32_t baseAddr
, uint32_t instance
)
970 BW_SIM_SCGC2_ENET(baseAddr
, 1);
973 /*FUNCTION**********************************************************************
975 * Function Name : SIM_HAL_DisableEnetClock
976 * Description : Disable the clock for ENET module
977 * This function disables the clock for ENET moudle
979 *END**************************************************************************/
980 void SIM_HAL_DisableEnetClock(uint32_t baseAddr
, uint32_t instance
)
982 BW_SIM_SCGC2_ENET(baseAddr
, 0);
985 /*FUNCTION**********************************************************************
987 * Function Name : SIM_HAL_GetEnetGateCmd
988 * Description : Get the the clock gate state for ENET module
989 * This function will get the clock gate state for ENET moudle.
991 *END**************************************************************************/
992 bool SIM_HAL_GetEnetGateCmd(uint32_t baseAddr
, uint32_t instance
)
994 return BR_SIM_SCGC2_ENET(baseAddr
);
997 /*FUNCTION**********************************************************************
999 * Function Name : SIM_HAL_EnableUsbClock
1000 * Description : Enable the clock for USBFS module
1001 * This function enables the clock for USBFS moudle
1003 *END**************************************************************************/
1004 void SIM_HAL_EnableUsbClock(uint32_t baseAddr
, uint32_t instance
)
1006 BW_SIM_SCGC4_USBOTG(baseAddr
, 1);
1009 /*FUNCTION**********************************************************************
1011 * Function Name : SIM_HAL_DisableUsbClock
1012 * Description : Disable the clock for USBFS module
1013 * This function disables the clock for USBFS moudle
1015 *END**************************************************************************/
1016 void SIM_HAL_DisableUsbClock(uint32_t baseAddr
, uint32_t instance
)
1018 BW_SIM_SCGC4_USBOTG(baseAddr
, 0);
1021 /*FUNCTION**********************************************************************
1023 * Function Name : SIM_HAL_GetUsbGateCmd
1024 * Description : Get the the clock gate state for USB module
1025 * This function will get the clock gate state for USB moudle.
1027 *END**************************************************************************/
1028 bool SIM_HAL_GetUsbGateCmd(uint32_t baseAddr
, uint32_t instance
)
1030 return BR_SIM_SCGC4_USBOTG(baseAddr
);
1033 /*FUNCTION**********************************************************************
1035 * Function Name : SIM_HAL_EnableUsbdcdClock
1036 * Description : Enable the clock for USBDCD module
1037 * This function enables the clock for USBDCD moudle
1039 *END**************************************************************************/
1040 void SIM_HAL_EnableUsbdcdClock(uint32_t baseAddr
, uint32_t instance
)
1042 BW_SIM_SCGC6_USBDCD(baseAddr
, 1);
1045 /*FUNCTION**********************************************************************
1047 * Function Name : SIM_HAL_DisableUsbdcdClock
1048 * Description : Disable the clock for USBDCD module
1049 * This function disables the clock for USBDCD moudle
1051 *END**************************************************************************/
1052 void SIM_HAL_DisableUsbdcdClock(uint32_t baseAddr
, uint32_t instance
)
1054 BW_SIM_SCGC6_USBDCD(baseAddr
, 0);
1057 /*FUNCTION**********************************************************************
1059 * Function Name : SIM_HAL_GetUsbdcdGateCmd
1060 * Description : Get the the clock gate state for USBDCD module
1061 * This function will get the clock gate state for USBDCD moudle.
1063 *END**************************************************************************/
1064 bool SIM_HAL_GetUsbdcdGateCmd(uint32_t baseAddr
, uint32_t instance
)
1066 return BR_SIM_SCGC6_USBDCD(baseAddr
);
1069 /*FUNCTION**********************************************************************
1071 * Function Name : SIM_HAL_EnableFlexcanClock
1072 * Description : Enable the clock for FLEXCAN module
1073 * This function enables the clock for FLEXCAN moudle
1075 *END**************************************************************************/
1076 void SIM_HAL_EnableFlexcanClock(uint32_t baseAddr
, uint32_t instance
)
1078 BW_SIM_SCGC6_FLEXCAN0(baseAddr
, 1);
1081 /*FUNCTION**********************************************************************
1083 * Function Name : SIM_HAL_DisableFlexcanClock
1084 * Description : Disable the clock for FLEXCAN module
1085 * This function disables the clock for FLEXCAN moudle
1087 *END**************************************************************************/
1088 void SIM_HAL_DisableFlexcanClock(uint32_t baseAddr
, uint32_t instance
)
1090 BW_SIM_SCGC6_FLEXCAN0(baseAddr
, 0);
1093 /*FUNCTION**********************************************************************
1095 * Function Name : SIM_HAL_GetFlexcanGateCmd
1096 * Description : Get the the clock gate state for FLEXCAN module
1097 * This function will get the clock gate state for FLEXCAN moudle.
1099 *END**************************************************************************/
1100 bool SIM_HAL_GetFlexcanGateCmd(uint32_t baseAddr
, uint32_t instance
)
1102 return BR_SIM_SCGC6_FLEXCAN0(baseAddr
);
1105 /*FUNCTION**********************************************************************
1107 * Function Name : SIM_HAL_EnableSpiClock
1108 * Description : Enable the clock for SPI module
1109 * This function enables the clock for SPI moudle
1111 *END**************************************************************************/
1112 void SIM_HAL_EnableSpiClock(uint32_t baseAddr
, uint32_t instance
)
1117 BW_SIM_SCGC6_SPI0(baseAddr
, 1);
1120 BW_SIM_SCGC6_SPI1(baseAddr
, 1);
1123 BW_SIM_SCGC3_SPI2(baseAddr
, 1);
1130 /*FUNCTION**********************************************************************
1132 * Function Name : SIM_HAL_DisableSpiClock
1133 * Description : Disable the clock for SPI module
1134 * This function disables the clock for SPI moudle
1136 *END**************************************************************************/
1137 void SIM_HAL_DisableSpiClock(uint32_t baseAddr
, uint32_t instance
)
1142 BW_SIM_SCGC6_SPI0(baseAddr
, 0);
1145 BW_SIM_SCGC6_SPI1(baseAddr
, 0);
1148 BW_SIM_SCGC3_SPI2(baseAddr
, 0);
1155 /*FUNCTION**********************************************************************
1157 * Function Name : SIM_HAL_GetSpiGateCmd
1158 * Description : Get the the clock gate state for SPI module
1159 * This function will get the clock gate state for SPI moudle.
1161 *END**************************************************************************/
1162 bool SIM_HAL_GetSpiGateCmd(uint32_t baseAddr
, uint32_t instance
)
1164 bool retValue
= false;
1169 retValue
= BR_SIM_SCGC6_SPI0(baseAddr
);
1172 retValue
= BR_SIM_SCGC6_SPI1(baseAddr
);
1175 retValue
= BR_SIM_SCGC3_SPI2(baseAddr
);
1185 /*FUNCTION**********************************************************************
1187 * Function Name : SIM_HAL_EnableI2cClock
1188 * Description : Enable the clock for I2C module
1189 * This function enables the clock for I2C moudle
1191 *END**************************************************************************/
1192 void SIM_HAL_EnableI2cClock(uint32_t baseAddr
, uint32_t instance
)
1197 BW_SIM_SCGC4_I2C0(baseAddr
, 1);
1200 BW_SIM_SCGC4_I2C1(baseAddr
, 1);
1203 BW_SIM_SCGC1_I2C2(baseAddr
, 1);
1210 /*FUNCTION**********************************************************************
1212 * Function Name : SIM_HAL_DisableI2cClock
1213 * Description : Disable the clock for I2C module
1214 * This function disables the clock for I2C moudle
1216 *END**************************************************************************/
1217 void SIM_HAL_DisableI2cClock(uint32_t baseAddr
, uint32_t instance
)
1222 BW_SIM_SCGC4_I2C0(baseAddr
, 0);
1225 BW_SIM_SCGC4_I2C1(baseAddr
, 0);
1228 BW_SIM_SCGC1_I2C2(baseAddr
, 0);
1235 /*FUNCTION**********************************************************************
1237 * Function Name : SIM_HAL_GetI2cGateCmd
1238 * Description : Get the the clock gate state for I2C module
1239 * This function will get the clock gate state for I2C moudle.
1241 *END**************************************************************************/
1242 bool SIM_HAL_GetI2cGateCmd(uint32_t baseAddr
, uint32_t instance
)
1244 bool retValue
= false;
1249 retValue
= BR_SIM_SCGC4_I2C0(baseAddr
);
1252 retValue
= BR_SIM_SCGC4_I2C1(baseAddr
);
1255 retValue
= BR_SIM_SCGC1_I2C2(baseAddr
);
1265 /*FUNCTION**********************************************************************
1267 * Function Name : SIM_HAL_EnableUartClock
1268 * Description : Enable the clock for UART module
1269 * This function enables the clock for UART moudle
1271 *END**************************************************************************/
1272 void SIM_HAL_EnableUartClock(uint32_t baseAddr
, uint32_t instance
)
1277 BW_SIM_SCGC4_UART0(baseAddr
, 1);
1280 BW_SIM_SCGC4_UART1(baseAddr
, 1);
1283 BW_SIM_SCGC4_UART2(baseAddr
, 1);
1286 BW_SIM_SCGC4_UART3(baseAddr
, 1);
1289 BW_SIM_SCGC1_UART4(baseAddr
, 1);
1292 BW_SIM_SCGC1_UART5(baseAddr
, 1);
1299 /*FUNCTION**********************************************************************
1301 * Function Name : SIM_HAL_DisableUartClock
1302 * Description : Disable the clock for UART module
1303 * This function disables the clock for UART moudle
1305 *END**************************************************************************/
1306 void SIM_HAL_DisableUartClock(uint32_t baseAddr
, uint32_t instance
)
1311 BW_SIM_SCGC4_UART0(baseAddr
, 0);
1314 BW_SIM_SCGC4_UART1(baseAddr
, 0);
1317 BW_SIM_SCGC4_UART2(baseAddr
, 0);
1320 BW_SIM_SCGC4_UART3(baseAddr
, 0);
1323 BW_SIM_SCGC1_UART4(baseAddr
, 0);
1326 BW_SIM_SCGC1_UART5(baseAddr
, 0);
1333 /*FUNCTION**********************************************************************
1335 * Function Name : SIM_HAL_GetUartGateCmd
1336 * Description : Get the the clock gate state for UART module
1337 * This function will get the clock gate state for UART moudle.
1339 *END**************************************************************************/
1340 bool SIM_HAL_GetUartGateCmd(uint32_t baseAddr
, uint32_t instance
)
1342 bool retValue
= false;
1347 retValue
= BR_SIM_SCGC4_UART0(baseAddr
);
1350 retValue
= BR_SIM_SCGC4_UART1(baseAddr
);
1353 retValue
= BR_SIM_SCGC4_UART2(baseAddr
);
1356 retValue
= BR_SIM_SCGC4_UART3(baseAddr
);
1359 retValue
= BR_SIM_SCGC1_UART4(baseAddr
);
1362 retValue
= BR_SIM_SCGC1_UART5(baseAddr
);
1372 /*FUNCTION**********************************************************************
1374 * Function Name : SIM_HAL_EnableSdhcClock
1375 * Description : Enable the clock for SDHC module
1376 * This function enables the clock for SDHC moudle
1378 *END**************************************************************************/
1379 void SIM_HAL_EnableSdhcClock(uint32_t baseAddr
, uint32_t instance
)
1381 BW_SIM_SCGC3_SDHC(baseAddr
, 1);
1384 /*FUNCTION**********************************************************************
1386 * Function Name : SIM_HAL_DisableSdhcClock
1387 * Description : Disable the clock for SDHC module
1388 * This function disables the clock for SDHC moudle
1390 *END**************************************************************************/
1391 void SIM_HAL_DisableSdhcClock(uint32_t baseAddr
, uint32_t instance
)
1393 BW_SIM_SCGC3_SDHC(baseAddr
, 0);
1396 /*FUNCTION**********************************************************************
1398 * Function Name : SIM_HAL_GetSdhcGateCmd
1399 * Description : Get the the clock gate state for SDHC module
1400 * This function will get the clock gate state for SDHC moudle.
1402 *END**************************************************************************/
1403 bool SIM_HAL_GetSdhcGateCmd(uint32_t baseAddr
, uint32_t instance
)
1405 return BR_SIM_SCGC3_SDHC(baseAddr
);
1407 /*******************************************************************************
1409 ******************************************************************************/