# PSC Functions
[PSC]

## Functions

CSL_IDEF_INLINE Uint32 | CSL_PSC_getVersionInfo (void)
CSL_IDEF_INLINE Uint8 | CSL_PSC_getVoltageControl (void)
CSL_IDEF_INLINE void | CSL_PSC_setModuleNextState (Uint32 moduleNum, CSL_PSC_MODSTATE state)
CSL_IDEF_INLINE CSL_PSC_MODSTATE | CSL_PSC_getModuleNextState (Uint32 moduleNum)
CSL_IDEF_INLINE void | CSL_PSC_setModuleLocalReset (Uint32 moduleNum, CSL_PSC_MDLRST resetState)
CSL_IDEF_INLINE CSL_PSC_MDLRST | CSL_PSC_getModuleLocalReset (Uint32 moduleNum)
CSL_IDEF_INLINE void | CSL_PSC_enableModuleResetIsolation (Uint32 moduleNum)
CSL_IDEF_INLINE void | CSL_PSC_disableModuleResetIsolation (Uint32 moduleNum)
CSL_IDEF_INLINE Bool | CSL_PSC_isModuleResetIsolationEnabled (Uint32 moduleNum)
CSL_IDEF_INLINE CSL_PSC_MODSTATE | CSL_PSC_getModuleState (Uint32 moduleNum)
CSL_IDEF_INLINE CSL_PSC_MDLRST | CSL_PSC_getModuleLocalResetStatus (Uint32 moduleNum)
CSL_IDEF_INLINE Bool | CSL_PSC_isModuleLocalResetDone (Uint32 moduleNum)
CSL_IDEF_INLINE CSL_PSC_MDRST | CSL_PSC_getModuleResetStatus (Uint32 moduleNum)
CSL_IDEF_INLINE Bool | CSL_PSC_isModuleResetDone (Uint32 moduleNum)
CSL_IDEF_INLINE Bool | CSL_PSC_isModuleClockOn (Uint32 moduleNum)
CSL_IDEF_INLINE void | CSL_PSC_enablePowerDomain (Uint32 pwrDmnNum)
CSL_IDEF_INLINE void | CSL_PSC_disablePowerDomain (Uint32 pwrDmnNum)
CSL_IDEF_INLINE CSL_PSC_PDSTATE | CSL_PSC_getPowerDomainState (Uint32 pwrDmnNum)
CSL_IDEF_INLINE void | CSL_PSC_startStateTransition (Uint32 pwrDmnNum)
CSL_IDEF_INLINE Uint32 | CSL_PSC_isStateTransitionDone (Uint32 pwrDmnNum)

## Function Documentation

CSL_IDEF_INLINE void CSL_PSC_disableModuleResetIsolation | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_disableModuleResetIsolation

Description
This function disables the Module reset isolation control.

Arguments

            moduleNum       Module number for which the configuration must be done.

Return Value None

Pre Condition
None

Post Condition
None

Writes
PSC_MDCTL_RSTISO=0

Example

            ...
            // Disable Module 2's reset isolation
            CSL_PSC_disableModuleResetIsolation (2);
            ...

============================================================================

CSL_IDEF_INLINE void CSL_PSC_disablePowerDomain | ( | Uint32 | pwrDmnNum | ) |

============================================================================
CSL_PSC_disablePowerDomain

Description
This function turns off the specified power domain.

Arguments

            pwrDmnNum       Power domain number that needs to be disabled.

Return Value None

Pre Condition
None

Post Condition
Power domain is disabled.

Writes
PSC_PDCTL_NEXT=0

Example

            ...
            // Off the power domain 2
            CSL_PSC_disablePowerDomain (2);
            ...

============================================================================

CSL_IDEF_INLINE void CSL_PSC_enableModuleResetIsolation | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_enableModuleResetIsolation

Description
This function enables the Module reset isolation control.

Arguments

            moduleNum       Module number for which the configuration must be done.

Return Value None

Pre Condition
None

Post Condition
None

Writes
PSC_MDCTL_RSTISO=1

Example

            ...
            // Enable Module 2's reset isolation
            CSL_PSC_enableModuleResetIsolation (2);
            ...

============================================================================

CSL_IDEF_INLINE void CSL_PSC_enablePowerDomain | ( | Uint32 | pwrDmnNum | ) |

============================================================================
CSL_PSC_enablePowerDomain

Description
This function enables the specified power domain.

Arguments

            pwrDmnNum       Power domain number that needs to be enabled.

Return Value None

Pre Condition
None

Post Condition
Power domain is enabled.

Writes
PSC_PDCTL_NEXT=1

Example

            ...
            // On the power domain 2
            CSL_PSC_enablePowerDomain (2);
            ...

============================================================================

CSL_IDEF_INLINE CSL_PSC_MDLRST CSL_PSC_getModuleLocalReset | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_getModuleLocalReset

Description
This function reads the Module local reset control configured.

Arguments

            moduleNum       Module number for which the status must be retrieved.

Return Value CSL_PSC_MDLRST

Pre Condition
None

Post Condition
None

Reads
PSC_MDCTL_LRST

Example

     *      Uint32  resetState;

            ...
            // Check Module 2's local reset bit
            resetState = CSL_PSC_getModuleLocalReset (2);
            ...

============================================================================

CSL_IDEF_INLINE CSL_PSC_MDLRST CSL_PSC_getModuleLocalResetStatus | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_getModuleLocalResetStatus

Description
This function returns the Module local reset actual status.

Arguments

            moduleNum       Module number for which the status must be retrieved.

Return Value CSL_PSC_MDLRST

Pre Condition
None

Post Condition
None

Reads
PSC_MDSTAT_LRST

Example

            ...
            // Check Module 2's local reset status
            if (CSL_PSC_getModuleLocalResetStatus (2) == PSC_MDLRST_ASSERTED)
            {
                // Module 2's local reset asserted.
                ...
            }
            ...

============================================================================

CSL_IDEF_INLINE CSL_PSC_MODSTATE CSL_PSC_getModuleNextState | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_getModuleNextState

Description
This function returns the next state configured for a given module.

Arguments

            moduleNum       Module number for which the state must be retrieved.

Return Value CSL_PSC_MODSTATE

Pre Condition
None

Post Condition
None

Reads
PSC_MDCTL_NEXT

Example

            ...
            // Check Module 2's next state configured
            if (CSL_PSC_getModuleNextState (2) == PSC_MODSTATE_ENABLE)
            {
                ...
            }
            ...

============================================================================

CSL_IDEF_INLINE CSL_PSC_MDRST CSL_PSC_getModuleResetStatus | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_getModuleResetStatus

Description
This function returns the Module reset actual status.

Arguments

            moduleNum       Module number for which the status must be retrieved.

Return Value CSL_PSC_MDRST

Pre Condition
None

Post Condition
None

Reads
PSC_MDSTAT_MRST

Example

            ...
            // Check Module 2's reset status
            if (CSL_PSC_getModuleResetStatus (2) == PSC_MDRST_ASSERTED)
            {
                // Module 2's reset asserted.
                ...
            }
            ...

============================================================================

CSL_IDEF_INLINE CSL_PSC_MODSTATE CSL_PSC_getModuleState | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_getModuleState

Description
This function returns the current state of a given module.

Arguments

            moduleNum       Module number for which the state must be retrieved.

Return Value CSL_PSC_MODSTATE

Pre Condition
None

Post Condition
Power Domain status is returned

Reads
PSC_MDSTAT_STATE

Example

            ...
            // Check if Module 2's clock is enabled.
            if (CSL_PSC_getModuleState (2) == PSC_MODSTATE_ENABLE)
            {
                // Module 2's clock is enabled.
                ...
            }
            ...

============================================================================

CSL_IDEF_INLINE CSL_PSC_PDSTATE CSL_PSC_getPowerDomainState | ( | Uint32 | pwrDmnNum | ) |

===========================================================================
CSL_PSC_getPowerDomainState

Description
This function returns the current state of a given power domain.

Arguments

            pwrDmnNum       Power domain number for which the state must be retrieved.

Return Value CSL_PSC_PDSTATE

Pre Condition
None

Post Condition
Power Domain status is returned

Reads
PSC_PDSTAT_STATE

Example

            ...
            // Check if Power domain is On.
            if (CSL_PSC_getPowerDomainState(2) == PSC_PDSTATE_ON)
            {
                // Power domain 2 is on
                ...
            }
            else
            {
                // Power domain 2 is off
            }
            ...

============================================================================

CSL_IDEF_INLINE Uint32 CSL_PSC_getVersionInfo | ( | void |  | ) |

============================================================================
CSL_PSC_getVersionInfo

Description
This function retrieves the PSC peripheral identification register contents.

Arguments
None

Return Value Uint32 - version value

Pre Condition
None

Post Condition
None

Reads
PSC_PID

Example

            Uint32      versionInfo;

            versionInfo =   CSL_PSC_getVersionInfo ();

=============================================================================

CSL_IDEF_INLINE Uint8 CSL_PSC_getVoltageControl | ( | void |  | ) |

============================================================================
CSL_PSC_getVoltageControl

Description
This function retrieves the Smart reflex bits from the voltage control identification register.

Arguments
None

Return Value Uint8

Pre Condition
None

Post Condition
None

Reads
PSC_VCNTLID_VCNTL

Example

            Uint32      vcntlInfo;

            vcntlInfo =   CSL_PSC_getVoltageControl ();

=============================================================================

CSL_IDEF_INLINE Bool CSL_PSC_isModuleClockOn | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_isModuleClockOn

Description
This function returns the actual modclk output to module.

Arguments

            moduleNum       Module number for which the clock status must be retrieved.

Return Value Bool

Pre Condition
None

Post Condition
None

Reads
PSC_MDSTAT_MCKOUT

Example

            ...
            // Check Module 2's modclk status
            if (CSL_PSC_isModuleClockOn (2))
            {
                // Module 2's modclk on.
                ...
            }
            else
            {
                // Module 2's modclk gated.
                ...
            }
            ...

============================================================================

CSL_IDEF_INLINE Bool CSL_PSC_isModuleLocalResetDone | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_isModuleLocalResetDone

Description
This function returns the Module local reset initialization done status.

Arguments

            moduleNum       Module number for which the status must be retrieved.

Return Value Bool

Pre Condition
None

Post Condition
None

Reads
PSC_MDSTAT_LRSTDONE

Example

            ...
            // Check Module 2's local reset initialization done status
            if (CSL_PSC_isModuleLocalResetDone (2))
            {
                // Module 2's local reset init done.
                ...
            }
            ...

============================================================================

CSL_IDEF_INLINE Bool CSL_PSC_isModuleResetDone | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_isModuleResetDone

Description
This function returns the Module reset initialization done status.

Arguments

            moduleNum       Module number for which the status must be retrieved.

Return Value Bool

Pre Condition
None

Post Condition
None

Reads
PSC_MDSTAT_MRSTDONE

Example

            ...
            // Check Module 2's reset initialization done status
            if (CSL_PSC_isModuleResetDone (2))
            {
                // Module 2's reset init done.
                ...
            }
            ...

============================================================================

CSL_IDEF_INLINE Bool CSL_PSC_isModuleResetIsolationEnabled | ( | Uint32 | moduleNum | ) |

===========================================================================
CSL_PSC_isModuleResetIsolationEnabled

Description
This function reads the Module reset isolation control bit.

Arguments

            moduleNum       Module number for which the status must be retrieved.

Return Value Bool

Pre Condition
None

Post Condition
None

Reads
PSC_MDCTL_RSTISO

Example

            ...
            // Check Module 2's reset isolation configuration
            if (CSL_PSC_isModuleResetIsolationEnabled (2) == TRUE)
            {
                // Module 2 reset isolation enabled
            }
            ...

============================================================================

CSL_IDEF_INLINE Uint32 CSL_PSC_isStateTransitionDone | ( | Uint32 | pwrDmnNum | ) |

===========================================================================
CSL_PSC_isStateTransitionDone

Description
This function gets the transition status of the power domain. This function returns 0 to indicate that the state transition initiated earlier using CSL_PSC_startStateTransition () API for the specified power domain has not yet been completed, and is in progress still. This function returns 1 to indicate when this transition is completed in the hardware.

Arguments

            pwrDmnNum       Power domain number for which the state transition status
                            must be retrieved.

Return Value Uint32

Pre Condition
None

Post Condition
Power domain transition status value is read

Reads
PSC_PTSTAT

Example

            ...
            // Ensure no transition in progress for Power domain 2
            // before we start a new one.
            while (!CSL_PSC_isStateTransitionDone (2));

            // To Enable Power domain 2 and modules 3, 4
            CSL_PSC_enablePowerDomain (2);
            CSL_PSC_setModuleNextState (3, PSC_MODSTATE_ENABLE);
            CSL_PSC_setModuleNextState (4, PSC_MODSTATE_ENABLE);
            CSL_PSC_startStateTransition (2);

            // Wait until the transition process is completed.
            while (!CSL_PSC_isStateTransitionDone (2));
            ...

============================================================================

CSL_IDEF_INLINE void CSL_PSC_setModuleLocalReset | ( | Uint32 | moduleNum,
|  | CSL_PSC_MDLRST | resetState |
| ) |  |  |

===========================================================================
CSL_PSC_setModuleLocalReset

Description
This function configures the Module local reset control.

Arguments

            moduleNum       Module number for which the status must be retrieved.
            resetState      Assert/Deassert module local reset.

Return Value None

Pre Condition
None

Post Condition
None

Writes
PSC_MDCTL_LRST

Example

            ...
            // Assert Module 2's local reset
            CSL_PSC_setModuleLocalReset (2, PSC_MDLRST_ASSERTED);
            ...

============================================================================

CSL_IDEF_INLINE void CSL_PSC_setModuleNextState | ( | Uint32 | moduleNum,
|  | CSL_PSC_MODSTATE | state |
| ) |  |  |

============================================================================
CSL_PSC_setModuleNextState

Description
This function sets up the "Next" state the module should be transitioned for a given module.

Arguments

            moduleNum       LPSC Module for which the next state must be configured.
            state           Next state to which the module must be transitioned.

Return Value None

Pre Condition
None

Post Condition
Module is moved to configured next state after transition is triggered using CSL_PSC_startStateTransition () API.

Writes
PSC_MDCTL_NEXT

Example

            ...
            // Enable Module 1's clock.
            CSL_PSC_setModuleNextState (1, PSC_MODSTATE_ENABLE);
            ...

============================================================================

CSL_IDEF_INLINE void CSL_PSC_startStateTransition | ( | Uint32 | pwrDmnNum | ) |

============================================================================
CSL_PSC_startStateTransition

Description
This function sets the 'GO' bit in the PSC Command register. All state transitions marked for a specified power domain and all its modules are initiated by the hardware.

This function starts a given Power domain and all its modules state transition.

Arguments

            pwrDmnNum       Power domain number for which the state transition
                            must be initiated.

Return Value None

Pre Condition
None

Post Condition
Power domain and modules are moved to a new "Next" state as marked earlier using APIs: CSL_PSC_setModuleNextState (), CSL_PSC_enablePowerDomain (), CSL_PSC_disablePowerDomain ().

Writes
PSC_PTCMD

Example

            ...
            // To Enable Power domain 2 and modules 3, 4
            CSL_PSC_enablePowerDomain (2);
            CSL_PSC_setModuleNextState  (3, PSC_MODSTATE_ENABLE);
            CSL_PSC_setModuleNextState (4, PSC_MODSTATE_ENABLE);
            CSL_PSC_startStateTransition (2);
            ...

============================================================================

Copyright 2012, Texas Instruments Incorporated