Changeset 1996 for Whitix/trunk

Show
Ignore:
Timestamp:
04/02/09 21:06:06 (3 years ago)
Author:
mwhitworth
Message:

Add KeBus code, with async bus scanning, bus entries, IcFs support etc..

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/include/devices/bus.h

    r1051 r1996  
     1#ifndef KEDEV_BUS_H 
     2#define KEDEV_BUS_H 
     3 
     4#include <completion.h> 
     5#include <keobject.h> 
     6#include <llist.h> 
     7#include <fs/icfs.h> 
     8 
     9#define BUS_STARTING    0 
     10#define BUS_RUNNING             1 
     11 
     12struct KeBus 
     13{ 
     14        struct ListHead deviceList; 
     15        struct ListHead next, node; 
     16        int index, state; 
     17        struct KeBusType* busType; 
     18         
     19        /* Used in the startup code to wait for all initial bus scans to complete. 
     20         * This does not mean all the devices have been linked with drivers (but 
     21         * the devices that match to drivers have been). */ 
     22        struct Completion initialBusScan; 
     23         
     24        struct KeSet set; 
     25}; 
     26 
     27struct KeBusType 
     28{ 
     29        /* These members should be specified before calling KeBusTypeRegister */ 
     30        char* name; 
     31         
     32        struct IcAttribute* busEntryAttrs; 
     33        int busEntryOffset; 
     34 
     35        /* Private members. */ 
     36        struct KeSet set; 
     37 
     38        /* List of all drivers that detect drivers on this bus type. */ 
     39        struct ListHead driverList; 
     40 
     41        /* List of all the KeBuses that are of this type. */ 
     42        struct ListHead busList; 
     43}; 
     44 
     45struct KeBusEntry 
     46{ 
     47        struct KeObject object; 
     48}; 
     49 
     50int KeBusTypeRegister(struct KeBusType* busType); 
     51int KeBusRegister(struct KeBusType* busType, struct KeBus* bus, int index); 
     52int KeBusEntryRegister(struct KeBus* bus, struct KeBusEntry* entry, char* name, ...); 
     53void KeBusStart(struct KeBus* bus); 
     54 
     55#endif