diff options
author | Michael Gmelin <grembo@FreeBSD.org> | 2015-04-25 16:15:01 +0000 |
---|---|---|
committer | Michael Gmelin <grembo@FreeBSD.org> | 2015-04-25 16:15:01 +0000 |
commit | 202379af847e82a654964f69aaa3435212732eff (patch) | |
tree | ba84fdf08fc09b66a10a6a8cbe9cb4d12560861d /share | |
parent | a9467c3c45b0fdbc6cf4d7b7d6a204f4d61c7338 (diff) | |
download | src-202379af847e82a654964f69aaa3435212732eff.tar.gz src-202379af847e82a654964f69aaa3435212732eff.zip |
Expand SMBUS API to add smbus_trans() function.
Differential Revision: https://reviews.freebsd.org/D1955
Reviewed by: adrian, jhb, wblock
Approved by: adrian, jhb
Notes
Notes:
svn path=/head/; revision=281985
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man4/smb.4 | 99 |
1 files changed, 69 insertions, 30 deletions
diff --git a/share/man/man4/smb.4 b/share/man/man4/smb.4 index afe4605b449f..ba0e8f13b101 100644 --- a/share/man/man4/smb.4 +++ b/share/man/man4/smb.4 @@ -1,5 +1,6 @@ .\" Copyright (c) 1998, Nicolas Souchu .\" Copyright (c) 2004, Joerg Wunsch +.\" Copyright (c) 2015, Michael Gmelin <freebsd@grem.de> .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 6, 2009 +.Dd April 25, 2015 .Dt SMB 4 .Os .Sh NAME @@ -49,21 +50,24 @@ as its argument. #include <sys/types.h> struct smbcmd { - char cmd; - int count; - u_char slave; + u_char cmd; + u_char reserved; + u_short op; union { - char byte; - short word; - - char *byte_ptr; - short *word_ptr; - - struct { - short sdata; - short *rdata; - } process; - } data; + char byte; + char buf[2]; + short word; + } wdata; + union { + char byte; + char buf[2]; + short word; + } rdata; + int slave; + char *wbuf; /* use wdata if NULL */ + int wcount; + char *rbuf; /* use rdata if NULL */ + int rcount; }; .Ed .Pp @@ -107,14 +111,14 @@ The command first sends the byte from the .Fa cmd field to the device, followed by the byte given in -.Fa data.byte . +.Fa wdata.byte . .It Dv SMB_WRITEW Ta The .Em WriteWord command first sends the byte from the .Fa cmd field to the device, followed by the word given in -.Fa data.word . +.Fa wdata.word . Note that the SMBus byte-order is little-endian by definition. .It Dv SMB_READB Ta The @@ -123,8 +127,8 @@ command first sends the byte from the .Fa cmd field to the device, and then reads one byte of data from the device. -The returned data will be stored in the location pointed to by -.Fa data.byte_ptr . +The returned data will be stored in +.Fa rdata.byte . .It Dv SMB_READW Ta The .Em ReadWord @@ -132,29 +136,33 @@ command first sends the byte from the .Fa cmd field to the device, and then reads one word of data from the device. -The returned data will be stored in the location pointed to by -.Fa data.word_ptr . +The returned data will be stored in +.Fa rdata.word . .It Dv SMB_PCALL Ta The .Em ProcedureCall command first sends the byte from the .Fa cmd field to the device, followed by the word provided in -.Fa data.process.sdata . +.Fa wdata.word . It then reads one word of data from the device, and returns it -in the location pointed to by -.Fa data.process.rdata . +in +.Fa rdata.word . .It Dv SMB_BWRITE Ta The .Em BlockWrite command first sends the byte from the .Fa cmd field to the device, followed by -.Fa count +.Fa wcount bytes of data that are taken from the buffer pointed to by -.Fa data.byte_ptr . +.Fa wbuf . The SMBus specification mandates that no more than 32 bytes of -data can be transferred in a single block read or write command. +data can be transferred in a single block read or write command, +but since +.Xr smbus 4 +is also used to access I2C devices, the limit has been increased +to 1024. This value is available in the constant .Dv SMB_MAXBLOCKSIZE . .It Dv SMB_BREAD Ta @@ -163,10 +171,38 @@ The command first sends the byte from the .Fa cmd field to the device, and then reads -.Fa count +.Fa rcount +bytes of data that from the device. +These data will be returned in the buffer pointed to by +.Fa rbuf . +.It Dv SMB_TRANS Ta +The +.Em Trans +command sends an SMB roll-up transaction with flags that also allow it to +be used for (mostly) I2C pass-through and with with 10-bit addresses. +This function can be used to roll up all of the above functions. +It first sends the byte from the +.Fa cmd +field to the device, followed by +.Fa wcount +bytes of data that are taken from the buffer pointed to by +.Fa wbuf , +then reads +.Fa rcount bytes of data that from the device. These data will be returned in the buffer pointed to by -.Fa data.byte_ptr . +.Fa rbuf . +.Pp +The following flags are allowed in +.Fa op : +.Pp +.Bd -literal -compact +SMB_TRANS_NOSTOP Do not send STOP at end +SMB_TRANS_NOCMD Ignore cmd field (do not tx) +SMB_TRANS_NOCNT Do not tx or rx count field +SMB_TRANS_7BIT Change address mode to 7-bit +SMB_TRANS_10BIT Change address mode to 10-bit +.Ed .El .Pp The @@ -201,4 +237,7 @@ manual page first appeared in .Sh AUTHORS This manual page was written by -.An Nicolas Souchu . +.An Nicolas Souchu +and extended by +.An Michael Gmelin Aq freebsd@grem.de +. |