author | Florian Pose <fp@igh-essen.com> |
Mon, 29 Mar 2010 13:53:17 +0200 | |
changeset 1886 | a9fcecb8415c |
parent 1882 | 8ae8cc56d910 |
child 1905 | 5abe24872083 |
permissions | -rw-r--r-- |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* published by the Free Software Foundation. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* The IgH EtherCAT Master is distributed in the hope that it will be useful, |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* Public License for more details. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License along |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* --- |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* The license mentioned above concerns the source code only. Using the |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* EtherCAT technology and brand is only permitted in compliance with the |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
/** |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
\file |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
EtherCAT SoE state machines. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include "globals.h" |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
#include "master.h" |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
#include "mailbox.h" |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
#include "fsm_soe.h" |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
/** Mailbox type for SoE. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
#define EC_MBOX_TYPE_SOE 0x05 |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
|
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
48 |
#define EC_SOE_OPCODE_READ_REQUEST 0x01 |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
49 |
#define EC_SOE_OPCODE_READ_RESPONSE 0x02 |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
50 |
#define EC_SOE_OPCODE_WRITE_REQUEST 0x03 |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
51 |
#define EC_SOE_OPCODE_WRITE_RESPONSE 0x04 |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
52 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
53 |
#define EC_SOE_READ_REQUEST_SIZE 0x04 |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
54 |
#define EC_SOE_READ_RESPONSE_SIZE 0x04 |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
55 |
#define EC_SOE_WRITE_REQUEST_SIZE 0x04 |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
56 |
#define EC_SOE_WRITE_RESPONSE_SIZE 0x04 |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
#define EC_SOE_RESPONSE_TIMEOUT 1000 |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
void ec_fsm_soe_read_start(ec_fsm_soe_t *); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
void ec_fsm_soe_read_request(ec_fsm_soe_t *); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
void ec_fsm_soe_read_check(ec_fsm_soe_t *); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
void ec_fsm_soe_read_response(ec_fsm_soe_t *); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
|
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
67 |
void ec_fsm_soe_write_start(ec_fsm_soe_t *); |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
68 |
void ec_fsm_soe_write_request(ec_fsm_soe_t *); |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
69 |
void ec_fsm_soe_write_check(ec_fsm_soe_t *); |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
70 |
void ec_fsm_soe_write_response(ec_fsm_soe_t *); |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
71 |
|
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
void ec_fsm_soe_end(ec_fsm_soe_t *); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
void ec_fsm_soe_error(ec_fsm_soe_t *); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
|
1877
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
77 |
extern const ec_code_msg_t soe_error_codes[]; |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
78 |
|
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
79 |
/*****************************************************************************/ |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
80 |
|
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
81 |
/** Outputs an SoE error code. |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
82 |
*/ |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
83 |
void ec_print_soe_error(uint16_t error_code) |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
84 |
{ |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
85 |
const ec_code_msg_t *error_msg; |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
86 |
|
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
87 |
for (error_msg = soe_error_codes; error_msg->code; error_msg++) { |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
88 |
if (error_msg->code == error_code) { |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
89 |
EC_ERR("SoE error 0x%04X: \"%s\".\n", |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
90 |
error_msg->code, error_msg->message); |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
91 |
return; |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
92 |
} |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
93 |
} |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
94 |
|
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
95 |
EC_ERR("Unknown SoE error 0x%04X.\n", error_code); |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
96 |
} |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
97 |
|
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
98 |
/*****************************************************************************/ |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
99 |
|
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
/** Constructor. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
void ec_fsm_soe_init( |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
103 |
ec_fsm_soe_t *fsm, /**< finite state machine */ |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
104 |
ec_datagram_t *datagram /**< datagram */ |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
105 |
) |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
fsm->state = NULL; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
fsm->datagram = datagram; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
/** Destructor. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
void ec_fsm_soe_clear( |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
116 |
ec_fsm_soe_t *fsm /**< finite state machine */ |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
117 |
) |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
/** Starts to transfer an IDN to/from a slave. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
void ec_fsm_soe_transfer( |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
ec_fsm_soe_t *fsm, /**< State machine. */ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
ec_slave_t *slave, /**< EtherCAT slave. */ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
ec_soe_request_t *request /**< SoE request. */ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
fsm->slave = slave; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
fsm->request = request; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
if (request->dir == EC_DIR_OUTPUT) { |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
134 |
fsm->state = ec_fsm_soe_write_start; |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
135 |
} else { |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
fsm->state = ec_fsm_soe_read_start; |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
137 |
} |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
/** |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
Executes the current state of the state machine. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
\return false, if state machine has terminated |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
int ec_fsm_soe_exec(ec_fsm_soe_t *fsm /**< finite state machine */) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
fsm->state(fsm); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
return fsm->state != ec_fsm_soe_end && fsm->state != ec_fsm_soe_error; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
/** |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
Returns, if the state machine terminated with success. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
\return non-zero if successful. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
int ec_fsm_soe_success(ec_fsm_soe_t *fsm /**< Finite state machine */) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
return fsm->state == ec_fsm_soe_end; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
|
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
166 |
/*****************************************************************************/ |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
167 |
|
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
168 |
/** Output information about a failed SoE transfer. |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
169 |
*/ |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
170 |
void ec_fsm_soe_print_error(ec_fsm_soe_t *fsm /**< Finite state machine */) |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
171 |
{ |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
172 |
ec_soe_request_t *request = fsm->request; |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
173 |
|
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
174 |
EC_ERR(""); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
175 |
|
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
176 |
if (request->dir == EC_DIR_OUTPUT) { |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
177 |
printk("Writing"); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
178 |
} else { |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
179 |
printk("Reading"); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
180 |
} |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
181 |
|
1882 | 182 |
printk(" IDN 0x%04X failed on slave %u.\n", |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
183 |
request->idn, fsm->slave->ring_position); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
184 |
} |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
185 |
|
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
/****************************************************************************** |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
* SoE read state machine |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
/** SoE state: READ START. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
void ec_fsm_soe_read_start(ec_fsm_soe_t *fsm /**< finite state machine */) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
ec_datagram_t *datagram = fsm->datagram; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
ec_slave_t *slave = fsm->slave; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
ec_master_t *master = slave->master; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
ec_soe_request_t *request = fsm->request; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
uint8_t *data; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
if (master->debug_level) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
EC_DBG("Reading IDN 0x%04X from slave %u.\n", |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
request->idn, slave->ring_position); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
if (!(slave->sii.mailbox_protocols & EC_MBOX_SOE)) { |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
205 |
EC_ERR("Slave does not support SoE!\n"); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
206 |
fsm->state = ec_fsm_soe_error; |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
207 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
data = ec_slave_mbox_prepare_send(slave, datagram, EC_MBOX_TYPE_SOE, |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
212 |
EC_SOE_READ_REQUEST_SIZE); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
if (IS_ERR(data)) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
215 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
EC_WRITE_U8(data, EC_SOE_OPCODE_READ_REQUEST); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
EC_WRITE_U8(data + 1, 1 << 6); // request value |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
EC_WRITE_U16(data + 2, request->idn); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
if (master->debug_level) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
EC_DBG("SCC read request:\n"); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
ec_print_data(data, EC_SOE_READ_REQUEST_SIZE); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
|
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
228 |
fsm->request->data_size = 0; |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
fsm->request->jiffies_sent = jiffies; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
fsm->retries = EC_FSM_RETRIES; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
fsm->state = ec_fsm_soe_read_request; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
/** SoE state: READ REQUEST. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
void ec_fsm_soe_read_request(ec_fsm_soe_t *fsm /**< finite state machine */) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
ec_datagram_t *datagram = fsm->datagram; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
ec_slave_t *slave = fsm->slave; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
unsigned long diff_ms; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
return; // FIXME: check for response first? |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
249 |
EC_ERR("Failed to receive SoE read request: "); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
ec_datagram_print_state(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
251 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
diff_ms = (jiffies - fsm->request->jiffies_sent) * 1000 / HZ; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
if (datagram->working_counter != 1) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
if (!datagram->working_counter) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
if (diff_ms < EC_SOE_RESPONSE_TIMEOUT) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
// no response; send request datagram again |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
265 |
EC_ERR("Reception of SoE read request failed after %u ms: ", |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
266 |
(u32) diff_ms); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
ec_datagram_print_wc_error(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
268 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
fsm->jiffies_start = datagram->jiffies_sent; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
ec_slave_mbox_prepare_check(slave, datagram); // can not fail. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
fsm->retries = EC_FSM_RETRIES; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
fsm->state = ec_fsm_soe_read_check; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
/** CoE state: READ CHECK. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
void ec_fsm_soe_read_check(ec_fsm_soe_t *fsm /**< finite state machine */) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
ec_datagram_t *datagram = fsm->datagram; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
ec_slave_t *slave = fsm->slave; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
292 |
EC_ERR("Failed to receive SoE mailbox check datagram: "); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
ec_datagram_print_state(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
294 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
if (datagram->working_counter != 1) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
300 |
EC_ERR("Reception of SoE mailbox check datagram failed: "); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
ec_datagram_print_wc_error(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
302 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
if (!ec_slave_mbox_check(datagram)) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
unsigned long diff_ms = |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
(datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
if (diff_ms >= EC_SOE_RESPONSE_TIMEOUT) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
311 |
EC_ERR("Timeout after %u ms while waiting for read response.\n", |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
312 |
(u32) diff_ms); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
313 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
ec_slave_mbox_prepare_check(slave, datagram); // can not fail. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
fsm->retries = EC_FSM_RETRIES; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
// Fetch response |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
fsm->retries = EC_FSM_RETRIES; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
fsm->state = ec_fsm_soe_read_response; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
/** SoE state: READ RESPONSE. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
void ec_fsm_soe_read_response(ec_fsm_soe_t *fsm /**< finite state machine */) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
ec_datagram_t *datagram = fsm->datagram; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
ec_slave_t *slave = fsm->slave; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
ec_master_t *master = slave->master; |
1864
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
337 |
uint8_t *data, mbox_prot, header, opcode, incomplete, error_flag, |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
338 |
value_included; |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
size_t rec_size, data_size; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
ec_soe_request_t *req = fsm->request; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
return; // FIXME: request again? |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
347 |
EC_ERR("Failed to receive SoE read response datagram: "); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
ec_datagram_print_state(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
349 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
if (datagram->working_counter != 1) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
355 |
EC_ERR("Reception of SoE read response failed: "); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
ec_datagram_print_wc_error(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
357 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
data = ec_slave_mbox_fetch(slave, datagram, &mbox_prot, &rec_size); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
if (IS_ERR(data)) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
364 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
if (master->debug_level) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
EC_DBG("SCC read response:\n"); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
ec_print_data(data, rec_size); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
if (mbox_prot != EC_MBOX_TYPE_SOE) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
375 |
EC_ERR("Received mailbox protocol 0x%02X as response.\n", mbox_prot); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
376 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
if (rec_size < EC_SOE_READ_RESPONSE_SIZE) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
382 |
EC_ERR("Received currupted SoE read response" |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
383 |
" (%zu bytes)!\n", rec_size); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
ec_print_data(data, rec_size); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
385 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
|
1864
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
389 |
header = EC_READ_U8(data); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
390 |
opcode = header & 0x7; |
1864
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
391 |
incomplete = (header >> 3) & 1; |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
392 |
error_flag = (header >> 4) & 1; |
1864
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
393 |
|
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
if (opcode != EC_SOE_OPCODE_READ_RESPONSE) { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
EC_ERR("Received no read response (opcode %x).\n", opcode); |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
ec_print_data(data, rec_size); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
397 |
ec_fsm_soe_print_error(fsm); |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
fsm->state = ec_fsm_soe_error; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
return; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
|
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
402 |
if (error_flag) { |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
403 |
req->error_code = EC_READ_U16(data + rec_size - 2); |
1877
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
404 |
EC_ERR("Received error response:\n"); |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
405 |
ec_print_soe_error(req->error_code); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
406 |
ec_fsm_soe_print_error(fsm); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
407 |
fsm->state = ec_fsm_soe_error; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
408 |
return; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
409 |
} else { |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
410 |
req->error_code = 0x0000; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
411 |
} |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
412 |
|
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
413 |
value_included = (EC_READ_U8(data + 1) >> 6) & 1; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
414 |
if (!value_included) { |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
415 |
EC_ERR("No value included!\n"); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
416 |
ec_fsm_soe_print_error(fsm); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
417 |
fsm->state = ec_fsm_soe_error; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
418 |
return; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
419 |
} |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
420 |
|
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
421 |
data_size = rec_size - EC_SOE_READ_RESPONSE_SIZE; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
422 |
if (ec_soe_request_append_data(req, |
1864
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
423 |
data + EC_SOE_READ_RESPONSE_SIZE, data_size)) { |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
424 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
425 |
ec_fsm_soe_print_error(fsm); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
426 |
return; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
427 |
} |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
|
1864
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
429 |
if (incomplete) { |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
430 |
if (master->debug_level) { |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
431 |
EC_DBG("SoE data incomplete. Waiting for fragment" |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
432 |
" at offset %zu.\n", req->data_size); |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
433 |
} |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
434 |
fsm->jiffies_start = datagram->jiffies_sent; |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
435 |
ec_slave_mbox_prepare_check(slave, datagram); // can not fail. |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
436 |
fsm->retries = EC_FSM_RETRIES; |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
437 |
fsm->state = ec_fsm_soe_read_check; |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
438 |
} else { |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
439 |
if (master->debug_level) { |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
440 |
EC_DBG("IDN data:\n"); |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
441 |
ec_print_data(req->data, req->data_size); |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
442 |
} |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
443 |
|
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
444 |
fsm->state = ec_fsm_soe_end; // success |
0a6b3aacc847
Implemented SoE fragmented reading.
Florian Pose <fp@igh-essen.com>
parents:
1840
diff
changeset
|
445 |
} |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
|
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
448 |
/****************************************************************************** |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
449 |
* SoE write state machine |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
450 |
*****************************************************************************/ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
451 |
|
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
452 |
/** Write next fragment. |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
453 |
*/ |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
454 |
void ec_fsm_soe_write_next_fragment( |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
455 |
ec_fsm_soe_t *fsm /**< finite state machine */ |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
456 |
) |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
457 |
{ |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
458 |
ec_datagram_t *datagram = fsm->datagram; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
459 |
ec_slave_t *slave = fsm->slave; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
460 |
ec_master_t *master = slave->master; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
461 |
ec_soe_request_t *req = fsm->request; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
462 |
uint8_t incomplete, *data; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
463 |
size_t header_size, max_fragment_size, remaining_size, fragment_size; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
464 |
uint16_t fragments_left; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
465 |
|
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
466 |
header_size = EC_MBOX_HEADER_SIZE + EC_SOE_WRITE_REQUEST_SIZE; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
467 |
if (slave->configured_rx_mailbox_size <= header_size) { |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
468 |
EC_ERR("Mailbox size (%u) too small for SoE write.\n", |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
469 |
slave->configured_rx_mailbox_size); |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
470 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
471 |
ec_fsm_soe_print_error(fsm); |
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
472 |
return; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
473 |
} |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
474 |
|
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
475 |
remaining_size = req->data_size - fsm->offset; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
476 |
max_fragment_size = slave->configured_rx_mailbox_size - header_size; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
477 |
incomplete = remaining_size > max_fragment_size; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
478 |
fragment_size = incomplete ? max_fragment_size : remaining_size; |
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
479 |
fragments_left = remaining_size / fragment_size - 1; |
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
480 |
if (remaining_size % fragment_size) { |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
481 |
fragments_left++; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
482 |
} |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
483 |
|
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
484 |
data = ec_slave_mbox_prepare_send(slave, datagram, EC_MBOX_TYPE_SOE, |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
485 |
EC_SOE_WRITE_REQUEST_SIZE + fragment_size); |
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
486 |
if (IS_ERR(data)) { |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
487 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
488 |
ec_fsm_soe_print_error(fsm); |
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
489 |
return; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
490 |
} |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
491 |
|
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
492 |
EC_WRITE_U8(data, EC_SOE_OPCODE_WRITE_REQUEST | incomplete << 3); |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
493 |
EC_WRITE_U8(data + 1, 1 << 6); // only value included |
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
494 |
EC_WRITE_U16(data + 2, incomplete ? fragments_left : req->idn); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
495 |
memcpy(data + 4, req->data + fsm->offset, fragment_size); |
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
496 |
fsm->offset += fragment_size; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
497 |
|
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
498 |
if (master->debug_level) { |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
499 |
EC_DBG("SCC write request:\n"); |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
500 |
ec_print_data(data, EC_SOE_WRITE_REQUEST_SIZE + fragment_size); |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
501 |
} |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
502 |
|
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
503 |
req->jiffies_sent = jiffies; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
504 |
fsm->retries = EC_FSM_RETRIES; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
505 |
fsm->state = ec_fsm_soe_write_request; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
506 |
} |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
507 |
|
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
508 |
/*****************************************************************************/ |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
509 |
|
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
510 |
/** SoE state: WRITE START. |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
511 |
*/ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
512 |
void ec_fsm_soe_write_start(ec_fsm_soe_t *fsm /**< finite state machine */) |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
513 |
{ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
514 |
ec_slave_t *slave = fsm->slave; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
515 |
ec_master_t *master = slave->master; |
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
516 |
ec_soe_request_t *req = fsm->request; |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
517 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
518 |
if (master->debug_level) |
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
519 |
EC_DBG("Writing IDN 0x%04X (%zu byte) to slave %u.\n", |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
520 |
req->idn, req->data_size, slave->ring_position); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
521 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
522 |
if (!(slave->sii.mailbox_protocols & EC_MBOX_SOE)) { |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
523 |
EC_ERR("Slave does not support SoE!\n"); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
524 |
fsm->state = ec_fsm_soe_error; |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
525 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
526 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
527 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
528 |
|
1865
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
529 |
fsm->offset = 0; |
c6c8b457bb40
Implemented SoE write fragmenting.
Florian Pose <fp@igh-essen.com>
parents:
1864
diff
changeset
|
530 |
ec_fsm_soe_write_next_fragment(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
531 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
532 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
533 |
/*****************************************************************************/ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
534 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
535 |
/** SoE state: WRITE REQUEST. |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
536 |
*/ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
537 |
void ec_fsm_soe_write_request(ec_fsm_soe_t *fsm /**< finite state machine */) |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
538 |
{ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
539 |
ec_datagram_t *datagram = fsm->datagram; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
540 |
ec_slave_t *slave = fsm->slave; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
541 |
unsigned long diff_ms; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
542 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
543 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
544 |
return; // FIXME: check for response first? |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
545 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
546 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
547 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
548 |
EC_ERR("Failed to receive SoE write request: "); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
549 |
ec_datagram_print_state(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
550 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
551 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
552 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
553 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
554 |
diff_ms = (jiffies - fsm->request->jiffies_sent) * 1000 / HZ; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
555 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
556 |
if (datagram->working_counter != 1) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
557 |
if (!datagram->working_counter) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
558 |
if (diff_ms < EC_SOE_RESPONSE_TIMEOUT) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
559 |
// no response; send request datagram again |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
560 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
561 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
562 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
563 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
564 |
EC_ERR("Reception of SoE write request failed after %u ms: ", |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
565 |
(u32) diff_ms); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
566 |
ec_datagram_print_wc_error(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
567 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
568 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
569 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
570 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
571 |
fsm->jiffies_start = datagram->jiffies_sent; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
572 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
573 |
ec_slave_mbox_prepare_check(slave, datagram); // can not fail. |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
574 |
fsm->retries = EC_FSM_RETRIES; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
575 |
fsm->state = ec_fsm_soe_write_check; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
576 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
577 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
578 |
/*****************************************************************************/ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
579 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
580 |
/** CoE state: WRITE CHECK. |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
581 |
*/ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
582 |
void ec_fsm_soe_write_check(ec_fsm_soe_t *fsm /**< finite state machine */) |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
583 |
{ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
584 |
ec_datagram_t *datagram = fsm->datagram; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
585 |
ec_slave_t *slave = fsm->slave; |
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
586 |
ec_soe_request_t *req = fsm->request; |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
587 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
588 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
589 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
590 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
591 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
592 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
593 |
EC_ERR("Failed to receive SoE write request datagram: "); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
594 |
ec_datagram_print_state(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
595 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
596 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
597 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
598 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
599 |
if (datagram->working_counter != 1) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
600 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
601 |
EC_ERR("Reception of SoE write request datagram: "); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
602 |
ec_datagram_print_wc_error(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
603 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
604 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
605 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
606 |
|
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
607 |
if (fsm->offset < req->data_size) { |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
608 |
ec_fsm_soe_write_next_fragment(fsm); |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
609 |
} else { |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
610 |
if (!ec_slave_mbox_check(datagram)) { |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
611 |
unsigned long diff_ms = |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
612 |
(datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ; |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
613 |
if (diff_ms >= EC_SOE_RESPONSE_TIMEOUT) { |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
614 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
615 |
EC_ERR("Timeout after %u ms while waiting" |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
616 |
" for write response.\n", (u32) diff_ms); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
617 |
ec_fsm_soe_print_error(fsm); |
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
618 |
return; |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
619 |
} |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
620 |
|
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
621 |
ec_slave_mbox_prepare_check(slave, datagram); // can not fail. |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
622 |
fsm->retries = EC_FSM_RETRIES; |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
623 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
624 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
625 |
|
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
626 |
// Fetch response |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
627 |
ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail. |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
628 |
fsm->retries = EC_FSM_RETRIES; |
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
629 |
fsm->state = ec_fsm_soe_write_response; |
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
630 |
} |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
631 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
632 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
633 |
/*****************************************************************************/ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
634 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
635 |
/** SoE state: WRITE RESPONSE. |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
636 |
*/ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
637 |
void ec_fsm_soe_write_response(ec_fsm_soe_t *fsm /**< finite state machine */) |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
638 |
{ |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
639 |
ec_datagram_t *datagram = fsm->datagram; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
640 |
ec_slave_t *slave = fsm->slave; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
641 |
ec_master_t *master = slave->master; |
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
642 |
ec_soe_request_t *req = fsm->request; |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
643 |
uint8_t *data, mbox_prot, opcode, error_flag; |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
644 |
uint16_t idn; |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
645 |
size_t rec_size; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
646 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
647 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
648 |
return; // FIXME: request again? |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
649 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
650 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
651 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
652 |
EC_ERR("Failed to receive SoE write response datagram: "); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
653 |
ec_datagram_print_state(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
654 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
655 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
656 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
657 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
658 |
if (datagram->working_counter != 1) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
659 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
660 |
EC_ERR("Reception of SoE write response failed: "); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
661 |
ec_datagram_print_wc_error(datagram); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
662 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
663 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
664 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
665 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
666 |
data = ec_slave_mbox_fetch(slave, datagram, &mbox_prot, &rec_size); |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
667 |
if (IS_ERR(data)) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
668 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
669 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
670 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
671 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
672 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
673 |
if (master->debug_level) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
674 |
EC_DBG("SCC write response:\n"); |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
675 |
ec_print_data(data, rec_size); |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
676 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
677 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
678 |
if (mbox_prot != EC_MBOX_TYPE_SOE) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
679 |
fsm->state = ec_fsm_soe_error; |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
680 |
EC_ERR("Received mailbox protocol 0x%02X as response.\n", mbox_prot); |
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
681 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
682 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
683 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
684 |
|
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
685 |
if (rec_size < EC_SOE_WRITE_RESPONSE_SIZE) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
686 |
fsm->state = ec_fsm_soe_error; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
687 |
EC_ERR("Received currupted SoE write response (%zu bytes)!\n", |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
688 |
rec_size); |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
689 |
ec_print_data(data, rec_size); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
690 |
ec_fsm_soe_print_error(fsm); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
691 |
return; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
692 |
} |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
693 |
|
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
694 |
opcode = EC_READ_U8(data) & 0x7; |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
695 |
if (opcode != EC_SOE_OPCODE_WRITE_RESPONSE) { |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
696 |
EC_ERR("Received no write response (opcode %x).\n", opcode); |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
697 |
ec_print_data(data, rec_size); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
698 |
ec_fsm_soe_print_error(fsm); |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
699 |
fsm->state = ec_fsm_soe_error; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
700 |
return; |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
701 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
702 |
|
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
703 |
idn = EC_READ_U16(data + 2); |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
704 |
if (idn != req->idn) { |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
705 |
EC_ERR("Received response for wrong IDN 0x%04x.\n", idn); |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
706 |
ec_print_data(data, rec_size); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
707 |
ec_fsm_soe_print_error(fsm); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
708 |
fsm->state = ec_fsm_soe_error; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
709 |
return; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
710 |
} |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
711 |
|
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
712 |
error_flag = (EC_READ_U8(data) >> 4) & 1; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
713 |
if (error_flag) { |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
714 |
if (rec_size < EC_SOE_WRITE_RESPONSE_SIZE + 2) { |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
715 |
EC_ERR("Received corrupted error response - error flag set," |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
716 |
" but received size is %zu.\n", rec_size); |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
717 |
} else { |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
718 |
req->error_code = EC_READ_U16(data + EC_SOE_WRITE_RESPONSE_SIZE); |
1877
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
719 |
EC_ERR("Received error response:\n"); |
7b77000f9764
Included list of common SoE error messages.
Florian Pose <fp@igh-essen.com>
parents:
1873
diff
changeset
|
720 |
ec_print_soe_error(req->error_code); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
721 |
} |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
722 |
ec_print_data(data, rec_size); |
1881
f0047c6226c0
Improved SoE statemachine error output.
Florian Pose <fp@igh-essen.com>
parents:
1877
diff
changeset
|
723 |
ec_fsm_soe_print_error(fsm); |
1873
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
724 |
fsm->state = ec_fsm_soe_error; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
725 |
return; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
726 |
} else { |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
727 |
req->error_code = 0x0000; |
219be3742274
Added missing queue_external_datagram(); removed tabs.
Florian Pose <fp@igh-essen.com>
parents:
1866
diff
changeset
|
728 |
} |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
729 |
|
1866
02323e72efc9
Fixed fragmented SoE write.
Florian Pose <fp@igh-essen.com>
parents:
1865
diff
changeset
|
730 |
fsm->state = ec_fsm_soe_end; // success |
1837
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
731 |
} |
32136215c1fa
Implemented SoE write state machine and soe_write command.
Florian Pose <fp@igh-essen.com>
parents:
1831
diff
changeset
|
732 |
|
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
/** State: ERROR. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
void ec_fsm_soe_error(ec_fsm_soe_t *fsm /**< finite state machine */) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
/** State: END. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
void ec_fsm_soe_end(ec_fsm_soe_t *fsm /**< finite state machine */) |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
{ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
} |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
|
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
/*****************************************************************************/ |