diff --git a/Makefile b/Makefile index 26d476e..0b1a35d 100644 --- a/Makefile +++ b/Makefile @@ -11,27 +11,34 @@ REMOVE = rm -f #Objects -OBJS = main.o +OBJS = main.o vfs.o ramdrive.o + +#Includes +INCLUDES = -I./include + +#CFLAGS + +CFLAGS = -O # Link The Binary $(BINARY) : $(OBJS) - $(CC) $(CFLAGS) -o $@ $(OBJS) + $(CXX) $(CFLAGS) -o $@ $(OBJS) # Compile the source files .cpp.o: - $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< + $(CXX) -Wall $(CFLAGS) $(INCLUDES) -c -o $@ $< .cc.o: - $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< + $(CXX) -Wall $(CFLAGS) $(INCLUDES) -c -o $@ $< .cc.s: - $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< + $(CXX) -Wall $(CFLAGS) $(INCLUDES) -S -o $@ $< .c.o: - $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< + $(CC) -Wall $(CFLAGS) $(INCLUDES) -c -o $@ $< .c.s: - $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< + $(CC) -Wall $(CFLAGS) $(INCLUDES) -S -o $@ $< .S.o: $(CC) -Wall $(CLFAGS) $(INCLUDES) -c -o $@ $< diff --git a/include/device.h b/include/device.h new file mode 100644 index 0000000..e390b2e --- /dev/null +++ b/include/device.h @@ -0,0 +1,58 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +*****************************************************************************************/ + +#ifndef __DEVICE_H_ +#define __DEVICE_H_ + +#include + +struct dev_t; + +typedef struct device_node { + int major; + void *info; + int (*read)(dev_t *,void *,uInt32,uInt32); + void (*write)(void *,void *,uInt32,uInt32); + void (*reset)(void *); + int (*init)(void *); + void (*ioctl)(void *); + void (*stop)(void *); + void (*start)(void *); + void (*standby)(void *); + } dev_t; + +dev_t *dev_ramDrive(); + +#endif + +/*** + $Log$ + END + ***/ + diff --git a/include/ubix_types.h b/include/ubix_types.h new file mode 100644 index 0000000..5384d88 --- /dev/null +++ b/include/ubix_types.h @@ -0,0 +1,41 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +*****************************************************************************************/ + +#ifndef __UBIX_TYPES_H_ +#define __UBIX_TYPES_H_ + +typedef unsigned long uInt32; + +#endif + +/*** + $Log$ + END + ***/ + diff --git a/include/ubixfs.h b/include/ubixfs.h index f0bc839..17fd474 100644 --- a/include/ubixfs.h +++ b/include/ubixfs.h @@ -31,3 +31,9 @@ #define __UBIXFS_H_ #endif + +/*** + $Log$ + END + ***/ + diff --git a/include/vfs.h b/include/vfs.h new file mode 100644 index 0000000..aecfc6d --- /dev/null +++ b/include/vfs.h @@ -0,0 +1,59 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +*****************************************************************************************/ + +#ifndef __VFS_H_ +#define __VFS_H_ + +#include + +class vfs { + private: + vfs *prev; + vfs *next; + public: + dev_t *dev; + int vfs_initFS(); + int vfs_read(char *,long,long); + int vfs_Write(char *,long,long); + int vfs_OpenFile(void *,void *); + int vfs_Unlink(char *,void *); + int vfs_MakeDir(char *,void *); + int vfs_RemDir(char *); + int vfs_Sync(void); + int vfs_Type; + int open(); + }; + +#endif + +/*** + $Log$ + END + ***/ + diff --git a/main.cc b/main.cc index f8dac0b..6790e9c 100644 --- a/main.cc +++ b/main.cc @@ -29,6 +29,21 @@ #include +#include +#include + int main(int argc,char **argv) { + vfs *ubixfs_VFS = new(vfs); + + ubixfs_VFS->dev = dev_ramDrive(); + + ubixfs_VFS->vfs_initFS(); + return(0x0); } + +/*** + $Log$ + END + ***/ + diff --git a/ramdrive.cc b/ramdrive.cc new file mode 100644 index 0000000..b4241ca --- /dev/null +++ b/ramdrive.cc @@ -0,0 +1,55 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +*****************************************************************************************/ + +#include +#include + +#include + + +static int ramDrive_read(dev_t *dev,void *ptr,uInt32 length,uInt32 offset) { + printf("READ!!!\n"); + return(0x0); + } + +dev_t *dev_ramDrive() { + dev_t *ramDrive = 0x0; + + ramDrive = (dev_t *)malloc(sizeof(dev_t)); + + ramDrive->read = ramDrive_read; + + return(ramDrive); + } + +/*** + $Log$ + END + ***/ + diff --git a/vfs.cc b/vfs.cc new file mode 100644 index 0000000..acc8640 --- /dev/null +++ b/vfs.cc @@ -0,0 +1,43 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +*****************************************************************************************/ + +#include + +#include + +int vfs::vfs_initFS() { + printf("test: %i\n",dev->i); + return(0x0); + } + +/*** + $Log$ + END + ***/ +