IgH EtherCAT Master  1.5.3
fsm_coe.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * $Id$
4  *
5  * Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH
6  *
7  * This file is part of the IgH EtherCAT Master.
8  *
9  * The IgH EtherCAT Master is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License version 2, as
11  * published by the Free Software Foundation.
12  *
13  * The IgH EtherCAT Master is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with the IgH EtherCAT Master; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * ---
23  *
24  * The license mentioned above concerns the source code only. Using the
25  * EtherCAT technology and brand is only permitted in compliance with the
26  * industrial property and similar rights of Beckhoff Automation GmbH.
27  *
28  *****************************************************************************/
29 
35 /*****************************************************************************/
36 
37 #ifndef __EC_FSM_COE_H__
38 #define __EC_FSM_COE_H__
39 
40 #include "globals.h"
41 #include "datagram.h"
42 #include "slave.h"
43 #include "sdo.h"
44 #include "sdo_request.h"
45 
46 /*****************************************************************************/
47 
48 typedef struct ec_fsm_coe ec_fsm_coe_t;
52 struct ec_fsm_coe {
54  unsigned int retries;
58  unsigned long jiffies_start;
60  uint8_t subindex;
62  uint32_t complete_size;
63  uint8_t toggle;
64  uint32_t offset;
65  uint32_t remaining;
66  size_t segment_size;
67 };
68 
69 /*****************************************************************************/
70 
73 
76 
78 int ec_fsm_coe_success(const ec_fsm_coe_t *);
79 
80 /*****************************************************************************/
81 
82 #endif
uint32_t offset
Data offset during segmented download.
Definition: fsm_coe.h:64
size_t segment_size
Current segment size.
Definition: fsm_coe.h:66
CANopen SDO request.
Definition: sdo_request.h:46
EtherCAT slave structure.
EtherCAT datagram.
Definition: datagram.h:87
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:56
CANopen SDO.
Definition: sdo.h:49
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:205
Global definitions and macros.
ec_sdo_t * sdo
current SDO
Definition: fsm_coe.h:59
EtherCAT slave.
Definition: slave.h:176
EtherCAT CANopen SDO request structure.
ec_sdo_request_t * request
SDO request.
Definition: fsm_coe.h:61
uint8_t subindex
current subindex
Definition: fsm_coe.h:60
ec_datagram_t * datagram
Datagram used in last step.
Definition: fsm_coe.h:57
uint32_t remaining
Remaining bytes during segmented download.
Definition: fsm_coe.h:65
uint32_t complete_size
Used when segmenting.
Definition: fsm_coe.h:62
unsigned long jiffies_start
CoE timestamp.
Definition: fsm_coe.h:58
void ec_fsm_coe_dictionary(ec_fsm_coe_t *, ec_slave_t *)
Starts reading a slaves' SDO dictionary.
Definition: fsm_coe.c:192
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:228
int ec_fsm_coe_success(const ec_fsm_coe_t *)
Returns, if the state machine terminated with success.
Definition: fsm_coe.c:262
void ec_fsm_coe_init(ec_fsm_coe_t *)
Constructor.
Definition: fsm_coe.c:170
uint8_t toggle
toggle bit for segment commands
Definition: fsm_coe.h:63
unsigned int retries
retries upon datagram timeout
Definition: fsm_coe.h:54
EtherCAT CANopen SDO structure.
ec_slave_t * slave
slave the FSM runs on
Definition: fsm_coe.h:53
Finite state machines for the CANopen over EtherCAT protocol.
Definition: fsm_coe.h:52