master/device_id.h
author Florian Pose <fp@igh-essen.com>
Wed, 07 Mar 2007 11:11:17 +0000
changeset 624 11332ad89f47
parent 577 db34078f34cc
permissions -rw-r--r--
Simplified handling of EEPROM strings.
575
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *  License, or (at your option) any later version.
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  charge under condition of compatibility of product made by
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 *  Technology, IP and trade marks.
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 *
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
/**
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
   \file
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
   EtherCAT device ID structure.
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
*/
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#ifndef _EC_DEVICE_ID_H_
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#define _EC_DEVICE_ID_H_
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#include <linux/if_ether.h>
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
#include "globals.h"
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
/*****************************************************************************/
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
typedef enum {
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
    ec_device_id_empty,
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
    ec_device_id_mac
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
}
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
ec_device_id_type_t;
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
typedef struct {
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
    struct list_head list;
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
    ec_device_id_type_t type;
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
    unsigned char octets[ETH_ALEN];
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
}
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
ec_device_id_t;
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
/*****************************************************************************/
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
int ec_device_id_process_params(const char *, const char *,
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
        struct list_head *, struct list_head *);
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
void ec_device_id_clear_list(struct list_head *);
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
int ec_device_id_check(const ec_device_id_t *, const struct net_device *,
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
        const char *, unsigned int);
577
db34078f34cc Added ec_device_id_print().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
    70
ssize_t ec_device_id_print(const ec_device_id_t *, char *);
575
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
/*****************************************************************************/
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
9a2121b500b1 Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
#endif