# device.h

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: device_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 #ifndef _DEVICE_H
    00031 #define _DEVICE_H
    00032
    00033 #include <ubixos/types.h>
    00034
    00035 struct device_node {
    00036   struct device_node      *prev;
    00037   struct device_node      *next;
    00038   struct device_interface *devInfo;
    00039   struct device_resource  *devRec;
    00040   char                      type;
    00041   int                       minor;
    00042   };
    00043
    00044 struct device_resource {
    00045   uInt8 irq;
    00046   };
    00047
    00048 struct device_interface {
    00049   uInt8  initialized;
    00050   uInt32 size;
    00051   int    major;
    00052   void  *info;
    00053   void (*read)(void *,void *,uInt32,uInt32);
    00054   void (*write)(void *,void *,uInt32,uInt32);
    00055   void (*reset)(void *);
    00056   int  (*init)(void *);
    00057   void (*ioctl)(void *);
    00058   void (*stop)(void *);
    00059   void (*start)(void *);
    00060   void (*standby)(void *);
    00061   };
    00062
    00063
    00064 int device_add(int,char,struct device_interface *);
    00065 struct device_node *device_find(int major,int minor);
    00066 int device_remove(struct device_node *);
    00067 #endif
    00068
    00069 /***
    00070  $Log: device_8h-source.html,v $
    00070  Revision 1.2  2006/12/15 17:47:04  reddawg
    00070  Updates
    00070
    00071  Revision 1.1.1.1  2006/06/01 12:46:15  reddawg
    00072  ubix2
    00073
    00074  Revision 1.2  2005/10/12 00:13:37  reddawg
    00075  Removed
    00076
    00077  Revision 1.1.1.1  2005/09/26 17:23:51  reddawg
    00078  no message
    00079
    00080  Revision 1.14  2004/08/15 00:33:02  reddawg
    00081  Wow the ide driver works again
    00082
    00083  Revision 1.13  2004/08/14 21:56:44  reddawg
    00084  Added initialized byte to the device system to make it easy to add child devices which use parent hardware.
    00085
    00086  Revision 1.12  2004/07/21 10:02:09  reddawg
    00087  devfs: renamed functions
    00088  device system: renamed functions
    00089  fdc: fixed a few potential bugs and cleaned up some unused variables
    00090  strol: fixed definition
    00091  endtask: made it print out freepage debug info
    00092  kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
    00093  ld: fixed a pointer conversion
    00094  file: cleaned up a few unused variables
    00095  sched: broke task deletion
    00096  kprintf: fixed ogPrintf definition
    00097
    00098  Revision 1.11  2004/05/22 02:40:04  ionix
    00099
    00100
    00101  fixed typo in device.h and initialized previous in device.c :)
    00102
    00103  Revision 1.10  2004/05/22 02:34:03  ionix
    00104
    00105
    00106  Added proto
    00107
    00108  Revision 1.9  2004/05/21 15:12:17  reddawg
    00109  Cleaned up
    00110
    00111
    00112  END
    00113  ***/
    00114