Skip to main content

Freq Lib API

danger

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)
 

Enumerations

enum  tPXAClockIDs {
  PXACPUClockID, PXARunClockID, PXASysClockID, PXAMemClockID,
  PXASDRAMClockID, PXASRAMClockID, PXALCDClockID
}
 PXA Clocks Definitions. More...
 
enum  tTEGClockIDs {
  TEGCPUClockID, TEGSysClockID, TEGAVPClockID, TEGAHBClockID,
  TEGAPBClockID, TEGVIDClockID, TEGEMCClockID, TEGClockIDMax
}
 Tegra Clocks Definitions. More...
 

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]msMultiplier Configuration Structure
[out]pCPUClkCPU Clock Speed (RunMode Clock * XN)
[out]pRunClkRunMode Clock Speed
[out]pSysClkSystem Clock Speed
[out]pMemClkMemory Clock Speed
[out]pSdramClkSDRAM Clock Speed
[out]pSRamClkSRAM Clock Speed
[out]pLcdClkLCD 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]pVerMajReturns the major version number. Set this parameter to NULL if not required.
[out]pVerMinReturns the minor version number. Set this parameter to NULL if not required.
[out]pBuildReturns 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
TRUESuccess
FALSEFailure
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
TRUESuccess
FALSEFailure
DWORD FRQGetTEGDFSState( ) 
Description: Returns the current state of DFS (Dynamic Frequency Switching).
Return values
2DFS Stopped
3DFS Closed Loop
BOOL FRQInit( ) 
Description: Initialises the frequency library.
Return values
TRUESuccess
FALSEFailure
DWORD FRQSetPXA270Voltage(DWORD core_voltage) 
Set core voltage.
Parameters
[in]core_voltageVoltage required in mV
Return values
Voltageset in mV Remarks: !!!this is working on PXA270 only!!!
BOOL FRQSetPXAFrequencies(MULTCFG multiplierConfig) 
Description: Sets the PXA Multiplier Configuration.
Parameters
[in]multiplierConfigMultiplier Configuration Structure
Return values
TRUESuccess
FALSEFailure
BOOL FRQSetTEGDFSState(DWORD state) 
Description: Sets the state of DFS (Dynamic Frequency Switching).
Parameters
[in]stateNew DFS State (2 = Stopped, 3 = Closed Loop)
Return values
TRUESuccess
FALSEFailure
BOOL FRQSetTEGFrequency(tTEGClockIDs tegClockID,
  DWORD frequency 
 )  
Description: Sets the given Tegra clock to the given frequency.
Parameters
[in]tegClockIDID of the Tegra Clock to be set
[in]frequencyFrequency to set
Return values
TRUESuccess
FALSEFailure
MULTCFG GetFreq(void  ) 
Get the actual processor frequencies
Return values
MultiplierConfiguration Structure
void SetFreq(MULTCFG mp) 
Set the processor frequencies according to mp
Parameters
[in]mpMultiplier Configuration Structure
DWORD SetVoltage(DWORD core_voltage) 
Set core voltage.
Parameters
[in]core_voltageVoltage in mV
Return values
Setvoltage 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]hintsArray 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]numHintsNumber of array elments
[in]modeTegDfsBusyHintSyncMode_Async = function returns immediately TegDfsBusyHintSyncMode_Sync = function only returns after boost is active.
Return values
TRUESuccess
FALSEFailure
Send Feedback!