# 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: ubixfsv2_2device_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 #include <sys/types.h>
    00035 #include "types.h"
    00036
    00037 struct device_node {
    00038   struct device_node      *prev;
    00039   struct device_node      *next;
    00040   struct device_t            *devInfo;
    00041   struct device_resource  *devRec;
    00042   char                     type;
    00043   int                      minor;
    00044   };
    00045
    00046 struct device_resource {
    00047   uInt8 irq;
    00048   };
    00049
    00050 typedef struct device_t {
    00051   int    major;
    00052   void  *info;
    00053   uInt32 sectors;
    00054   int  (*read)(device_t *, void *, off_t, size_t);
    00055   int  (*write)(device_t *, void *, off_t, size_t);
    00056   int  (*reset)(void *);
    00057   int  (*init)(device_t *);
    00058   void (*ioctl)(void *);
    00059   void (*stop)(void *);
    00060   void (*start)(void *);
    00061   void (*standby)(void *);
    00062   };
    00063
    00064 #endif
    00065
    00066 /***
    00067  $Log: ubixfsv2_2device_8h-source.html,v $
    00067  Revision 1.4  2006/12/06 04:41:03  reddawg
    00067  More syscalls implimented
    00067
    00068  Revision 1.1.1.1  2006/06/01 12:46:15  reddawg
    00069  ubix2
    00070
    00071  Revision 1.2  2005/10/12 00:13:38  reddawg
    00072  Removed
    00073
    00074  Revision 1.1.1.1  2005/09/26 17:24:44  reddawg
    00075  no message
    00076
    00077  Revision 1.4  2004/09/20 00:53:04  flameshadow
    00078  chg: UbixFS::vfs_read() now works for direct block extents
    00079  chg: UbixFS::vfs_read() returns ~0 on error, or the size read in on success
    00080  chg: UbixFS::root member is now a fileDescriptor
    00081  chg: UbixFS::vfs_init() creates a file descriptor for the root dir
    00082  chg: UbixFS::vfs_format() now sets all values in the bTreeHeader before writing
    00083  chg: UbixFS::vfs_format() sets the inode magic number
    00084  chg: device_t::read(device_t *, void *, off_t, size_t)
    00085  chg: device_t::write(device_t *, void *, off_t, size_t)
    00086  chg: vfs_abstract::vfs_read(fileDescriptor *, void *, off_t, size_t)
    00087  chg: vfs_abstract::vfs_write(fileDescriptor *, void *, off_t, size_t)
    00088  chg: ramDrive_read(device_t *dev,void *ptr,off_t offset,size_t length)
    00089  chg: ramDrive_write(device_t *dev,void *ptr,off_t offset,size_t length)
    00090
    00091  Revision 1.3  2004/09/13 15:21:26  flameshadow
    00092  add: ramdrive.h
    00093  chg: renamed device_t.size to sectors
    00094  chg: made #define for size of ramdisk
    00095  chg: calculated sectors of ramdisk and stored in the device_t struct
    00096
    00097  Revision 1.2  2004/09/11 22:05:59  flameshadow
    00098  chg: modified UbixFS::vfs_format() to properly init the device
    00099  chg: modified UbixFS::vfs_init() to verify that it's a ubixfs partition
    00100  add: added BAT blockRun in the superBlock
    00101
    00102  Revision 1.1  2004/09/11 12:43:42  flameshadow
    00103  add: device.h, types.h. Temporarily moved custom ubix typedefs to types.h
    00104       (<ubixos/types.h> supercedes this file when this code is included into
    00105       the kernel)
    00106  chg: changed dev_t to device_interface so as to not conflict with bsd/linux
    00107       definitions
    00108  chg: fixed up compiler warnings in btree.cpp
    00109
    00110  Revision 1.14  2004/08/15 00:33:02  reddawg
    00111  Wow the ide driver works again
    00112
    00113  Revision 1.13  2004/08/14 21:56:44  reddawg
    00114  Added initialized byte to the device system to make it easy to add child devices which use parent hardware.
    00115
    00116  Revision 1.12  2004/07/21 10:02:09  reddawg
    00117  devfs: renamed functions
    00118  device system: renamed functions
    00119  fdc: fixed a few potential bugs and cleaned up some unused variables
    00120  strol: fixed definition
    00121  endtask: made it print out freepage debug info
    00122  kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
    00123  ld: fixed a pointer conversion
    00124  file: cleaned up a few unused variables
    00125  sched: broke task deletion
    00126  kprintf: fixed ogPrintf definition
    00127
    00128  Revision 1.11  2004/05/22 02:40:04  ionix
    00129
    00130
    00131  fixed typo in device.h and initialized previous in device.c :)
    00132
    00133  Revision 1.10  2004/05/22 02:34:03  ionix
    00134
    00135
    00136  Added proto
    00137
    00138  Revision 1.9  2004/05/21 15:12:17  reddawg
    00139  Cleaned up
    00140
    00141
    00142  END
    00143  ***/
    00144