Linux Kernel
3.7.1
|
Go to the source code of this file.
Data Structures | |
struct | pwm_channel |
Macros | |
#define | pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1) |
#define | pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0) |
#define | PWM_CMR 0x00 /* mode register */ |
#define | PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */ |
#define | PWM_CPR_CPOL (1 << 9) /* set: idle high */ |
#define | PWM_CPR_CALG (1 << 8) /* set: center align */ |
#define | PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */ |
#define | PWM_CPR_CLKA (0xb << 0) /* rate CLKA */ |
#define | PWM_CPR_CLKB (0xc << 0) /* rate CLKB */ |
#define | PWM_CDTY 0x04 /* duty cycle (max of CPRD) */ |
#define | PWM_CPRD 0x08 /* period (count up from zero) */ |
#define | PWM_CCNT 0x0c /* counter (20 bits?) */ |
#define | PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */ |
Functions | |
int | pwm_channel_alloc (int index, struct pwm_channel *ch) |
int | pwm_channel_free (struct pwm_channel *ch) |
int | pwm_clk_alloc (unsigned prescale, unsigned div) |
void | pwm_clk_free (unsigned clk) |
int | __pwm_channel_onoff (struct pwm_channel *ch, int enabled) |
int | pwm_channel_handler (struct pwm_channel *ch, void(*handler)(struct pwm_channel *ch)) |
#define PWM_CCNT 0x0c /* counter (20 bits?) */ |
Definition at line 56 of file atmel_pwm.h.
#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */ |
Definition at line 54 of file atmel_pwm.h.
#define pwm_channel_disable | ( | ch | ) | __pwm_channel_onoff((ch), 0) |
Definition at line 40 of file atmel_pwm.h.
#define pwm_channel_enable | ( | ch | ) | __pwm_channel_onoff((ch), 1) |
Definition at line 39 of file atmel_pwm.h.
#define PWM_CMR 0x00 /* mode register */ |
Definition at line 47 of file atmel_pwm.h.
#define PWM_CPR_CALG (1 << 8) /* set: center align */ |
Definition at line 50 of file atmel_pwm.h.
#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */ |
Definition at line 52 of file atmel_pwm.h.
#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */ |
Definition at line 53 of file atmel_pwm.h.
#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */ |
Definition at line 48 of file atmel_pwm.h.
Definition at line 49 of file atmel_pwm.h.
#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */ |
Definition at line 51 of file atmel_pwm.h.
#define PWM_CPRD 0x08 /* period (count up from zero) */ |
Definition at line 55 of file atmel_pwm.h.
#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */ |
Definition at line 57 of file atmel_pwm.h.
int __pwm_channel_onoff | ( | struct pwm_channel * | ch, |
int | enabled | ||
) |
Definition at line 170 of file atmel_pwm.c.
int pwm_channel_alloc | ( | int | index, |
struct pwm_channel * | ch | ||
) |
pwm_channel_alloc - allocate an unused PWM channel : identifies the channel : structure to be initialized
Drivers allocate PWM channels according to the board's wiring, and matching board-specific setup code. Returns zero or negative errno.
Definition at line 88 of file atmel_pwm.c.
int pwm_channel_free | ( | struct pwm_channel * | ch | ) |
pwm_channel_free - release a previously allocated channel : the channel being released
The channel is completely shut down (counter and IRQ disabled), and made available for re-use. Returns zero, or negative errno.
Definition at line 147 of file atmel_pwm.c.
int pwm_channel_handler | ( | struct pwm_channel * | ch, |
void(*)(struct pwm_channel *ch) | handler | ||
) |
int pwm_clk_alloc | ( | unsigned | prescale, |
unsigned | div | ||
) |
pwm_clk_alloc - allocate and configure CLKA or CLKB : from 0..10, the power of two used to divide MCK : from 1..255, the linear divisor to use
Returns PWM_CPR_CLKA, PWM_CPR_CLKB, or negative errno. The allocated clock will run with a period of (2^prescale * div) / MCK, or twice as long if center aligned PWM output is used. The clock must later be deconfigured using pwm_clk_free().
Definition at line 200 of file atmel_pwm.c.
void pwm_clk_free | ( | unsigned | clk | ) |
pwm_clk_free - deconfigure and release CLKA or CLKB
Reverses the effect of pwm_clk_alloc().
Definition at line 231 of file atmel_pwm.c.