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 "mbox_gateway_request.h"
46 #include "fsm_reboot.h"
47 
48 /*****************************************************************************/
49 
52 typedef struct {
53  struct list_head list;
55  uint16_t offset;
56  size_t nwords;
57  const uint16_t *words;
60 
61 /*****************************************************************************/
62 
67 struct ec_fsm_master {
70  unsigned int retries;
72  void (*state)(ec_fsm_master_t *);
75  int idle;
76  unsigned long scan_jiffies;
77  uint8_t link_state[EC_MAX_NUM_DEVICES];
79  unsigned int slaves_responding[EC_MAX_NUM_DEVICES];
82  unsigned int rescan_required;
83  ec_slave_state_t slave_states[EC_MAX_NUM_DEVICES];
88  off_t sii_index;
92 };
93 
94 /*****************************************************************************/
95 
98 
100 
103 
104 /*****************************************************************************/
105 
106 #endif
uint16_t offset
SII word offset.
Definition: fsm_master.h:55
ec_datagram_t * datagram
datagram used in the state machine
Definition: fsm_master.h:69
void ec_fsm_master_clear(ec_fsm_master_t *)
Destructor.
Definition: fsm_master.c:103
ec_sii_write_request_t * sii_request
SII write request.
Definition: fsm_master.h:87
EtherCAT slave reboot FSM.
Finite state machine of an EtherCAT master.
Definition: fsm_master.h:67
ec_internal_request_state_t state
State of the request.
Definition: fsm_master.h:58
unsigned int slaves_responding[EC_MAX_NUM_DEVICES]
Number of responding slaves for every device.
Definition: fsm_master.h:79
Slave information interface FSM.
Definition: fsm_sii.h:61
void(* state)(ec_fsm_master_t *)
master state function
Definition: fsm_master.h:72
size_t nwords
Number of words.
Definition: fsm_master.h:56
unsigned int rescan_required
A bus rescan is required.
Definition: fsm_master.h:82
EtherCAT datagram.
Definition: datagram.h:88
ec_slave_state_t slave_states[EC_MAX_NUM_DEVICES]
AL states of responding slaves for every device.
Definition: fsm_master.h:83
SII write request.
Definition: fsm_master.h:52
int ec_fsm_master_idle(const ec_fsm_master_t *)
Definition: fsm_master.c:164
Global definitions and macros.
ec_internal_request_state_t
Generic request state.
Definition: globals.h:325
int ec_fsm_master_exec(ec_fsm_master_t *)
Executes the current state of the state machine.
Definition: fsm_master.c:145
ec_slave_t * slave
EtherCAT slave.
Definition: fsm_master.h:54
void ec_fsm_master_init(ec_fsm_master_t *, ec_master_t *, ec_datagram_t *)
Constructor.
Definition: fsm_master.c:83
EtherCAT slave.
Definition: slave.h:214
EtherCAT slave reboot FSM.
Definition: fsm_reboot.h:53
ec_fsm_sii_t fsm_sii
SII state machine.
Definition: fsm_master.h:91
EtherCAT CANopen SDO request structure.
ec_device_index_t
Master devices.
Definition: globals.h:236
unsigned long scan_jiffies
beginning of slave scanning
Definition: fsm_master.h:76
ec_fsm_reboot_t fsm_reboot
Slave reboot state machine.
Definition: fsm_master.h:90
EtherCAT FoE request structure.
ec_slave_state_t
State of an EtherCAT slave.
Definition: globals.h:159
EtherCAT datagram structure.
EtherCAT Mailbox Gateway request structure.
void ec_fsm_master_reset(ec_fsm_master_t *)
Reset state machine.
Definition: fsm_master.c:116
int idle
state machine is in idle phase
Definition: fsm_master.h:75
ec_master_t * master
master the FSM runs on
Definition: fsm_master.h:68
unsigned int retries
retries on datagram timeout.
Definition: fsm_master.h:70
EtherCAT SoE request structure.
ec_slave_t * slave
current slave
Definition: fsm_master.h:86
off_t sii_index
index to SII write request data
Definition: fsm_master.h:88
EtherCAT master.
Definition: master.h:202
ec_device_index_t dev_idx
Current device index (for scanning etc.).
Definition: fsm_master.h:73
const uint16_t * words
Pointer to the data words.
Definition: fsm_master.h:57
uint8_t link_state[EC_MAX_NUM_DEVICES]
Last link state for every device.
Definition: fsm_master.h:77