UbixOS V2 2.0

device.h
Go to the documentation of this file.
1 /*****************************************************************************************
2 Copyright (c) 2002-2004 The UbixOS Project
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification, are
6 permitted provided that the following conditions are met:
7
8 Redistributions of source code must retain the above copyright notice, this list of
9 conditions, the following disclaimer and the list of authors. Redistributions in binary
10 form must reproduce the above copyright notice, this list of conditions, the following
11 disclaimer and the list of authors in the documentation and/or other materials provided
12 with the distribution. Neither the name of the UbixOS Project nor the names of its
13 contributors may be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
17 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
23 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26 $Id: device.h 54 2016-01-11 01:29:55Z reddawg $
27
28 *****************************************************************************************/
29 /*
30 #ifndef _DEVICE_H
31 #define _DEVICE_H
32
33 // #include <ubixos/types.h>
34 #include <sys/types.h>
35 #include "types.h"
36
37 struct device_node {
38 struct device_node *prev;
39 struct device_node *next;
40 struct device_t *devInfo;
41 struct device_resource *devRec;
42 char type;
43 int minor;
44 };
45
46 struct device_resource {
47 uInt8 irq;
48 };
49
50 typedef struct device_t {
51 int major;
52 void *info;
53 uInt32 sectors;
54 int (*read)(device_t *, void *, off_t, size_t);
55 int (*write)(device_t *, void *, off_t, size_t);
56 int (*reset)(void *);
57 int (*init)(device_t *);
58 void (*ioctl)(void *);
59 void (*stop)(void *);
60 void (*start)(void *);
61 void (*standby)(void *);
62 };
63
64 #endif
65 */
66 /***
67 $Log: device.h,v $
68 Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
69 ubix2
70
71 Revision 1.2 2005/10/12 00:13:38 reddawg
72 Removed
73
74 Revision 1.1.1.1 2005/09/26 17:24:44 reddawg
75 no message
76
77 Revision 1.4 2004/09/20 00:53:04 flameshadow
78 chg: UbixFS::vfs_read() now works for direct block extents
79 chg: UbixFS::vfs_read() returns ~0 on error, or the size read in on success
80 chg: UbixFS::root member is now a fileDescriptor
81 chg: UbixFS::vfs_init() creates a file descriptor for the root dir
82 chg: UbixFS::vfs_format() now sets all values in the bTreeHeader before writing
83 chg: UbixFS::vfs_format() sets the inode magic number
84 chg: device_t::read(device_t *, void *, off_t, size_t)
85 chg: device_t::write(device_t *, void *, off_t, size_t)
86 chg: vfs_abstract::vfs_read(fileDescriptor *, void *, off_t, size_t)
87 chg: vfs_abstract::vfs_write(fileDescriptor *, void *, off_t, size_t)
88 chg: ramDrive_read(device_t *dev,void *ptr,off_t offset,size_t length)
89 chg: ramDrive_write(device_t *dev,void *ptr,off_t offset,size_t length)
90
91 Revision 1.3 2004/09/13 15:21:26 flameshadow
92 add: ramdrive.h
93 chg: renamed device_t.size to sectors
94 chg: made #define for size of ramdisk
95 chg: calculated sectors of ramdisk and stored in the device_t struct
96
97 Revision 1.2 2004/09/11 22:05:59 flameshadow
98 chg: modified UbixFS::vfs_format() to properly init the device
99 chg: modified UbixFS::vfs_init() to verify that it's a ubixfs partition
100 add: added BAT blockRun in the superBlock
101
102 Revision 1.1 2004/09/11 12:43:42 flameshadow
103 add: device.h, types.h. Temporarily moved custom ubix typedefs to types.h
104 (<ubixos/types.h> supercedes this file when this code is included into
105 the kernel)
106 chg: changed dev_t to device_interface so as to not conflict with bsd/linux
107 definitions
108 chg: fixed up compiler warnings in btree.cpp
109
110 Revision 1.14 2004/08/15 00:33:02 reddawg
111 Wow the ide driver works again
112
113 Revision 1.13 2004/08/14 21:56:44 reddawg
114 Added initialized byte to the device system to make it easy to add child devices which use parent hardware.
115
116 Revision 1.12 2004/07/21 10:02:09 reddawg
117 devfs: renamed functions
118 device system: renamed functions
119 fdc: fixed a few potential bugs and cleaned up some unused variables
120 strol: fixed definition
121 endtask: made it print out freepage debug info
122 kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
123 ld: fixed a pointer conversion
124 file: cleaned up a few unused variables
125 sched: broke task deletion
126 kprintf: fixed ogPrintf definition
127
128 Revision 1.11 2004/05/22 02:40:04 ionix
129
130
131 fixed typo in device.h and initialized previous in device.c :)
132
133 Revision 1.10 2004/05/22 02:34:03 ionix
134
135
136 Added proto
137
138 Revision 1.9 2004/05/21 15:12:17 reddawg
139 Cleaned up
140
141
142 END
143 ***/
144