简体   繁体   中英

Controlling PWM-device using C in Linux

I am fairly new to Linux development, and I am having some trouble finding answers to the issue I'm having.

I have a PWM-device connected to a Beaglebone (white) running Debian with kernel version 3.8.13. The Beaglebone is connected to a PWM-device, and I am able to control the device from /sys/devices/ocp.3/pwm_test_P8_13.10/ . Ultimately I want to control the device using C, and I figure the best way to do this is using ioctl .

This is where my question arises: Don't I need to access the device from /dev , and if so, how would I do that when there's no pwm-entry in /dev at all? I know I can write directly to the files in [...]/pwm_test_P8_13.10/ , but I am trying to avoid this if possible.

Is there any other way of approaching this?

A kernel module has been developed during GSOC2010. The driver exports a character device, but it supports ioctls as well.

Anyway, using the sysfs interface may be a valid option, in case you are not able to recompile the kernel module. If you want to do it for studying then ok go for the ioctl-based solution, but in general remember that software has to be realiable an correct, and only secondarly it has to use the feature you like most ;-)

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