1 /**
2 * @file csl_pscAux.h
3 *
4 * @brief API Auxilary header file for PSC CSL
5 *
6 * \par
7 * ============================================================================
8 * @n (C) Copyright 2002-2010 Texas Instruments, Inc.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the
20 * distribution.
21 *
22 * Neither the name of Texas Instruments Incorporated nor the names of
23 * its contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 */
39 #ifndef _CSL_PSCAUX_H_
40 #define _CSL_PSCAUX_H_
42 #include <ti/csl/csl_psc.h>
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
48 /** @addtogroup CSL_PSC_FUNCTION
49 @{ */
52 /** ============================================================================
53 * @n@b CSL_PSC_getVersionInfo
54 *
55 * @b Description
56 * @n This function retrieves the PSC peripheral identification register
57 * contents.
58 *
59 * @b Arguments
60 * @n None
61 *
62 * <b> Return Value </b> Uint32 - version value
63 *
64 *
65 * <b> Pre Condition </b>
66 * @n None
67 *
68 * <b> Post Condition </b>
69 * @n None
70 *
71 * @b Reads
72 * @n PSC_PID
73 *
74 * @b Example
75 * @verbatim
76 Uint32 versionInfo;
78 versionInfo = CSL_PSC_getVersionInfo ();
80 @endverbatim
81 * =============================================================================
82 */
83 static inline Uint32 CSL_PSC_getVersionInfo (void)
84 {
86 return hPscRegs->PID;
87 }
90 /** ============================================================================
91 * @n@b CSL_PSC_getVoltageControl
92 *
93 * @b Description
94 * @n This function retrieves the Smart reflex bits from the voltage
95 * control identification register.
96 *
97 * @b Arguments
98 * @n None
99 *
100 * <b> Return Value </b> Uint8
101 *
102 *
103 * <b> Pre Condition </b>
104 * @n None
105 *
106 * <b> Post Condition </b>
107 * @n None
108 *
109 * @b Reads
110 * @n PSC_VCNTLID_VCNTL
111 *
112 * @b Example
113 * @verbatim
114 Uint32 vcntlInfo;
116 vcntlInfo = CSL_PSC_getVoltageControl ();
118 @endverbatim
119 * =============================================================================
120 */
121 static inline Uint8 CSL_PSC_getVoltageControl (void)
122 {
124 return CSL_FEXT (hPscRegs->VCNTLID, PSC_VCNTLID_VCNTL);
125 }
128 /** ============================================================================
129 * @n@b CSL_PSC_setModuleNextState
130 *
131 * @b Description
132 * @n This function sets up the "Next" state the module should be
133 * transitioned for a given module.
134 *
135 * @b Arguments
136 * @verbatim
137 moduleNum LPSC Module for which the next state must be configured.
138 state Next state to which the module must be transitioned.
139 @endverbatim
140 *
141 * <b> Return Value </b> None
142 *
143 * <b> Pre Condition </b>
144 * @n None
145 *
146 * <b> Post Condition </b>
147 * @n Module is moved to configured next state after transition is triggered
148 * using @a CSL_PSC_startStateTransition () API.
149 *
150 * @b Writes
151 * @n PSC_MDCTL_NEXT
152 *
153 * @b Example
154 * @verbatim
155 ...
156 // Enable Module 1's clock.
157 CSL_PSC_setModuleNextState (1, PSC_MODSTATE_ENABLE);
158 ...
159 @endverbatim
160 * ============================================================================
161 */
162 static inline void CSL_PSC_setModuleNextState (
163 Uint32 moduleNum,
164 CSL_PSC_MODSTATE state
165 )
166 {
167 CSL_FINS (hPscRegs->MDCTL[moduleNum], PSC_MDCTL_NEXT, state);
169 return;
170 }
172 /** ===========================================================================
173 * @n@b CSL_PSC_getModuleNextState
174 *
175 * @b Description
176 * @n This function returns the next state configured for a given module.
177 *
178 * @b Arguments
179 * @verbatim
180 moduleNum Module number for which the state must be retrieved.
181 @endverbatim
182 *
183 * <b> Return Value </b> CSL_PSC_MODSTATE
184 *
185 * <b> Pre Condition </b>
186 * @n None
187 *
188 * <b> Post Condition </b>
189 * @n None
190 *
191 * @b Reads
192 * @n PSC_MDCTL_NEXT
193 *
194 * @b Example
195 * @verbatim
196 ...
197 // Check Module 2's next state configured
198 if (CSL_PSC_getModuleNextState (2) == PSC_MODSTATE_ENABLE)
199 {
200 ...
201 }
202 ...
203 @endverbatim
204 * ============================================================================
205 */
206 static inline CSL_PSC_MODSTATE CSL_PSC_getModuleNextState (
207 Uint32 moduleNum
208 )
209 {
210 return (CSL_PSC_MODSTATE) CSL_FEXT (hPscRegs->MDCTL[moduleNum], PSC_MDCTL_NEXT);
211 }
213 /** ===========================================================================
214 * @n@b CSL_PSC_setModuleLocalReset
215 *
216 * @b Description
217 * @n This function configures the Module local reset control.
218 *
219 * @b Arguments
220 * @verbatim
221 moduleNum Module number for which the status must be retrieved.
222 resetState Assert/Deassert module local reset.
223 @endverbatim
224 *
225 * <b> Return Value </b> None
226 *
227 * <b> Pre Condition </b>
228 * @n None
229 *
230 * <b> Post Condition </b>
231 * @n None
232 *
233 * @b Writes
234 * @n PSC_MDCTL_LRST
235 *
236 * @b Example
237 * @verbatim
238 ...
239 // Assert Module 2's local reset
240 CSL_PSC_setModuleLocalReset (2, PSC_MDLRST_ASSERTED);
241 ...
242 @endverbatim
243 * ============================================================================
244 */
245 static inline void CSL_PSC_setModuleLocalReset (
246 Uint32 moduleNum,
247 CSL_PSC_MDLRST resetState
248 )
249 {
250 CSL_FINS (hPscRegs->MDCTL[moduleNum], PSC_MDCTL_LRST, resetState);
252 return;
253 }
255 /** ===========================================================================
256 * @n@b CSL_PSC_getModuleLocalReset
257 *
258 * @b Description
259 * @n This function reads the Module local reset control configured.
260 *
261 * @b Arguments
262 * @verbatim
263 moduleNum Module number for which the status must be retrieved.
264 @endverbatim
265 *
266 * <b> Return Value </b> CSL_PSC_MDLRST
267 *
268 * <b> Pre Condition </b>
269 * @n None
270 *
271 * <b> Post Condition </b>
272 * @n None
273 *
274 * @b Reads
275 * @n PSC_MDCTL_LRST
276 *
277 * @b Example
278 * @verbatim
279 * Uint32 resetState;
281 ...
282 // Check Module 2's local reset bit
283 resetState = CSL_PSC_getModuleLocalReset (2);
284 ...
285 @endverbatim
286 * ============================================================================
287 */
288 static inline CSL_PSC_MDLRST CSL_PSC_getModuleLocalReset (
289 Uint32 moduleNum
290 )
291 {
292 return (CSL_PSC_MDLRST) CSL_FEXT (hPscRegs->MDCTL[moduleNum], PSC_MDCTL_LRST);
293 }
296 /** ===========================================================================
297 * @n@b CSL_PSC_enableModuleResetIsolation
298 *
299 * @b Description
300 * @n This function enables the Module reset isolation control.
301 *
302 * @b Arguments
303 * @verbatim
304 moduleNum Module number for which the configuration must be done.
305 @endverbatim
306 *
307 * <b> Return Value </b> None
308 *
309 * <b> Pre Condition </b>
310 * @n None
311 *
312 * <b> Post Condition </b>
313 * @n None
314 *
315 * @b Writes
316 * @n PSC_MDCTL_RSTISO=1
317 *
318 * @b Example
319 * @verbatim
320 ...
321 // Enable Module 2's reset isolation
322 CSL_PSC_enableModuleResetIsolation (2);
323 ...
324 @endverbatim
325 * ============================================================================
326 */
327 static inline void CSL_PSC_enableModuleResetIsolation (
328 Uint32 moduleNum
329 )
330 {
331 CSL_FINST (hPscRegs->MDCTL[moduleNum], PSC_MDCTL_RSTISO, ENABLE);
333 return;
334 }
337 /** ===========================================================================
338 * @n@b CSL_PSC_disableModuleResetIsolation
339 *
340 * @b Description
341 * @n This function disables the Module reset isolation control.
342 *
343 * @b Arguments
344 * @verbatim
345 moduleNum Module number for which the configuration must be done.
346 @endverbatim
347 *
348 * <b> Return Value </b> None
349 *
350 * <b> Pre Condition </b>
351 * @n None
352 *
353 * <b> Post Condition </b>
354 * @n None
355 *
356 * @b Writes
357 * @n PSC_MDCTL_RSTISO=0
358 *
359 * @b Example
360 * @verbatim
361 ...
362 // Disable Module 2's reset isolation
363 CSL_PSC_disableModuleResetIsolation (2);
364 ...
365 @endverbatim
366 * ============================================================================
367 */
368 static inline void CSL_PSC_disableModuleResetIsolation (
369 Uint32 moduleNum
370 )
371 {
372 CSL_FINST (hPscRegs->MDCTL[moduleNum], PSC_MDCTL_RSTISO, DISABLE);
374 return;
375 }
378 /** ===========================================================================
379 * @n@b CSL_PSC_isModuleResetIsolationEnabled
380 *
381 * @b Description
382 * @n This function reads the Module reset isolation control bit.
383 *
384 * @b Arguments
385 * @verbatim
386 moduleNum Module number for which the status must be retrieved.
387 @endverbatim
388 *
389 * <b> Return Value </b> Bool
390 *
391 * <b> Pre Condition </b>
392 * @n None
393 *
394 * <b> Post Condition </b>
395 * @n None
396 *
397 * @b Reads
398 * @n PSC_MDCTL_RSTISO
399 *
400 * @b Example
401 * @verbatim
402 ...
403 // Check Module 2's reset isolation configuration
404 if (CSL_PSC_isModuleResetIsolationEnabled (2) == TRUE)
405 {
406 // Module 2 reset isolation enabled
407 }
408 ...
409 @endverbatim
410 * ============================================================================
411 */
412 static inline Bool CSL_PSC_isModuleResetIsolationEnabled (
413 Uint32 moduleNum
414 )
415 {
416 return CSL_FEXT (hPscRegs->MDCTL[moduleNum], PSC_MDCTL_RSTISO);
417 }
420 /** ===========================================================================
421 * @n@b CSL_PSC_getModuleState
422 *
423 * @b Description
424 * @n This function returns the current state of a given module.
425 *
426 * @b Arguments
427 * @verbatim
428 moduleNum Module number for which the state must be retrieved.
429 @endverbatim
430 *
431 * <b> Return Value </b> CSL_PSC_MODSTATE
432 *
433 * <b> Pre Condition </b>
434 * @n None
435 *
436 * <b> Post Condition </b>
437 * @n Power Domain status is returned
438 *
439 * @b Reads
440 * @n PSC_MDSTAT_STATE
441 *
442 * @b Example
443 * @verbatim
444 ...
445 // Check if Module 2's clock is enabled.
446 if (CSL_PSC_getModuleState (2) == PSC_MODSTATE_ENABLE)
447 {
448 // Module 2's clock is enabled.
449 ...
450 }
451 ...
452 @endverbatim
453 * ============================================================================
454 */
455 static inline CSL_PSC_MODSTATE CSL_PSC_getModuleState (
456 Uint32 moduleNum
457 )
458 {
459 return (CSL_PSC_MODSTATE) CSL_FEXT(hPscRegs->MDSTAT[moduleNum], PSC_MDSTAT_STATE);
460 }
463 /** ===========================================================================
464 * @n@b CSL_PSC_getModuleLocalResetStatus
465 *
466 * @b Description
467 * @n This function returns the Module local reset actual status.
468 *
469 * @b Arguments
470 * @verbatim
471 moduleNum Module number for which the status must be retrieved.
472 @endverbatim
473 *
474 * <b> Return Value </b> CSL_PSC_MDLRST
475 *
476 * <b> Pre Condition </b>
477 * @n None
478 *
479 * <b> Post Condition </b>
480 * @n None
481 *
482 * @b Reads
483 * @n PSC_MDSTAT_LRST
484 *
485 * @b Example
486 * @verbatim
487 ...
488 // Check Module 2's local reset status
489 if (CSL_PSC_getModuleLocalResetStatus (2) == PSC_MDLRST_ASSERTED)
490 {
491 // Module 2's local reset asserted.
492 ...
493 }
494 ...
495 @endverbatim
496 * ============================================================================
497 */
498 static inline CSL_PSC_MDLRST CSL_PSC_getModuleLocalResetStatus (
499 Uint32 moduleNum
500 )
501 {
502 return (CSL_PSC_MDLRST) CSL_FEXT(hPscRegs->MDSTAT[moduleNum], PSC_MDSTAT_LRST);
503 }
506 /** ===========================================================================
507 * @n@b CSL_PSC_isModuleLocalResetDone
508 *
509 * @b Description
510 * @n This function returns the Module local reset initialization done status.
511 *
512 * @b Arguments
513 * @verbatim
514 moduleNum Module number for which the status must be retrieved.
515 @endverbatim
516 *
517 * <b> Return Value </b> Bool
518 *
519 * <b> Pre Condition </b>
520 * @n None
521 *
522 * <b> Post Condition </b>
523 * @n None
524 *
525 * @b Reads
526 * @n PSC_MDSTAT_LRSTDONE
527 *
528 * @b Example
529 * @verbatim
530 ...
531 // Check Module 2's local reset initialization done status
532 if (CSL_PSC_isModuleLocalResetDone (2))
533 {
534 // Module 2's local reset init done.
535 ...
536 }
537 ...
538 @endverbatim
539 * ============================================================================
540 */
541 static inline Bool CSL_PSC_isModuleLocalResetDone (
542 Uint32 moduleNum
543 )
544 {
545 return (Bool) CSL_FEXT(hPscRegs->MDSTAT[moduleNum], PSC_MDSTAT_LRSTDONE);
546 }
549 /** ===========================================================================
550 * @n@b CSL_PSC_getModuleResetStatus
551 *
552 * @b Description
553 * @n This function returns the Module reset actual status.
554 *
555 * @b Arguments
556 * @verbatim
557 moduleNum Module number for which the status must be retrieved.
558 @endverbatim
559 *
560 * <b> Return Value </b> CSL_PSC_MDRST
561 *
562 * <b> Pre Condition </b>
563 * @n None
564 *
565 * <b> Post Condition </b>
566 * @n None
567 *
568 * @b Reads
569 * @n PSC_MDSTAT_MRST
570 *
571 * @b Example
572 * @verbatim
573 ...
574 // Check Module 2's reset status
575 if (CSL_PSC_getModuleResetStatus (2) == PSC_MDRST_ASSERTED)
576 {
577 // Module 2's reset asserted.
578 ...
579 }
580 ...
581 @endverbatim
582 * ============================================================================
583 */
584 static inline CSL_PSC_MDRST CSL_PSC_getModuleResetStatus (
585 Uint32 moduleNum
586 )
587 {
588 return (CSL_PSC_MDRST) CSL_FEXT(hPscRegs->MDSTAT[moduleNum], PSC_MDSTAT_MRST);
589 }
592 /** ===========================================================================
593 * @n@b CSL_PSC_isModuleResetDone
594 *
595 * @b Description
596 * @n This function returns the Module reset initialization done status.
597 *
598 * @b Arguments
599 * @verbatim
600 moduleNum Module number for which the status must be retrieved.
601 @endverbatim
602 *
603 * <b> Return Value </b> Bool
604 *
605 * <b> Pre Condition </b>
606 * @n None
607 *
608 * <b> Post Condition </b>
609 * @n None
610 *
611 * @b Reads
612 * @n PSC_MDSTAT_MRSTDONE
613 *
614 * @b Example
615 * @verbatim
616 ...
617 // Check Module 2's reset initialization done status
618 if (CSL_PSC_isModuleResetDone (2))
619 {
620 // Module 2's reset init done.
621 ...
622 }
623 ...
624 @endverbatim
625 * ============================================================================
626 */
627 static inline Bool CSL_PSC_isModuleResetDone (
628 Uint32 moduleNum
629 )
630 {
631 return (Bool) CSL_FEXT(hPscRegs->MDSTAT[moduleNum], PSC_MDSTAT_MRSTDONE);
632 }
635 /** ===========================================================================
636 * @n@b CSL_PSC_isModuleClockOn
637 *
638 * @b Description
639 * @n This function returns the actual modclk output to module.
640 *
641 * @b Arguments
642 * @verbatim
643 moduleNum Module number for which the clock status must be retrieved.
644 @endverbatim
645 *
646 * <b> Return Value </b> Bool
647 *
648 * <b> Pre Condition </b>
649 * @n None
650 *
651 * <b> Post Condition </b>
652 * @n None
653 *
654 * @b Reads
655 * @n PSC_MDSTAT_MCKOUT
656 *
657 * @b Example
658 * @verbatim
659 ...
660 // Check Module 2's modclk status
661 if (CSL_PSC_isModuleClockOn (2))
662 {
663 // Module 2's modclk on.
664 ...
665 }
666 else
667 {
668 // Module 2's modclk gated.
669 ...
670 }
671 ...
672 @endverbatim
673 * ============================================================================
674 */
675 static inline Bool CSL_PSC_isModuleClockOn (
676 Uint32 moduleNum
677 )
678 {
679 return (Bool) CSL_FEXT(hPscRegs->MDSTAT[moduleNum], PSC_MDSTAT_MCKOUT);
680 }
683 /** ============================================================================
684 * @n@b CSL_PSC_enablePowerDomain
685 *
686 * @b Description
687 * @n This function enables the specified power domain.
688 *
689 * @b Arguments
690 * @verbatim
691 pwrDmnNum Power domain number that needs to be enabled.
692 @endverbatim
693 *
694 * <b> Return Value </b> None
695 *
696 * <b> Pre Condition </b>
697 * @n None
698 *
699 * <b> Post Condition </b>
700 * @n Power domain is enabled.
701 *
702 * @b Writes
703 * @n PSC_PDCTL_NEXT=1
704 *
705 * @b Example
706 * @verbatim
707 ...
708 // On the power domain 2
709 CSL_PSC_enablePowerDomain (2);
710 ...
711 @endverbatim
712 * ============================================================================
713 */
714 static inline void CSL_PSC_enablePowerDomain (
715 Uint32 pwrDmnNum
716 )
717 {
718 CSL_FINST (hPscRegs->PDCTL[pwrDmnNum], PSC_PDCTL_NEXT, ON);
720 return;
721 }
724 /** ============================================================================
725 * @n@b CSL_PSC_disablePowerDomain
726 *
727 * @b Description
728 * @n This function turns off the specified power domain.
729 *
730 * @b Arguments
731 * @verbatim
732 pwrDmnNum Power domain number that needs to be disabled.
733 @endverbatim
734 *
735 * <b> Return Value </b> None
736 *
737 * <b> Pre Condition </b>
738 * @n None
739 *
740 * <b> Post Condition </b>
741 * @n Power domain is disabled.
742 *
743 * @b Writes
744 * @n PSC_PDCTL_NEXT=0
745 *
746 * @b Example
747 * @verbatim
748 ...
749 // Off the power domain 2
750 CSL_PSC_disablePowerDomain (2);
751 ...
752 @endverbatim
753 * ============================================================================
754 */
755 static inline void CSL_PSC_disablePowerDomain (
756 Uint32 pwrDmnNum
757 )
758 {
759 CSL_FINST (hPscRegs->PDCTL[pwrDmnNum], PSC_PDCTL_NEXT, OFF);
761 return;
762 }
766 /** ===========================================================================
767 * @n@b CSL_PSC_getPowerDomainState
768 *
769 * @b Description
770 * @n This function returns the current state of a given power domain.
771 *
772 * @b Arguments
773 * @verbatim
774 pwrDmnNum Power domain number for which the state must be retrieved.
775 @endverbatim
776 *
777 * <b> Return Value </b> CSL_PSC_PDSTATE
778 *
779 * <b> Pre Condition </b>
780 * @n None
781 *
782 * <b> Post Condition </b>
783 * @n Power Domain status is returned
784 *
785 * @b Reads
786 * @n PSC_PDSTAT_STATE
787 *
788 * @b Example
789 * @verbatim
790 ...
791 // Check if Power domain is On.
792 if (CSL_PSC_getPowerDomainState(2) == PSC_PDSTATE_ON)
793 {
794 // Power domain 2 is on
795 ...
796 }
797 else
798 {
799 // Power domain 2 is off
800 }
801 ...
802 @endverbatim
803 * ============================================================================
804 */
805 static inline CSL_PSC_PDSTATE CSL_PSC_getPowerDomainState (
806 Uint32 pwrDmnNum
807 )
808 {
809 return (CSL_PSC_PDSTATE) CSL_FEXT(hPscRegs->PDSTAT[pwrDmnNum], PSC_PDSTAT_STATE);
810 }
814 /** ============================================================================
815 * @n@b CSL_PSC_startStateTransition
816 *
817 * @b Description
818 * @n This function sets the 'GO' bit in the PSC Command register. All state
819 * transitions marked for a specified power domain and all its modules are
820 * initiated by the hardware.
821 *
822 * This function starts a given Power domain and all its modules state
823 * transition.
824 *
825 * @b Arguments
826 * @verbatim
827 pwrDmnNum Power domain number for which the state transition
828 must be initiated.
829 @endverbatim
830 *
831 * <b> Return Value </b> None
832 *
833 * <b> Pre Condition </b>
834 * @n None
835 *
836 * <b> Post Condition </b>
837 * @n Power domain and modules are moved to a new "Next" state as marked
838 * earlier using APIs: @a CSL_PSC_setModuleNextState (),
839 * @a CSL_PSC_enablePowerDomain (), @a CSL_PSC_disablePowerDomain ().
840 *
841 * @b Writes
842 * @n PSC_PTCMD
843 *
844 * @b Example
845 * @verbatim
846 ...
847 // To Enable Power domain 2 and modules 3, 4
848 CSL_PSC_enablePowerDomain (2);
849 CSL_PSC_setModuleNextState (3, PSC_MODSTATE_ENABLE);
850 CSL_PSC_setModuleNextState (4, PSC_MODSTATE_ENABLE);
851 CSL_PSC_startStateTransition (2);
852 ...
853 @endverbatim
854 * ============================================================================
855 */
856 static inline void CSL_PSC_startStateTransition (
857 Uint32 pwrDmnNum
858 )
859 {
860 hPscRegs->PTCMD = (1 << pwrDmnNum);
862 return;
863 }
865 /** ===========================================================================
866 * @n@b CSL_PSC_isStateTransitionDone
867 *
868 * @b Description
869 * @n This function gets the transition status of the power domain. This function
870 * returns 0 to indicate that the state transition initiated earlier using
871 * @a CSL_PSC_startStateTransition () API for the specified power domain has not
872 * yet been completed, and is in progress still. This function returns 1
873 * to indicate when this transition is completed in the hardware.
874 *
875 * @b Arguments
876 * @verbatim
877 pwrDmnNum Power domain number for which the state transition status
878 must be retrieved.
879 @endverbatim
880 *
881 * <b> Return Value </b> Uint32
882 *
883 * <b> Pre Condition </b>
884 * @n None
885 *
886 * <b> Post Condition </b>
887 * @n Power domain transition status value is read
888 *
889 * @b Reads
890 * @n PSC_PTSTAT
891 *
892 * @b Example
893 * @verbatim
894 ...
895 // Ensure no transition in progress for Power domain 2
896 // before we start a new one.
897 while (!CSL_PSC_isStateTransitionDone (2));
899 // To Enable Power domain 2 and modules 3, 4
900 CSL_PSC_enablePowerDomain (2);
901 CSL_PSC_setModuleNextState (3, PSC_MODSTATE_ENABLE);
902 CSL_PSC_setModuleNextState (4, PSC_MODSTATE_ENABLE);
903 CSL_PSC_startStateTransition (2);
905 // Wait until the transition process is completed.
906 while (!CSL_PSC_isStateTransitionDone (2));
907 ...
908 @endverbatim
909 * ============================================================================
910 */
911 static inline Uint32 CSL_PSC_isStateTransitionDone (
912 Uint32 pwrDmnNum
913 )
914 {
915 Uint32 pdTransStatus;
917 pdTransStatus = CSL_FEXTR (hPscRegs->PTSTAT, pwrDmnNum, pwrDmnNum);
919 if (pdTransStatus)
920 {
921 /* Power domain transition is in progress. Return 0 to indicate not yet done. */
922 return 0;
923 }
924 else
925 {
926 /* Power domain transition is done. */
927 return 1;
928 }
929 }
931 /**
932 @}
933 */
935 #ifdef __cplusplus
936 }
937 #endif
939 #endif /* CSL_PSCAUX_H_ */