kb_pwm.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int kb_pwm_init ()
int kb_pwm_cleanup ()
int kb_clk_init ()
int kb_clk_cleanup ()
int kb_pwm_activate (unsigned pwm)
int kb_pwm_desactivate (unsigned pwm)
int kb_pwm_config (unsigned pwm, unsigned pwm_sd, unsigned prescale)
int kb_pwm_duty (unsigned pwm, unsigned FDcycle, unsigned Dcycle)
int kb_pwm_period (unsigned pwm, unsigned pwm_period)


Function Documentation

int kb_clk_cleanup (  ) 

int kb_clk_init (  ) 

Initialize the CLK module. This function must be called before any other call the pwm functions.

Returns:
  • 0 on success
  • a negative error code on failure

Definition at line 199 of file kb_pwm.c.

References CLK_BASE, fd_clk, KB_ERROR, KB_ERROR_FILEOPEN, KB_ERROR_MMAP, map_base_clk, MAP_MASK, MAP_SIZE, and MEMDEV.

Referenced by kb_pwm_init().

int kb_pwm_activate ( unsigned  pwm  ) 

Configure the given IO as an PWM. The GPIO will be configure as an output.

Parameters:
pwm A pwm number between 0 and 1

Definition at line 317 of file kb_pwm.c.

References bit_set_clk(), CKEN, KB_ERROR, KB_ERROR_INVALID, kb_gpio_dir(), kb_gpio_function(), MAXPWM, PWM0, and PWM1.

Referenced by main(), and pwm_on().

Here is the call graph for this function:

int kb_pwm_cleanup (  ) 

Cleanup the PWM module. Must be called to free the module ressources.

Definition at line 301 of file kb_pwm.c.

References fd_pwm0, fd_pwm1, KB_ERROR, KB_ERROR_MMAP, map_base_pwm0, map_base_pwm1, and MAP_SIZE.

int kb_pwm_config ( unsigned  pwm,
unsigned  pwm_sd,
unsigned  prescale 
)

Configure the control register of the given PWM.

Parameters:
pwm A pwm number between 0 and 1
pwm_sd Choose the shutdown method
prescale Determines the frequency of the PWM module clock (old PSCLK_PWMn = 3.6864 MHz / (PWM_CTRL[PRESCALE] + 1)) (PSCLK_PWMn = 13.0 MHz / (PWM_CTRL[PRESCALE] + 1))

Definition at line 390 of file kb_pwm.c.

References KB_ERROR, KB_ERROR_INVALID, MAXPWM, PWM_CTRL0, PWM_CTRL1, reg_set_pwm0(), and reg_set_pwm1().

Referenced by pwm_config().

Here is the call graph for this function:

int kb_pwm_desactivate ( unsigned  pwm  ) 

Desactivate the PWM.

Parameters:
pwm A pwm number between 0 and 1

Definition at line 363 of file kb_pwm.c.

References bit_clear_clk(), CKEN, KB_ERROR, KB_ERROR_INVALID, and MAXPWM.

Referenced by pwm_off().

Here is the call graph for this function:

int kb_pwm_duty ( unsigned  pwm,
unsigned  FDcycle,
unsigned  Dcycle 
)

Configure the duty cycle of the given PWM.

Parameters:
pwm A pwm number between 0 and 1
FDcycle Full Duty Cycle
Dcycle Duty Cycle of PWMn clock

Definition at line 429 of file kb_pwm.c.

References KB_ERROR, KB_ERROR_INVALID, MAXPWM, PWM_PWDUTY0, PWM_PWDUTY1, reg_set_pwm0(), and reg_set_pwm1().

Referenced by main(), and pwm_ratio().

Here is the call graph for this function:

int kb_pwm_init (  ) 

Initialize the two PWM module. This function must be called before any other call the pwm functions.

Returns:
  • 0 on success
  • a negative error code on failure

Definition at line 289 of file kb_pwm.c.

References kb_clk_init(), kb_gpio_init(), kb_pwm0_init(), and kb_pwm1_init().

Referenced by main().

Here is the call graph for this function:

int kb_pwm_period ( unsigned  pwm,
unsigned  pwm_period 
)

Configure the frequency of the given PWM.

Parameters:
pwm A pwm number between 0 and 1
pwm_period Period of given PWM

Definition at line 468 of file kb_pwm.c.

References KB_ERROR, KB_ERROR_INVALID, MAXPWM, PWM_PERVAL0, PWM_PERVAL1, reg_set_pwm0(), and reg_set_pwm1().

Referenced by main(), and pwm_freq().

Here is the call graph for this function:


Generated on Wed Dec 15 11:49:28 2010 for KoreBot Library by  doxygen 1.5.5