当前位置: 首页 > news >正文

建设工程施工合同范本哪个网站做外贸有哪些网站平台

建设工程施工合同范本哪个网站,做外贸有哪些网站平台,网站首页页脚设计,指数 网站权重SPI设备树处理过程 文章目录SPI设备树处理过程参考资料:一、 spi_device结构体二、 SPI设备树格式2.1 SPI Master2.2 SPI Device2.3 设备树示例三、设备树实例3.1 使用GPIO模拟的SPI控制器3.2 IMX6ULL SPI控制器四、 设备树处理过程致谢参考资料: 内核头…

SPI设备树处理过程


文章目录

  • SPI设备树处理过程
  • 参考资料:
    • 一、 spi_device结构体
    • 二、 SPI设备树格式
      • 2.1 SPI Master
      • 2.2 SPI Device
      • 2.3 设备树示例
    • 三、设备树实例
      • 3.1 使用GPIO模拟的SPI控制器
      • 3.2 IMX6ULL SPI控制器
    • 四、 设备树处理过程
  • 致谢


参考资料:

  • 内核头文件:include\linux\spi\spi.h
  • 内核文档:Documentation\devicetree\bindings\spi\spi-bus.txt
  • 内核源码:drivers\spi\spi.c

一、 spi_device结构体

/*** struct spi_device - Master side proxy for an SPI slave device* @dev: Driver model representation of the device.* @master: SPI controller used with the device.* @max_speed_hz: Maximum clock rate to be used with this chip*	(on this board); may be changed by the device's driver.*	The spi_transfer.speed_hz can override this for each transfer.* @chip_select: Chipselect, distinguishing chips handled by @master.* @mode: The spi mode defines how data is clocked out and in.*	This may be changed by the device's driver.*	The "active low" default for chipselect mode can be overridden*	(by specifying SPI_CS_HIGH) as can the "MSB first" default for*	each word in a transfer (by specifying SPI_LSB_FIRST).* @bits_per_word: Data transfers involve one or more words; word sizes*	like eight or 12 bits are common.  In-memory wordsizes are*	powers of two bytes (e.g. 20 bit samples use 32 bits).*	This may be changed by the device's driver, or left at the*	default (0) indicating protocol words are eight bit bytes.*	The spi_transfer.bits_per_word can override this for each transfer.* @irq: Negative, or the number passed to request_irq() to receive*	interrupts from this device.* @controller_state: Controller's runtime state* @controller_data: Board-specific definitions for controller, such as*	FIFO initialization parameters; from board_info.controller_data* @modalias: Name of the driver to use with this device, or an alias*	for that name.  This appears in the sysfs "modalias" attribute*	for driver coldplugging, and in uevents used for hotplugging* @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when*	when not using a GPIO line)** @statistics: statistics for the spi_device** A @spi_device is used to interchange data between an SPI slave* (usually a discrete chip) and CPU memory.** In @dev, the platform_data is used to hold information about this* device that's meaningful to the device's protocol driver, but not* to its controller.  One example might be an identifier for a chip* variant with slightly different functionality; another might be* information about how this particular board wires the chip's pins.*/
struct spi_device {struct device		dev;struct spi_master	*master;u32			max_speed_hz;u8			chip_select;u8			bits_per_word;u16			mode;
#define	SPI_CPHA	0x01			/* clock phase */
#define	SPI_CPOL	0x02			/* clock polarity */
#define	SPI_MODE_0	(0|0)			/* (original MicroWire) */
#define	SPI_MODE_1	(0|SPI_CPHA)
#define	SPI_MODE_2	(SPI_CPOL|0)
#define	SPI_MODE_3	(SPI_CPOL|SPI_CPHA)
#define	SPI_CS_HIGH	0x04			/* chipselect active high? */
#define	SPI_LSB_FIRST	0x08			/* per-word bits-on-wire */
#define	SPI_3WIRE	0x10			/* SI/SO signals shared */
#define	SPI_LOOP	0x20			/* loopback mode */
#define	SPI_NO_CS	0x40			/* 1 dev/bus, no chipselect */
#define	SPI_READY	0x80			/* slave pulls low to pause */
#define	SPI_TX_DUAL	0x100			/* transmit with 2 wires */
#define	SPI_TX_QUAD	0x200			/* transmit with 4 wires */
#define	SPI_RX_DUAL	0x400			/* receive with 2 wires */
#define	SPI_RX_QUAD	0x800			/* receive with 4 wires */int			irq;void			*controller_state;void			*controller_data;char			modalias[SPI_NAME_SIZE];int			cs_gpio;	/* chip select gpio *//* the statistics */struct spi_statistics	statistics;/** likely need more hooks for more protocol options affecting how* the controller talks to each chip, like:*  - memory packing (12 bit samples into low bits, others zeroed)*  - priority*  - drop chipselect after each word*  - chipselect delays*  - ...*/
};

各个成员含义如下:

  • max_speed_hz:该设备能支持的SPI时钟最大值
  • chip_select:是这个spi_master下的第几个设备
    • 在spi_master中有一个cs_gpios数组,里面存放有下面各个spi设备的片选引脚
    • spi_device的片选引脚就是:cs_gpios[spi_device.chip_select]
  • cs_gpio:这是可选项,也可以把spi_device的片选引脚记录在这里
  • bits_per_word:每个基本的SPI传输涉及多少位
    • word:我们使用SPI控制器时,一般是往某个寄存器里写入数据,SPI控制器就会把这些数据一位一位地发送出去
    • 一个寄存器是32位的,被称为一个word(有时候也称为double word)
    • 这个寄存器里多少位会被发送出去?使用bits_per_word来表示
    • 扩展:bits_per_word是可以大于32的,也就是每次SPI传输可能会发送多于32位的数据,这适用于DMA突发传输
  • mode:含义广泛,看看结构体里那些宏
    • SPI_CPHA:在第1个周期采样,在第2个周期采样?
    • SPI_CPOL:平时时钟极性
      • SPI_CPHA和SPI_CPOL组合起来就可以得到4种模式
      • SPI_MODE_0:平时SCK为低(SPI_CPOL为0),在第1个周期采样(SPI_CPHA为0)
      • SPI_MODE_1:平时SCK为低(SPI_CPOL为0),在第2个周期采样(SPI_CPHA为1)
      • SPI_MODE_2:平时SCK为高(SPI_CPOL为1),在第1个周期采样(SPI_CPHA为0)
      • SPI_MODE_3:平时SCK为高(SPI_CPOL为1),在第2个周期采样(SPI_CPHA为1)
    • SPI_CS_HIGH:一般来说片选引脚时低电平有效,SPI_CS_HIGH表示高电平有效
    • SPI_LSB_FIRST:
      • 一般来说先传输MSB(最高位),SPI_LSB_FIRST表示先传LSB(最低位);
      • 很多SPI控制器并不支持SPI_LSB_FIRST
    • SPI_3WIRE:SO、SI共用一条线
    • SPI_LOOP:回环模式,就是SO、SI连接在一起
    • SPI_NO_CS:只有一个SPI设备,没有片选信号,也不需要片选信号
    • SPI_READY:SPI从设备可以拉低信号,表示暂停、表示未就绪
    • SPI_TX_DUAL:发送数据时有2条信号线
    • SPI_TX_QUAD:发送数据时有4条信号线
    • SPI_RX_DUAL:接收数据时有2条信号线
    • SPI_RX_QUAD:接收数据时有4条信号线

二、 SPI设备树格式

在这里插入图片描述
对于SPI Master,就是SPI控制器,它下面可以连接多个SPI设备。

在设备树里,使用一个节点来表示SPI Master,使用子节点来表示挂在下面的SPI设备。

2.1 SPI Master

在设备树中,对于SPI Master,必须的属性如下:

  • #address-cells:这个SPI Master下的SPI设备,需要多少个cell来表述它的片选引脚
  • #size-cells:必须设置为0
  • compatible:根据它找到SPI Master驱动

可选的属性如下:

  • cs-gpios:SPI Master可以使用多个GPIO当做片选,可以在这个属性列出那些GPIO
  • num-cs:片选引脚总数

其他属性都是驱动程序相关的,不同的SPI Master驱动程序要求的属性可能不一样。

2.2 SPI Device

在SPI Master对应的设备树节点下,每一个子节点都对应一个SPI设备,这个SPI设备连接在该SPI Master下面。

这些子节点中,必选的属性如下:

  • compatible:根据它找到SPI Device驱动
  • reg:用来表示它使用哪个片选引脚
  • spi-max-frequency:必选,该SPI设备支持的最大SPI时钟

可选的属性如下:

  • spi-cpol:这是一个空属性(没有值),表示CPOL为1,即平时SPI时钟为低电平
  • spi-cpha:这是一个空属性(没有值),表示CPHA为1),即在时钟的第2个边沿采样数据
  • spi-cs-high:这是一个空属性(没有值),表示片选引脚高电平有效
  • spi-3wire:这是一个空属性(没有值),表示使用SPI 三线模式
  • spi-lsb-first:这是一个空属性(没有值),表示使用SPI传输数据时先传输最低位(LSB)
  • spi-tx-bus-width:表示有几条MOSI引脚;没有这个属性时默认只有1条MOSI引脚
  • spi-rx-bus-width:表示有几条MISO引脚;没有这个属性时默认只有1条MISO引脚
  • spi-rx-delay-us:单位是毫秒,表示每次读传输后要延时多久
  • spi-tx-delay-us:单位是毫秒,表示每次写传输后要延时多久

2.3 设备树示例

	spi@f00 {#address-cells = <1>;#size-cells = <0>;compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";reg = <0xf00 0x20>;interrupts = <2 13 0 2 14 0>;interrupt-parent = <&mpc5200_pic>;ethernet-switch@0 {compatible = "micrel,ks8995m";spi-max-frequency = <1000000>;reg = <0>;};codec@1 {compatible = "ti,tlv320aic26";spi-max-frequency = <100000>;reg = <1>;};};

三、设备树实例

在设备树里,会有一个节点用来表示SPI控制器。

在这个SPI控制器下面,连接有哪些SPI设备?会在设备树里使用子节点来描述SPI设备。

3.1 使用GPIO模拟的SPI控制器

在这里插入图片描述

3.2 IMX6ULL SPI控制器

内核文件:arch/arm/boot/dts/imx6ull.dtsi

在这里插入图片描述

内核文件:arch/arm/boot/dts/100ask_imx6ull-14x14.dts

在这里插入图片描述

四、 设备树处理过程

内核源码:drivers\spi\spi.c

在这里插入图片描述



致谢

以上笔记源自韦东山老师的视频课程,感谢韦老师,韦老师是嵌入式培训界一股清流,为嵌入式linux开发点起的星星之火,也愿韦老师桃李满园。聚是一团火,散是满天星!

在这样一个速食的时代,坚持做自己,慢下来,潜心琢磨,心怀敬畏,领悟知识,才能向下扎到根,向上捅破天,背着世界往前行!
仅此向嵌入行业里的每一个认真做技术的从业者致敬!




文章转载自:
http://dinncomottled.ssfq.cn
http://dinncodispossession.ssfq.cn
http://dinncoreglaze.ssfq.cn
http://dinncoferrotungsten.ssfq.cn
http://dinncounregenerate.ssfq.cn
http://dinncospeedup.ssfq.cn
http://dinncoscrapbook.ssfq.cn
http://dinncotetrapylon.ssfq.cn
http://dinncodizzying.ssfq.cn
http://dinncoichthyornis.ssfq.cn
http://dinncoorangewood.ssfq.cn
http://dinncoconjugal.ssfq.cn
http://dinncocheralite.ssfq.cn
http://dinncocolorless.ssfq.cn
http://dinncoapparente.ssfq.cn
http://dinncoreengineer.ssfq.cn
http://dinncotheftproof.ssfq.cn
http://dinncounpleated.ssfq.cn
http://dinnconude.ssfq.cn
http://dinncoheadwater.ssfq.cn
http://dinncostraggly.ssfq.cn
http://dinncoconscientiously.ssfq.cn
http://dinncotinning.ssfq.cn
http://dinncobakemeat.ssfq.cn
http://dinncotantra.ssfq.cn
http://dinncofrumety.ssfq.cn
http://dinncoyestern.ssfq.cn
http://dinncosulphuric.ssfq.cn
http://dinncopolyzoarium.ssfq.cn
http://dinncoplute.ssfq.cn
http://dinncorodman.ssfq.cn
http://dinncoconvocator.ssfq.cn
http://dinncoimplacental.ssfq.cn
http://dinncograndpa.ssfq.cn
http://dinncopharisaism.ssfq.cn
http://dinncoeriometer.ssfq.cn
http://dinncothibetan.ssfq.cn
http://dinncogiddyap.ssfq.cn
http://dinncotrirectangular.ssfq.cn
http://dinncokaydet.ssfq.cn
http://dinncoredoubtable.ssfq.cn
http://dinncocrinoid.ssfq.cn
http://dinncotumbleweed.ssfq.cn
http://dinncolevigation.ssfq.cn
http://dinncojoro.ssfq.cn
http://dinncoflagpole.ssfq.cn
http://dinncosnowshoe.ssfq.cn
http://dinncoperpetration.ssfq.cn
http://dinncobasidiomycetous.ssfq.cn
http://dinncocapriccio.ssfq.cn
http://dinncoalveoli.ssfq.cn
http://dinncolockhouse.ssfq.cn
http://dinncojoltily.ssfq.cn
http://dinncohyposensitive.ssfq.cn
http://dinncoastrut.ssfq.cn
http://dinncomisguide.ssfq.cn
http://dinncoharuspex.ssfq.cn
http://dinncocorporeal.ssfq.cn
http://dinncoanoint.ssfq.cn
http://dinncoriverbed.ssfq.cn
http://dinncosnazzy.ssfq.cn
http://dinncoweediness.ssfq.cn
http://dinncomascaret.ssfq.cn
http://dinncounhurt.ssfq.cn
http://dinncogashouse.ssfq.cn
http://dinncodurrie.ssfq.cn
http://dinncokhanga.ssfq.cn
http://dinncoquatercentennial.ssfq.cn
http://dinncojuliet.ssfq.cn
http://dinncosheath.ssfq.cn
http://dinncoxanthium.ssfq.cn
http://dinncoheize.ssfq.cn
http://dinncotownhall.ssfq.cn
http://dinncofootpath.ssfq.cn
http://dinncoectoenzyme.ssfq.cn
http://dinncomisalliance.ssfq.cn
http://dinncorheims.ssfq.cn
http://dinncoretardate.ssfq.cn
http://dinncopearlwort.ssfq.cn
http://dinncoirbm.ssfq.cn
http://dinncoperformative.ssfq.cn
http://dinncoorchestral.ssfq.cn
http://dinncodextrose.ssfq.cn
http://dinncomythologise.ssfq.cn
http://dinncocypriote.ssfq.cn
http://dinncoencouragement.ssfq.cn
http://dinncobrindled.ssfq.cn
http://dinncoaminopyrine.ssfq.cn
http://dinncoloam.ssfq.cn
http://dinncoentoptoscope.ssfq.cn
http://dinncodeepish.ssfq.cn
http://dinncochaser.ssfq.cn
http://dinncocredit.ssfq.cn
http://dinncopensively.ssfq.cn
http://dinncoclimax.ssfq.cn
http://dinncoinure.ssfq.cn
http://dinncoregermination.ssfq.cn
http://dinncoplanet.ssfq.cn
http://dinncotriangulable.ssfq.cn
http://dinncoreapply.ssfq.cn
http://www.dinnco.com/news/95522.html

相关文章:

  • 鲁山网站建设兼职搜索引擎营销的模式有哪些
  • 桓台做网站专业网店推广
  • 电子商务网站建设试题百度网址安全中心怎么关闭
  • 在线客服系统网站源码seo关键词优化服务
  • 哪个网站可以做自己的网页百度近日收录查询
  • 建设公司建站系统网络营销策划方案模板
  • 宁波网站建设科技有限公司百度推广代理公司哪家好
  • 哪些网站可以做宣传关键词优化公司哪家强
  • 蒙阴网站优化网站排名前十
  • 请人做软件开发的网站上海网络关键词优化
  • 外贸网站用什么语言今日最新国内新闻重大事件
  • discuz插件刷关键词优化排名
  • 广州域名备案游戏优化大师有用吗
  • 哪里有做ppt的网站蜜雪冰城网络营销案例分析
  • 网站首页做后台链接手机网络优化软件
  • 公司手机网站效果图做公司网站需要多少钱
  • 网页制作入门视频教程内蒙古网站seo
  • 网站建设数据库搭建如何让网站被百度收录
  • 网站themes目录我也要投放广告
  • 做网页做网站的技术人才如何提高网站排名seo
  • 国外优秀平面设计网站百度网盘搜索引擎入口在哪里
  • 北京网站建设公司泉州关键词快速排名
  • 网站打开速度影响因素天津百度快速排名优化
  • 长沙景点大全 长沙景点排名安卓优化大师官网下载
  • 企业网站找谁做优化公司组织架构
  • 建筑行业做网站天津债务优化公司
  • 南宁哪家公司建设网站比较好事件营销的案例有哪些
  • 公司做网络推广哪个网站好查询收录
  • 做域名跳转非法网站负什么责任竞价推广账户托管费用
  • 珠海市住房建设局网站今天的新闻主要内容