author | Florian Pose <fp@igh-essen.com> |
Fri, 16 Dec 2005 09:44:54 +0000 | |
branch | kernel2.6 |
changeset 32 | 7d9809fbf7b9 |
parent 26 | 60435f959e5c |
child 39 | 6965c23a6826 |
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" |
|
15 |
||
16 |
/***************************************************************/ |
|
17 |
||
18 |
/** |
|
19 |
Kommando-Konstruktor. |
|
20 |
||
21 |
Initialisiert alle Variablen innerhalb des Kommandos auf die |
|
22 |
Default-Werte. |
|
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
23 |
|
0 | 24 |
@param cmd Zeiger auf das zu initialisierende Kommando. |
25 |
*/ |
|
26 |
||
27 |
void EtherCAT_command_init(EtherCAT_command_t *cmd) |
|
28 |
{ |
|
29 |
cmd->type = ECAT_CMD_NONE; |
|
30 |
cmd->address.logical = 0x00000000; |
|
31 |
cmd->data_length = 0; |
|
32 |
cmd->state = ECAT_CS_READY; |
|
33 |
cmd->index = 0; |
|
34 |
cmd->working_counter = 0; |
|
35 |
} |
|
36 |
||
37 |
/***************************************************************/ |
|
38 |
||
39 |
/** |
|
40 |
Kommando-Destruktor. |
|
41 |
||
2
b0a7a4745bf9
?nderungen an no_rtai r110:110 in drivers gemergt.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
42 |
Setzt alle Attribute auf den Anfangswert zurueck. |
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
43 |
|
0 | 44 |
@param cmd Zeiger auf das zu initialisierende Kommando. |
45 |
*/ |
|
46 |
||
47 |
void EtherCAT_command_clear(EtherCAT_command_t *cmd) |
|
48 |
{ |
|
2
b0a7a4745bf9
?nderungen an no_rtai r110:110 in drivers gemergt.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
49 |
EtherCAT_command_init(cmd); |
0 | 50 |
} |
51 |
||
52 |
/***************************************************************/ |
|
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
53 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
54 |
#define ECAT_FUNC_HEADER \ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
55 |
EtherCAT_command_init(cmd) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
56 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
57 |
#define ECAT_FUNC_WRITE_FOOTER \ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
58 |
cmd->data_length = length; \ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
59 |
memcpy(cmd->data, data, length); |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
60 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
61 |
#define ECAT_FUNC_READ_FOOTER \ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
62 |
cmd->data_length = length; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
63 |
|
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 |
Initialisiert ein EtherCAT-NPRD-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
68 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
69 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
70 |
@param node_address Adresse des Knotens (Slaves) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
71 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
72 |
@param length Länge der zu lesenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
73 |
*/ |
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 |
void EtherCAT_command_read(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
76 |
unsigned short node_address, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
77 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
78 |
unsigned int length) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
79 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
80 |
if (node_address == 0x0000) |
26 | 81 |
printk(KERN_WARNING "EtherCAT: Using node address 0x0000!\n"); |
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
82 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
83 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
84 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
85 |
cmd->type = ECAT_CMD_NPRD; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
86 |
cmd->address.phy.dev.node = node_address; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
87 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
88 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
89 |
ECAT_FUNC_READ_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
90 |
} |
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 |
Initialisiert ein EtherCAT-NPWR-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
96 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
97 |
Alloziert ein "node-adressed physical write"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
98 |
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
|
99 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
100 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
101 |
@param node_address Adresse des Knotens (Slaves) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
102 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
103 |
@param length Länge der zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
104 |
@param data Zeiger auf Speicher mit zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
105 |
*/ |
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 |
void EtherCAT_command_write(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
108 |
unsigned short node_address, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
109 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
110 |
unsigned int length, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
111 |
const unsigned char *data) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
112 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
113 |
if (node_address == 0x0000) |
26 | 114 |
printk(KERN_WARNING "EtherCAT: Using node address 0x0000!\n"); |
13
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
115 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
116 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
117 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
118 |
cmd->type = ECAT_CMD_NPWR; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
119 |
cmd->address.phy.dev.node = node_address; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
120 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
121 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
122 |
ECAT_FUNC_WRITE_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
123 |
} |
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 |
Initialisiert ein EtherCAT-APRD-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
129 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
130 |
Alloziert ein "autoincerement physical read"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
131 |
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
|
132 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
133 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
134 |
@param ring_position (Negative) Position des Slaves im Bus |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
135 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
136 |
@param length Länge der zu lesenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
137 |
*/ |
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 |
void EtherCAT_command_position_read(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
140 |
short ring_position, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
141 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
142 |
unsigned int length) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
143 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
144 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
145 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
146 |
cmd->type = ECAT_CMD_APRD; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
147 |
cmd->address.phy.dev.pos = ring_position; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
148 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
149 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
150 |
ECAT_FUNC_READ_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
151 |
} |
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 |
Initialisiert ein EtherCAT-APWR-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
157 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
158 |
Alloziert ein "autoincrement physical write"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
159 |
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
|
160 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
161 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
162 |
@param ring_position (Negative) Position des Slaves im Bus |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
163 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
164 |
@param length Länge der zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
165 |
@param data Zeiger auf Speicher mit zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
166 |
*/ |
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 |
void EtherCAT_command_position_write(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
169 |
short ring_position, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
170 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
171 |
unsigned int length, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
172 |
const unsigned char *data) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
173 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
174 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
175 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
176 |
cmd->type = ECAT_CMD_APWR; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
177 |
cmd->address.phy.dev.pos = ring_position; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
178 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
179 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
180 |
ECAT_FUNC_WRITE_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
181 |
} |
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 |
Initialisiert ein EtherCAT-BRD-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
187 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
188 |
Alloziert ein "broadcast read"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
189 |
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
|
190 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
191 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
192 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
193 |
@param length Länge der zu lesenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
194 |
*/ |
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 |
void EtherCAT_command_broadcast_read(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
197 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
198 |
unsigned int length) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
199 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
200 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
201 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
202 |
cmd->type = ECAT_CMD_BRD; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
203 |
cmd->address.phy.dev.node = 0x0000; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
204 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
205 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
206 |
ECAT_FUNC_READ_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
207 |
} |
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 |
Initialisiert ein EtherCAT-BWR-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
213 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
214 |
Alloziert ein "broadcast write"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
215 |
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
|
216 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
217 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
218 |
@param offset Physikalische Speicheradresse im Slave |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
219 |
@param length Länge der zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
220 |
@param data Zeiger auf Speicher mit zu schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
221 |
*/ |
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 |
void EtherCAT_command_broadcast_write(EtherCAT_command_t *cmd, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
224 |
unsigned short offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
225 |
unsigned int length, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
226 |
const unsigned char *data) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
227 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
228 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
229 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
230 |
cmd->type = ECAT_CMD_BWR; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
231 |
cmd->address.phy.dev.node = 0x0000; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
232 |
cmd->address.phy.mem = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
233 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
234 |
ECAT_FUNC_WRITE_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
235 |
} |
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 |
Initialisiert ein EtherCAT-LRW-Kommando. |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
241 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
242 |
Alloziert ein "logical read write"-Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
243 |
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
|
244 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
245 |
@param cmd Zeiger auf das Kommando |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
246 |
@param offset Logische Speicheradresse |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
247 |
@param length Länge der zu lesenden/schreibenden Daten |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
248 |
@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
|
249 |
*/ |
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 |
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
|
252 |
unsigned int offset, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
253 |
unsigned int length, |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
254 |
unsigned char *data) |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
255 |
{ |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
256 |
ECAT_FUNC_HEADER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
257 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
258 |
cmd->type = ECAT_CMD_LRW; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
259 |
cmd->address.logical = offset; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
260 |
|
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
261 |
ECAT_FUNC_WRITE_FOOTER; |
db0742533c10
Simple Send/Receive Funktionen.
Florian Pose <fp@igh-essen.com>
parents:
2
diff
changeset
|
262 |
} |
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 |
/***************************************************************/ |