0
|
1 |
//---------------------------------------------------------------
|
|
2 |
//
|
|
3 |
// e c _ s l a v e . h
|
|
4 |
//
|
|
5 |
// $LastChangedDate$
|
|
6 |
// $Author$
|
|
7 |
//
|
|
8 |
//---------------------------------------------------------------
|
|
9 |
|
|
10 |
#define SIMPLE 0
|
|
11 |
#define MAILBOX 1
|
|
12 |
|
|
13 |
//---------------------------------------------------------------
|
|
14 |
|
|
15 |
typedef struct slave_desc EtherCAT_slave_desc_t;
|
|
16 |
|
|
17 |
typedef struct
|
|
18 |
{
|
|
19 |
// Base data
|
|
20 |
unsigned char type;
|
|
21 |
unsigned char revision;
|
|
22 |
unsigned short build;
|
|
23 |
|
|
24 |
// Addresses
|
|
25 |
short ring_position;
|
|
26 |
unsigned short station_address;
|
|
27 |
|
|
28 |
// Slave information interface
|
|
29 |
unsigned int vendor_id;
|
|
30 |
unsigned int product_code;
|
|
31 |
unsigned int revision_number;
|
|
32 |
|
|
33 |
const EtherCAT_slave_desc_t *desc;
|
|
34 |
|
|
35 |
unsigned int logical_address0;
|
|
36 |
|
|
37 |
unsigned int current_state;
|
|
38 |
unsigned int requested_state;
|
|
39 |
|
|
40 |
unsigned char *process_data;
|
|
41 |
}
|
|
42 |
EtherCAT_slave_t;
|
|
43 |
|
|
44 |
#define ECAT_INIT_SLAVE(TYPE) {0, 0, 0, 0, 0, 0, 0, 0, TYPE, 0, 0, 0, NULL}
|
|
45 |
|
|
46 |
//---------------------------------------------------------------
|
|
47 |
|
|
48 |
// Slave construction and deletion
|
|
49 |
void EtherCAT_slave_init(EtherCAT_slave_t *);
|
|
50 |
void EtherCAT_slave_clear(EtherCAT_slave_t *);
|
|
51 |
|
|
52 |
// Debug
|
|
53 |
void EtherCAT_slave_print(EtherCAT_slave_t *);
|
|
54 |
|
|
55 |
//---------------------------------------------------------------
|
|
56 |
|
|
57 |
typedef struct slave_desc
|
|
58 |
{
|
|
59 |
const char *vendor_name;
|
|
60 |
const char *product_name;
|
|
61 |
const char *product_desc;
|
|
62 |
|
|
63 |
const int type;
|
|
64 |
|
|
65 |
const unsigned char *sm0;
|
|
66 |
const unsigned char *sm1;
|
|
67 |
const unsigned char *sm2;
|
|
68 |
const unsigned char *sm3;
|
|
69 |
|
|
70 |
const unsigned char *fmmu0;
|
|
71 |
|
|
72 |
const unsigned int data_length;
|
|
73 |
}
|
|
74 |
EtherCAT_slave_desc_t;
|
|
75 |
|
|
76 |
extern EtherCAT_slave_desc_t Beckhoff_EK1100[];
|
|
77 |
extern EtherCAT_slave_desc_t Beckhoff_EL1014[];
|
|
78 |
extern EtherCAT_slave_desc_t Beckhoff_EL2004[];
|
|
79 |
extern EtherCAT_slave_desc_t Beckhoff_EL3102[];
|
|
80 |
extern EtherCAT_slave_desc_t Beckhoff_EL3162[];
|
|
81 |
extern EtherCAT_slave_desc_t Beckhoff_EL4102[];
|
|
82 |
extern EtherCAT_slave_desc_t Beckhoff_EL5001[];
|
|
83 |
|
|
84 |
//---------------------------------------------------------------
|
|
85 |
|
|
86 |
struct slave_ident
|
|
87 |
{
|
|
88 |
const unsigned int vendor_id;
|
|
89 |
const unsigned int product_code;
|
|
90 |
const EtherCAT_slave_desc_t *desc;
|
|
91 |
};
|
|
92 |
|
|
93 |
extern struct slave_ident slave_idents[];
|
|
94 |
extern unsigned int slave_idents_count;
|
|
95 |
|
|
96 |
//---------------------------------------------------------------
|