coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pwm.c File Reference
#include <device/mmio.h>
#include <soc/addressmap.h>
#include <soc/grf.h>
#include <soc/soc.h>
#include <soc/pwm.h>
#include <soc/clock.h>
#include <timer.h>
Include dependency graph for pwm.c:

Go to the source code of this file.

Data Structures

struct  pwm_ctl
 
struct  rk_pwm_regs
 

Macros

#define RK_PWM_DISABLE   (0 << 0)
 
#define RK_PWM_ENABLE   (1 << 0)
 
#define PWM_ONE_SHOT   (0 << 1)
 
#define PWM_CONTINUOUS   (1 << 1)
 
#define RK_PWM_CAPTURE   (1 << 2)
 
#define PWM_DUTY_POSTIVE   (1 << 3)
 
#define PWM_DUTY_NEGATIVE   (0 << 3)
 
#define PWM_INACTIVE_POSTIVE   (1 << 4)
 
#define PWM_INACTIVE_NEGATIVE   (0 << 4)
 
#define PWM_OUTPUT_LEFT   (0 << 5)
 
#define PWM_OUTPUT_CENTER   (1 << 5)
 
#define PWM_LP_ENABLE   (1 << 8)
 
#define PWM_LP_DISABLE   (0 << 8)
 
#define PWM_SEL_SCALE_CLK   (1 << 9)
 
#define PWM_SEL_SRC_CLK   (0 << 9)
 

Functions

 check_member (rk_pwm_regs, int_en, 0x44)
 
void pwm_init (u32 id, u32 period_ns, u32 duty_ns)
 

Variables

struct rk_pwm_regsrk_pwm = (void *)RK_PWM_BASE
 

Macro Definition Documentation

◆ PWM_CONTINUOUS

#define PWM_CONTINUOUS   (1 << 1)

Definition at line 29 of file pwm.c.

◆ PWM_DUTY_NEGATIVE

#define PWM_DUTY_NEGATIVE   (0 << 3)

Definition at line 33 of file pwm.c.

◆ PWM_DUTY_POSTIVE

#define PWM_DUTY_POSTIVE   (1 << 3)

Definition at line 32 of file pwm.c.

◆ PWM_INACTIVE_NEGATIVE

#define PWM_INACTIVE_NEGATIVE   (0 << 4)

Definition at line 36 of file pwm.c.

◆ PWM_INACTIVE_POSTIVE

#define PWM_INACTIVE_POSTIVE   (1 << 4)

Definition at line 35 of file pwm.c.

◆ PWM_LP_DISABLE

#define PWM_LP_DISABLE   (0 << 8)

Definition at line 42 of file pwm.c.

◆ PWM_LP_ENABLE

#define PWM_LP_ENABLE   (1 << 8)

Definition at line 41 of file pwm.c.

◆ PWM_ONE_SHOT

#define PWM_ONE_SHOT   (0 << 1)

Definition at line 28 of file pwm.c.

◆ PWM_OUTPUT_CENTER

#define PWM_OUTPUT_CENTER   (1 << 5)

Definition at line 39 of file pwm.c.

◆ PWM_OUTPUT_LEFT

#define PWM_OUTPUT_LEFT   (0 << 5)

Definition at line 38 of file pwm.c.

◆ PWM_SEL_SCALE_CLK

#define PWM_SEL_SCALE_CLK   (1 << 9)

Definition at line 44 of file pwm.c.

◆ PWM_SEL_SRC_CLK

#define PWM_SEL_SRC_CLK   (0 << 9)

Definition at line 45 of file pwm.c.

◆ RK_PWM_CAPTURE

#define RK_PWM_CAPTURE   (1 << 2)

Definition at line 30 of file pwm.c.

◆ RK_PWM_DISABLE

#define RK_PWM_DISABLE   (0 << 0)

Definition at line 25 of file pwm.c.

◆ RK_PWM_ENABLE

#define RK_PWM_ENABLE   (1 << 0)

Definition at line 26 of file pwm.c.

Function Documentation

◆ check_member()

check_member ( rk_pwm_regs  ,
int_en  ,
0x44   
)

◆ pwm_init()

void pwm_init ( u32  id,
u32  period_ns,
u32  duty_ns 
)

Variable Documentation

◆ rk_pwm

struct rk_pwm_regs* rk_pwm = (void *)RK_PWM_BASE

Definition at line 47 of file pwm.c.

Referenced by pwm_init().