IgH EtherCAT Master  1.5.3
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;
60  uint8_t subindex;
62  uint8_t toggle;
64  uint8_t *tx_buffer;
65  uint32_t tx_buffer_size;
66  uint32_t tx_buffer_offset;
67  uint32_t tx_last_packet;
68  uint32_t tx_packet_no;
69  uint32_t tx_current_size;
70  uint8_t *tx_filename;
71  uint32_t tx_filename_len;
73  uint8_t *rx_buffer;
74  uint32_t rx_buffer_size;
75  uint32_t rx_buffer_offset;
77  uint32_t rx_last_packet;
78  uint8_t *rx_filename;
79  uint32_t rx_filename_len;
80 };
81 
82 /*****************************************************************************/
83 
86 
88 int ec_fsm_foe_success(const ec_fsm_foe_t *);
89 
91 
92 /*****************************************************************************/
93 
94 #endif
uint8_t * tx_filename
Name of file to transmit.
Definition: fsm_foe.h:70
ec_slave_t * slave
Slave the FSM runs on.
Definition: fsm_foe.h:54
uint8_t * rx_buffer
Buffer for received data.
Definition: fsm_foe.h:73
void ec_fsm_foe_clear(ec_fsm_foe_t *)
Destructor.
Definition: fsm_foe.c:115
uint32_t tx_packet_no
FoE packet number.
Definition: fsm_foe.h:68
unsigned long jiffies_start
FoE timestamp.
Definition: fsm_foe.h:59
EtherCAT slave structure.
EtherCAT datagram.
Definition: datagram.h:87
uint8_t * tx_buffer
Buffer with data to transmit.
Definition: fsm_foe.h:64
uint32_t tx_buffer_offset
Offset of data to tranmit next.
Definition: fsm_foe.h:66
uint32_t tx_filename_len
Lenth of transmit file name.
Definition: fsm_foe.h:71
uint32_t rx_filename_len
Length of the receive file name.
Definition: fsm_foe.h:79
int ec_fsm_foe_exec(ec_fsm_foe_t *, ec_datagram_t *)
Executes the current state of the state machine.
Definition: fsm_foe.c:125
Global definitions and macros.
EtherCAT slave.
Definition: slave.h:176
uint32_t tx_last_packet
Current packet is last one to send.
Definition: fsm_foe.h:67
uint32_t rx_expected_packet_no
Expected receive packet number.
Definition: fsm_foe.h:76
uint32_t rx_buffer_size
Size of receive buffer.
Definition: fsm_foe.h:74
void ec_fsm_foe_transfer(ec_fsm_foe_t *, ec_slave_t *, ec_foe_request_t *)
Prepares an FoE transfer.
Definition: fsm_foe.c:168
EtherCAT FoE request structure.
EtherCAT datagram structure.
uint32_t tx_buffer_size
Size of data to transmit.
Definition: fsm_foe.h:65
uint32_t rx_last_packet
Current packet is the last to receive.
Definition: fsm_foe.h:77
uint8_t toggle
Toggle bit for segment commands.
Definition: fsm_foe.h:62
uint8_t subindex
Current subindex.
Definition: fsm_foe.h:60
unsigned int retries
Retries upon datagram timeout.
Definition: fsm_foe.h:55
FoE request.
Definition: foe_request.h:50
int ec_fsm_foe_success(const ec_fsm_foe_t *)
Returns, if the state machine terminated with success.
Definition: fsm_foe.c:159
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:103
ec_foe_request_t * request
FoE request.
Definition: fsm_foe.h:61
void(* state)(ec_fsm_foe_t *, ec_datagram_t *)
FoE state function.
Definition: fsm_foe.h:57
uint8_t * rx_filename
Name of the file to receive.
Definition: fsm_foe.h:78
uint32_t tx_current_size
Size of current packet to send.
Definition: fsm_foe.h:69
Finite state machines for the CANopen-over-EtherCAT protocol.
Definition: fsm_foe.h:53
uint32_t rx_buffer_offset
Offset in receive buffer.
Definition: fsm_foe.h:75