Search by Tags

Clk Lib API

 

Article updated at 28 Oct 2017
Compare with Revision




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 manange clock settings. More...

Macros

#define CLKLIB_VERSION_MAJOR  3 Version Info. More...
#define CLKLIB_VERSION_MINOR  3 #define CLKLIB_VERSION_BUILD  0 #define USE_DEFAULT_CLOCK_SOURCE  255 #define USE_DEFAULT_CLOCK_DIVIDER  4294967295 

Functions

void  ClkLibGetLibVersion (DWORD *VersionMajor, DWORD *VersionMinor, DWORD *Build)
void  ClkLibInit (void)
Initialises the library, call before calling any other functions. More...
void  ClkLibDeInit (void)
Releases the library resources, call when finsihed with the library. More...
BOOL  ClkLibSetClock (DWORD clockID, BOOL status)
BOOL  ClkLibSetClockEx (DWORD clockID, BOOL status, DWORD ClockDivider)
DWORD  ClkLibSetClockFrequency (DWORD clockID, DWORD minimumFrequency, DWORD maximumFrequency, tClockOptimise optimiseTarget)
BOOL  ClkLibGetClockEnableStatus (DWORD clockID)
DWORD  ClkLibGetClockFrequency (DWORD clockID)
void  ClkLibWaitus (UINT32 uSec)
Deprecated legacy declarations
void  InitClkLib (void)
void  DeInitClkLib (void)
BOOL  SetClk (DWORD clkID, BOOL value)
BOOL  SetClkEx (DWORD clkID, BOOL value, DWORD ClkDivider)
BOOL  GetClkEn (DWORD clkID)
void  Waitus (UINT32 uSec)
void  CLKGetLibVersion (DWORD *pVerMaj, DWORD *pVerMin, DWORD *pBuild)

Detailed Description

Library to manange clock settings.

Author:
kia
Rev:
2101
Date:
2014-03-10 14:27:38 +0100 (Mo, 10 Mrz 2014)
Target Platforms:
PXAxxx / T20 / T30

Macro Definition Documentation

#define CLKLIB_VERSION_BUILD   0
#define CLKLIB_VERSION_MAJOR   3

Version Info.

#define CLKLIB_VERSION_MINOR   3
#define USE_DEFAULT_CLOCK_DIVIDER   4294967295
#define USE_DEFAULT_CLOCK_SOURCE   255

Enumeration Type Documentation

Enumerator
ClockOptimiseForPower

Optimise clock source selection for lowest power consumption.

ClockOptimiseForPrecision

Optimise clock source selection to be the closest frequency.

Function Documentation

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

Returns the library Version.

Deprecated:
Please use ClkLibGetLibVersion()
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.
void ClkLibDeInit ( void  )

Releases the library resources, call when finsihed with the library.

BOOL ClkLibGetClockEnableStatus ( DWORD  clockID )

Returns the clock enable status for a specific peripheral

Parameters
[in] clockID Clock ID (refer to ClkLib.h)
Return values
TRUE,: Success, FALSE: Error
DWORD ClkLibGetClockFrequency ( DWORD  clockID )

Gets the current frequency of the given clock. Tegra 2 Only

Parameters
[in] clockID Clock ID (refer to ClkLib.h)
Return values
Actual Frequency configured, 0 = function failed
void ClkLibGetLibVersion ( DWORD *  VersionMajor,
DWORD *  VersionMinor,
DWORD *  Build
)

Returns the library version.

Parameters
[out] VersionMajor Returns the major version number. Set this parameter to NULL if not required.
[out] VersionMinor Returns the minor version number. Set this parameter to NULL if not required.
[out] Build Returns the build number. Set this parameter to NULL if not required.
void ClkLibInit ( void  )

Initialises the library, call before calling any other functions.

BOOL ClkLibSetClock ( DWORD  clockID,
BOOL  status
)

Enables or disables the clock for a specific peripheral.

Parameters
[in] clockID Clock ID (refer to ClkLib.h)
[in] status TRUE: Enable clock, FALSE: Disable clock
Return values
TRUE,: Success, FALSE: Error
BOOL ClkLibSetClockEx ( DWORD  clockID,
BOOL  status,
DWORD  ClockDivider
)

Enables / disables clock for a specific peripheral - extended version.

Parameters
[in] clockID Clock ID (refer to ClkLib.h)
[in] status TRUE for enable clock, FALSE for disable clock
[in] clockDivider Clock Divisor, set to USE_DEFAULT_CLOCK_DIVIDER to use default (Tegra only)
Return values
TRUE,: Success, FALSE: Error
DWORD ClkLibSetClockFrequency ( DWORD  clockID,
DWORD  minimumFrequency,
DWORD  maximumFrequency,
tClockOptimise optimiseTarget
)

Sets the Clock Speed as close as possible to the provided frequency. Tegra 2 Only

Parameters
[in] clockID Clock ID (refer to ClkLib.h)
[in] minimumFrequency Lowest allowed frequency [Hz]
[in] maximumFrequency Highest allowed frequency [Hz]
[in] optimiseTarget ClkOptimiseForPower = select the slowest clock source which can be used to generate a frequency in the requested range
ClkOptimizeForPrecision = select the clock source which can generate a clock as close as possible to the average of minimumFrequency and maximumFrequency
Return values
Actual Frequency configured, 0 = function failed
void ClkLibWaitus ( UINT32  uSec )

Delay with microsecond resolution.

Parameters
[in] uSec Number of microseconds.
void DeInitClkLib ( void  )

Releases the library resources, call when finsihed with the library

Deprecated:
Please use ClkLibDeInit()
BOOL GetClkEn ( DWORD  clkID )

Request clock enable status for a specific peripheral

Deprecated:
Please use ClkLibGetClockEnableStatus()
Parameters
[in] clkID Clock ID (refer to ClkLib.h)
Return values
TRUE,: Success, FALSE: Error
void InitClkLib ( void  )

Initialises the library, call before calling any other functions

Deprecated:
Please use ClkLibInit()
BOOL SetClk ( DWORD  clkID,
BOOL  value
)

Enables / disables clock for a specific peripheral.

Deprecated:
Please use ClkLibSetClock()
Parameters
[in] clkID Clock ID (refer to ClkLib.h)
[in] value TRUE: Enable clock, FALSE: Disable clock
Return values
TRUE,: Success, FALSE: Error
BOOL SetClkEx ( DWORD  clkID,
BOOL  value,
DWORD  ClkDivider
)

Enables / disables clock for a specific peripheral - extended version.

Deprecated:
Please use ClkLibSetClockEx()
Parameters
[in] clkID Clock ID (refer to ClkLib.h)
[in] value TRUE for enable clock, FALSE for disable clock
[in] ClkDivider Clock Divisor, set to USE_DEFAULT_CLOCK_DIVIDER to use default (Tegra only)
Return values
TRUE,: Success, FALSE: Error
void Waitus ( UINT32  uSec )

Delay with microsecond resolution.

Deprecated:
Please use ClkLibWaitus()
Parameters
[in] uSec Number of microseconds.