author | Florian Pose <fp@igh-essen.com> |
Tue, 12 Jan 2010 23:40:37 +0100 | |
branch | kernel-2.4 |
changeset 1766 | 9e4d4306b641 |
parent 19 | a51289e6cb2d |
child 26 | 60435f959e5c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************** |
2 |
* |
|
3 |
* e c _ c o m m a n d . c |
|
4 |
* |
|
5 |
* Methoden für ein EtherCAT-Kommando. |
|
6 |
* |
|
7 |
* $Date$ |
|
8 |
* $Author$ |
|
9 |
* |
|
10 |
***************************************************************/ |
|
11 |
||
12 |
#include <linux/slab.h> |
|
13 |
||
14 |
#include "ec_command.h" |
|
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
15 |
#include "ec_dbg.h" |
0 | 16 |
|
17 |
/***************************************************************/ |
|
18 |
||
19 |
/** |
|
20 |
Kommando-Konstruktor. |
|
21 |
||
22 |
Initialisiert alle Variablen innerhalb des Kommandos auf die |
|
23 |
Default-Werte. |
|
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
24 |
|
0 | 25 |
@param cmd Zeiger auf das zu initialisierende Kommando. |
26 |
*/ |
|
27 |
||
28 |
void EtherCAT_command_init(EtherCAT_command_t *cmd) |
|
29 |
{ |
|
30 |
cmd->type = ECAT_CMD_NONE; |
|
31 |
cmd->address.logical = 0x00000000; |
|
32 |
cmd->data_length = 0; |
|
33 |
cmd->state = ECAT_CS_READY; |
|
34 |
cmd->index = 0; |
|
35 |
cmd->working_counter = 0; |
|
36 |
} |
|
37 |
||
38 |
/***************************************************************/ |
|
39 |
||
40 |
/** |
|
41 |
Kommando-Destruktor. |
|
42 |
||
2
b0a7a4745bf9
?nderungen an no_rtai r110:110 in drivers gemergt.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
43 |
Setzt alle Attribute auf den Anfangswert zurueck. |
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
44 |
|
0 | 45 |
@param cmd Zeiger auf das zu initialisierende Kommando. |
46 |
*/ |
|
47 |
||
48 |
void EtherCAT_command_clear(EtherCAT_command_t *cmd) |
|
49 |
{ |
|
2
b0a7a4745bf9
?nderungen an no_rtai r110:110 in drivers gemergt.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
50 |
EtherCAT_command_init(cmd); |
0 | 51 |
} |
52 |
||
53 |
/***************************************************************/ |
|
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
54 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
55 |
#define ECAT_FUNC_HEADER \ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
56 |
EtherCAT_command_init(cmd) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
57 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
58 |
#define ECAT_FUNC_WRITE_FOOTER \ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
59 |
cmd->data_length = length; \ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
60 |
memcpy(cmd->data, data, length); |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
61 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
62 |
#define ECAT_FUNC_READ_FOOTER \ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
63 |
cmd->data_length = length; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
64 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
65 |
/***************************************************************/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
66 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
67 |
/** |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
68 |
Initialisiert ein EtherCAT-NPRD-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
69 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
70 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
71 |
@param node_address Adresse des Knotens (Slaves) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
72 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
73 |
@param length Länge der zu lesenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
74 |
*/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
75 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
76 |
void EtherCAT_command_read(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
77 |
unsigned short node_address, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
78 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
79 |
unsigned int length) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
80 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
81 |
if (node_address == 0x0000) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
82 |
EC_DBG(KERN_WARNING "EtherCAT: Using node address 0x0000!\n"); |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
83 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
84 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
85 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
86 |
cmd->type = ECAT_CMD_NPRD; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
87 |
cmd->address.phy.dev.node = node_address; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
88 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
89 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
90 |
ECAT_FUNC_READ_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
91 |
} |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
92 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
93 |
/***************************************************************/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
94 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
95 |
/** |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
96 |
Initialisiert ein EtherCAT-NPWR-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
97 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
98 |
Alloziert ein "node-adressed physical write"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
99 |
und fügt es in die Liste des Masters ein. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
100 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
101 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
102 |
@param node_address Adresse des Knotens (Slaves) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
103 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
104 |
@param length Länge der zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
105 |
@param data Zeiger auf Speicher mit zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
106 |
*/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
107 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
108 |
void EtherCAT_command_write(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
109 |
unsigned short node_address, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
110 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
111 |
unsigned int length, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
112 |
const unsigned char *data) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
113 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
114 |
if (node_address == 0x0000) |
19
a51289e6cb2d
Warten beim Empfangen der Prozessdaten, Bugfix und kleinere Verbesserungen.
Florian Pose <fp@igh-essen.com>
parents:
17
diff
changeset
|
115 |
EC_DBG(KERN_WARNING "EtherCAT: Using node address 0x0000!\n"); |
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
116 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
117 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
118 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
119 |
cmd->type = ECAT_CMD_NPWR; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
120 |
cmd->address.phy.dev.node = node_address; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
121 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
122 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
123 |
ECAT_FUNC_WRITE_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
124 |
} |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
125 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
126 |
/***************************************************************/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
127 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
128 |
/** |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
129 |
Initialisiert ein EtherCAT-APRD-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
130 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
131 |
Alloziert ein "autoincerement physical read"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
132 |
und fügt es in die Liste des Masters ein. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
133 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
134 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
135 |
@param ring_position (Negative) Position des Slaves im Bus |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
136 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
137 |
@param length Länge der zu lesenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
138 |
*/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
139 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
140 |
void EtherCAT_command_position_read(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
141 |
short ring_position, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
142 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
143 |
unsigned int length) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
144 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
145 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
146 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
147 |
cmd->type = ECAT_CMD_APRD; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
148 |
cmd->address.phy.dev.pos = ring_position; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
149 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
150 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
151 |
ECAT_FUNC_READ_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
152 |
} |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
153 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
154 |
/***************************************************************/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
155 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
156 |
/** |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
157 |
Initialisiert ein EtherCAT-APWR-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
158 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
159 |
Alloziert ein "autoincrement physical write"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
160 |
und fügt es in die Liste des Masters ein. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
161 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
162 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
163 |
@param ring_position (Negative) Position des Slaves im Bus |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
164 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
165 |
@param length Länge der zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
166 |
@param data Zeiger auf Speicher mit zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
167 |
*/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
168 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
169 |
void EtherCAT_command_position_write(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
170 |
short ring_position, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
171 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
172 |
unsigned int length, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
173 |
const unsigned char *data) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
174 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
175 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
176 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
177 |
cmd->type = ECAT_CMD_APWR; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
178 |
cmd->address.phy.dev.pos = ring_position; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
179 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
180 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
181 |
ECAT_FUNC_WRITE_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
182 |
} |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
183 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
184 |
/***************************************************************/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
185 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
186 |
/** |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
187 |
Initialisiert ein EtherCAT-BRD-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
188 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
189 |
Alloziert ein "broadcast read"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
190 |
und fügt es in die Liste des Masters ein. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
191 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
192 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
193 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
194 |
@param length Länge der zu lesenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
195 |
*/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
196 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
197 |
void EtherCAT_command_broadcast_read(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
198 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
199 |
unsigned int length) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
200 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
201 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
202 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
203 |
cmd->type = ECAT_CMD_BRD; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
204 |
cmd->address.phy.dev.node = 0x0000; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
205 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
206 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
207 |
ECAT_FUNC_READ_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
208 |
} |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
209 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
210 |
/***************************************************************/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
211 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
212 |
/** |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
213 |
Initialisiert ein EtherCAT-BWR-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
214 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
215 |
Alloziert ein "broadcast write"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
216 |
und fügt es in die Liste des Masters ein. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
217 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
218 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
219 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
220 |
@param length Länge der zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
221 |
@param data Zeiger auf Speicher mit zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
222 |
*/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
223 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
224 |
void EtherCAT_command_broadcast_write(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
225 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
226 |
unsigned int length, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
227 |
const unsigned char *data) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
228 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
229 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
230 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
231 |
cmd->type = ECAT_CMD_BWR; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
232 |
cmd->address.phy.dev.node = 0x0000; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
233 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
234 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
235 |
ECAT_FUNC_WRITE_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
236 |
} |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
237 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
238 |
/***************************************************************/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
239 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
240 |
/** |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
241 |
Initialisiert ein EtherCAT-LRW-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
242 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
243 |
Alloziert ein "logical read write"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
244 |
und fügt es in die Liste des Masters ein. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
245 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
246 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
247 |
@param offset Logische Speicheradresse |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
248 |
@param length Länge der zu lesenden/schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
249 |
@param data Zeiger auf Speicher mit zu lesenden/schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
250 |
*/ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
251 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
252 |
void EtherCAT_command_logical_read_write(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
253 |
unsigned int offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
254 |
unsigned int length, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
255 |
unsigned char *data) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
256 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
257 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
258 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
259 |
cmd->type = ECAT_CMD_LRW; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
260 |
cmd->address.logical = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
261 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
262 |
ECAT_FUNC_WRITE_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
263 |
} |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
264 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
265 |
/***************************************************************/ |