1 /**************************************************************** |
1 /****************************************************************************** |
2 * |
2 * |
3 * e c _ c o m m a n d . h |
3 * e c _ c o m m a n d . h |
4 * |
4 * |
5 * Struktur für ein EtherCAT-Kommando. |
5 * Struktur für ein EtherCAT-Kommando. |
6 * |
6 * |
7 * $Date$ |
7 * $Id$ |
8 * $Author$ |
|
9 * |
8 * |
10 ***************************************************************/ |
9 *****************************************************************************/ |
11 |
10 |
12 #ifndef _EC_COMMAND_H_ |
11 #ifndef _EC_COMMAND_H_ |
13 #define _EC_COMMAND_H_ |
12 #define _EC_COMMAND_H_ |
14 |
13 |
15 #include "ec_globals.h" |
14 #include "ec_globals.h" |
55 unsigned long logical; /**< Logische Adresse */ |
54 unsigned long logical; /**< Logische Adresse */ |
56 unsigned char raw[4]; /**< Rohdaten für die Generierung des Frames */ |
55 unsigned char raw[4]; /**< Rohdaten für die Generierung des Frames */ |
57 } |
56 } |
58 EtherCAT_address_t; |
57 EtherCAT_address_t; |
59 |
58 |
60 /***************************************************************/ |
59 /*****************************************************************************/ |
61 |
60 |
62 /** |
61 /** |
63 EtherCAT-Kommando. |
62 EtherCAT-Kommando. |
64 */ |
63 */ |
65 |
64 |
66 typedef struct EtherCAT_command |
65 typedef struct EtherCAT_command |
67 { |
66 { |
68 EtherCAT_cmd_type_t type; /**< Typ des Kommandos (APRD, NPWR, etc...) */ |
67 EtherCAT_cmd_type_t type; /**< Typ des Kommandos (APRD, NPWR, etc...) */ |
69 EtherCAT_address_t address; /**< Adresse des/der Empfänger */ |
68 EtherCAT_address_t address; /**< Adresse des/der Empfänger */ |
70 unsigned int data_length; /**< Länge der zu sendenden und/oder empfangenen Daten */ |
69 unsigned int data_length; /**< Länge der zu sendenden und/oder |
|
70 empfangenen Daten */ |
71 |
71 |
72 EtherCAT_command_state_t state; /**< Zustand des Kommandos (bereit, gesendet, etc...) */ |
72 EtherCAT_command_state_t state; /**< Zustand des Kommandos |
73 unsigned char index; /**< Kommando-Index, mit der das Kommando gesendet wurde (wird |
73 (bereit, gesendet, etc...) */ |
74 vom Master beim Senden gesetzt. */ |
74 unsigned char index; /**< Kommando-Index, mit der das Kommando gesendet |
75 unsigned int working_counter; /**< Working-Counter bei Empfang (wird vom Master gesetzt) */ |
75 wurde (wird vom Master beim Senden gesetzt. */ |
|
76 unsigned int working_counter; /**< Working-Counter bei Empfang (wird |
|
77 vom Master gesetzt) */ |
76 |
78 |
77 unsigned char data[ECAT_FRAME_BUFFER_SIZE]; /**< Kommandodaten */ |
79 unsigned char data[ECAT_FRAME_BUFFER_SIZE]; /**< Kommandodaten */ |
78 } |
80 } |
79 EtherCAT_command_t; |
81 EtherCAT_command_t; |
80 |
82 |
81 /***************************************************************/ |
83 /*****************************************************************************/ |
82 |
84 |
83 void EtherCAT_command_init(EtherCAT_command_t *); |
85 void EtherCAT_command_init(EtherCAT_command_t *); |
84 void EtherCAT_command_clear(EtherCAT_command_t *); |
86 void EtherCAT_command_clear(EtherCAT_command_t *); |
85 |
87 |
86 void EtherCAT_command_read(EtherCAT_command_t *, |
88 void EtherCAT_command_read(EtherCAT_command_t *, |