IgH EtherCAT Master  1.7.0
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 "fsm_mbox.h"
38 #include "foe_request.h"
39 
40 /****************************************************************************/
41 
42 typedef struct ec_fsm_foe ec_fsm_foe_t;
46 struct ec_fsm_foe {
52  unsigned long jiffies_start;
54  uint8_t subindex;
56  uint8_t toggle;
58  uint8_t *tx_buffer;
59  uint32_t tx_buffer_size;
60  uint32_t tx_buffer_offset;
61  uint32_t tx_last_packet;
62  uint32_t tx_packet_no;
63  uint32_t tx_current_size;
64  uint8_t *tx_filename;
65  uint32_t tx_filename_len;
67  uint8_t *rx_buffer;
68  uint32_t rx_buffer_size;
69  uint32_t rx_buffer_offset;
71  uint32_t rx_last_packet;
72  uint8_t *rx_filename;
73  uint32_t rx_filename_len;
74 };
75 
76 /****************************************************************************/
77 
80 
82 int ec_fsm_foe_success(const ec_fsm_foe_t *);
83 
85 
86 /****************************************************************************/
87 
88 #endif
uint8_t * tx_filename
Name of file to transmit.
Definition: fsm_foe.h:64
ec_slave_t * slave
Slave the FSM runs on.
Definition: fsm_foe.h:47
uint8_t * rx_buffer
Buffer for received data.
Definition: fsm_foe.h:67
EtherCAT mailbox receive state machine.
Definition: fsm_mbox.h:62
void ec_fsm_foe_clear(ec_fsm_foe_t *)
Destructor.
Definition: fsm_foe.c:106
uint32_t tx_packet_no
FoE packet number.
Definition: fsm_foe.h:62
unsigned long jiffies_start
FoE timestamp.
Definition: fsm_foe.h:52
EtherCAT slave structure.
EtherCAT datagram.
Definition: datagram.h:81
uint8_t * tx_buffer
Buffer with data to transmit.
Definition: fsm_foe.h:58
uint32_t tx_buffer_offset
Offset of data to tranmit next.
Definition: fsm_foe.h:60
ec_fsm_mbox_t fsm_mbox
Mailbox receive state machine.
Definition: fsm_foe.h:53
uint32_t tx_filename_len
Lenth of transmit file name.
Definition: fsm_foe.h:65
uint32_t rx_filename_len
Length of the receive file name.
Definition: fsm_foe.h:73
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:170
uint32_t tx_last_packet
Current packet is last one to send.
Definition: fsm_foe.h:61
uint32_t rx_expected_packet_no
Expected receive packet number.
Definition: fsm_foe.h:70
EtherCAT mailbox receive state machine.
uint32_t rx_buffer_size
Size of receive buffer.
Definition: fsm_foe.h:68
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:59
uint32_t rx_last_packet
Current packet is the last to receive.
Definition: fsm_foe.h:71
uint8_t toggle
Toggle bit for segment commands.
Definition: fsm_foe.h:56
uint8_t subindex
Current subindex.
Definition: fsm_foe.h:54
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:93
ec_foe_request_t * request
FoE request.
Definition: fsm_foe.h:55
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:72
uint32_t tx_current_size
Size of current packet to send.
Definition: fsm_foe.h:63
Finite state machines for the CANopen-over-EtherCAT protocol.
Definition: fsm_foe.h:46
uint32_t rx_buffer_offset
Offset in receive buffer.
Definition: fsm_foe.h:69