From 4e5c20dab63cb97c30ea8279fc145330171131e3 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 22 Feb 2006 15:14:57 +0000 Subject: * include/socket-can/can.h: new AF_CAN git-svn-id: https://iocaste.extern.pengutronix.de/svn/canutils/trunks/canutils-1.1-trunk@59 5fd5a299-6ef2-0310-aa18-8b01d7c39d8c --- configure.ac | 2 +- include/socket-can/can.h | 5 ++-- src/canconfig.c | 76 ++++++++++++++++++++++++------------------------ 3 files changed, 42 insertions(+), 41 deletions(-) diff --git a/configure.ac b/configure.ac index b1328e9..60b2692 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([canutils], [1.0.6], [socket-can@pengutronix.de]) +AC_INIT([canutils], [1.1.0], [socket-can@pengutronix.de]) AC_CONFIG_HEADERS([include/can_config.h]) AC_CONFIG_SRCDIR([src/canconfig.c]) AC_CONFIG_MACRO_DIR([config/m4]) diff --git a/include/socket-can/can.h b/include/socket-can/can.h index 77e309e..507cfd7 100644 --- a/include/socket-can/can.h +++ b/include/socket-can/can.h @@ -1,7 +1,7 @@ /* * can.h (userspace) * - * Copyright (C) 2004, 2005 + * Copyright (C) 2004, 2005, 2006 * * - Robert Schwebel, Benedikt Spranger, Marc Kleine-Budde, Pengutronix * @@ -202,7 +202,7 @@ union can_settings { }; -#define AF_CAN 30 /* CAN Bus */ +#define AF_CAN 29 /* CAN Bus */ #define PF_CAN AF_CAN enum CAN_PROTO { @@ -236,6 +236,7 @@ struct can_filter { uint32_t can_id; uint32_t can_mask; }; + #define SO_CAN_SET_FILTER 1 #define SO_CAN_UNSET_FILTER 2 diff --git a/src/canconfig.c b/src/canconfig.c index 9207fe5..d481ce2 100644 --- a/src/canconfig.c +++ b/src/canconfig.c @@ -91,18 +91,18 @@ speed_t can_value_to_baud(unsigned long value) void help(void) { - fprintf(stderr, "usage:\n\t" - "canconfig baudrate { BR | BTR }\n\t\t" - "BR := { 10 | 20 | 50 | 100 | 125 | 250 | 500 | 800 | 1000 }\n\t\t" - "BTR := btr_sja1000 \n\t\t" - "BTR := btr_c_can \n\t\t" - "BTR := btr_nios \n\t" - "canconfig mode MODE\n\t\t" - "MODE := { start }\n\t" - "canconfig state\n" - ); - - exit(EXIT_FAILURE); + fprintf(stderr, "usage:\n\t" + "canconfig baudrate { BR | BTR }\n\t\t" + "BR := { 10 | 20 | 50 | 100 | 125 | 250 | 500 | 800 | 1000 }\n\t\t" + "BTR := btr_sja1000 \n\t\t" + "BTR := btr_c_can \n\t\t" + "BTR := btr_nios \n\t" + "canconfig mode MODE\n\t\t" + "MODE := { start }\n\t" + "canconfig state\n" + ); + + exit(EXIT_FAILURE); } @@ -118,32 +118,32 @@ void do_show_baudrate(int argc, char* argv[]) } switch (br->baudrate) { - case CAN_BAUD_BTR_SJA1000: - fprintf(stdout, "%s: sja1000 brp=%d sjw=%d tseg1=%d tseg2=%d sam=%d\n", - ifr.ifr_name, - br->btr.sja1000.brp, - br->btr.sja1000.sjw, - br->btr.sja1000.tseg1, - br->btr.sja1000.tseg2, - br->btr.sja1000.sam); - break; - case CAN_BAUD_BTR_C_CAN: - fprintf(stdout, "%s: C-Can brp=%d sjw=%d tseg1=%d tseg2=%d\n", - ifr.ifr_name, - br->btr.c_can.brp, - br->btr.c_can.sjw, - br->btr.c_can.tseg1, - br->btr.c_can.tseg2); - break; - case CAN_BAUD_BTR_NIOS: - fprintf(stdout, "%s: nios prescale=%d timea=%d timeb=%d\n", - ifr.ifr_name, - br->btr.nios.prescale, - br->btr.nios.timea, - br->btr.nios.timeb); - break; - default: - value = can_baud_to_value(br->baudrate); + case CAN_BAUD_BTR_SJA1000: + fprintf(stdout, "%s: sja1000 brp=%d sjw=%d tseg1=%d tseg2=%d sam=%d\n", + ifr.ifr_name, + br->btr.sja1000.brp, + br->btr.sja1000.sjw, + br->btr.sja1000.tseg1, + br->btr.sja1000.tseg2, + br->btr.sja1000.sam); + break; + case CAN_BAUD_BTR_C_CAN: + fprintf(stdout, "%s: C-Can brp=%d sjw=%d tseg1=%d tseg2=%d\n", + ifr.ifr_name, + br->btr.c_can.brp, + br->btr.c_can.sjw, + br->btr.c_can.tseg1, + br->btr.c_can.tseg2); + break; + case CAN_BAUD_BTR_NIOS: + fprintf(stdout, "%s: nios prescale=%d timea=%d timeb=%d\n", + ifr.ifr_name, + br->btr.nios.prescale, + br->btr.nios.timea, + br->btr.nios.timeb); + break; + default: + value = can_baud_to_value(br->baudrate); if (value != 0) fprintf(stdout, "%s: baudrate %d\n", ifr.ifr_name, value); -- cgit v1.2.3