Search by Tags

Freq Lib API

 

Article updated at 28 Oct 2017
Compare with Revision




Subscribe for this article updates

Attention: this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.

Library to manage system clocks frequencies. More...

Data Structures

struct  FRQPXAClocks struct  FRQTEGClocks 

Macros

#define  FRQ_VER_MAJ  2
#define  FRQ_VER_MIN  3
#define  FRQ_VER_BUILD  0
#define  TEG_DFS_STATE_STOPPED  2
#define  TEG_DFS_STATE_CLOSED_LOOP  3
#define  CLKCFG_T  1
#define  CLKCFG_F  2
#define  CLKCFG_HT  4
#define  CLKCFG_B  8
#define  MDREFR_APD  (1<<20)
#define  MDREFR_K0DB2  (1<<14)
#define  MDREFR_K1DB2  (1<<17)
#define  MDREFR_K0DB4  (1<<29)

Functions

void  FRQGetLibVersion (DWORD *pVerMaj, DWORD *pVerMin, DWORD *pBuild)
BOOL  FRQInit ()
void  FRQDeInit ()
Description: De-initialises the frequency library. More...
BOOL  FRQPXAClocks *pxaClocks)
BOOL  FRQTEGClocks *tegClocks)
DWORD  FRQGetTEGDFSState ()
BOOL  FRQSetPXAFrequencies (MULTCFG multiplierConfig)
DWORD  FRQSetPXA270Voltage (DWORD core_voltage)
BOOL  FRQSetTEGFrequency (tTEGClockIDs tegClockID, DWORD frequency)
BOOL  FRQSetTEGDFSState (DWORD state)
BOOL  TegFrq_Boost (const tTegDfsBusyHint *hints, DWORD numHints, tTegDfsBusyHintSyncMode mode)
void  SetFreq (MULTCFG mp)
MULTCFG  GetFreq (void)
void  CalcSystemFreq (MULTCFG ms, DWORD *pCpuClk, DWORD *pRunClk, DWORD *pSysClk, DWORD *pMemClk, DWORD *pSdramClk, DWORD *pSramClk, DWORD *pLcdClk)
DWORD  SetVoltage (DWORD core_voltage)

Detailed Description

Library to manage system clocks frequencies.

Author
andy.kiser
Rev
2863
Date
2015-06-26 17:18:52 +0200 (Fr, 26 Jun 2015)
Target Platforms:
PXAxxx, Txx

Macro Definition Documentation

#define CLKCFG_B   8
#define CLKCFG_F   2
#define CLKCFG_HT   4
#define CLKCFG_T   1
#define FRQ_VER_BUILD   0
#define FRQ_VER_MAJ   2
#define FRQ_VER_MIN   3
#define MDREFR_APD   (1<<20)
#define MDREFR_K0DB2   (1<<14)
#define MDREFR_K0DB4   (1<<29)
#define MDREFR_K1DB2   (1<<17)
#define TEG_DFS_STATE_CLOSED_LOOP   3
#define TEG_DFS_STATE_STOPPED   2

Enumeration Type Documentation

PXA Clocks Definitions.

Enumerator
PXACPUClockID 
PXARunClockID 
PXASysClockID 
PXAMemClockID 
PXASDRAMClockID 
PXASRAMClockID 
PXALCDClockID 

Tegra Clocks Definitions.

Enumerator
TEGCPUClockID 
TEGSysClockID 
TEGAVPClockID 
TEGAHBClockID 
TEGAPBClockID 
TEGVIDClockID 
TEGEMCClockID 
TEGClockIDMax 

Function Documentation

void CalcSystemFreq ( MULTCFG  ms,
DWORD *  pCpuClk,
DWORD *  pRunClk,
DWORD *  pSysClk,
DWORD *  pMemClk,
DWORD *  pSdramClk,
DWORD *  pSramClk,
DWORD *  pLcdClk
)

Calculate the different clocks in HZ

Parameters
[in] ms Multiplier Configuration Structure
[out] pCPUClk CPU Clock Speed (RunMode Clock * XN)
[out] pRunClk RunMode Clock Speed
[out] pSysClk System Clock Speed
[out] pMemClk Memory Clock Speed
[out] pSdramClk SDRAM Clock Speed
[out] pSRamClk SRAM Clock Speed
[out] pLcdClk LCD Clock Speed
void FRQDeInit ( )

Description: De-initialises the frequency library.

void FRQGetLibVersion ( DWORD *  pVerMaj,
DWORD *  pVerMin,
DWORD *  pBuild
)

Description: Returns the library Version.

Parameters
[out] pVerMaj Returns the major version number. Set this parameter to NULL if not required.
[out] pVerMin Returns the minor version number. Set this parameter to NULL if not required.
[out] pBuild Returns the build number. Set this parameter to NULL if not required.
BOOL FRQGetPXAClocks ( FRQPXAClocks *  pxaClocks )

Description: Returns the current PXA Clocks Frequencies.

Parameters
in/out] pxaClocks Pointer to FRQPXAClocks structure that will be updated
Return values
TRUE Success
FALSE Failure
BOOL FRQGetTEGClocks ( FRQTEGClocks *  tegClocks )

Description: Returns the current Tegra Clocks Frequencies.

Parameters
in/out] tegClocks Pointer to FRQTEGClocks structure that will be updated
Return values
TRUE Success
FALSE Failure
DWORD FRQGetTEGDFSState ( )

Description: Returns the current state of DFS (Dynamic Frequency Switching).

Return values
2 DFS Stopped
3 DFS Closed Loop
BOOL FRQInit ( )

Description: Initialises the frequency library.

Return values
TRUE Success
FALSE Failure
DWORD FRQSetPXA270Voltage ( DWORD  core_voltage )

Set core voltage.

Parameters
[in] core_voltage Voltage required in mV
Return values
Voltage set in mV Remarks: !!!this is working on PXA270 only!!!
BOOL FRQSetPXAFrequencies ( MULTCFG  multiplierConfig )

Description: Sets the PXA Multiplier Configuration.

Parameters
[in] multiplierConfig Multiplier Configuration Structure
Return values
TRUE Success
FALSE Failure
BOOL FRQSetTEGDFSState ( DWORD  state )

Description: Sets the state of DFS (Dynamic Frequency Switching).

Parameters
[in] state New DFS State (2 = Stopped, 3 = Closed Loop)
Return values
TRUE Success
FALSE Failure
BOOL FRQSetTEGFrequency ( tTEGClockIDs tegClockID,
DWORD  frequency
)

Description: Sets the given Tegra clock to the given frequency.

Parameters
[in] tegClockID ID of the Tegra Clock to be set
[in] frequency Frequency to set
Return values
TRUE Success
FALSE Failure
MULTCFG GetFreq ( void  )

Get the actual processor frequencies

Return values
Multiplier Configuration Structure
void SetFreq ( MULTCFG  mp )

Set the processor frequencies according to mp

Parameters
[in] mp Multiplier Configuration Structure
DWORD SetVoltage ( DWORD  core_voltage )

Set core voltage.

Parameters
[in] core_voltage Voltage in mV
Return values
Set voltage in mV Remarks: !!!this is working on PXA270 only!!!
BOOL TegFrq_Boost ( const tTegDfsBusyHint *  hints,
DWORD  numHints,
tTegDfsBusyHintSyncMode  mode
)

Description: Request / Release Minimum Clock Frequencies

Parameters
[in] hints Array of boost informations. Each array element contains
  • Clock name
  • How long will it be boosted (can be infinite)
  • Clock Frequency -> used to turn off boosting
  • finish boost immediately, or gradually See tegra_dma.h for details.
[in] numHints Number of array elments
[in] mode TegDfsBusyHintSyncMode_Async = function returns immediately TegDfsBusyHintSyncMode_Sync = function only returns after boost is active.
Return values
TRUE Success
FALSE Failure