简体   繁体   中英

Using Pulse Width Modulation (PWM) interface in kernel module

I'm new in kernel development driver and I'm trying to develop a Linux kernel module, using the this module information:

http://lxr.free-electrons.com/source/drivers/pwm/pwm-tiehrpwm.c

But I didn't understand how to use it. How could adapt this module or better, how to create a new module using functions contained in this file like ehrpwm_pwm_config, ehrpwm_pwm_enable?

PS:I don't want to use sysfs, I would configure the pwm signal programmatically. I'm using a Beaglebone Black board running a Debian distribution , and cape-universaln.

Thanks

You need to enable CONFIG_PWM_TIEHRPWM in your .config file of your linux-kernel. By default, CONFIG_PWM_TIEHRPWM is not set and you need to enable it as CONFIG_PWM_TIEHRPWM=y , if you want to build it as a part of kernel image, or as CONFIG_PWM_TIEHRPWM=m , if you want to build it as a LKM .

Then, build your kernel as make -j12 and insmod your module as:

#insmod /lib/modules/$uname -r/drivers/pwm/pwm_tiehrpwm.ko if you have built it as a LKM . Check Linux kernel documentation on how to configure pwm !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM