]> rtime.felk.cvut.cz Git - can-utils.git/blobdiff - can-calc-bit-timing.c
slcan: added listen-only flag
[can-utils.git] / can-calc-bit-timing.c
index a9fb992bf8129f2f568b20c29035a035eceea638..9031a78f36180735195ad521a24f0f30c5a435f7 100644 (file)
@@ -9,7 +9,10 @@
  *   Copyright 2005      Stanislav Marek
  *   email:pisa@cmp.felk.cvut.cz
  *
- *   This software is released under the GPL-License.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
  */
 
 #include <errno.h>
@@ -26,7 +29,7 @@
 #define ENOTSUPP       524     /* Operation is not supported */
 #endif
 
-/* usefull defines */
+/* useful defines */
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
 #define do_div(a,b) a = (a) / (b)
@@ -192,7 +195,7 @@ static void printf_btr_mcp251x(struct can_bittiming *bt, int hdr)
        if (hdr) {
                printf("CNF1 CNF2 CNF3");
        } else {
-               cnf1 = ((bt->sjw - 1) << 6) | bt->brp;
+               cnf1 = ((bt->sjw - 1) << 6) | (bt->brp - 1);
                cnf2 = 0x80 | ((bt->phase_seg1 - 1) << 3) | (bt->prop_seg - 1);
                cnf3 = bt->phase_seg2 - 1;
                printf("0x%02x 0x%02x 0x%02x", cnf1, cnf2, cnf3);
@@ -301,6 +304,20 @@ static struct can_bittiming_const can_calc_consts[] = {
                .ref_clk = 66660000,    /* mpc5121 */
                .printf_btr = printf_btr_sja1000,
        },
+       {
+               .name = "mscan",
+               .tseg1_min = 4,
+               .tseg1_max = 16,
+               .tseg2_min = 2,
+               .tseg2_max = 8,
+               .sjw_max = 4,
+               .brp_min = 1,
+               .brp_max = 64,
+               .brp_inc = 1,
+
+               .ref_clk = 66666666,    /* mpc5121 */
+               .printf_btr = printf_btr_sja1000,
+       },
        {
                .name = "at91",
                .tseg1_min = 4,
@@ -386,6 +403,34 @@ static struct can_bittiming_const can_calc_consts[] = {
                .ref_clk = 66500000,
                .printf_btr = printf_btr_flexcan,
        },
+       {
+               .name = "flexcan",
+               .tseg1_min = 4,
+               .tseg1_max = 16,
+               .tseg2_min = 2,
+               .tseg2_max = 8,
+               .sjw_max = 4,
+               .brp_min = 1,
+               .brp_max = 256,
+               .brp_inc = 1,
+
+               .ref_clk = 66666666,
+               .printf_btr = printf_btr_flexcan,
+       },
+       {
+               .name = "flexcan",
+               .tseg1_min = 4,
+               .tseg1_max = 16,
+               .tseg2_min = 2,
+               .tseg2_max = 8,
+               .sjw_max = 4,
+               .brp_min = 1,
+               .brp_max = 256,
+               .brp_inc = 1,
+
+               .ref_clk = 83368421,
+               .printf_btr = printf_btr_flexcan, /* vybrid */
+       },
        {
                .name = "mcp251x",
                .tseg1_min = 3,