devices/rtdmnet.c
author Edouard Tisserant <edouard.tisserant@gmail.com>
Mon, 01 Oct 2018 18:55:06 +0200
branchstable-1.5
changeset 2716 4f7421c058bb
parent 2711 a5c4ccc02285
child 2717 b5e3de0467a5
permissions -rw-r--r--
Fixed wrong xeno_lib_ldflags, missing --posix --auto-init-solib
2709
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
/******************************************************************************
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
 *  $Id$
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
 *  Copyright (C) 2014-2018  Edouard Tisserant
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
 *  This file is part of the IgH EtherCAT Master.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
 *  modify it under the terms of the GNU General Public License version 2, as
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
 *  published by the Free Software Foundation.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    17
 *  Public License for more details.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    18
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License along
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    20
 *  with the IgH EtherCAT Master; if not, write to the Free Software
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    22
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    23
 *  ---
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    24
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    25
 *  The license mentioned above concerns the source code only. Using the
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    26
 *  EtherCAT technology and brand is only permitted in compliance with the
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    27
 *  industrial property and similar rights of Beckhoff Automation GmbH.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    28
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    29
 *****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    30
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    31
/** \file
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    32
 * EtherCAT generic Xenomai's RTDM RAW Ethernet socket device module.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    33
 * Heavily based on generic.c. Should be merged in a single file with #ifdefs
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    34
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    35
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    36
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    37
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    38
#include <linux/module.h>
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    39
#include <linux/device.h>
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    40
#include <linux/err.h>
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    41
#include <linux/version.h>
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    42
#include <linux/if_arp.h> /* ARPHRD_ETHER */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    43
#include <linux/etherdevice.h>
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    44
#include <rtdm/rtdm.h>
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    45
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    46
// for rtnetif_carrier_ok
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    47
// This needs -I@XENOMAI_DIR@/kernel/drivers/net/stack/include in Kbuild.in
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    48
#include <rtnet_port.h>
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    49
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    50
#include "../globals.h"
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    51
#include "ecdev.h"
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    52
2711
a5c4ccc02285 Fixed rtdmnet.c PFX and removed useless commented code.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2709
diff changeset
    53
#define PFX "ec_rtdmnet: "
2709
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    54
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    55
#define ETH_P_ETHERCAT 0x88A4
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    56
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    57
#define EC_GEN_RX_BUF_SIZE 1600
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    58
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    59
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    60
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    61
int __init ec_gen_init_module(void);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    62
void __exit ec_gen_cleanup_module(void);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    63
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    64
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    65
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    66
/** \cond */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    67
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    68
MODULE_AUTHOR("Edouard Tisserant <edouard.tisserant@gmail.com>");
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    69
MODULE_DESCRIPTION("EtherCAT generic Xenomai's RTDM RAW Ethernet socket device module.");
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    70
MODULE_LICENSE("GPL");
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    71
MODULE_VERSION(EC_MASTER_VERSION);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    72
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    73
/** \endcond */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    74
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    75
struct list_head generic_devices;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    76
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    77
typedef struct {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    78
    struct list_head list;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    79
    struct net_device *netdev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    80
    struct rtnet_device *used_netdev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    81
    int socket;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    82
    ec_device_t *ecdev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    83
    uint8_t *rx_buf;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    84
    // struct sockaddr_ll dest_addr;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    85
} ec_gen_device_t;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    86
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    87
typedef struct {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    88
    struct list_head list;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    89
    struct rtnet_device *netdev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    90
    char name[IFNAMSIZ];
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    91
    int ifindex;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    92
    uint8_t dev_addr[ETH_ALEN];
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    93
} ec_gen_interface_desc_t;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    94
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    95
int ec_gen_device_open(ec_gen_device_t *);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    96
int ec_gen_device_stop(ec_gen_device_t *);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    97
int ec_gen_device_start_xmit(ec_gen_device_t *, struct sk_buff *);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    98
void ec_gen_device_poll(ec_gen_device_t *);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    99
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   100
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   101
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   102
static int ec_gen_netdev_open(struct net_device *dev)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   103
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   104
    ec_gen_device_t *gendev = *((ec_gen_device_t **) netdev_priv(dev));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   105
    return ec_gen_device_open(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   106
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   107
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   108
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   109
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   110
static int ec_gen_netdev_stop(struct net_device *dev)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   111
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   112
    ec_gen_device_t *gendev = *((ec_gen_device_t **) netdev_priv(dev));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   113
    return ec_gen_device_stop(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   114
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   115
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   116
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   117
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   118
static int ec_gen_netdev_start_xmit(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   119
        struct sk_buff *skb,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   120
        struct net_device *dev
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   121
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   122
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   123
    ec_gen_device_t *gendev = *((ec_gen_device_t **) netdev_priv(dev));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   124
    return ec_gen_device_start_xmit(gendev, skb);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   125
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   126
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   127
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   128
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   129
void ec_gen_poll(struct net_device *dev)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   130
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   131
    ec_gen_device_t *gendev = *((ec_gen_device_t **) netdev_priv(dev));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   132
    ec_gen_device_poll(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   133
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   134
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   135
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   136
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   137
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   138
static const struct net_device_ops ec_gen_netdev_ops = {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   139
    .ndo_open       = ec_gen_netdev_open,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   140
    .ndo_stop       = ec_gen_netdev_stop,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   141
    .ndo_start_xmit = ec_gen_netdev_start_xmit,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   142
};
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   143
#endif
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   144
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   145
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   146
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   147
/** Init generic device.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   148
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   149
int ec_gen_device_init(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   150
        ec_gen_device_t *dev
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   151
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   152
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   153
    ec_gen_device_t **priv;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   154
    char null = 0x00;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   155
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   156
    dev->ecdev = NULL;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   157
    dev->socket = -1;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   158
    dev->rx_buf = NULL;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   159
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   160
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   161
    dev->netdev = alloc_netdev(sizeof(ec_gen_device_t *), &null,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   162
            NET_NAME_UNKNOWN, ether_setup);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   163
#else
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   164
    dev->netdev = alloc_netdev(sizeof(ec_gen_device_t *), &null, ether_setup);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   165
#endif
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   166
    if (!dev->netdev) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   167
        return -ENOMEM;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   168
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   169
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   170
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   171
    dev->netdev->netdev_ops = &ec_gen_netdev_ops;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   172
#else
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   173
    dev->netdev->open = ec_gen_netdev_open;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   174
    dev->netdev->stop = ec_gen_netdev_stop;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   175
    dev->netdev->hard_start_xmit = ec_gen_netdev_start_xmit;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   176
#endif
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   177
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   178
    priv = netdev_priv(dev->netdev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   179
    *priv = dev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   180
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   181
    return 0;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   182
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   183
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   184
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   185
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   186
/** Clear generic device.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   187
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   188
void ec_gen_device_clear(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   189
        ec_gen_device_t *dev
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   190
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   191
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   192
    if (dev->ecdev) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   193
        ecdev_close(dev->ecdev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   194
        ecdev_withdraw(dev->ecdev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   195
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   196
    if (!(dev->socket < 0)) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   197
        rtdm_close(dev->socket);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   198
        dev->socket = -1;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   199
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   200
    free_netdev(dev->netdev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   201
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   202
    if (dev->rx_buf) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   203
        kfree(dev->rx_buf);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   204
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   205
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   206
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   207
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   208
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   209
/** Creates a network socket.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   210
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   211
int ec_gen_device_create_socket(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   212
        ec_gen_device_t *dev,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   213
        ec_gen_interface_desc_t *desc
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   214
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   215
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   216
    int ret;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   217
    struct sockaddr_ll sa;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   218
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   219
    dev->rx_buf = kmalloc(EC_GEN_RX_BUF_SIZE, GFP_KERNEL);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   220
    if (!dev->rx_buf) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   221
        return -ENOMEM;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   222
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   223
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   224
    /* create rt-socket */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   225
    dev->socket = rtdm_socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ETHERCAT));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   226
    if (dev->socket < 0) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   227
        printk(" rtdm_socket() = %d!\n", dev->socket);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   228
        return dev->socket;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   229
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   230
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   231
    printk(KERN_ERR PFX "Binding socket to interface %i (%s).\n",
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   232
            desc->ifindex, desc->name);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   233
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   234
    memset(&sa, 0x00, sizeof(sa));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   235
    sa.sll_family = AF_PACKET;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   236
    sa.sll_protocol = htons(ETH_P_ETHERCAT);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   237
    sa.sll_ifindex = desc->ifindex;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   238
    ret = rtdm_bind(dev->socket, (struct sockaddr *)&sa,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   239
                      sizeof(struct sockaddr_ll));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   240
    if (ret < 0) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   241
        printk(" rtdm_bind() = %d!\n", ret);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   242
        rtdm_close(dev->socket);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   243
        dev->socket = -1;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   244
        return ret;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   245
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   246
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   247
    return 0;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   248
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   249
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   250
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   251
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   252
/** Offer generic device to master.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   253
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   254
int ec_gen_device_offer(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   255
        ec_gen_device_t *dev,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   256
        ec_gen_interface_desc_t *desc
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   257
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   258
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   259
    int ret = 0;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   260
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   261
    dev->used_netdev = desc->netdev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   262
    memcpy(dev->netdev->dev_addr, desc->dev_addr, ETH_ALEN);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   263
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   264
    dev->ecdev = ecdev_offer(dev->netdev, ec_gen_poll, THIS_MODULE);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   265
    if (dev->ecdev) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   266
        if (ec_gen_device_create_socket(dev, desc)) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   267
            ecdev_withdraw(dev->ecdev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   268
            dev->ecdev = NULL;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   269
        } else if (ecdev_open(dev->ecdev)) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   270
            ecdev_withdraw(dev->ecdev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   271
            dev->ecdev = NULL;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   272
        } else {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   273
            ecdev_set_link(dev->ecdev, rtnetif_carrier_ok(dev->used_netdev)); // FIXME
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   274
            ret = 1;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   275
        }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   276
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   277
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   278
    return ret;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   279
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   280
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   281
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   282
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   283
/** Open the device.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   284
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   285
int ec_gen_device_open(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   286
        ec_gen_device_t *dev
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   287
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   288
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   289
    return 0;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   290
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   291
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   292
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   293
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   294
/** Stop the device.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   295
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   296
int ec_gen_device_stop(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   297
        ec_gen_device_t *dev
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   298
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   299
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   300
    return 0;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   301
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   302
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   303
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   304
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   305
int ec_gen_device_start_xmit(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   306
        ec_gen_device_t *dev,
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   307
        struct sk_buff *skb
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   308
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   309
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   310
    struct user_msghdr msg;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   311
    struct iovec iov;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   312
    size_t len = skb->len;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   313
    int ret;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   314
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   315
    ecdev_set_link(dev->ecdev, rtnetif_carrier_ok(dev->used_netdev));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   316
    //ecdev_set_link(dev->ecdev, 1); // FIXME
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   317
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   318
    iov.iov_base = skb->data;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   319
    iov.iov_len = len;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   320
    memset(&msg, 0, sizeof(msg));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   321
    // msg.msg_name    = &dev->dest_addr;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   322
    // msg.msg_namelen = sizeof(dev->dest_addr);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   323
    msg.msg_iov     = &iov;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   324
    msg.msg_iovlen  = 1;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   325
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   326
    ret = rtdm_sendmsg(dev->socket, &msg, 0);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   327
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   328
    return ret == len ? NETDEV_TX_OK : NETDEV_TX_BUSY;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   329
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   330
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   331
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   332
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   333
/** Polls the device.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   334
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   335
void ec_gen_device_poll(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   336
        ec_gen_device_t *dev
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   337
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   338
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   339
    struct user_msghdr msg;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   340
    struct iovec iov;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   341
    int ret, budget = 128; // FIXME
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   342
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   343
    ecdev_set_link(dev->ecdev, rtnetif_carrier_ok(dev->used_netdev));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   344
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   345
    do {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   346
        iov.iov_base = dev->rx_buf;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   347
        iov.iov_len = EC_GEN_RX_BUF_SIZE;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   348
        memset(&msg, 0, sizeof(msg));
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   349
        msg.msg_iov     = &iov;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   350
        msg.msg_iovlen  = 1;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   351
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   352
        ret = rtdm_recvmsg(dev->socket, &msg, MSG_DONTWAIT);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   353
        if (ret > 0) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   354
            ecdev_receive(dev->ecdev, dev->rx_buf, ret);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   355
        } else if (ret < 0) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   356
            break;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   357
        }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   358
        budget--;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   359
    } while (budget);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   360
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   361
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   362
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   363
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   364
/** Offer device.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   365
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   366
int offer_device(
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   367
        ec_gen_interface_desc_t *desc
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   368
        )
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   369
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   370
    ec_gen_device_t *gendev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   371
    int ret = 0;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   372
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   373
    gendev = kmalloc(sizeof(ec_gen_device_t), GFP_KERNEL);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   374
    if (!gendev) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   375
        return -ENOMEM;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   376
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   377
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   378
    ret = ec_gen_device_init(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   379
    if (ret) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   380
        kfree(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   381
        return ret;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   382
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   383
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   384
    if (ec_gen_device_offer(gendev, desc)) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   385
        list_add_tail(&gendev->list, &generic_devices);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   386
    } else {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   387
        ec_gen_device_clear(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   388
        kfree(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   389
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   390
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   391
    return ret;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   392
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   393
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   394
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   395
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   396
/** Clear devices.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   397
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   398
void clear_devices(void)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   399
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   400
    ec_gen_device_t *gendev, *next;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   401
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   402
    list_for_each_entry_safe(gendev, next, &generic_devices, list) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   403
        list_del(&gendev->list);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   404
        ec_gen_device_clear(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   405
        kfree(gendev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   406
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   407
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   408
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   409
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   410
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   411
/** Module initialization.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   412
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   413
 * Initializes \a master_count masters.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   414
 * \return 0 on success, else < 0
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   415
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   416
int __init ec_gen_init_module(void)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   417
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   418
    int ret = 0;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   419
    int devices = 0;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   420
    int i;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   421
    struct list_head descs;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   422
    struct rtnet_device *rtdev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   423
    ec_gen_interface_desc_t *desc, *next;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   424
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   425
    printk(KERN_INFO PFX "EtherCAT master RTnet Ethernet device module %s\n",
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   426
            EC_MASTER_VERSION);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   427
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   428
    INIT_LIST_HEAD(&generic_devices);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   429
    INIT_LIST_HEAD(&descs);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   430
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   431
    for (i = 0; i < MAX_RT_DEVICES; i++) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   432
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   433
        rtdev = rtdev_get_by_index(i);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   434
        if (rtdev != NULL) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   435
            mutex_lock(&rtdev->nrt_lock);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   436
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   437
            //if (test_bit(PRIV_FLAG_UP, &rtdev->priv_flags)) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   438
            //    mutex_unlock(&rtdev->nrt_lock);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   439
            //    printk(KERN_ERR PFX "%s busy, skipping device!\n", rtdev->name);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   440
            //    rtdev_dereference(rtdev);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   441
            //    continue;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   442
            //}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   443
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   444
            desc = kmalloc(sizeof(ec_gen_interface_desc_t), GFP_ATOMIC);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   445
            if (!desc) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   446
                ret = -ENOMEM;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   447
                goto out_err;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   448
            }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   449
            strncpy(desc->name, rtdev->name, IFNAMSIZ);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   450
            desc->netdev = rtdev;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   451
            desc->ifindex = rtdev->ifindex;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   452
            memcpy(desc->dev_addr, rtdev->dev_addr, ETH_ALEN);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   453
            list_add_tail(&desc->list, &descs);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   454
              mutex_unlock(&rtdev->nrt_lock);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   455
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   456
            devices++;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   457
        }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   458
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   459
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   460
    if (devices == 0) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   461
        printk(KERN_ERR PFX "no real-time devices found!\n");
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   462
        ret = -ENODEV;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   463
        goto out_err;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   464
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   465
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   466
    list_for_each_entry_safe(desc, next, &descs, list) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   467
        ret = offer_device(desc);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   468
        if (ret) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   469
            goto out_err;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   470
        }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   471
        kfree(desc);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   472
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   473
    return ret;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   474
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   475
out_err:
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   476
    list_for_each_entry_safe(desc, next, &descs, list) {
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   477
        list_del(&desc->list);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   478
        kfree(desc);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   479
    }
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   480
    clear_devices();
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   481
    return ret;
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   482
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   483
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   484
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   485
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   486
/** Module cleanup.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   487
 *
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   488
 * Clears all master instances.
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   489
 */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   490
void __exit ec_gen_cleanup_module(void)
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   491
{
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   492
    clear_devices();
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   493
    printk(KERN_INFO PFX "Unloading.\n");
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   494
}
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   495
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   496
/*****************************************************************************/
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   497
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   498
/** \cond */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   499
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   500
module_init(ec_gen_init_module);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   501
module_exit(ec_gen_cleanup_module);
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   502
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   503
/** \endcond */
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   504
e0c2f17ebed1 Added devices/rtdmnet.c, heavily based on devices/generic.c, and with similar purpose. It uses Xenomai's RTNet/RTDM socket instead of Linux socket.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   505
/*****************************************************************************/