33 EC_CMD_LRW = 0x0C /**< Logical read/write */ |
33 EC_CMD_LRW = 0x0C /**< Logical read/write */ |
34 } |
34 } |
35 ec_command_type_t; |
35 ec_command_type_t; |
36 |
36 |
37 /** |
37 /** |
38 EtherCAT-Kommando-Zustand. |
38 EtherCAT command state. |
39 */ |
39 */ |
40 |
40 |
41 typedef enum |
41 typedef enum |
42 { |
42 { |
43 EC_CMD_INIT, /**< Neues Kommando */ |
43 EC_CMD_INIT, /**< new command */ |
44 EC_CMD_QUEUED, /**< Kommando in Warteschlange */ |
44 EC_CMD_QUEUED, /**< command queued by master */ |
45 EC_CMD_SENT, /**< Kommando gesendet */ |
45 EC_CMD_SENT, /**< command has been sent */ |
46 EC_CMD_RECEIVED, /**< Kommando empfangen */ |
46 EC_CMD_RECEIVED, /**< command has been received */ |
47 EC_CMD_TIMEOUT, /**< Zeitgrenze überschritten */ |
47 EC_CMD_TIMEOUT, /**< command timed out */ |
48 EC_CMD_ERROR /**< Fehler beim Senden oder Empfangen */ |
48 EC_CMD_ERROR /**< error while sending/receiving */ |
49 } |
49 } |
50 ec_command_state_t; |
50 ec_command_state_t; |
51 |
51 |
52 /*****************************************************************************/ |
52 /*****************************************************************************/ |
53 |
53 |
54 /** |
54 /** |
55 EtherCAT-Adresse. |
55 EtherCAT address. |
56 |
|
57 Im EtherCAT-Kommando sind 4 Bytes für die Adresse reserviert, die je nach |
|
58 Kommandotyp, eine andere Bedeutung haben können: Bei Autoinkrementbefehlen |
|
59 sind die ersten zwei Bytes die (negative) Autoinkrement-Adresse, bei Knoten- |
|
60 adressierten Befehlen entsprechen sie der Knotenadresse. Das dritte und |
|
61 vierte Byte entspricht in diesen Fällen der physikalischen Speicheradresse |
|
62 auf dem Slave. Bei einer logischen Adressierung entsprechen alle vier Bytes |
|
63 der logischen Adresse. |
|
64 */ |
56 */ |
65 |
57 |
66 typedef union |
58 typedef union |
67 { |
59 { |
68 struct |
60 struct |
69 { |
61 { |
70 uint16_t slave; /**< Adresse des Slaves (Ringposition oder Knoten) */ |
62 uint16_t slave; /**< configured or autoincrement address */ |
71 uint16_t mem; /**< Physikalische Speicheradresse im Slave */ |
63 uint16_t mem; /**< physical memory address */ |
72 } |
64 } |
73 physical; /**< Physikalische Adresse */ |
65 physical; /**< physical address */ |
74 |
66 |
75 uint32_t logical; /**< Logische Adresse */ |
67 uint32_t logical; /**< logical address */ |
76 } |
68 } |
77 ec_address_t; |
69 ec_address_t; |
78 |
70 |
79 /*****************************************************************************/ |
71 /*****************************************************************************/ |
80 |
72 |
81 /** |
73 /** |
82 EtherCAT-Kommando. |
74 EtherCAT command |
83 */ |
75 */ |
84 |
76 |
85 typedef struct |
77 typedef struct |
86 { |
78 { |
87 struct list_head list; /**< Kommando-Listeneintrag */ |
79 struct list_head list; /**< needed by domain command lists */ |
88 struct list_head queue; /**< Master-Kommando-Queue */ |
80 struct list_head queue; /**< master command queue item */ |
89 ec_command_type_t type; /**< Typ des Kommandos (APRD, NPWR, etc) */ |
81 ec_command_type_t type; /**< command type (APRD, BWR, etc) */ |
90 ec_address_t address; /**< Adresse des/der Empfänger */ |
82 ec_address_t address; /**< receipient address */ |
91 uint8_t *data; /**< Kommandodaten */ |
83 uint8_t *data; /**< command data */ |
92 size_t mem_size; /**< Größe des Speichers */ |
84 size_t mem_size; /**< command \a data memory size */ |
93 size_t data_size; /**< Länge der zu sendenden und/oder empfangenen Daten */ |
85 size_t data_size; /**< size of the data in \a data */ |
94 uint8_t index; /**< Kommando-Index, wird vom Master beim Senden gesetzt. */ |
86 uint8_t index; /**< command index (set by master) */ |
95 uint16_t working_counter; /**< Working-Counter */ |
87 uint16_t working_counter; /**< working counter */ |
96 ec_command_state_t state; /**< Zustand */ |
88 ec_command_state_t state; /**< command state */ |
97 } |
89 } |
98 ec_command_t; |
90 ec_command_t; |
99 |
91 |
100 /*****************************************************************************/ |
92 /*****************************************************************************/ |
101 |
93 |