Wsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget"/translations/zh_CN/iio/iio_devbufmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/zh_TW/iio/iio_devbufmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/it_IT/iio/iio_devbufmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/ja_JP/iio/iio_devbufmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/ko_KR/iio/iio_devbufmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/sp_SP/iio/iio_devbufmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh>shift], where:h]hRead-only attribute containing the description of the scan element data storage within the buffer and hence the form in which it is read from userspace. Format is [be|le]:[s|u]bits/storagebits[Xrepeat][>>shift], where:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThj8hhubh bullet_list)}(hhh](h list_item)}(h0**be** or **le** specifies big or little-endian.h]h)}(hjh](j\)}(h**be**h]hbe}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j[hjubh or }(hjhhhNhNubj\)}(h**le**h]hle}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j[hjubh specifies big or little-endian.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h@**s** or **u** specifies if signed (2's complement) or unsigned.h]h)}(hjh](j\)}(h**s**h]hs}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j[hj ubh or }(hj hhhNhNubj\)}(h**u**h]hu}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j[hj ubh4 specifies if signed (2’s complement) or unsigned.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKYhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h***bits** is the number of valid data bits.h]h)}(hj?h](j\)}(h**bits**h]hbits}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1j[hjAubh" is the number of valid data bits.}(hjAhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKZhj=ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hU**storagebits** is the number of bits (after padding) that it occupies in the buffer.h]h)}(hU**storagebits** is the number of bits (after padding) that it occupies in the buffer.h](j\)}(h**storagebits**h]h storagebits}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1j[hjfubhF is the number of bits (after padding) that it occupies in the buffer.}(hjfhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK[hjbubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h**repeat** specifies the number of bits/storagebits repetitions. When the repeat element is 0 or 1, then the repeat value is omitted.h]h)}(h**repeat** specifies the number of bits/storagebits repetitions. When the repeat element is 0 or 1, then the repeat value is omitted.h](j\)}(h **repeat**h]hrepeat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j[hjubh{ specifies the number of bits/storagebits repetitions. When the repeat element is 0 or 1, then the repeat value is omitted.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK]hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h`**shift** if specified, is the shift that needs to be applied prior to masking out unused bits. h]h)}(h_**shift** if specified, is the shift that needs to be applied prior to masking out unused bits.h](j\)}(h **shift**h]hshift}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j[hjubhV if specified, is the shift that needs to be applied prior to masking out unused bits.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK_hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1jhhhKXhj8hhubh)}(hFor example, a driver for a 3-axis accelerometer with 12-bit resolution where data is stored in two 8-bit registers is as follows::h]hFor example, a driver for a 3-axis accelerometer with 12-bit resolution where data is stored in two 8-bit registers is as follows:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhj8hhubh literal_block)}(hX? 7 6 5 4 3 2 1 0 +---+---+---+---+---+---+---+---+ |D3 |D2 |D1 |D0 | X | X | X | X | (LOW byte, address 0x06) +---+---+---+---+---+---+---+---+ 7 6 5 4 3 2 1 0 +---+---+---+---+---+---+---+---+ |D11|D10|D9 |D8 |D7 |D6 |D5 |D4 | (HIGH byte, address 0x07) +---+---+---+---+---+---+---+---+h]hX? 7 6 5 4 3 2 1 0 +---+---+---+---+---+---+---+---+ |D3 |D2 |D1 |D0 | X | X | X | X | (LOW byte, address 0x06) +---+---+---+---+---+---+---+---+ 7 6 5 4 3 2 1 0 +---+---+---+---+---+---+---+---+ |D11|D10|D9 |D8 |D7 |D6 |D5 |D4 | (HIGH byte, address 0x07) +---+---+---+---+---+---+---+---+}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKehj8hhubh)}(h8will have the following scan element type for each axis:h]h8will have the following scan element type for each axis:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohj8hhubj)}(hK$ cat /sys/bus/iio/devices/iio:device0/buffer0/in_accel_y_type le:s12/16>>4h]hK$ cat /sys/bus/iio/devices/iio:device0/buffer0/in_accel_y_type le:s12/16>>4}hjsbah}(h]h ]h"]h$]h&]hhforcelanguagebashhighlight_args}uh1jhhhKqhj8hhubh)}(hA userspace application will interpret data samples read from the buffer as two-byte little-endian signed data, that needs a 4 bits right shift before masking out the 12 valid bits of data.h]hA userspace application will interpret data samples read from the buffer as two-byte little-endian signed data, that needs a 4 bits right shift before masking out the 12 valid bits of data.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKvhj8hhubh)}(hIt is also worth mentioning that the data in the buffer will be naturally aligned, so the userspace application has to handle the buffers accordingly.h]hIt is also worth mentioning that the data in the buffer will be naturally aligned, so the userspace application has to handle the buffers accordingly.}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKzhj8hhubh)}(hTake for example, a driver with four channels with the following description: - channel0: index: 0, type: be:u16/16>>0 - channel1: index: 1, type: be:u32/32>>0 - channel2: index: 2, type: be:u32/32>>0 - channel3: index: 3, type: be:u64/64>>0h]hTake for example, a driver with four channels with the following description: - channel0: index: 0, type: be:u16/16>>0 - channel1: index: 1, type: be:u32/32>>0 - channel2: index: 2, type: be:u32/32>>0 - channel3: index: 3, type: be:u64/64>>0}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK}hj8hhubh)}(hPIf all channels are enabled, the data will be aligned in the buffer as follows::h]hOIf all channels are enabled, the data will be aligned in the buffer as follows:}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj8hhubj)}(h 0-1 2 3 4-7 8-11 12 13 14 15 16-23 -> buffer byte number +-----+---+---+-----+-----+---+---+---+---+-----+ |CHN_0|PAD|PAD|CHN_1|CHN_2|PAD|PAD|PAD|PAD|CHN_3| -> buffer content +-----+---+---+-----+-----+---+---+---+---+-----+h]h 0-1 2 3 4-7 8-11 12 13 14 15 16-23 -> buffer byte number +-----+---+---+-----+-----+---+---+---+---+-----+ |CHN_0|PAD|PAD|CHN_1|CHN_2|PAD|PAD|PAD|PAD|CHN_3| -> buffer content +-----+---+---+-----+-----+---+---+---+---+-----+}hjSsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj8hhubh)}(h^If only channel0 and channel3 are enabled, the data will be aligned in the buffer as follows::h]h]If only channel0 and channel3 are enabled, the data will be aligned in the buffer as follows:}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj8hhubj)}(h 0-1 2 3 4 5 6 7 8-15 -> buffer byte number +-----+---+---+---+---+---+---+-----+ |CHN_0|PAD|PAD|PAD|PAD|PAD|PAD|CHN_3| -> buffer content +-----+---+---+---+---+---+---+-----+h]h 0-1 2 3 4 5 6 7 8-15 -> buffer byte number +-----+---+---+---+---+---+---+-----+ |CHN_0|PAD|PAD|PAD|PAD|PAD|PAD|CHN_3| -> buffer content +-----+---+---+---+---+---+---+-----+}hjosbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj8hhubh)}(hTypically the buffered data is found in raw format (unscaled with no offset applied), however there are corner cases in which the buffered data may be found in a processed form. Please note that these corner cases are not addressed by this documentation.h]hTypically the buffered data is found in raw format (unscaled with no offset applied), however there are corner cases in which the buffered data may be found in a processed form. Please note that these corner cases are not addressed by this documentation.}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj8hhubh)}(h`Please see Documentation/ABI/testing/sysfs-bus-iio for a complete description of the attributes.h]h`Please see Documentation/ABI/testing/sysfs-bus-iio for a complete description of the attributes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj8hhubeh}(h] scan-elementsah ]h"] scan elementsah$]h&]uh1hhj&hhhhhK?ubeh}(h]buffer-attributesah ]h"]2. buffer attributesah$]h&]uh1hhhhhhhhKubeh}(h]industrial-iio-device-buffersah ]h"]industrial iio device buffersah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjj#j jjjjjjjj j5j2jju nametypes}(jj#jjjjj5juh}(jhj hjj&jjWjjj jj2jjj8u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.