61 |
80 |
62 struct ec_device |
81 struct ec_device |
63 { |
82 { |
64 ec_master_t *master; /**< EtherCAT master */ |
83 ec_master_t *master; /**< EtherCAT master */ |
65 struct net_device *dev; /**< pointer to the assigned net_device */ |
84 struct net_device *dev; /**< pointer to the assigned net_device */ |
|
85 ec_pollfunc_t poll; /**< pointer to the device's poll function */ |
|
86 struct module *module; /**< pointer to the device's owning module */ |
66 uint8_t open; /**< true, if the net_device has been opened */ |
87 uint8_t open; /**< true, if the net_device has been opened */ |
67 struct sk_buff *tx_skb; /**< transmit socket buffer */ |
88 uint8_t link_state; /**< device link state */ |
68 ec_pollfunc_t poll; /**< pointer to the device's poll function */ |
89 struct sk_buff *tx_skb[EC_TX_RING_SIZE]; /**< transmit skb ring */ |
|
90 unsigned int tx_ring_index; |
69 cycles_t cycles_poll; /**< cycles of last poll */ |
91 cycles_t cycles_poll; /**< cycles of last poll */ |
|
92 #ifdef EC_DEBUG_RING |
|
93 struct timeval timeval_poll; |
|
94 #endif |
70 unsigned long jiffies_poll; /**< jiffies of last poll */ |
95 unsigned long jiffies_poll; /**< jiffies of last poll */ |
71 struct module *module; /**< pointer to the device's owning module */ |
|
72 uint8_t link_state; /**< device link state */ |
|
73 unsigned int tx_count; /**< number of frames sent */ |
96 unsigned int tx_count; /**< number of frames sent */ |
74 unsigned int rx_count; /**< number of frames received */ |
97 unsigned int rx_count; /**< number of frames received */ |
75 #ifdef EC_DBG_IF |
98 #ifdef EC_DEBUG_IF |
76 ec_debug_t dbg; /**< debug device */ |
99 ec_debug_t dbg; /**< debug device */ |
|
100 #endif |
|
101 #ifdef EC_DEBUG_RING |
|
102 ec_debug_frame_t debug_frames[EC_DEBUG_RING_SIZE]; |
|
103 unsigned int debug_frame_index; |
|
104 unsigned int debug_frame_count; |
77 #endif |
105 #endif |
78 }; |
106 }; |
79 |
107 |
80 /*****************************************************************************/ |
108 /*****************************************************************************/ |
81 |
109 |
82 int ec_device_init(ec_device_t *, ec_master_t *, struct net_device *, |
110 int ec_device_init(ec_device_t *, ec_master_t *); |
83 ec_pollfunc_t, struct module *); |
|
84 void ec_device_clear(ec_device_t *); |
111 void ec_device_clear(ec_device_t *); |
|
112 |
|
113 void ec_device_attach(ec_device_t *, struct net_device *, ec_pollfunc_t, |
|
114 struct module *); |
|
115 void ec_device_detach(ec_device_t *); |
85 |
116 |
86 int ec_device_open(ec_device_t *); |
117 int ec_device_open(ec_device_t *); |
87 int ec_device_close(ec_device_t *); |
118 int ec_device_close(ec_device_t *); |
88 |
119 |
89 void ec_device_poll(ec_device_t *); |
120 void ec_device_poll(ec_device_t *); |
90 uint8_t *ec_device_tx_data(ec_device_t *); |
121 uint8_t *ec_device_tx_data(ec_device_t *); |
91 void ec_device_send(ec_device_t *, size_t); |
122 void ec_device_send(ec_device_t *, size_t); |
92 |
123 |
|
124 #ifdef EC_DEBUG_RING |
|
125 void ec_device_debug_ring_append(ec_device_t *, ec_debug_frame_dir_t, |
|
126 const void *, size_t); |
|
127 void ec_device_debug_ring_print(const ec_device_t *); |
|
128 #endif |
|
129 |
93 /*****************************************************************************/ |
130 /*****************************************************************************/ |
94 |
131 |
95 #endif |
132 #endif |