Skip site navigation (1)Skip section navigation (2)

FreeBSD Man Pages

Man Page or Keyword Search:
Man Architecture
Apropos Keyword Search (all sections) Output format
home | help
SMB(4)		       FreeBSD Kernel Interfaces Manual			SMB(4)

NAME
     smb -- SMB	generic	I/O device driver

SYNOPSIS
     device smb

DESCRIPTION
     The smb character device driver provides generic I/O to any smbus(4)
     instance.	To control SMB devices,	use /dev/smb? with the ioctls
     described below.  Any of these ioctl commands takes a pointer to struct
     smbcmd as its argument.

     #include <sys/types.h>

     struct smbcmd {
	     u_char cmd;
	     u_char reserved;
	     u_short op;
	     union {
		     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;
     };

     The slave field is	always used, and provides the address of the SMBus
     slave device.  The	slave address is specified in the seven	most signifi-
     cant bits (i.e., ``left-justified'').  The	least significant bit of the
     slave address must	be zero.

     Ioctl		Description

     SMB_QUICK_WRITE	QuickWrite does	not transfer any data.	It just	issues
			the device address with	write intent to	the bus.
     SMB_QUICK_READ	QuickRead does not transfer any	data.  It just issues
			the device address with	read intent to the bus.
     SMB_SENDB		SendByte sends the byte	provided in cmd	to the device.
     SMB_RECVB		ReceiveByte reads a single byte	from the device	which
			is returned in cmd.
     SMB_WRITEB		WriteByte first	sends the byte from cmd	to the device,
			followed by the	byte given in wdata.byte.
     SMB_WRITEW		WriteWord first	sends the byte from cmd	to the device,
			followed by the	word given in wdata.word.  Note	that
			the SMBus byte-order is	little-endian by definition.
     SMB_READB		ReadByte first sends the byte from cmd to the device,
			then reads one byte of data from the device.  Returned
			data is	stored in rdata.byte.
     SMB_READW		ReadWord first sends the byte from cmd to the device,
			then reads one word of data from the device.  Returned
			data is	stored in rdata.word.
     SMB_PCALL		ProcedureCall first sends the byte from	cmd to the
			device,	followed by the	word provided in wdata.word.
			It then	reads one word of data from the	device and
			returns	it in rdata.word.
     SMB_BWRITE		BlockWrite first sends the byte	from cmd to the
			device,	followed by wcount bytes of data that are
			taken from the buffer pointed to by wbuf.  The SMBus
			specification mandates that no more than 32 bytes of
			data can be transferred	in a single block read or
			write command, but since smbus(4) is also used to
			access I2C devices, the	limit has been increased to
			1024.  This value can be read from the constant
			SMB_MAXBLOCKSIZE.
     SMB_BREAD		BlockRead first	sends the byte from cmd	to the device,
			then reads rcount bytes	of data	that from the device.
			This data is returned in the buffer pointed to by
			rbuf.
     SMB_TRANS		Trans sends an SMB roll-up transaction with flags that
			also allow it to be used for (mostly) I2C pass-through
			and with 10-bit	addresses.  This function can be uti-
			lized to roll up all of	the above functions.  It first
			sends the byte from cmd	to the device, followed	by
			wcount bytes of	data that are taken from the buffer
			pointed	to by wbuf, then reads rcount bytes of data
			that from the device.  This data is returned in	the
			buffer pointed to by rbuf.

			The following flags are	allowed	in op:

			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

     The read(2) and write(2) system calls are not implemented by this driver.

ERRORS
     The ioctl(2) commands can cause the following driver-specific errors:

     [ENXIO]		Device did not respond to selection.

     [EBUSY]		Device still in	use.

     [ENODEV]		Operation not supported	by device (not supposed	to
			happen).

     [EINVAL]		General	argument error.

     [EWOULDBLOCK]	SMBus transaction timed	out.

SEE ALSO
     ioctl(2), smbus(4)

HISTORY
     The smb manual page first appeared	in FreeBSD 3.0.

AUTHORS
     This manual page was written by Nicolas Souchu and	extended by
     Michael Gmelin <freebsd@grem.de>.

FreeBSD	11.0			April 25, 2015			  FreeBSD 11.0

NAME | SYNOPSIS | DESCRIPTION | ERRORS | SEE ALSO | HISTORY | AUTHORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=smb&manpath=FreeBSD+11.0-RELEASE+and+Ports>

home | help