早晨起床口苦是什么原因| q币有什么用| 男女身份证号码有什么区分| 兔子肉不能和什么一起吃| 豆蔻年华是什么意思| 下焦不通吃什么中成药| beaf什么意思| nt是什么意思| 为什么会流鼻血什么原因引起的| 戳什么意思| 男性硬不起来什么原因| 吃什么补充维生素d| 身上总是痒是什么原因| 挥霍是什么意思| 睡不着觉有什么办法| 什么是花青素| 尿隐血什么意思| 芙蕖是什么花| 心服口服是什么意思| 胆汁为什么会反流到胃里面| 12月7号是什么星座| 酒后喝什么饮料比较好| 佛光普照是什么生肖| 松鼠喜欢吃什么食物| 舌头溃疡用什么药| 荨麻疹需要注意什么| 什么是房补| 腺样体肥大是什么意思| 化学学什么| 护照办理需要什么材料| 耳朵闷闷的堵住的感觉是什么原因| 脚没有力气是什么原因| 情人总分分合合是什么歌| 白癜风是什么| 层出不穷是什么意思| 嗜睡是什么原因| 经常犯困是什么原因| 肝外胆管扩张什么意思| 苦瓜有什么功效和作用| 害羞是什么意思| 什么地制宜| 肚子咕咕叫放屁多是什么原因| smz是什么药| 立秋那天吃什么| 去极化是什么意思| 相位是什么| 什么东西解辣| 屏幕总成带框和不带框有什么区别| 精子是什么味道| LOP是什么胎位| 燕窝是什么做的| 为什么要睡觉| 7点是什么时辰| 射手什么象星座| 橙子和橘子有什么区别| 控制线是什么意思| 什么的哭声| 夷是什么意思| 路由器什么牌子好| 十月二十三号是什么星座| 茔是什么意思| 树脂材料是什么| 六块钱的麻辣烫是什么意思| 童话故事有什么| 肌酸激酶偏高吃什么药| 今年27岁属什么生肖| 大脚骨疼是什么原因| 减肥能吃什么零食| 寻麻疹涂什么药膏| 什么血型容易被蚊子咬| 今年什么时间进伏| 百年灵手表什么档次| 清油是什么油| 鲥鱼是什么鱼| 羊水透声欠佳什么意思| 胰腺挂什么科| 医院五行属什么| 矢什么意思| 今年是什么生肖| 三级护理是什么意思| 孕中期同房要注意什么| 盆腔磁共振平扫能查出什么| 强字五行属什么| 身份证借给别人有什么危害性| 执业药师什么时候考试| 脑电图能检查出什么疾病| 血压高是什么引起的| 朱雀是什么| 超敏c反应蛋白偏高说明什么| 桃花是什么颜色| 肠系膜淋巴结肿大吃什么药| 梦见把老鼠打死是什么意思| ed什么意思| 什么时候种胡萝卜最好| 大连有什么好吃的| 生理盐水是什么水| 猫毛过敏吃什么药| 祭祀什么意思| 红花油和活络油有什么区别| 治疗风湿有什么好方法| 长白班什么意思| 养生馆是干什么的| 惨绿少年什么意思| 心率高是什么原因| 相伴是什么意思| 15号是什么日子| 柏拉图爱情是什么意思| 什么颜色衣服显白| 阑尾炎吃什么水果| 产值是什么| 儿童上火了吃什么降火最快| 南浦大桥什么时候建成| 身份证上的数字是什么字体| 女人吃鹅蛋有什么好处| 手上蜕皮是什么原因| 嘴巴里苦是什么原因| 育婴师是干什么的| 为什么镜子不能对着床| 为什么叫马路| 硝苯地平是什么药| 肝火旺盛吃什么药好| 什么龙什么虎| 冬眠是什么意思| 双清是什么意思| 一直耳鸣是什么原因引起的| 什么食物含钙量最高| 大腿根部痒用什么药膏| 脖子长痘痘是什么原因| 四季春属于什么茶| 花生不能和什么食物一起吃| b型钠尿肽高说明什么| 婕妤是什么意思| 月字旁的字有什么| 身份证末尾x代表什么| 惜字如金是什么意思| 海藻面膜有什么作用| 梦见嫖娼是什么意思| 膀胱炎是什么症状表现| 低血压吃什么药效果好| 小蛮腰是什么意思| 男人腿毛多代表什么| 虚火旺吃什么去火最快| 晚上喝什么茶好| 藏毛窦挂什么科| 微创是什么| 空是什么生肖| 左手小手指麻木是什么原因引起的| 高筋面粉可以做什么| 骨折吃什么好的快| 嘴里有粘液是什么原因| 单身为什么中指戴戒指| 支元体阳性是什么意思| 什么是喜欢| 大便长期不成形是什么原因| 壮腰健肾丸有什么功效| 制动是什么意思| 坎坷人生是什么生肖| 避孕套上的油是什么油| soso是什么意思| 姊妹是什么意思| 宰相是什么意思| 嘴边起水泡是什么原因| 男人梦见血是什么预兆| 为什么会晕车| 好样的什么意思| 腰麻是什么麻醉| 什么花园| ferragamo是什么牌子| 高沫是什么茶| 膝关节退行性改变是什么意思| 小孩流鼻血是什么原因| wpc是什么意思| 裸贷是什么意思| 月桂酸是什么| 秋天有什么花开| 淋巴结肿大看什么科| 花青素是什么| 经常耳鸣是什么原因引起的| 文殊菩萨是管什么的| 紫菜不能和什么一起吃| 蜂蜜的波美度是什么意思| 牙医靠什么吃饭| 雷暴是什么意思| 嗓子疼喝什么饮料| 甲状腺激素是什么| 吃什么增强免疫力| 看守所和拘留所有什么区别| 10月23号是什么星座| 结晶果糖是什么| 2b什么意思| 受精卵发育成什么| 头痛头晕挂什么科| 唾液臭是什么原因| c反应蛋白高是什么意思| 胰岛素偏高是什么意思| 1997年7月1日属什么生肖| 常务副省长是什么级别| 若叶青汁有什么功效| 什么是大专| 玫瑰金是什么颜色| 老人高烧不退是什么原因| cpp是什么意思| 良性反应性改变是什么意思| 取决于你是什么意思| 肚脐眼上面痛是什么原因引起的| 传染病八项包括什么| 生鱼是什么鱼| 社恐的人适合什么工作| 大姨妈期间适合吃什么水果| 五鬼是什么意思| 长可以加什么偏旁| 小孩便秘是什么原因引起的| 潮湿是什么意思| 汗疱疹涂什么药膏| 这是什么呀| 心慌心悸是什么原因| 什么食物胆固醇高| coolmax是什么面料| 猫咪取什么名字好听| 所费不赀是什么意思| 代管是什么意思| 包罗万象是什么意思| 什么叫飞机杯| 上午12点是什么时候| 什么是周期| 三个犬念什么字| 孕妇吐得厉害有什么办法解决| 晚上老是做梦是什么原因| 9点多是什么时辰| 总蛋白偏低是什么意思| 李逵的绰号是什么| 0tc是什么意思| 热惊厥病发是什么症状| 牛黄清心丸适合什么人群吃| 靶向药有什么副作用| 溶媒是什么| 心脏不舒服有什么症状| 女人最想要什么| 痔疮什么情况下需要做手术| 宋江是属什么生肖| 头发掉是什么原因引起的| 乌龟下蛋预示着什么| lcr是什么意思| 面部脂溢性皮炎用什么药| 防疫站属于什么单位| 吃什么败火| 火加同念什么| 牙齿发酸是什么病征兆| 腰间盘突出用什么药| 沉香是什么| 胃胀吃什么药好| 牙齿一碰就疼是什么原因| 尿隐血2十是什么原因| 总是什么意思| 庭字五行属什么| 一什么金光| 脑袋痛什么原因| 血尿酸偏高是什么原因| 孕妇吃什么最好| 蜘蛛痣是什么原因引起的| 儿童缺铁吃什么补得快| 沙门氏菌用什么药| 脱口秀是什么意思| 手脚发麻是什么原因引起的| 百度

瘘是什么意思

The most recent version of this page is a draft.DiffThis version (02 Nov 2021 16:04) was approved by Robin Getz.The Previously approved version (05 Jan 2021 14:58) is available.Diff
百度 张山营镇政府一位负责人说。

This is an old revision of the document!


AD7476A IIO Single Channel Serial ADC Linux Driver

Supported Devices

Reference Circuits

Evaluation Boards

Description

This is a Linux industrial I/O (IIO) subsystem driver, targeting single channel serial interface ADCs. The industrial I/O subsystem provides a unified framework for drivers for many different types of converters and sensors using a number of different physical interfaces (i2c, spi, etc). See IIO for more information.

Source Code

Status

Source Mainlined?
git Yes

Files

Function File
driver drivers/iio/adc/ad7476.c

Example platform device initialization

Specifying reference voltage via the regulator framework

Below example specifies a 3.3 Volt reference for the SPI device 3 on SPI-Bus 0. (spi0.3)

#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
static struct regulator_consumer_supply ad7476_consumer_supplies[] = {
	REGULATOR_SUPPLY("vcc", "spi0.3"),
};
 
static struct regulator_init_data stamp_avdd_reg_init_data = {
	.constraints	= {
		.name	= "3V3",
		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
	},
	.consumer_supplies = ad7476_consumer_supplies,
	.num_consumer_supplies = ARRAY_SIZE(ad7476_consumer_supplies),
};
 
static struct fixed_voltage_config stamp_vdd_pdata = {
	.supply_name	= "board-3V3",
	.microvolts	= 3300000,
	.gpio		= -EINVAL,
	.enabled_at_boot = 0,
	.init_data	= &stamp_avdd_reg_init_data,
};
static struct platform_device brd_voltage_regulator = {
	.name		= "reg-fixed-voltage",
	.id		= -1,
	.num_resources	= 0,
	.dev		= {
		.platform_data	= &stamp_vdd_pdata,
	},
};
#endif
static struct platform_device *board_devices[] __initdata = {
#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
	&brd_voltage_regulator
#endif
};
static int __init board_init(void)
{
	[--snip--]
 
	platform_add_devices(board_devices, ARRAY_SIZE(board_devices));
 
	[--snip--]
 
	return 0;
}
arch_initcall(board_init);

Declaring SPI slave devices

Unlike PCI or USB devices, SPI devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each SPI bus segment, and what slave selects these devices are using. For this reason, the kernel code must instantiate SPI devices explicitly. The most common method is to declare the SPI devices by bus number.

This method is appropriate when the SPI bus is a system bus, as in many embedded systems, wherein each SPI bus has a number which is known in advance. It is thus possible to pre-declare the SPI devices that inhabit this bus. This is done with an array of struct spi_board_info, which is registered by calling spi_register_board_info().

For more information see: Documentation/spi/spi-summary.rst

21 Oct 2010 14:10

Depending on the converter IC used, you may need to set the modalias accordingly, matching your part name. It may also required to adjust max_speed_hz. Please consult the datasheet, for maximum spi clock supported by the device in question.

static struct spi_board_info board_spi_board_info[] __initdata = {
#if defined(CONFIG_AD7476) || \
 	defined(CONFIG_AD7476_MODULE)
	{
		/* the modalias must be the same as spi device driver name */
		.modalias = "ad7476", /* Name of spi_driver for this device */
		.max_speed_hz = 1000000,     /* max spi clock (SCK) speed in HZ */
		.bus_num = 0, /* Framework bus number */
		.chip_select = 3, /* Framework chip select */
		.mode = SPI_MODE_3,
	},
#endif
};
static int __init board_init(void)
{
	[--snip--]
 
	spi_register_board_info(board_spi_board_info, ARRAY_SIZE(board_spi_board_info));
 
	[--snip--]
 
	return 0;
}
arch_initcall(board_init);

Devicetree

Required devicetree properties:

  • compatible: Needs to be “adi,” followed by the name of the device. E.g. “adi,ad7476a”
  • reg: The chipselect number used for the device
  • spi-max-frequency: Maximum SPI clock frequency.
  • spi-cpha: Needs to be set for the correct SPI mode
  • spi-cpol: Needs to be set for the correct SPI mode
  • vcc-supply: Phandle to the supply regulator
       adc_supply: fixedregulator {
               compatible = "regulator-fixed";
               regulator-name = "fixed-supply";
               regulator-min-microvolt = <3300000>;
               regulator-max-microvolt = <3300000>;
       };

       spi: spi@e0007000 {
               #address-cells = <1>;
               #size-cells = <0>;
               compatible = "xlnx,ps7-spi-1.00.a";
               ...

               ad7476@0 {
                       compatible = "adi,ad7476a";
                       reg = <0>;
                       spi-max-frequency = <1000000>;
                       spi-cpha;
                       spi-cpol;
                       vcc-supply = <&adc_supply>;
               };
        };

Adding Linux driver support

Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)

The AD7476 Driver depends on CONFIG_SPI

Linux Kernel Configuration
    Device Drivers  --->
        ...
        <*>     Industrial I/O support --->
            --- Industrial I/O support
            ...
            Analog to digital converters  ---> 
                ...
                <*>  Analog Devices AD7476 and similar 1-channel ADCs driver
                ...
            ...
        ...

Hardware configuration

Driver testing

Each and every IIO device, typically a hardware chip, has a device folder under /sys/bus/iio/devices/iio:deviceX. Where X is the IIO index of the device. Under every of these directory folders reside a set of files, depending on the characteristics and features of the hardware device in question. These files are consistently generalized and documented in the IIO ABI documentation. In order to determine which IIO deviceX corresponds to which hardware device, the user can read the name file /sys/bus/iio/devices/iio:deviceX/name. In case the sequence in which the iio device drivers are loaded/registered is constant, the numbering is constant and may be known in advance.

02 Mar 2011 14:16

This specifies any shell prompt running on the target

root:/> cd /sys/bus/iio/devices/
root:/sys/bus/iio/devices> ls
device0                  device0:buffer0:access0  trigger0
device0:buffer0          device0:buffer0:event0

root:/sys/bus/iio/devices> cd device0

root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> ls -l
drwxr-xr-x    5 root     root             0 Jan  1 00:00 buffer
-r--r--r--    1 root     root          4096 Jan  1 00:00 in_voltage0_raw
-r--r--r--    1 root     root          4096 Jan  1 00:00 in_voltage_scale
-r--r--r--    1 root     root          4096 Jan  1 00:00 name
lrwxrwxrwx    1 root     root             0 Jan  1 00:00 subsystem -> ../../../../../bus/iio
drwxr-xr-x    2 root     root             0 Jan  1 00:00 trigger
-rw-r--r--    1 root     root          4096 Jan  1 00:00 uevent

Show device name

This specifies any shell prompt running on the target

root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> cat name
ad7476

Show scale

Description:
scale to be applied to in_voltage0_raw in order to obtain the measured voltage in millivolts.

This specifies any shell prompt running on the target

root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> cat in_voltage_scale
0.805

Show channel 0 measurement

Description:
Raw unscaled voltage measurement on channel 0

This specifies any shell prompt running on the target

root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> cat in_voltage0_raw
2001

U = in_voltage0_raw * in_voltage_scale = 2001 * 0.805 = 1610,805 mV

Trigger management

If deviceX supports triggered sampling, it’s a so called trigger consumer and there will be an additional folder /sys/bus/iio/device/iio:deviceX/trigger. In this folder there is a file called current_trigger, allowing controlling and viewing the current trigger source connected to deviceX. Available trigger sources can be identified by reading the name file /sys/bus/iio/devices/triggerY/name. The same trigger source can connect to multiple devices, so a single trigger may initialize data capture or reading from a number of sensors, converters, etc.

Trigger Consumers:
Currently triggers are only used for the filling of software ring buffers and as such any device supporting INDIO_RING_TRIGGERED has the consumer interface automatically created.

Description: Read name of triggerY

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/triggerY/> cat name
irqtrig56

Description: Make irqtrig56 (trigger using system IRQ56, likely a GPIO IRQ), to current trigger of deviceX

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:deviceX/trigger> echo irqtrig56 > current_trigger

Description: Read current trigger source of deviceX

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:deviceX/trigger> cat current_trigger
irqtrig56

02 Mar 2011 14:16

Available standalone trigger drivers

name description
iio-trig-gpio Provides support for using GPIO pins as IIO triggers.
iio-trig-rtc Provides support for using periodic capable real time clocks as IIO triggers.
iio-trig-sysfs Provides support for using SYSFS entry as IIO triggers.
iio-trig-bfin-timer Provides support for using a Blackfin timer as IIO triggers.
02 Mar 2011 14:16

Buffer management

This specifies any shell prompt running on the target

root:/sys/devices/platform/bfin-spi.0/spi0.3/device0/device0:buffer0> ls
bytes_per_datum          enable                   subsystem
device0:buffer0:access0  length                   uevent
device0:buffer0:event0   scan_elements
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0/device0:buffer0>

The Industrial I/O subsystem provides support for various ring buffer based data acquisition methods. Apart from device specific hardware buffer support, the user can chose between two different software ring buffer implementations. One is the IIO lock free software ring, and the other is based on Linux kfifo. Devices with buffer support feature an additional sub-folder in the /sys/bus/iio/devices/deviceX/ folder hierarchy. Called deviceX:bufferY, where Y defaults to 0, for devices with a single buffer.

Every buffer implementation features a set of files:

length
Get/set the number of sample sets that may be held by the buffer.

enable
Enables/disables the buffer. This file should be written last, after length and selection of scan elements.

watermark
A single positive integer specifying the maximum number of scan elements to wait for. Poll will block until the watermark is reached. Blocking read will wait until the minimum between the requested read amount or the low water mark is available. Non-blocking read will retrieve the available samples from the buffer even if there are less samples then watermark level. This allows the application to block on poll with a timeout and read the available samples after the timeout expires and thus have a maximum delay guarantee.

data_available
A read-only value indicating the bytes of data available in the buffer. In the case of an output buffer, this indicates the amount of empty space available to write data to. In the case of an input buffer, this indicates the amount of data available for reading.

length_align_bytes
Using the high-speed interface. DMA buffers may have an alignment requirement for the buffer length. Newer versions of the kernel will report the alignment requirements associated with a device through the `length_align_bytes` property.

scan_elements
The scan_elements directory contains interfaces for elements that will be captured for a single triggered sample set in the buffer.

02 Mar 2011 14:16

This specifies any shell prompt running on the target

root:/sys/devices/platform/bfin-spi.0/spi0.3/device0/device0:buffer0/scan_elements> ls
in0_en           in_type          timestamp_index
in0_index        timestamp_en     timestamp_type
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0/device0:buffer0/scan_elements>

in_voltageX_en / in_voltageX-voltageY_en / timestamp_en:
Scan element control for triggered data capture. Writing 1 will enable the scan element, writing 0 will disable it

in_voltageX_type / in_voltageX-voltageY_type / timestamp_type:
Description of the scan element data storage within the buffer and therefore in the form in which it is read from user-space. Form is [s|u]bits/storage-bits. s or u specifies if signed (2's complement) or unsigned. bits is the number of bits of data and storage-bits is the space (after padding) that it occupies in the buffer. Note that some devices will have additional information in the unused bits so to get a clean value, the bits value must be used to mask the buffer output value appropriately. The storage-bits value also specifies the data alignment. So u12/16 will be a unsigned 12 bit integer stored in a 16 bit location aligned to a 16 bit boundary. For other storage combinations this attribute will be extended appropriately.

in_voltageX_index / in_voltageX-voltageY_index / timestamp_index:
A single positive integer specifying the position of this scan element in the buffer. Note these are not dependent on what is enabled and may not be contiguous. Thus for user-space to establish the full layout these must be used in conjunction with all _en attributes to establish which channels are present, and the relevant _type attributes to establish the data storage format.

02 Mar 2011 14:16

More Information

/srv/wiki.analog.com/data/pages/resources/tools-software/linux-drivers/iio-adc/ad7476a.txt · Last modified: 31 Oct 2024 20:25 by David Lechner

? 
7月4日是什么星座 什么时候闰九月 苦瓜不能跟什么一起吃 疣是什么原因造成的 不吃香菜什么意思
四大名著是什么 欲望是什么 胰腺炎有什么症状 鸟衣念什么 高沫是什么茶
哈西奈德溶液治什么病 为什么静脉曲张 前纵隔结节是什么意思 护士一般什么学历 有妇之夫是什么意思
孕妇吃花胶对胎儿有什么好处 腿纹不对称有什么影响 花痴病是什么症状 臀疗是什么 gb10769是什么标准
委曲求全是什么生肖travellingsim.com 喉咙有异物感吃什么药hcv8jop3ns3r.cn 老气横秋什么意思zsyouku.com 睡觉张嘴巴是什么原因hcv8jop6ns8r.cn 体内湿气重是什么原因造成的beikeqingting.com
吃榴莲对女人有什么好处hcv8jop5ns3r.cn 相什么并什么hcv7jop5ns1r.cn 矢什么意思hcv8jop3ns4r.cn 心灵手巧什么意思hcv9jop2ns4r.cn 儿童淋巴结肿大挂什么科hcv8jop1ns0r.cn
什么运动使人脸部年轻hcv8jop8ns3r.cn 时柱将星是什么意思hcv8jop4ns2r.cn 消化快容易饿什么原因hcv8jop8ns6r.cn 请结合临床是什么意思hcv9jop1ns7r.cn 声优是什么意思hcv8jop3ns6r.cn
什么然而生hcv9jop5ns4r.cn 菠萝和凤梨有什么区别hcv8jop6ns0r.cn 小孩磨牙是什么原因hcv9jop6ns9r.cn 红男绿女是什么生肖hcv8jop0ns5r.cn 耳朵发烫是什么原因hcv8jop6ns0r.cn
百度