Changeset 640 for Whitix/branches

Show
Ignore:
Timestamp:
06/24/08 14:02:57 (5 months ago)
Author:
mwhitworth
Message:

Add to device, add queue handling functions.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/network/include/net/network.h

    r288 r640  
    4747}; 
    4848 
     49#define NET_DEVICE_UP                           0x01 
     50#define NET_DEVICE_QUEUE_RUNNING        0x02 
     51 
    4952struct NetDevice 
    5053{ 
    5154        char name[12]; 
    5255        int type; /* Ethernet, wireless etc. */ 
    53         struct PciDevice* pciDev; 
     56        struct PciDevice* pciDev; /* More general? */ 
     57        int state; 
     58        struct ListHead sendList; 
    5459        struct NetDevOps* ops; 
    5560        struct NetProtoOps* protoOps; 
     
    6065extern struct NetDevice* currDevice; 
    6166 
     67/* Net device API */ 
    6268struct NetDevice* NetDeviceAlloc(); 
    6369int NetDeviceRegister(struct NetDevice* device); 
    6470 
     71static inline int NetDeviceQueueRunning(struct NetDevice* device) 
     72{ 
     73        return (device->state & NET_DEVICE_QUEUE_RUNNING); 
     74} 
     75 
     76static inline void NetDeviceStartQueue(struct NetDevice* device) 
     77{ 
     78        device->state |= NET_DEVICE_QUEUE_RUNNING; 
     79} 
     80 
     81static inline void NetDeviceStopQueue(struct NetDevice* device) 
     82{ 
     83        device->state &= ~NET_DEVICE_QUEUE_RUNNING; 
     84} 
     85 
     86int NetDeviceSend(struct NetDevice* device, struct SocketBuffer* buffer); 
     87 
     88 
    6589#endif