1 /****************************************************************************** |
1 /****************************************************************************** |
2 * |
|
3 * e t h e r n e t . c |
|
4 * |
|
5 * Ethernet-over-EtherCAT (EoE) |
|
6 * |
2 * |
7 * $Id$ |
3 * $Id$ |
8 * |
4 * |
|
5 * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
|
6 * |
|
7 * This file is part of the IgH EtherCAT Master. |
|
8 * |
|
9 * The IgH EtherCAT Master is free software; you can redistribute it |
|
10 * and/or modify it under the terms of the GNU General Public License |
|
11 * as published by the Free Software Foundation; version 2 of the License. |
|
12 * |
|
13 * The IgH EtherCAT Master is distributed in the hope that it will be |
|
14 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 * GNU General Public License for more details. |
|
17 * |
|
18 * You should have received a copy of the GNU General Public License |
|
19 * along with the IgH EtherCAT Master; if not, write to the Free Software |
|
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
21 * |
9 *****************************************************************************/ |
22 *****************************************************************************/ |
|
23 |
|
24 /** |
|
25 \file |
|
26 Ethernet-over-EtherCAT (EoE). |
|
27 */ |
|
28 |
|
29 /*****************************************************************************/ |
10 |
30 |
11 #include "../include/ecrt.h" |
31 #include "../include/ecrt.h" |
12 #include "globals.h" |
32 #include "globals.h" |
13 #include "master.h" |
33 #include "master.h" |
14 #include "slave.h" |
34 #include "slave.h" |
15 #include "mailbox.h" |
35 #include "mailbox.h" |
16 #include "ethernet.h" |
36 #include "ethernet.h" |
17 |
37 |
18 /*****************************************************************************/ |
38 /*****************************************************************************/ |
19 |
39 |
|
40 /** |
|
41 EoE constructor. |
|
42 */ |
|
43 |
20 void ec_eoe_init(ec_eoe_t *eoe, ec_slave_t *slave) |
44 void ec_eoe_init(ec_eoe_t *eoe, ec_slave_t *slave) |
21 { |
45 { |
22 eoe->slave = slave; |
46 eoe->slave = slave; |
23 eoe->rx_state = EC_EOE_IDLE; |
47 eoe->rx_state = EC_EOE_IDLE; |
24 } |
48 } |
25 |
49 |
26 /*****************************************************************************/ |
50 /*****************************************************************************/ |
27 |
51 |
|
52 /** |
|
53 EoE destructor. |
|
54 */ |
|
55 |
28 void ec_eoe_clear(ec_eoe_t *eoe) |
56 void ec_eoe_clear(ec_eoe_t *eoe) |
29 { |
57 { |
30 } |
58 } |
31 |
59 |
32 /*****************************************************************************/ |
60 /*****************************************************************************/ |
|
61 |
|
62 /** |
|
63 Runs the EoE state machine. |
|
64 */ |
33 |
65 |
34 void ec_eoe_run(ec_eoe_t *eoe) |
66 void ec_eoe_run(ec_eoe_t *eoe) |
35 { |
67 { |
36 uint8_t *data; |
68 uint8_t *data; |
37 ec_master_t *master; |
69 ec_master_t *master; |
108 } |
140 } |
109 } |
141 } |
110 |
142 |
111 /*****************************************************************************/ |
143 /*****************************************************************************/ |
112 |
144 |
|
145 /** |
|
146 Prints EoE object information. |
|
147 */ |
|
148 |
113 void ec_eoe_print(const ec_eoe_t *eoe) |
149 void ec_eoe_print(const ec_eoe_t *eoe) |
114 { |
150 { |
115 EC_INFO(" EoE slave %i\n", eoe->slave->ring_position); |
151 EC_INFO(" EoE slave %i\n", eoe->slave->ring_position); |
116 EC_INFO(" RX State %i\n", eoe->rx_state); |
152 EC_INFO(" RX State %i\n", eoe->rx_state); |
117 } |
153 } |