#include <errno.h>
#include <getopt.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
/* added for can-calc-bit-timing utility */
__u32 ref_clk; /* CAN system clock frequency in Hz */
- void (*printf_btr)(struct can_bittiming *bt, int hdr);
+ void (*printf_btr)(struct can_bittiming *bt, bool hdr);
};
/*
exit(EXIT_FAILURE);
}
-static void printf_btr_sja1000(struct can_bittiming *bt, int hdr)
+static void printf_btr_sja1000(struct can_bittiming *bt, bool hdr)
{
uint8_t btr0, btr1;
}
}
-static void printf_btr_at91(struct can_bittiming *bt, int hdr)
+static void printf_btr_at91(struct can_bittiming *bt, bool hdr)
{
if (hdr) {
printf("%10s", "CAN_BR");
}
}
-static void printf_btr_flexcan(struct can_bittiming *bt, int hdr)
+static void printf_btr_flexcan(struct can_bittiming *bt, bool hdr)
{
if (hdr) {
printf("%10s", "CAN_CTRL");
}
}
-static void printf_btr_mcp251x(struct can_bittiming *bt, int hdr)
+static void printf_btr_mcp251x(struct can_bittiming *bt, bool hdr)
{
uint8_t cnf1, cnf2, cnf3;
}
}
-static void printf_btr_ti_hecc(struct can_bittiming *bt, int hdr)
+static void printf_btr_ti_hecc(struct can_bittiming *bt, bool hdr)
{
if (hdr) {
printf("%10s", "CANBTC");
#define RCAR_CAN_BCR_SJW(x) (((x) & 0x3) << 4)
#define RCAR_CAN_BCR_TSEG2(x) ((x) & 0x07)
-static void printf_btr_rcar_can(struct can_bittiming *bt, int hdr)
+static void printf_btr_rcar_can(struct can_bittiming *bt, bool hdr)
{
if (hdr) {
printf("%10s", "CiBCR");
static void print_bit_timing(const struct can_bittiming_const *btc,
__u32 bitrate, __u32 sample_point, __u32 ref_clk,
- int quiet)
+ bool quiet)
{
struct net_device dev = {
.priv.bittiming_const = btc,
btc->name,
ref_clk / 1000000.0);
- btc->printf_btr(&bt, 1);
+ btc->printf_btr(&bt, true);
printf("\n");
}
bt.sample_point / 10.0,
100.0 * spt_error / sample_point);
- btc->printf_btr(&bt, 0);
+ btc->printf_btr(&bt, false);
printf("\n");
}
__u32 bitrate = 0;
__u32 opt_ref_clk = 0, ref_clk;
int sampl_pt = 0;
- int quiet = 0;
- int list = 0;
+ bool quiet = false, list = false, found = false;
char *name = NULL;
unsigned int i, j;
- int opt, found = 0;
+ int opt;
const struct can_bittiming_const *btc = NULL;
break;
case 'l':
- list = 1;
+ list = true;
break;
case 'q':
- quiet = 1;
+ quiet = true;
break;
case 's':
if (name && strcmp(can_calc_consts[i].name, name))
continue;
- found = 1;
+ found = true;
btc = &can_calc_consts[i];
if (opt_ref_clk)