diff --git a/share/man/man4/iic.4 b/share/man/man4/iic.4 index 75c96e901619..56f74bfba204 100644 --- a/share/man/man4/iic.4 +++ b/share/man/man4/iic.4 @@ -30,27 +30,26 @@ .Os .Sh NAME .Nm iic -.Nd I2C generic i/o device driver +.Nd I2C generic I/O device driver .Sh SYNOPSIS .Cd "device iic" .Pp .In dev/iicbus/iic.h .Sh DESCRIPTION The -.Em iic -character device driver provides generic i/o to any +.Nm +device driver provides generic I/O to any .Xr iicbus 4 instance. In order to control I2C devices, use .Pa /dev/iic? with the following ioctls: -.Pp -.Bl -tag -wdith ".Dv I2CRSTCARD" +.Bl -tag -width ".Dv I2CRSTCARD" .It Dv I2CSTART -.Vt "struct iiccmd" ; +.Pq Vt "struct iiccmd" Sends the start condition to the slave specified by the -.Vt slave +.Va slave element to the bus. All other elements are ignored. .It Dv I2CSTOP @@ -58,60 +57,74 @@ No argument is passed. Sends the stop condition to the bus. This terminates the current transaction. .It Dv I2CRSTCARD -.Vt "struct iiccmd" ; +.Pq Vt "struct iiccmd" Resets the bus. The argument is completely ignored. .It Dv I2CWRITE -.Vt "struct iiccmd" ; -Writes data to the iicbus. +.Pq Vt "struct iiccmd" +Writes data to the +.Xr iicbus 4 . The bus should already be started. -.Vt "slave" -is ignored. -.Vt "count" -is the number of bytes to write. -.Vt "last" -is a boolean flag. +The +.Va slave +element is ignored. +The +.Va count +element is the number of bytes to write. +The +.Va last +element is a boolean flag. It is non-zero when additional write commands will follow. -.Vt "buf" -is a pointer to the data to write to the bus. +The +.Va buf +element is a pointer to the data to write to the bus. .It Dv I2CREAD -.Vt "struct iiccmd" ; -Reads data from the iicbus. +.Pq Vt "struct iiccmd" +Reads data from the +.Xr iicbus 4 . The bus should already be started. -.Vt "slave" -is ignored. -.Vt "count" -is the number of bytes to write. -.Vt "last" -is a boolean flag. +The +.Va slave +element is ignored. +The +.Va count +element is the number of bytes to write. +The +.Va last +element is a boolean flag. It is non-zero when additional write commands will follow. -.Vt "buf" -is a pointer to where to store the data read from the bus. +The +.Va buf +element is a pointer to where to store the data read from the bus. Short reads on the bus produce undefined results. .It Dv I2CRDWR -.Vt "struct iic_rdwr_data" ; +.Pq Vt "struct iic_rdwr_data" Generic read/write interface. Allows for an arbitrary number of commands to be sent to an arbitrary number of devices on the bus. A read transfer is speficied if -.Vt IIC_M_RD +.Dv IIC_M_RD is set in -.Vt flags . +.Va flags . Otherwise the transfer is a write transfer. -The -.Vt slave -specifieds the 7-bit address for the transfer. -.Vt len -is the length of the data. -.Vt buf -is a buffer for that data. -This ioctl is intended to be Linux compatible. +The +.Va slave +element specifies the 7-bit address for the transfer. +The +.Va len +element is the length of the data. +The +.Va buf +element is a buffer for that data. +This ioctl is intended to be +.Tn Linux +compatible. .El .Pp The following data structures are defined in .In dev/iicbus/iic.h and referenced above: -.Bd -literal +.Bd -literal -offset indent struct iiccmd { u_char slave; int count; @@ -133,26 +146,27 @@ struct iic_rdwr_data { struct iic_msg *msgs; uint32_t nmsgs; }; - .Ed .Pp -You may also use read/write routines, then I2C start/stop handshake is -managed by the iicbus system. +It is also possible to use read/write routines, then I2C start/stop handshake is +managed by the +.Xr iicbus 4 +system. However, the address used for the read/write routines is the one passed to last .Dv I2CSTART .Xr ioctl 2 to this device. .Sh BUGS -Only the +Only the .Dv I2CRDWR .Xr ioctl 2 is thread safe. All other interfaces suffer from some kind of race. .Sh SEE ALSO -.Xr ioctl 2 -.Xr read 2 -.Xr write 2 +.Xr ioctl 2 , +.Xr read 2 , +.Xr write 2 , .Xr iicbus 4 .Sh HISTORY The @@ -160,6 +174,7 @@ The manual page first appeared in .Fx 3.0 . .Sh AUTHORS +.An -nosplit This manual page was written by .An Nicolas Souchu