PWM Memory Mode使用方法
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
PWM memory Mode介绍和Demo Code
[SOLUTION]
PWM Memory Mode介绍:
PWM Memory Demo Code:
static void PWM_MemoryMode_DemoCode()
{
struct pwm_spec_config conf = {0};
unsigned int *phys;
unsigned int *virt;
pr_err("<0>""=============demo test===============\n");
conf.mode = PWM_MODE_MEMORY;
conf.pwm_no = 0;
conf.clk_div = CLK_div1;
conf.clk_src = PWM_CLK_NEW_MODE_BLOCK;
conf.PWM_MODE_MEMORY_REGS.IDLE_VALUE = IDLE_FALSE;
conf.PWM_MODE_MEMORY_REGS.GUARD_VALUE = GUARD_FALSE;
conf.PWM_MODE_MEMORY_REGS.HDURATION = 119;
conf.PWM_MODE_MEMORY_REGS.LDURATION = 119;
conf.PWM_MODE_MEMORY_REGS.GDURATION = 0;
conf.PWM_MODE_MEMORY_REGS.WAVE_NUM = 0;
conf.PWM_MODE_MEMORY_REGS.STOP_BITPOS_VALUE = 31;
virt = DMA_alloc_coherent(NULL, 8, &phys, GFP_KERNEL);//采用DMA方式分配地
址
unsigned int *membuff = virt;
membuff[0] = 0xaaaaaaaa;
membuff[1] = 0xffff0000;
conf.PWM_MODE_MEMORY_REGS.BUF0_SIZE = 8;
conf.PWM_MODE_MEMORY_REGS.BUF0_BASE_ADDR = phys;//传递物理地址给PWM
pwm_set_spec_config(&conf);
}
pwm使用完毕后,要调用函数void mt_pwm_disable(U32 pwm_no, BOOL pMIC_pad)关
闭掉PWM。
PWM memory Mode介绍和Demo Code
[SOLUTION]
PWM Memory Mode介绍:
PWM Memory Demo Code:
static void PWM_MemoryMode_DemoCode()
{
struct pwm_spec_config conf = {0};
unsigned int *phys;
unsigned int *virt;
pr_err("<0>""=============demo test===============\n");
conf.mode = PWM_MODE_MEMORY;
conf.pwm_no = 0;
conf.clk_div = CLK_div1;
conf.clk_src = PWM_CLK_NEW_MODE_BLOCK;
conf.PWM_MODE_MEMORY_REGS.IDLE_VALUE = IDLE_FALSE;
conf.PWM_MODE_MEMORY_REGS.GUARD_VALUE = GUARD_FALSE;
conf.PWM_MODE_MEMORY_REGS.HDURATION = 119;
conf.PWM_MODE_MEMORY_REGS.LDURATION = 119;
conf.PWM_MODE_MEMORY_REGS.GDURATION = 0;
conf.PWM_MODE_MEMORY_REGS.WAVE_NUM = 0;
conf.PWM_MODE_MEMORY_REGS.STOP_BITPOS_VALUE = 31;
virt = DMA_alloc_coherent(NULL, 8, &phys, GFP_KERNEL);//采用DMA方式分配地
址
unsigned int *membuff = virt;
membuff[0] = 0xaaaaaaaa;
membuff[1] = 0xffff0000;
conf.PWM_MODE_MEMORY_REGS.BUF0_SIZE = 8;
conf.PWM_MODE_MEMORY_REGS.BUF0_BASE_ADDR = phys;//传递物理地址给PWM
pwm_set_spec_config(&conf);
}
pwm使用完毕后,要调用函数void mt_pwm_disable(U32 pwm_no, BOOL pMIC_pad)关
闭掉PWM。
本尊签到
哈哈 大家都这么逗 这样真的好么