author | Florian Pose <fp@igh-essen.com> |
Tue, 14 Feb 2006 14:53:41 +0000 | |
changeset 69 | 69dad4ec73c2 |
parent 67 | 56964b20c15d |
child 71 | 79d7b9cfdeb9 |
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 |
|
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
#define EC_WRITE_EL20XX(SLAVE, CHANNEL, VALUE) \ |
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 |
|
67
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
28 |
#define EC_READ_EL31XX(SLAVE, CHANNEL) \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
29 |
((short int) ((EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 2] << 8) | \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
30 |
EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 1])) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
31 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
32 |
/*****************************************************************************/ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
33 |
|
59
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
#define EC_WRITE_EL41XX(SLAVE, CHANNEL, VALUE) \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
do { \ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
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
|
37 |
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
|
38 |
} while (0) |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
|
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
/*****************************************************************************/ |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
|
67
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
42 |
#define EC_CONF_EL5001_BAUD (0x4067) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
43 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
44 |
#define EC_READ_EL5001_STATE(SLAVE) \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
45 |
((unsigned char) EC_PROC_DATA(SLAVE)[0]) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
46 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
47 |
#define EC_READ_EL5001_VALUE(SLAVE) \ |
66
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
48 |
((unsigned int) (EC_PROC_DATA(SLAVE)[1] | \ |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
49 |
(EC_PROC_DATA(SLAVE)[2] << 8) | \ |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
50 |
(EC_PROC_DATA(SLAVE)[3] << 16) | \ |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
51 |
(EC_PROC_DATA(SLAVE)[4] << 24))) |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
52 |
|
67
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
53 |
/*****************************************************************************/ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
54 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
55 |
#define EC_READ_EL5101_STATE(SLAVE) \ |
66
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
56 |
((unsigned char) EC_PROC_DATA(SLAVE)[0]) |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
57 |
|
67
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
58 |
#define EC_READ_EL5101_VALUE(SLAVE) \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
59 |
((unsigned int) (EC_PROC_DATA(SLAVE)[1] | \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
60 |
(EC_PROC_DATA(SLAVE)[2] << 8))) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
61 |
|
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
62 |
#define EC_READ_EL5101_LATCH(SLAVE) \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
63 |
((unsigned int) (EC_PROC_DATA(SLAVE)[3] | \ |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
64 |
(EC_PROC_DATA(SLAVE)[4] << 8))) |
56964b20c15d
EL5101-Inkrementalgeberklemme hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
66
diff
changeset
|
65 |
|
66
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
66 |
/*****************************************************************************/ |
cab9cc6a2721
SSI-Klemmen-Interface und kleinere ?nderungen.
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
67 |
|
59
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
/* Emacs-Konfiguration |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
;;; Local Variables: *** |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
;;; c-basic-offset:4 *** |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
;;; End: *** |
c8bd4fe3b38c
EtherCAT-Slave-Interface als Makros implementiert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
*/ |