IgH EtherCAT Master  1.7.0
fsm_coe.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH
4  *
5  * This file is part of the IgH EtherCAT Master.
6  *
7  * The IgH EtherCAT Master is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License version 2, as
9  * published by the Free Software Foundation.
10  *
11  * The IgH EtherCAT Master is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with the IgH EtherCAT Master; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  ****************************************************************************/
21 
27 /****************************************************************************/
28 
29 #ifndef __EC_FSM_COE_H__
30 #define __EC_FSM_COE_H__
31 
32 #include "globals.h"
33 #include "datagram.h"
34 #include "slave.h"
35 #include "fsm_mbox.h"
36 #include "sdo.h"
37 #include "sdo_request.h"
38 
39 /****************************************************************************/
40 
41 typedef struct ec_fsm_coe ec_fsm_coe_t;
45 struct ec_fsm_coe {
47  unsigned int retries;
51  unsigned long jiffies_start;
54  uint8_t subindex;
56  uint32_t complete_size;
57  uint8_t toggle;
58  uint32_t offset;
59  uint32_t remaining;
60  size_t segment_size;
61 };
62 
63 /****************************************************************************/
64 
67 
70 
72 int ec_fsm_coe_success(const ec_fsm_coe_t *);
74 
75 /****************************************************************************/
76 
77 #endif
EtherCAT mailbox receive state machine.
Definition: fsm_mbox.h:62
uint32_t offset
Data offset during segmented download.
Definition: fsm_coe.h:58
size_t segment_size
Current segment size.
Definition: fsm_coe.h:60
CANopen SDO request.
Definition: sdo_request.h:40
EtherCAT slave structure.
void ec_fsm_coe_abort(ec_fsm_coe_t *)
Aborts a running transfer.
Definition: fsm_coe.c:276
EtherCAT datagram.
Definition: datagram.h:81
void ec_fsm_coe_clear(ec_fsm_coe_t *)
Destructor.
Definition: fsm_coe.c:182
void(* state)(ec_fsm_coe_t *, ec_datagram_t *)
CoE state function.
Definition: fsm_coe.h:49
CANopen SDO.
Definition: sdo.h:41
void ec_fsm_coe_transfer(ec_fsm_coe_t *, ec_slave_t *, ec_sdo_request_t *)
Starts to transfer an SDO to/from a slave.
Definition: fsm_coe.c:206
Global definitions and macros.
ec_sdo_t * sdo
current SDO
Definition: fsm_coe.h:53
EtherCAT slave.
Definition: slave.h:170
EtherCAT CANopen SDO request structure.
ec_sdo_request_t * request
SDO request.
Definition: fsm_coe.h:55
EtherCAT mailbox receive state machine.
uint8_t subindex
current subindex
Definition: fsm_coe.h:54
ec_datagram_t * datagram
Datagram used in last step.
Definition: fsm_coe.h:50
uint32_t remaining
Remaining bytes during segmented download.
Definition: fsm_coe.h:59
uint32_t complete_size
Used when segmenting.
Definition: fsm_coe.h:56
unsigned long jiffies_start
CoE timestamp.
Definition: fsm_coe.h:51
void ec_fsm_coe_dictionary(ec_fsm_coe_t *, ec_slave_t *)
Starts reading a slaves' SDO dictionary.
Definition: fsm_coe.c:193
EtherCAT datagram structure.
int ec_fsm_coe_exec(ec_fsm_coe_t *, ec_datagram_t *)
Executes the current state of the state machine.
Definition: fsm_coe.c:229
int ec_fsm_coe_success(const ec_fsm_coe_t *)
Returns, if the state machine terminated with success.
Definition: fsm_coe.c:262
ec_fsm_mbox_t fsm_mbox
Mailbox receive state machine.
Definition: fsm_coe.h:52
void ec_fsm_coe_init(ec_fsm_coe_t *)
Constructor.
Definition: fsm_coe.c:169
uint8_t toggle
toggle bit for segment commands
Definition: fsm_coe.h:57
unsigned int retries
retries upon datagram timeout
Definition: fsm_coe.h:47
EtherCAT CANopen SDO structure.
ec_slave_t * slave
slave the FSM runs on
Definition: fsm_coe.h:46
Finite state machines for the CANopen over EtherCAT protocol.
Definition: fsm_coe.h:45