IgH EtherCAT Master  1.6.2
fsm_foe.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2008 Olav Zarges, imc Messsysteme GmbH
4  * 2009-2012 Florian Pose <fp@igh.de>
5  *
6  * This file is part of the IgH EtherCAT Master.
7  *
8  * The IgH EtherCAT Master is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License version 2, as
10  * published by the Free Software Foundation.
11  *
12  * The IgH EtherCAT Master is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15  * Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with the IgH EtherCAT Master; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  ****************************************************************************/
22 
28 /****************************************************************************/
29 
30 #ifndef __EC_FSM_FOE_H__
31 #define __EC_FSM_FOE_H__
32 
33 #include "globals.h"
34 #include "../include/ecrt.h"
35 #include "datagram.h"
36 #include "slave.h"
37 #include "foe_request.h"
38 
39 /****************************************************************************/
40 
41 typedef struct ec_fsm_foe ec_fsm_foe_t;
45 struct ec_fsm_foe {
47  unsigned int retries;
52  unsigned long jiffies_start;
53  uint8_t subindex;
55  uint8_t toggle;
57  uint8_t *tx_buffer;
58  uint32_t tx_buffer_size;
59  uint32_t tx_buffer_offset;
60  uint32_t tx_last_packet;
61  uint32_t tx_packet_no;
62  uint32_t tx_current_size;
63  uint8_t *tx_filename;
64  uint32_t tx_filename_len;
66  uint8_t *rx_buffer;
67  uint32_t rx_buffer_size;
68  uint32_t rx_buffer_offset;
70  uint32_t rx_last_packet;
71  uint8_t *rx_filename;
72  uint32_t rx_filename_len;
73 };
74 
75 /****************************************************************************/
76 
79 
81 int ec_fsm_foe_success(const ec_fsm_foe_t *);
82 
84 
85 /****************************************************************************/
86 
87 #endif
uint8_t * tx_filename
Name of file to transmit.
Definition: fsm_foe.h:63
ec_slave_t * slave
Slave the FSM runs on.
Definition: fsm_foe.h:46
uint8_t * rx_buffer
Buffer for received data.
Definition: fsm_foe.h:66
void ec_fsm_foe_clear(ec_fsm_foe_t *)
Destructor.
Definition: fsm_foe.c:107
uint32_t tx_packet_no
FoE packet number.
Definition: fsm_foe.h:61
unsigned long jiffies_start
FoE timestamp.
Definition: fsm_foe.h:52
EtherCAT slave structure.
EtherCAT datagram.
Definition: datagram.h:79
uint8_t * tx_buffer
Buffer with data to transmit.
Definition: fsm_foe.h:57
uint32_t tx_buffer_offset
Offset of data to tranmit next.
Definition: fsm_foe.h:59
uint32_t tx_filename_len
Lenth of transmit file name.
Definition: fsm_foe.h:64
uint32_t rx_filename_len
Length of the receive file name.
Definition: fsm_foe.h:72
int ec_fsm_foe_exec(ec_fsm_foe_t *, ec_datagram_t *)
Executes the current state of the state machine.
Definition: fsm_foe.c:117
Global definitions and macros.
EtherCAT slave.
Definition: slave.h:168
uint32_t tx_last_packet
Current packet is last one to send.
Definition: fsm_foe.h:60
uint32_t rx_expected_packet_no
Expected receive packet number.
Definition: fsm_foe.h:69
uint32_t rx_buffer_size
Size of receive buffer.
Definition: fsm_foe.h:67
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.
uint32_t tx_buffer_size
Size of data to transmit.
Definition: fsm_foe.h:58
uint32_t rx_last_packet
Current packet is the last to receive.
Definition: fsm_foe.h:70
uint8_t toggle
Toggle bit for segment commands.
Definition: fsm_foe.h:55
uint8_t subindex
Current subindex.
Definition: fsm_foe.h:53
unsigned int retries
Retries upon datagram timeout.
Definition: fsm_foe.h:47
FoE request.
Definition: foe_request.h:42
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:51
void ec_fsm_foe_init(ec_fsm_foe_t *)
Constructor.
Definition: fsm_foe.c:95
ec_foe_request_t * request
FoE request.
Definition: fsm_foe.h:54
void(* state)(ec_fsm_foe_t *, ec_datagram_t *)
FoE state function.
Definition: fsm_foe.h:49
uint8_t * rx_filename
Name of the file to receive.
Definition: fsm_foe.h:71
uint32_t tx_current_size
Size of current packet to send.
Definition: fsm_foe.h:62
Finite state machines for the CANopen-over-EtherCAT protocol.
Definition: fsm_foe.h:45
uint32_t rx_buffer_offset
Offset in receive buffer.
Definition: fsm_foe.h:68