IgH EtherCAT Master  1.5.2
fsm_master.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * $Id$
4 *
5 * Copyright (C) 2006-2012 Florian Pose, Ingenieurgemeinschaft IgH
6 *
7 * This file is part of the IgH EtherCAT Master.
8 *
9 * The IgH EtherCAT Master is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version 2, as
11 * published by the Free Software Foundation.
12 *
13 * The IgH EtherCAT Master is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 * Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with the IgH EtherCAT Master; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * ---
23 *
24 * The license mentioned above concerns the source code only. Using the
25 * EtherCAT technology and brand is only permitted in compliance with the
26 * industrial property and similar rights of Beckhoff Automation GmbH.
27 *
28 *****************************************************************************/
29
35/*****************************************************************************/
36
37#ifndef __EC_FSM_MASTER_H__
38#define __EC_FSM_MASTER_H__
39
40#include "globals.h"
41#include "datagram.h"
42#include "foe_request.h"
43#include "sdo_request.h"
44#include "soe_request.h"
45#include "fsm_slave_config.h"
46#include "fsm_slave_scan.h"
47#include "fsm_pdo.h"
48
49/*****************************************************************************/
50
53typedef struct {
54 struct list_head list;
56 uint16_t offset;
57 size_t nwords;
58 const uint16_t *words;
61
62/*****************************************************************************/
63
71 unsigned int retries;
76 int idle;
77 unsigned long scan_jiffies;
78 uint8_t link_state[EC_MAX_NUM_DEVICES];
80 unsigned int slaves_responding[EC_MAX_NUM_DEVICES];
83 unsigned int rescan_required;
84 ec_slave_state_t slave_states[EC_MAX_NUM_DEVICES];
89 off_t sii_index;
99};
100
101/*****************************************************************************/
102
105
107
110
111/*****************************************************************************/
112
113#endif
EtherCAT datagram structure.
EtherCAT FoE request structure.
void ec_fsm_master_reset(ec_fsm_master_t *)
Reset state machine.
Definition: fsm_master.c:122
void ec_fsm_master_clear(ec_fsm_master_t *)
Destructor.
Definition: fsm_master.c:104
void ec_fsm_master_init(ec_fsm_master_t *, ec_master_t *, ec_datagram_t *)
Constructor.
Definition: fsm_master.c:77
int ec_fsm_master_exec(ec_fsm_master_t *)
Executes the current state of the state machine.
Definition: fsm_master.c:151
int ec_fsm_master_idle(const ec_fsm_master_t *)
Definition: fsm_master.c:170
EtherCAT PDO configuration state machine structures.
EtherCAT slave configuration state machine.
EtherCAT slave scanning state machine.
Global definitions and macros.
ec_slave_state_t
State of an EtherCAT slave.
Definition: globals.h:115
ec_device_index_t
Master devices.
Definition: globals.h:189
ec_internal_request_state_t
Generic request state.
Definition: globals.h:278
EtherCAT CANopen SDO request structure.
EtherCAT SoE request structure.
EtherCAT datagram.
Definition: datagram.h:87
EtherCAT state change FSM.
Definition: fsm_change.h:65
Finite state machines for the CANopen over EtherCAT protocol.
Definition: fsm_coe.h:52
Finite state machine of an EtherCAT master.
Definition: fsm_master.h:68
unsigned int slaves_responding[EC_MAX_NUM_DEVICES]
Number of responding slaves for every device.
Definition: fsm_master.h:80
ec_sii_write_request_t * sii_request
SII write request.
Definition: fsm_master.h:88
unsigned int rescan_required
A bus rescan is required.
Definition: fsm_master.h:83
ec_fsm_coe_t fsm_coe
CoE state machine.
Definition: fsm_master.h:92
void(* state)(ec_fsm_master_t *)
master state function
Definition: fsm_master.h:73
ec_sdo_request_t * sdo_request
SDO request to process.
Definition: fsm_master.h:90
ec_datagram_t * datagram
datagram used in the state machine
Definition: fsm_master.h:70
ec_fsm_change_t fsm_change
State change state machine.
Definition: fsm_master.h:95
uint8_t link_state[EC_MAX_NUM_DEVICES]
Last link state for every device.
Definition: fsm_master.h:78
unsigned int retries
retries on datagram timeout.
Definition: fsm_master.h:71
ec_slave_state_t slave_states[EC_MAX_NUM_DEVICES]
AL states of responding slaves for every device.
Definition: fsm_master.h:84
ec_fsm_pdo_t fsm_pdo
PDO configuration state machine.
Definition: fsm_master.h:94
int idle
state machine is in idle phase
Definition: fsm_master.h:76
ec_slave_t * slave
current slave
Definition: fsm_master.h:87
ec_device_index_t dev_idx
Current device index (for scanning etc.).
Definition: fsm_master.h:74
ec_fsm_soe_t fsm_soe
SoE state machine.
Definition: fsm_master.h:93
ec_fsm_slave_config_t fsm_slave_config
slave state machine
Definition: fsm_master.h:96
unsigned long scan_jiffies
beginning of slave scanning
Definition: fsm_master.h:77
off_t sii_index
index to SII write request data
Definition: fsm_master.h:89
ec_fsm_sii_t fsm_sii
SII state machine.
Definition: fsm_master.h:98
ec_fsm_slave_scan_t fsm_slave_scan
slave state machine
Definition: fsm_master.h:97
ec_master_t * master
master the FSM runs on
Definition: fsm_master.h:69
PDO configuration state machine.
Definition: fsm_pdo.h:55
Slave information interface FSM.
Definition: fsm_sii.h:62
Finite state machine to configure an EtherCAT slave.
Finite state machine for scanning an EtherCAT slave.
Finite state machines for the Sercos over EtherCAT protocol.
Definition: fsm_soe.h:51
EtherCAT master.
Definition: master.h:194
CANopen SDO request.
Definition: sdo_request.h:48
SII write request.
Definition: fsm_master.h:53
ec_slave_t * slave
EtherCAT slave.
Definition: fsm_master.h:55
ec_internal_request_state_t state
State of the request.
Definition: fsm_master.h:59
const uint16_t * words
Pointer to the data words.
Definition: fsm_master.h:58
size_t nwords
Number of words.
Definition: fsm_master.h:57
uint16_t offset
SII word offset.
Definition: fsm_master.h:56
EtherCAT slave.
Definition: slave.h:177