1 /* 2 * Copyright 2007, Hugo Santos. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Hugo Santos, hugosantos@gmail.com 7 * 8 * Some of this code is based on previous work by Marcus Overhagen. 9 */ 10 #ifndef _DEVICE_H_ 11 #define _DEVICE_H_ 12 13 #include <stdint.h> 14 15 #include <KernelExport.h> 16 #include <drivers/PCI.h> 17 18 #include <net_stack.h> 19 20 #include <compat/sys/kernel.h> 21 #include <compat/net/if.h> 22 #include <compat/net/if_var.h> 23 24 struct ifnet; 25 26 struct device { 27 pci_info pci_info; 28 char dev_name[128]; 29 30 int32 flags; 31 32 struct ifqueue receive_queue; 33 sem_id receive_sem; 34 35 struct ifnet * ifp; 36 37 int unit; 38 char nameunit[64]; 39 const char * description; 40 void * softc; 41 }; 42 43 44 enum { 45 DEVICE_OPEN = 1 << 0, 46 DEVICE_CLOSED = 1 << 1, 47 DEVICE_NON_BLOCK = 1 << 2, 48 }; 49 50 51 status_t init_mbufs(void); 52 void uninit_mbufs(void); 53 54 status_t init_mutexes(void); 55 void uninit_mutexes(void); 56 57 /* busdma_machdep.c */ 58 void init_bounce_pages(void); 59 void uninit_bounce_pages(void); 60 61 extern struct net_stack_module_info *gStack; 62 extern pci_module_info *gPci; 63 64 extern char *gDevNameList[]; 65 extern struct device *gDevices[]; 66 67 #endif 68