OWN(9)
๐ OWN(9) โ Kernel Developer's Manual ๐
okay bestie, this is the whole vibe for the Dallas Semiconductor 1-Wire Network and Transport Interface โ yes, thatโs a mouthful, and yes, it slays ๐
๐ NAME ๐
The full roster is own, own_send_command, own_command_wait, own_self_command, own_acquire_bus, own crc, own_release_bus, OWN_ACQUIRE_BUS, OWN_CRC, OWN_RELEASE_BUS, OWN_SEND_COMMAND โ and theyโre all about the Dallas Semiconductor 1-Wire Network and Transport Interface. ๐ฆ
โจ SYNOPSIS โจ
hereโs the exact spellbook, no cap:
#include <sys/bus.h>
#include <dev/ow/own.h>
int
own_send_command(device_t pdev, struct ow_cmd *cmd);
int
own_command_wait(device_t pdev, struct ow_cmd *cmd);
int
own_self_command(device_t pdev, struct ow_cmd *cmd, uint8_t xpt_cmd);
int
own_acquire_bus(device_t pdev, int how);
int
own_release_bus(device_t pdev);
int
own_crc(device_t pdev, uint8_t *buffer, size_t len);
int
OWN_SEND_COMMAND(device_t ndev, device_t pdev, struct ow_cmd *cmd);
int
OWN_ACQUIRE_BUS(device_t ndev, device_t pdev, int how);
void
OWN_RELEASE_BUS(device_t ndev, device_t pdev);
uint8_t
OWN_CRC(device_t ndev, device_t pdev, uint8_t *buffer, size_t len);
๐ธ DESCRIPTION ๐ธ
The own interface gives you three little friend groups of functions for talking to 1-Wire devices: sending commands, reserving the bus, and making sure the data is actually giving integrity. ๐
Wrappers are provided for the raw OWN kobj(9) interfaces, and you should use those wrappers for improved safety over the kobj(9) ones. iykyk ๐ซถ
๐ Bus Commands ๐
The 1-Wire bus defines different layers of access to the devices on the bus. The own functions give you access to the network and transport layers. The network layer designates the next command as being either for all devices on the bus, or for a specific device. The network layer also specifies the speed used by the link layer. โก
struct ow_cmd encapsulates network access, speed, and timing information. It specifies the commands to send and whether or not to read data. Its members are:
flagsโ Flags controlling the interpretation of the structure. These flags are defined in<dev/ow/ow.h>:OW_FLAG_OVERDRIVEโ Sendxpt_cmdbytes and readxpt_readbytes at overdrive speed. ๐๏ธOW_FLAG_READ_BITโ Interpretxpt_read_lento be in bits to be read afterxpt_cmdrather than bytes. ๐ง
rom_cmdโ ROM command bytes to send.rom_lenโ Number of ROM command bytes to send.rom_read_lenโ Number of bytes to read after sending the ROM command.rom_readโ Buffer for bytes read after the ROM command.xpt_cmdโ Transport command to send.xpt_lenโ Length of the transport command bytes to send. Specify0for no transport command.xpt_read_lenโ Number of bytes to read afterxpt_cmdbytes are sent. If theOW_FLAG_READ_BITbit is set inflags, then it is the number of bits to read. Bits read are packed into bytes.xpt_readโ Buffer for data read.
own_command_wait() acquires the 1-Wire bus, waiting if necessary, sends the command, and then releases the bus. own_send_command() sends the command without bus reservation. pdev is the client device (the presentation layer device) sending the command. The cmd argument describes the transaction to send to the 1-Wire bus. ๐
own_self_command() fills in cmd with a MATCH_ROM ROM command, the ROM address of pdev and the xpt_cmd as a convenient way to create directed commands. โจ
๐ Bus Reservation ๐
The 1-Wire system includes an advisory lock for the bus that presentation layer devices can use to coordinate access. Locking is purely advisory at this time. ๐ซถ
own_acquire_bus() reserves the bus. It waits indefinitely if the how argument is OWN_WAIT and returns the error EWOULDBLOCK if passed OWN_DONTWAIT when the bus is owned by another client. ๐ญ
own_release_bus() releases the bus. ๐
๐งฎ Data Integrity ๐งฎ
own_crc() computes the 1-Wire standard CRC function over the data passed in buffer and len and returns the result. โญ
๐ Notes ๐
The 1-Wire standard (Maxim AN937) defines layers that are akin to ISO networking layers. The lowest relevant layer, the link layer, defines the polling windows and the timing of the signaling of different modes. The network layer is built on top of the link layer and is used to address devices in a unicast or multicast manner. The transport layer defines commands and responses from the devices. The presentation layer is composed of the device specific commands and actions used to control the specific 1-Wire devices on bus. ๐
These interfaces are implemented by the ow(4) device. Presentation layer devices (children of the newbus ow(4) device) should only call the functions described here. The functionality provided by the owc(4) device (specifically the owll(9) interface) should only be called by the ow(4) driver. ๐
๐ SEE ALSO ๐
โ๏ธ LEGAL โ๏ธ
1-Wire is a registered trademark of Maxim Integrated Products, Inc. ๐
๐ฐ๏ธ HISTORY ๐ฐ๏ธ
The own driver first appeared in FreeBSD 11.0. ๐
โ๏ธ AUTHORS โ๏ธ
The own device driver and this manual page were written by Warner Losh. ๐ซถ
source/version/date cute sign-off: Debian ยท July 20, 2015 ยท OWN(9) ๐โจ
๐ฆ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2015 M. Warner Losh <imp@FreeBSD.org>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms