author | Florian Pose <fp@igh-essen.com> |
Wed, 22 Feb 2006 17:36:28 +0000 | |
changeset 72 | 7c986b717411 |
parent 71 | 79d7b9cfdeb9 |
child 74 | 9bf603942791 |
permissions | -rw-r--r-- |
59
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* E t h e r C A T _ s i . h |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* EtherCAT Slave-Interface. |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* $Id$ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
*****************************************************************************/ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
|
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
#define EC_PROC_DATA(SLAVE) ((unsigned char *) ((SLAVE)->process_data)) |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
|
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
/*****************************************************************************/ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
|
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
#define EC_READ_EL10XX(SLAVE, CHANNEL) \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
((EC_PROC_DATA(SLAVE)[0] >> (CHANNEL)) & 0x01) |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
|
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
/*****************************************************************************/ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
|
71
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
20 |
#define EC_WRITE_EL200X(SLAVE, CHANNEL, VALUE) \ |
59
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
do { \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
if (VALUE) EC_PROC_DATA(SLAVE)[0] |= (1 << (CHANNEL)); \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
else EC_PROC_DATA(SLAVE)[0] &= ~(1 << (CHANNEL)); \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
} while (0) |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
|
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
/*****************************************************************************/ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
|
71
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
28 |
#define EC_READ_EL310X(SLAVE, CHANNEL) \ |
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
29 |
((signed short int) ((EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 2] << 8) | \ |
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
30 |
EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 1])) |
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
31 |
|
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
32 |
#define EC_READ_EL316X(SLAVE, CHANNEL) \ |
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
33 |
((unsigned short int) ((EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 2] << 8) | \ |
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
34 |
EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 1])) |
67
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
35 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
36 |
/*****************************************************************************/ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
37 |
|
71
79d7b9cfdeb9
Slave interface und Makefile ge?ndert.
Florian Pose <fp@igh-essen.com>
parents:
67
diff
changeset
|
38 |
#define EC_WRITE_EL410X(SLAVE, CHANNEL, VALUE) \ |
59
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
do { \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 1] = ((VALUE) & 0xFF00) >> 8; \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 2] = (VALUE) & 0xFF; \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
} while (0) |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
|
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
/*****************************************************************************/ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
|
67
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
46 |
#define EC_CONF_EL5001_BAUD (0x4067) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
47 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
48 |
#define EC_READ_EL5001_STATE(SLAVE) \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
49 |
((unsigned char) EC_PROC_DATA(SLAVE)[0]) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
50 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
51 |
#define EC_READ_EL5001_VALUE(SLAVE) \ |
66
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
52 |
((unsigned int) (EC_PROC_DATA(SLAVE)[1] | \ |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
53 |
(EC_PROC_DATA(SLAVE)[2] << 8) | \ |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
54 |
(EC_PROC_DATA(SLAVE)[3] << 16) | \ |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
55 |
(EC_PROC_DATA(SLAVE)[4] << 24))) |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
56 |
|
67
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
57 |
/*****************************************************************************/ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
58 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
59 |
#define EC_READ_EL5101_STATE(SLAVE) \ |
66
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
60 |
((unsigned char) EC_PROC_DATA(SLAVE)[0]) |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
61 |
|
67
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
62 |
#define EC_READ_EL5101_VALUE(SLAVE) \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
63 |
((unsigned int) (EC_PROC_DATA(SLAVE)[1] | \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
64 |
(EC_PROC_DATA(SLAVE)[2] << 8))) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
65 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
66 |
#define EC_READ_EL5101_LATCH(SLAVE) \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
67 |
((unsigned int) (EC_PROC_DATA(SLAVE)[3] | \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
68 |
(EC_PROC_DATA(SLAVE)[4] << 8))) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
69 |
|
66
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
70 |
/*****************************************************************************/ |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
71 |
|
59
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
/* Emacs-Konfiguration |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
;;; Local Variables: *** |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
;;; c-basic-offset:4 *** |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
;;; End: *** |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
*/ |