[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: gpio(4) and pulsing pins in software
# Marc Balmer 2011-09-25:
> I recently added code to gpio(4) on jak's request to pulse a pin in
> software. The idea is, that when the hardware supports it, a pin is
> pulsed by the hardware, if the underlying hardware has no pulsate
> support, it can be done in software. While the current code works, I
> think it is done wrong, or at the wrong level, and I'd like to change
> that. Comments welcome.
Nice aspect is that presence of HW support is transparent to the user.
Doesn't your proposal mean this property is removed and the user has to
use gpioctl(8) for HW support and gpiopwm(4) for SW implementation (it
is not clear enough from you message)?
> I think gpio(4) should only be used to configure and control pins, but
> not to do any magic with them, like pulsing in software. We have the
> possibility to attach device drivers to individual pins which can then
> do the "magic". So I am suggesting removing the software pulsing
> support in gpio(4) and replacing it by a gpiopwm(4) driver that can be
> attached to an individual pin. gpioctl(8) will keep the pulse keyword,
> as this is needed for hardware pulsating devices. The interface to the
> gpiopwm(4) driver could be realized using three sysctl variables:
> hw.gpiopwm0.running=0 # Set to 1 to start pwm
> hw.gpiopwm0.ticks_on=n1 # Number of ticks the pin is 1
> hw.gpiopwm0.ticks_off=n2 # Number of ticks the pin is 0
Doesn't sysctl(3) interface mean one can't change lo+hi periods atomically?
Wouldn't it be better to specify hi/lo values in absolute units (current
implementation uses timeval) instead of relative ticks?
Main Index |
Thread Index |