master/fsm_slave_config.h
author Florian Pose <fp@igh-essen.com>
Mon, 26 Jan 2009 12:04:49 +0000
branch1.4-foe
changeset 1713 df6cdc79ea56
parent 1686 e206f4485f60
permissions -rw-r--r--
Removed todo line.
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    11
 *  published by the Free Software Foundation.
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    16
 *  Public License for more details.
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    22
 *  Using the EtherCAT technology and brand is permitted in compliance with
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1677
diff changeset
    23
 *  the industrial property and similar rights of Beckhoff Automation GmbH.
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *****************************************************************************/
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
/**
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
   \file
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
   EtherCAT slave configuration state machine.
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
*/
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
/*****************************************************************************/
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
    34
#ifndef __EC_FSM_SLAVE_CONFIG_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
    35
#define __EC_FSM_SLAVE_CONFIG_H__
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
#include "../include/ecrt.h"
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
#include "globals.h"
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
#include "slave.h"
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#include "datagram.h"
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#include "fsm_change.h"
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
#include "fsm_coe.h"
1174
235f34ca50e2 Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    44
#include "fsm_pdo.h"
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
/*****************************************************************************/
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
/** \see ec_fsm_slave_config */
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
typedef struct ec_fsm_slave_config ec_fsm_slave_config_t;
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
/** Finite state machine to configure an EtherCAT slave.
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
 */
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
struct ec_fsm_slave_config
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
{
1174
235f34ca50e2 Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    55
    ec_datagram_t *datagram; /**< Datagram used in the state machine. */
235f34ca50e2 Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    56
    ec_fsm_change_t *fsm_change; /**< State change state machine. */
235f34ca50e2 Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    57
    ec_fsm_coe_t *fsm_coe; /**< CoE state machine. */
1686
e206f4485f60 Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1685
diff changeset
    58
    ec_fsm_pdo_t *fsm_pdo; /**< PDO configuration state machine. */
1174
235f34ca50e2 Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    59
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
    ec_slave_t *slave; /**< Slave the FSM runs on. */
1174
235f34ca50e2 Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    61
    void (*state)(ec_fsm_slave_config_t *); /**< State function. */
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
    unsigned int retries; /**< Retries on datagram timeout. */
1686
e206f4485f60 Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1685
diff changeset
    63
    ec_sdo_request_t *request; /**< SDO request for SDO configuration. */
e206f4485f60 Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1685
diff changeset
    64
    ec_sdo_request_t request_copy; /**< Copied SDO request. */
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
};
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
/*****************************************************************************/
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
1174
235f34ca50e2 Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    69
void ec_fsm_slave_config_init(ec_fsm_slave_config_t *, ec_datagram_t *,
235f34ca50e2 Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    70
        ec_fsm_change_t *, ec_fsm_coe_t *, ec_fsm_pdo_t *);
830
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
void ec_fsm_slave_config_clear(ec_fsm_slave_config_t *);
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
void ec_fsm_slave_config_start(ec_fsm_slave_config_t *, ec_slave_t *);
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
int ec_fsm_slave_config_exec(ec_fsm_slave_config_t *);
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
int ec_fsm_slave_config_success(const ec_fsm_slave_config_t *);
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
/*****************************************************************************/
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
d83d92e1a919 Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
#endif