IgH EtherCAT Master  1.5.2
fsm_foe.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * $Id$
4  *
5  * Copyright (C) 2008 Olav Zarges, imc Messsysteme GmbH
6  * 2009-2012 Florian Pose <fp@igh-essen.com>
7  *
8  * This file is part of the IgH EtherCAT Master.
9  *
10  * The IgH EtherCAT Master is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License version 2, as
12  * published by the Free Software Foundation.
13  *
14  * The IgH EtherCAT Master is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17  * Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with the IgH EtherCAT Master; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  * ---
24  *
25  * The license mentioned above concerns the source code only. Using the
26  * EtherCAT technology and brand is only permitted in compliance with the
27  * industrial property and similar rights of Beckhoff Automation GmbH.
28  *
29  *****************************************************************************/
30 
36 /*****************************************************************************/
37 
38 #ifndef __EC_FSM_FOE_H__
39 #define __EC_FSM_FOE_H__
40 
41 #include "globals.h"
42 #include "../include/ecrt.h"
43 #include "datagram.h"
44 #include "slave.h"
45 #include "foe_request.h"
46 
47 /*****************************************************************************/
48 
49 typedef struct ec_fsm_foe ec_fsm_foe_t;
53 struct ec_fsm_foe {
55  unsigned int retries;
59  unsigned long jiffies_start;
62  uint32_t buffer_size;
63  uint32_t buffer_offset;
64  uint32_t last_packet;
65  uint32_t packet_no;
66  uint32_t current_size;
67 };
68 
69 /*****************************************************************************/
70 
73 
75 int ec_fsm_foe_success(const ec_fsm_foe_t *);
76 
78 
79 /*****************************************************************************/
80 
81 #endif
ec_slave_t * slave
Slave the FSM runs on.
Definition: fsm_foe.h:54
uint32_t buffer_offset
Offset of data to transmit/receive next.
Definition: fsm_foe.h:63
void ec_fsm_foe_clear(ec_fsm_foe_t *)
Destructor.
Definition: fsm_foe.c:117
unsigned long jiffies_start
FoE timestamp.
Definition: fsm_foe.h:59
EtherCAT slave structure.
uint32_t packet_no
FoE packet number.
Definition: fsm_foe.h:65
EtherCAT datagram.
Definition: datagram.h:88
int ec_fsm_foe_exec(ec_fsm_foe_t *, ec_datagram_t *)
Executes the current state of the state machine.
Definition: fsm_foe.c:127
Global definitions and macros.
uint32_t buffer_size
Size of transmit/receive buffer.
Definition: fsm_foe.h:62
EtherCAT slave.
Definition: slave.h:214
void ec_fsm_foe_transfer(ec_fsm_foe_t *, ec_slave_t *, ec_foe_request_t *)
Prepares an FoE transfer.
Definition: fsm_foe.c:160
EtherCAT FoE request structure.
EtherCAT datagram structure.
unsigned int retries
Retries upon datagram timeout.
Definition: fsm_foe.h:55
int ec_fsm_foe_success(const ec_fsm_foe_t *)
Returns, if the state machine terminated with success.
Definition: fsm_foe.c:151
ec_datagram_t * datagram
Datagram used in previous step.
Definition: fsm_foe.h:58
void ec_fsm_foe_init(ec_fsm_foe_t *)
Constructor.
Definition: fsm_foe.c:105
ec_foe_request_t * request
FoE request.
Definition: fsm_foe.h:60
void(* state)(ec_fsm_foe_t *, ec_datagram_t *)
FoE state function.
Definition: fsm_foe.h:57
FoE request.
Definition: foe_request.h:50
uint32_t last_packet
Current packet is last one to send/receive.
Definition: fsm_foe.h:64
uint32_t current_size
Size of current packet to send.
Definition: fsm_foe.h:66
Finite state machines for the CANopen-over-EtherCAT protocol.
Definition: fsm_foe.h:53