コード例 #1
0
ファイル: master.c プロジェクト: deiKruve/gmac-kernel-module
/** Output master statistics.
 *
 * This function outputs statistical data on demand, but not more often than
 * necessary. The output happens at most once a second.
 */
void ec_master_output_stats(ec_master_t *master /**< EtherCAT master */)
{
    if (unlikely(jiffies - master->stats.output_jiffies >= HZ)) {
        master->stats.output_jiffies = jiffies;

        if (master->stats.timeouts) {
            EC_MASTER_WARN(master, "%u datagram%s TIMED OUT!\n",
                    master->stats.timeouts,
                    master->stats.timeouts == 1 ? "" : "s");
            master->stats.timeouts = 0;
        }
        if (master->stats.corrupted) {
            EC_MASTER_WARN(master, "%u frame%s CORRUPTED!\n",
                    master->stats.corrupted,
                    master->stats.corrupted == 1 ? "" : "s");
            master->stats.corrupted = 0;
        }
        if (master->stats.unmatched) {
            EC_MASTER_WARN(master, "%u datagram%s UNMATCHED!\n",
                    master->stats.unmatched,
                    master->stats.unmatched == 1 ? "" : "s");
            master->stats.unmatched = 0;
        }
    }
}
コード例 #2
0
ファイル: rtdm.c プロジェクト: liangyaozhan/ethercat
/** Clear an RTDM device.
 */
void ec_rtdm_dev_clear(
        ec_rtdm_dev_t *rtdm_dev /**< EtherCAT RTDM device. */
        )
{
    int ret;

    EC_MASTER_INFO(rtdm_dev->master, "Unregistering RTDM device %s.\n",
            rtdm_dev->dev->driver_name);
    ret = rtdm_dev_unregister(rtdm_dev->dev, 1000 /* poll delay [ms] */);
    if (ret < 0) {
        EC_MASTER_WARN(rtdm_dev->master,
                "Failed to unregister RTDM device (code %i).\n", ret);
    }

    kfree(rtdm_dev->dev);
}
コード例 #3
0
ファイル: debug.c プロジェクト: BlastTNG/flight
/** Register debug interface.
 */
void ec_debug_register(
        ec_debug_t *dbg, /**< debug object */
        const struct net_device *net_dev /**< 'Real' Ethernet device. */
        )
{
    int result;

    ec_debug_unregister(dbg);

    // use the Ethernet address of the physical device for the debug device
    memcpy(dbg->dev->dev_addr, net_dev->dev_addr, ETH_ALEN);

    // connect the net_device to the kernel
    if ((result = register_netdev(dbg->dev))) {
        EC_MASTER_WARN(dbg->device->master, "Unable to register net_device:"
                " error %i\n", result);
    } else {
        dbg->registered = 1;
    }
}