CRpi
A library for rpi with intefaces to: gpio, pwm, dma
Macros | Functions
clockManager.h File Reference

Interface to the clock manager peripheral. More...

Go to the source code of this file.

Macros

#define CLK_SRC_GND   0
 Clock source: Ground: 0Hz.
 
#define CLK_SRC_OSCILLATOR   1
 Clock source: Oscillator: 19.2MHz.
 
#define CLK_SRC_TESTDBG0   2
 Clock source: Testdebug0: 0Hz.
 
#define CLK_SRC_TESTDBG1   3
 Clock source: TestDebug1: 0Hz.
 
#define CLK_SRC_PLLA   4
 Clock source: PLLA: 0Hz.
 
#define CLK_SRC_PLLC   5
 Clock source: PLLC: 1000MHz (changes with overclock)
 
#define CLK_SRC_PLLD   6
 Clock source: PLLD: 500MHz.
 
#define CLK_SRC_HDMI   7
 Clock source: HDMI: 216MHZ.
 

Functions

int clkMan_init ()
 Initializes this peripheral interface, to use before any other function in this file. More...
 
int clkMan_isInit ()
 true if clkMan_init has been called with success
 
int clkMan_setClock_gp0 (int clockSrc, int divisorInt, int divisorFrac)
 sets the clock for the general purpouse clock 0 More...
 
int clkMan_setClock_gp1 (int clockSrc, int divisorInt, int divisorFrac)
 sets the clock for the general purpouse clock 1 More...
 
int clkMan_setClock_gp2 (int clockSrc, int divisorInt, int divisorFrac)
 sets the clock for the general purpouse clock 2 More...
 
int clkMan_setClock_pcm (int clockSrc, int divisorInt, int divisorFrac)
 sets the clock for the pcm peripheral More...
 
int clkMan_setClock_pwm (int clockSrc, int divisorInt, int divisorFrac)
 sets the clock for the pwm peripheral More...
 

Detailed Description

Interface to the clock manager peripheral.

This peripheral controls various clocks in the BCM283x SoCs, for each of these clocks you can set a clock source and a frequency divider.
See the CLK_SRC_* macros for the available clock sources and their speed.

Function Documentation

int clkMan_init ( )

Initializes this peripheral interface, to use before any other function in this file.

Returns
negative in case of error
int clkMan_setClock_gp0 ( int  clockSrc,
int  divisorInt,
int  divisorFrac 
)

sets the clock for the general purpouse clock 0

Parameters
clockSrcThe desired clock source (use the CLK_SRC_* macros)
divisorIntInteger part of the divisor
divisorFracFractional part of the divisor
Returns
negative in case of error
int clkMan_setClock_gp1 ( int  clockSrc,
int  divisorInt,
int  divisorFrac 
)

sets the clock for the general purpouse clock 1

Parameters
clockSrcThe desired clock source (use the CLK_SRC_* macros)
divisorIntInteger part of the divisor
divisorFracFractional part of the divisor
Returns
negative in case of error
int clkMan_setClock_gp2 ( int  clockSrc,
int  divisorInt,
int  divisorFrac 
)

sets the clock for the general purpouse clock 2

Parameters
clockSrcThe desired clock source (use the CLK_SRC_* macros)
divisorIntInteger part of the divisor
divisorFracFractional part of the divisor
Returns
negative in case of error
int clkMan_setClock_pcm ( int  clockSrc,
int  divisorInt,
int  divisorFrac 
)

sets the clock for the pcm peripheral

Parameters
clockSrcThe desired clock source (use the CLK_SRC_* macros)
divisorIntInteger part of the divisor
divisorFracFractional part of the divisor
Returns
negative in case of error
int clkMan_setClock_pwm ( int  clockSrc,
int  divisorInt,
int  divisorFrac 
)

sets the clock for the pwm peripheral

Parameters
clockSrcThe desired clock source (use the CLK_SRC_* macros)
divisorIntInteger part of the divisor
divisorFracFractional part of the divisor
Returns
negative in case of error