2 * UDI Ne2000 NIC Driver
3 * By John Hodge (thePowersGang)
8 #ifndef _NE2000_COMMON_H_
9 #define _NE2000_COMMON_H_
12 #include <udi_physio.h>
15 #include "ne2000_hw.h"
17 #define ARRAY_SIZEOF(arr) (sizeof(arr)/sizeof(arr[0]))
29 udi_init_context_t init_context;
33 udi_intr_attach_cb_t *intr_attach_cb;
36 udi_index_t pio_index;
37 udi_index_t n_intr_event_cb;
39 udi_index_t rx_chan_index;
42 udi_pio_handle_t pio_handles[4];
43 udi_channel_t interrupt_channel;
44 udi_channel_t rx_channel;
45 udi_channel_t tx_channel;
47 udi_nic_rx_cb_t *rx_next_cb;
48 udi_ubit8_t rx_next_page;
50 udi_ubit8_t macaddr[6];
54 /* Copied from http://projectudi.cvs.sourceforge.net/viewvc/projectudi/udiref/driver/udi_dpt/udi_dpt.h */
55 #define DPT_SET_ATTR_BOOLEAN(attr, name, val) \
56 udi_strcpy((attr)->attr_name, (name)); \
57 (attr)->attr_type = UDI_ATTR_BOOLEAN; \
58 (attr)->attr_length = sizeof(udi_boolean_t); \
59 UDI_ATTR32_SET((attr)->attr_value, (val))
61 #define DPT_SET_ATTR32(attr, name, val) \
62 udi_strcpy((attr)->attr_name, (name)); \
63 (attr)->attr_type = UDI_ATTR_UBIT32; \
64 (attr)->attr_length = sizeof(udi_ubit32_t); \
65 UDI_ATTR32_SET((attr)->attr_value, (val))
67 #define DPT_SET_ATTR_ARRAY8(attr, name, val, len) \
68 udi_strcpy((attr)->attr_name, (name)); \
69 (attr)->attr_type = UDI_ATTR_ARRAY8; \
70 (attr)->attr_length = (len); \
71 udi_memcpy((attr)->attr_value, (val), (len))
73 #define DPT_SET_ATTR_STRING(attr, name, val, len) \
74 udi_strcpy((attr)->attr_name, (name)); \
75 (attr)->attr_type = UDI_ATTR_STRING; \
76 (attr)->attr_length = (len); \
77 udi_strncpy_rtrim((char *)(attr)->attr_value, (val), (len))
78 #define NE2K_SET_ATTR_STRFMT(attr, name, maxlen, fmt, v...) \
79 udi_strcpy((attr)->attr_name, (name)); \
80 (attr)->attr_type = UDI_ATTR_STRING; \
81 (attr)->attr_length = udi_snprintf((char *)(attr)->attr_value, (maxlen), (fmt) ,## v )
83 extern udi_channel_event_ind_op_t ne2k_bus_dev_channel_event_ind;
84 extern udi_bus_bind_ack_op_t ne2k_bus_dev_bus_bind_ack;
85 extern udi_pio_map_call_t ne2k_bus_dev_bind__pio_map;
86 extern udi_channel_spawn_call_t ne2k_bus_dev_bind__intr_chanel;
87 extern udi_cb_alloc_call_t ne2k_bus_dev_bind__intr_attach;
88 extern udi_bus_unbind_ack_op_t ne2k_bus_dev_bus_unbind_ack;
89 extern udi_intr_attach_ack_op_t ne2k_bus_dev_intr_attach_ack;
90 extern udi_cb_alloc_call_t ne2k_bus_dev_bind__intr_event_cb;
91 extern udi_pio_trans_call_t ne2k_bus_dev_bind__card_reset;
92 extern udi_intr_detach_ack_op_t ne2k_bus_dev_intr_detach_ack;
94 extern udi_channel_event_ind_op_t ne2k_nd_ctrl_channel_event_ind;
95 extern udi_nd_bind_req_op_t ne2k_nd_ctrl_bind_req;
96 extern udi_channel_spawn_call_t ne2k_nd_ctrl_bind__tx_chan_ok;
97 extern udi_channel_spawn_call_t ne2k_nd_ctrl_bind__rx_chan_ok;
98 extern udi_nd_unbind_req_op_t ne2k_nd_ctrl_unbind_req;
99 extern udi_nd_enable_req_op_t ne2k_nd_ctrl_enable_req;
100 extern udi_nd_disable_req_op_t ne2k_nd_ctrl_disable_req;
101 extern udi_nd_ctrl_req_op_t ne2k_nd_ctrl_ctrl_req;
102 extern udi_nd_info_req_op_t ne2k_nd_ctrl_info_req;
104 extern udi_channel_event_ind_op_t ne2k_nd_tx_channel_event_ind;
105 extern udi_nd_tx_req_op_t ne2k_nd_tx_tx_req;
106 extern udi_nd_exp_tx_req_op_t ne2k_nd_tx_exp_tx_req;
108 extern udi_channel_event_ind_op_t ne2k_nd_rx_channel_event_ind;
109 extern udi_nd_rx_rdy_op_t ne2k_nd_rx_rx_rdy;
111 extern udi_channel_event_ind_op_t ne2k_bus_irq_channel_event_ind;
112 extern udi_intr_event_ind_op_t ne2k_bus_irq_intr_event_ind;
114 extern void ne2k_intr__rx_ok(udi_cb_t *gcb);