4 * Copyright 2006, Haiku, Inc. All Rights Reserved.
5 * Distributed under the terms of the MIT License.
10 #ifndef _DEV_PEGASUS_H_
11 #define _DEV_PEGASUS_H_
15 #include <SupportDefs.h>
18 #include "ether_driver.h"
20 #include "ByteOrder.h"
23 #define u_uint8_t uint8
24 #define u_uint16_t uint16
26 #define u_int16_t int16
29 #include "if_auereg.h"
31 #define VERSION "Version 0, Copyright (c) 2006 Jérôme Duval, compiled on " ## __DATE__ ## " " ## __TIME__
32 #define DRIVER_NAME "pegasus"
34 #define MY_ID "\033[34m" DRIVER_NAME ":\033[m "
35 #define MY_ERR "\033[31merror:\033[m "
36 #define MY_WARN "\033[31mwarning:\033[m "
40 #define DPRINTF_INFO(x...) dprintf(MY_ID x)
41 #define DPRINTF_ERR(x...) dprintf(MY_ID x)
43 #define DPRINTF_INFO(x...)
44 #define DPRINTF_ERR(x...) dprintf(MY_ID x)
48 ((x) ? 0 : dprintf (MY_ID "assertion failed at " __FILE__ ", line %d\n", __LINE__))
53 #define DEFAULT_CONFIGURATION 0
55 #define ENET_HEADER_SIZE 14
56 #define ETHER_ADDRESS_LENGTH 6
57 #define MAX_FRAME_SIZE 1536
58 #define ETHER_TRANSMIT_TIMEOUT ((bigtime_t)5000000)
62 * Various supported device vendors/products.
70 #define LSYS 0x0001 /* use Linksys reset */
71 #define PNA 0x0002 /* has Home PNA */
72 #define PII 0x0004 /* Pegasus II chip */
80 typedef struct _pegasus_dev
{
82 struct _pegasus_dev
*next
;
89 char name
[DEVNAME
]; /* used for resources */
98 struct driver_cookie
*open_fds
;
99 volatile bool aue_dying
;
106 volatile bool nonblocking
;
108 uint32 maxframesize
; // 14 bytes header + MTU
111 usb_pipe pipe_in
; /**/
112 usb_pipe pipe_out
; /**/
113 usb_pipe pipe_intr
; /**/
122 char rx_buffer
[MAX_FRAME_SIZE
];
124 size_t rx_actual_length
;
130 char tx_buffer
[MAX_FRAME_SIZE
];
132 size_t tx_actual_length
;
136 #define PEGASUS_COOKIE_MAGIC 'pega'
141 extern usb_module_info
*usb
;
143 pegasus_dev
*create_device(const usb_device dev
, const usb_interface_info
*ii
, uint16 ifno
);
144 void remove_device(pegasus_dev
*device
);
148 extern sem_id gDeviceListLock
;
149 extern bool gDeviceListChanged
;
151 void add_device_info(pegasus_dev
*device
);
152 void remove_device_info(pegasus_dev
*device
);
153 pegasus_dev
*search_device_info(const char *name
);
155 extern char **gDeviceNames
;
157 void alloc_device_names(void);
158 void free_device_names(void);
159 void rebuild_device_names(void);
162 void aue_attach(pegasus_dev
*sc
);
163 void aue_init(pegasus_dev
*sc
);
164 void aue_uninit(pegasus_dev
*sc
);
166 #endif /* _DEV_PEGASUS_H_ */