Kconfig下的SPI驱动相关文件编写

知识汇总:

Y:表示选中,程序编译进内核;N:表示不选中,不编译;M:表示选中,程序编译成单独加载的驱动文件

配置项的类型:

bool        布尔型,Y N

tristate    常数型,Y N M

string      字符串型,这个可以输入字符串

hex        二进制

int          整数

 

 

1、打开在SPI目录下的 Kconfig文件,与SPI相关的如下:

知识点:

bool 为布尔量只有两种状态,选中Y  不选中N

depends 依赖关系,表示这个配置项目依赖的条件是XXX,如果XXX没有被选中 则看不到这个配置项目

#建立SPI的配置显示主页面选项,
menuconfig SPI
        #这个主页面叫 SPI support,bool表示 选中则为 Y  不选中为N  两种状态
	bool "SPI support"
        #依赖关系depends ,这里表示只有HAS_IOMEM不为N则显示SPI support选项
	depends on HAS_IOMEM
        #以下是帮助文档
	help
	  The "Serial Peripheral Interface" is a low level synchronous
	  protocol.  Chips that support SPI can have data transfer rates
	  up to several tens of Mbit/sec.  Chips are addressed with a
	  controller and a chipselect.  Most SPI slaves don't support
	  dynamic device discovery; some are even write-only or read-only.

	  SPI is widely used by microcontrollers to talk with sensors,
	  eeprom and flash memory, codecs and various other controller
	  chips, analog to digital (and d-to-a) converters, and more.
	  MMC and SD cards can be accessed using SPI protocol; and for
	  DataFlash cards used in MMC sockets, SPI must always be used.

	  SPI is one of a family of similar protocols using a four wire
	  interface (select, clock, data in, data out) including Microwire
	  (half duplex), SSP, SSI, and PSP.  This driver framework should
	  work with most such devices and controllers.

2、关于i.mx6芯片部份的SPI内容

知识点:

select与depends on是相反的逻辑关系。select叫反向依赖
A depends on B  ------那么只有在B选中才能选A
A select  B          -------那么只要选中A就会选中B

这里的A 是指     tristate "Freescale i.MX SPI controllers"

#建立spi_imx的目录
config SPI_IMX
        #这个目录在配置界面上显示的名称为Freescale i.MX SPI controllers
        #tristate 表示常数量,三种状态 Y选中编译进内核,N不编译,M单独编译不进内核
	tristate "Freescale i.MX SPI controllers"
        #depends 依赖条件,两个条件有一个选中了才会显示这个配置项目
	depends on ARCH_MXC || COMPILE_TEST
        #选中上面的Freescale i.MX SPI controllers,自然会选中SPI_BITBANG
	select SPI_BITBANG
	help
	  This enables using the Freescale i.MX SPI controllers in master
	  mode.

3、以下内容与本次SPI无关仅为了学习Konfig

知识点:

range 意义为数据范围格式

default 意义为默认值

 

if ARM_DMA_USE_IOMMU
#创建一个ARM_DMA_IOMMU_ALIGNMENT目录
config ARM_DMA_IOMMU_ALIGNMENT
        #int型,界面上显示是Maximum PAGE_SIZE order of alignment for DMA IOMMU buffers
	int "Maximum PAGE_SIZE order of alignment for DMA IOMMU buffers"
        #range 意义为范围。这里表示输入的数据范围是4-9
	range 4 9
        #default 意义为默认值。这里表示默认值为8
	default 8
	help
	  DMA mapping framework by default aligns all buffers to the smallest
	  PAGE_SIZE order which is greater than or equal to the requested buffer
	  size. This works well for buffers up to a few hundreds kilobytes, but
	  for larger buffers it just a waste of address space. Drivers which has
	  relatively small addressing window (like 64Mib) might run out of
	  virtual space with just a few allocations.

	  With this parameter you can specify the maximum PAGE_SIZE order for
	  DMA IOMMU buffers. Larger buffers will be aligned only to this
	  specified order. The order is expressed as a power of two multiplied
	  by the PAGE_SIZE.

endif

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值