master/fsm_eoe.h
author Knud Baastrup <kba@deif.com>
Tue, 14 Apr 2015 10:12:55 -0400
changeset 2625 e25af8bd3957
parent 2597 0e145bb05859
permissions -rw-r--r--
Eoe mac address now derived from unique mac.
The EoE MAC address is now derived from the NIC part of the first global
unique MAC address of the linked list of available network interfaces or
otherwise the MAC address used by the EtherCAT master. The EoE MAC address
will get the format 02:NIC:NIC:NIC:RP:RP where NIC comes from the unique MAC
address (if available) and RP is the ring position of the EoE slave.
2597
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/*****************************************************************************
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006-2014  Florian Pose, Ingenieurgemeinschaft IgH
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  published by the Free Software Foundation.
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  Public License for more details.
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *  ---
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 ****************************************************************************/
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
/**
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
   \file
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
   EtherCAT EoE set IP parameter state machines.
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
*/
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
/****************************************************************************/
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
#ifndef __EC_FSM_EOE_H__
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
#define __EC_FSM_EOE_H__
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
#include "globals.h"
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#include "datagram.h"
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#include "slave.h"
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
#include "eoe_request.h"
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
/****************************************************************************/
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
typedef struct ec_fsm_eoe ec_fsm_eoe_t; /**< \see ec_fsm_eoe */
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
/** Finite state machines for the Ethernet over EtherCAT protocol.
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
 */
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
struct ec_fsm_eoe {
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
    ec_slave_t *slave; /**< slave the FSM runs on */
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
    unsigned int retries; /**< retries upon datagram timeout */
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
    void (*state)(ec_fsm_eoe_t *, ec_datagram_t *); /**< EoE state function */
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
    ec_datagram_t *datagram; /**< Datagram used in the previous step. */
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
    unsigned long jiffies_start; /**< Timestamp. */
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
    ec_eoe_request_t *request; /**< EoE request */
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
};
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
/****************************************************************************/
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
void ec_fsm_eoe_init(ec_fsm_eoe_t *);
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
void ec_fsm_eoe_clear(ec_fsm_eoe_t *);
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
void ec_fsm_eoe_set_ip_param(ec_fsm_eoe_t *, ec_slave_t *,
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
        ec_eoe_request_t *);
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
int ec_fsm_eoe_exec(ec_fsm_eoe_t *, ec_datagram_t *);
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
int ec_fsm_eoe_success(const ec_fsm_eoe_t *);
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
/****************************************************************************/
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
0e145bb05859 Implemented EoE Set IP parameter request via command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
#endif