Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/bouyer-socketcan]: src Add can(4) and canloop(4) man pages



details:   https://anonhg.NetBSD.org/src/rev/771400891690
branches:  bouyer-socketcan
changeset: 820906:771400891690
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu May 18 11:28:48 2017 +0000

description:
Add can(4) and canloop(4) man pages

diffstat:

 distrib/sets/lists/man/mi |   8 +++-
 share/man/man4/Makefile   |   4 +-
 share/man/man4/can.4      |  96 +++++++++++++++++++++++++++++++++++++++++++++++
 share/man/man4/canloop.4  |  53 +++++++++++++++++++++++++
 4 files changed, 158 insertions(+), 3 deletions(-)

diffs (211 lines):

diff -r d92e319f06e4 -r 771400891690 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Wed Apr 26 11:45:23 2017 +0000
+++ b/distrib/sets/lists/man/mi Thu May 18 11:28:48 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1545.2.2 2017/04/21 16:51:14 bouyer Exp $
+# $NetBSD: mi,v 1.1545.2.3 2017/05/18 11:28:49 bouyer Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -954,6 +954,8 @@
 ./usr/share/man/cat4/bwi.0                     man-sys-catman          .cat
 ./usr/share/man/cat4/ca.0                      man-obsolete            obsolete
 ./usr/share/man/cat4/cac.0                     man-sys-catman          .cat
+./usr/share/man/cat4/can.0                     man-sys-catman          .cat
+./usr/share/man/cat4/canloop.0                 man-sys-catman          .cat
 ./usr/share/man/cat4/cardbus.0                 man-sys-catman          .cat
 ./usr/share/man/cat4/cardslot.0                        man-sys-catman          .cat
 ./usr/share/man/cat4/carp.0                    man-sys-catman          .cat
@@ -4066,6 +4068,8 @@
 ./usr/share/man/html4/btuart.html              man-sys-htmlman         html
 ./usr/share/man/html4/bwi.html                 man-sys-htmlman         html
 ./usr/share/man/html4/cac.html                 man-sys-htmlman         html
+./usr/share/man/html4/can.html                 man-sys-htmlman         html
+./usr/share/man/html4/canloop.html             man-sys-htmlman         html
 ./usr/share/man/html4/cardbus.html             man-sys-htmlman         html
 ./usr/share/man/html4/cardslot.html            man-sys-htmlman         html
 ./usr/share/man/html4/carp.html                        man-sys-htmlman         html
@@ -6950,6 +6954,8 @@
 ./usr/share/man/man4/bwi.4                     man-sys-man             .man
 ./usr/share/man/man4/ca.4                      man-obsolete            obsolete
 ./usr/share/man/man4/cac.4                     man-sys-man             .man
+./usr/share/man/man4/can.4                     man-sys-man             .man
+./usr/share/man/man4/canloop.4                 man-sys-man             .man
 ./usr/share/man/man4/cardbus.4                 man-sys-man             .man
 ./usr/share/man/man4/cardslot.4                        man-sys-man             .man
 ./usr/share/man/man4/carp.4                    man-sys-man             .man
diff -r d92e319f06e4 -r 771400891690 share/man/man4/Makefile
--- a/share/man/man4/Makefile   Wed Apr 26 11:45:23 2017 +0000
+++ b/share/man/man4/Makefile   Thu May 18 11:28:48 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.631.2.1 2017/04/21 16:53:15 bouyer Exp $
+#      $NetBSD: Makefile,v 1.631.2.2 2017/05/18 11:28:48 bouyer Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 MAN=   aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -16,7 +16,7 @@
        brgphy.4 bridge.4 bthidev.4 bthub.4 btkbd.4 \
        btmagic.4 btms.4 btsco.4 btuart.4 \
        bwi.4 \
-       cac.4 cardbus.4 carp.4 cas.4 ccd.4 cd.4 \
+       cac.4 can.4 canloop.4 cardbus.4 carp.4 cas.4 ccd.4 cd.4 \
        cec.4 cgd.4 cfb.4 ch.4 chipsfb.4 ciphy.4 ciss.4 clcs.4 clct.4 \
        clockctl.4 cmdide.4 cmpci.4 cms.4 cnw.4 \
        com.4 coram.4 crypto.4 cs80bus.4 cuda.4 cypide.4 cxdtv.4 \
diff -r d92e319f06e4 -r 771400891690 share/man/man4/can.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/can.4      Thu May 18 11:28:48 2017 +0000
@@ -0,0 +1,96 @@
+.\"    $NetBSD: can.4,v 1.1.2.1 2017/05/18 11:28:48 bouyer Exp $
+.\"
+.\" Copyright (c) 2017 Manuel Bouyer.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    
+.\"
+.Dd May 18, 2017
+.Dt CAN 4
+.Os
+.Sh NAME
+.Nm CAN
+.Nd CAN Protocol
+.Sh SYNOPSIS
+.In sys/socket.h
+.In netcan/can.h
+.Ft int
+.Fn socket AF_CAN SOCK_RAW CAN_RAW
+.Sh DESCRIPTION
+.Nm
+is the network layer protocol used on top of CAN bus networks. At this time
+only the SOCK_RAW socket type is supported.
+This protocol layer is intended to be compatible with the linux SocketCAN implementation.
+.Ss ADDRESSING
+A CAN frame consists of a 11 bits (standard frame format) or 29 bits
+(extended frame format) identifier, followed by up to 8 data bytes.
+The interpretation of the identifier is application-dependant, the CAN
+standard itself doesn't define an addressing.
+.Pp
+The
+.Nm
+layer uses a 32bits identifier. The 3 upper bits are used as control flags.
+The extended frame format is selected by setting the CAN_EFF_FLAG control bit.
+.Pp
+The socket address is defined as
+.Bd -literal
+struct sockaddr_can {
+        u_int8_t        can_len;
+        sa_family_t     can_family;
+        int             can_ifindex;
+        union {
+                /* transport protocol class address information */
+                struct { canid_t rx_id, tx_id; } tp;
+                /* reserved for future CAN protocols address information */
+        } can_addr;
+};
+.Ed
+For CAN raw sockets, the 32bits identifier is part of the message data.
+The can_addr field of the sockaddr structure is not used.
+.Ss MESSAGE
+Raw CAN sockets use fixed-length messages defined as follow:
+.Bd -literal
+struct can_frame {
+        canid_t can_id; /* ID + EFF/RTR/ERR flags */
+        uint8_t can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */
+        uint8_t __pad;
+        uint8_t __res0;
+        uint8_t __res1;
+        uint8_t data[CAN_MAX_DLEN] __aligned(8);
+};
+.Ed
+The lower 11 bits (for standard frames) or 29 bits (for exended frames) are
+used as the on-wire identifier. The CAN_EFF_FLAG bit is set in can_id for
+extended frames. The CAN_RTR_FLAG bit is set in can_id for remote transmission
+request frames.
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netintro 4 ,
+.Xr canloop 4 ,
+.Xr canconfig 8 ,
+.Pa /usr/include/netcan/can.h 
+.Pp
+.Lk https://en.wikipedia.org/wiki/SocketCAN "SocketCAN - Wikipedia"
+.Lk https://www.kernel.org/doc/Documentation/networking/can.txt "Readme file for the Controller Area Network Protocol Family"
+.Sh BUGS
+CANFD and error frames are not implemented.
+.Sh HISTORY
+The
+.Nm
+protocol appeared in
+.Nx 8.0 .
diff -r d92e319f06e4 -r 771400891690 share/man/man4/canloop.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/canloop.4  Thu May 18 11:28:48 2017 +0000
@@ -0,0 +1,53 @@
+.\"    $NetBSD: canloop.4,v 1.1.2.1 2017/05/18 11:28:48 bouyer Exp $
+.\"
+.\" Copyright (c) 2017 Manuel Bouyer.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    
+.\"
+.Dd May 18, 2017
+.Dt CANLOOP 4
+.Os
+.Sh NAME
+.Nm canloop
+.Nd software loopback CAN network interface
+.Sh SYNOPSIS
+.Cd "pseudo-device canloop"
+.Sh DESCRIPTION
+The
+.Nm canloop
+pseudo interface is a loopback interface for the CAN layer. It can be used
+as destination by a CAN application, when no CAN hardware is available.
+Other sockets bound to the same
+.Nm canloop
+interface (or not bound to any interface) will receive the frames.
+.Pp
+.Nm canloop
+interfaces can be created by using the
+.Xr ifconfig 8
+.Cm create
+command.
+.Sh SEE ALSO
+.Xr can 4 ,
+.Xr intro 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device appeared in
+.Nx 8.0 .



Home | Main Index | Thread Index | Old Index