Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
462 views
in Technique[技术] by (71.8m points)

linux - 简单的SPI设备驱动程序(Simple SPI device driver)

I have written a simple driver for a character device in Non Blocking mode using epoll.

(我已经使用epoll为非阻塞模式下的字符设备编写了一个简单的驱动程序。)

Now I would like to use that driver for SPI interface.

(现在,我想将该驱动程序用于SPI接口。)

What should be the device name or how will I map the actual device with the kernel ?

(设备名称应该是什么?如何将实际设备与内核映射?)

How will I use the interrupt?

(我将如何使用中断?)

Also who is the Master and Slave?Suppose I am connecting a SPI compatible device to the panda board.Will that device becomes a slave and the development board becomes Master?

(另外,谁是Master和Slave?假设我将SPI兼容设备连接到熊猫板上,那么该设备将成为从设备,而开发板又将成为Master吗?)

I am a newbie.I am using a panda board.

(我是新手,我在用熊猫板。)

In what way should I go through the Technical Reference manual?

(我应该以哪种方式阅读技术参考手册?)

I would really appreciate if anybody would explain and clarify my doubts.

(如果有人能解释和澄清我的疑问,我将不胜感激。)

  ask by ddpd translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You probably want to connect your driver to a SPI bus driver.

(您可能希望将驱动程序连接到SPI总线驱动程序。)

This requires a slight reworking of your driver.

(这需要对驱动程序进行少许重新加工。)

See drivers/spi/spi.c

(参见drivers/spi/spi.c)

You'll be using the commands for the bus (master, the CPU side) to read and write the commands to the unit.

(您将使用总线命令(主机,CPU端)来读取命令并将其写入单元。)

I don't know what a Panda board is, but if it connects via SPI, it might be a master, but it is probably a slave.

(我不知道熊猫板是什么,但是如果它通过SPI连接,它可能是一个主控板,但它可能是一个从属板。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...