Linux - Embedded & Single-board computerThis forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am new to linux drivers and want see if my approach is correct
here. I need to write a little bit banging device driver to a custom
CPLD 3-Wire serial interface. This is a one way communication meaning
we are only writing to the device over the serial interface.
So, I think what i need to do is write a character driver will
implement an open, release, and write methods and of course the init
and exit to setup the character driver. Is the correct approach?
In my write method in the driver, when i receive the 3 bytes of data
that I need to bit-bang over 3 gpios I will enable the chip select
gpio and start the clocking gpio and transmitting the the bits on the
Anyone have a sample driver of something similar? I just basically
want to see how the correct way to implement the timer for the clock
in the kernel. I am sure I can figure it out and will, but would like
to see an example from someone who is not as new to linux as I am.
i know the pseudo code is something like the following, but maybe a
timer (i assume there are timers in the kernel) is the better approach
which is the whole reason I am asking about this.
enable the chip select gpio (set low)
while (bits to write)
set clk gpio low
wait 1/2 bit time
set data gpio
wait 1/2 bit time
set clk gpio high
disable the chip select gpio (set high)