diff --git a/debug/open.c b/debug/open.c new file mode 100644 index 0000000..796979c --- /dev/null +++ b/debug/open.c @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +int main(int argc, char **argv) { + int fd = 0; + + fd = open("./open.test.file", DWR); + + printf("open/fd: %i\n", fd); + + write(fd, "TEST\n", 5); + + return(0); +} diff --git a/sys/compile/Makefile b/sys/compile/Makefile index 4f28ac4..7dcd4ae 100644 --- a/sys/compile/Makefile +++ b/sys/compile/Makefile @@ -9,7 +9,7 @@ OBJS = null.o #Kernel Parts -KPARTS = ../arch/${_ARCH}/*.o ../init/*.o ../sys/*.o ../vmm/*.o ../lib/*.o ../kernel/*.o ../isa/*.o ../fs/vfs/*.o ../pci/*.o ../fs/devfs/*.o ../mpi/*.o ../fs/ufs/*.o ../fs/common/*.o ../net/net/*.o ../net/netif/*.o ../net/api/*.o ../net/core/*.o ../net/core/ipv4/*.o ../sde/*.o +KPARTS = ../arch/${_ARCH}/*.o ../init/*.o ../sys/*.o ../vmm/*.o ../lib/*.o ../kernel/*.o ../isa/*.o ../fs/vfs/*.o ../pci/*.o ../fs/devfs/*.o ../mpi/*.o ../fs/ufs/*.o ../fs/fat/*.o ../fs/common/*.o ../net/net/*.o ../net/netif/*.o ../net/api/*.o ../net/core/*.o ../net/core/ipv4/*.o ../sde/*.o # ../net/core/ipv6/*.o # ../fs/ubixfs/*.o # ../sde/*.o ../graphics/*.o ../ld/*.o -Ttext 0x30000 -Tdata 0x34000 ../ubixfs/*.o diff --git a/sys/fs/fat/API.txt b/sys/fs/fat/API.txt index 61fc164..666cbe5 100644 --- a/sys/fs/fat/API.txt +++ b/sys/fs/fat/API.txt @@ -1,22 +1,22 @@ -File IO Lib API --=-=-=-=-=-=-=-=- - -void fl_init(void) - - Called to initialize FAT IO library. - This should be called prior to any other functions. - -void fl_attach_locks(void (*lock)(void), void (*unlock)(void)) - - [Optional] File system thread safety locking functions. - For thread safe operation, you should provide lock() and unlock() functions. - Note that locking primitive used must support recursive locking, i.e lock() called within an already �locked� region. - -int fl_attach_media(fn_diskio_read rd, fn_diskio_write wr) - - This function is used to attach system specific disk/media access functions. - This should be done subsequent to calling fl_init() and fl_attach_locks() (if locking required). - -void fl_shutdown(void) - - Shutdown the FAT IO library. This purges any un-saved data back to disk. +File IO Lib API +-=-=-=-=-=-=-=-=- + +void fl_init(void) + + Called to initialize FAT IO library. + This should be called prior to any other functions. + +void fl_attach_locks(void (*lock)(void), void (*unlock)(void)) + + [Optional] File system thread safety locking functions. + For thread safe operation, you should provide lock() and unlock() functions. + Note that locking primitive used must support recursive locking, i.e lock() called within an already �locked� region. + +int fl_attach_media(fn_diskio_read rd, fn_diskio_write wr) + + This function is used to attach system specific disk/media access functions. + This should be done subsequent to calling fl_init() and fl_attach_locks() (if locking required). + +void fl_shutdown(void) + + Shutdown the FAT IO library. This purges any un-saved data back to disk. diff --git a/sys/fs/fat/fat_access.c b/sys/fs/fat/fat_access.c index e287082..795a7fc 100644 --- a/sys/fs/fat/fat_access.c +++ b/sys/fs/fat/fat_access.c @@ -1,34 +1,34 @@ -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -// FAT16/32 File IO Library -// V2.6 -// Ultra-Embedded.com -// Copyright 2003 - 2012 -// -// Email: admin@ultra-embedded.com -// -// License: GPL -// If you would like a version with a more permissive license for use in -// closed source commercial applications please contact me for details. -//----------------------------------------------------------------------------- -// -// This file is part of FAT File IO Library. -// -// FAT File IO Library is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// FAT File IO Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FAT File IO Library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// FAT16/32 File IO Library +// V2.6 +// Ultra-Embedded.com +// Copyright 2003 - 2012 +// +// Email: admin@ultra-embedded.com +// +// License: GPL +// If you would like a version with a more permissive license for use in +// closed source commercial applications please contact me for details. +//----------------------------------------------------------------------------- +// +// This file is part of FAT File IO Library. +// +// FAT File IO Library is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// FAT File IO Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with FAT File IO Library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- #include #include "fat_defs.h" #include "fat_access.h" diff --git a/sys/fs/fat/fat_defs.h b/sys/fs/fat/fat_defs.h index 5fe8d6a..0c2d2aa 100644 --- a/sys/fs/fat/fat_defs.h +++ b/sys/fs/fat/fat_defs.h @@ -1,6 +1,7 @@ #ifndef __FAT_DEFS_H__ #define __FAT_DEFS_H__ +#include "fat/fat.h" #include "fat_opts.h" #include "fat_types.h" diff --git a/sys/fs/fat/fat_filelib.c b/sys/fs/fat/fat_filelib.c index 2c4a236..354a352 100644 --- a/sys/fs/fat/fat_filelib.c +++ b/sys/fs/fat/fat_filelib.c @@ -1,35 +1,35 @@ -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -// FAT16/32 File IO Library -// V2.6 -// Ultra-Embedded.com -// Copyright 2003 - 2012 -// -// Email: admin@ultra-embedded.com -// -// License: GPL -// If you would like a version with a more permissive license for use in -// closed source commercial applications please contact me for details. -//----------------------------------------------------------------------------- -// -// This file is part of FAT File IO Library. -// -// FAT File IO Library is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// FAT File IO Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FAT File IO Library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -#include +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// FAT16/32 File IO Library +// V2.6 +// Ultra-Embedded.com +// Copyright 2003 - 2012 +// +// Email: admin@ultra-embedded.com +// +// License: GPL +// If you would like a version with a more permissive license for use in +// closed source commercial applications please contact me for details. +//----------------------------------------------------------------------------- +// +// This file is part of FAT File IO Library. +// +// FAT File IO Library is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// FAT File IO Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with FAT File IO Library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//#include #include #include "fat_defs.h" #include "fat_access.h" diff --git a/sys/fs/fat/fat_misc.c b/sys/fs/fat/fat_misc.c index cbf6f08..c373d1a 100644 --- a/sys/fs/fat/fat_misc.c +++ b/sys/fs/fat/fat_misc.c @@ -1,35 +1,34 @@ -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -// FAT16/32 File IO Library -// V2.6 -// Ultra-Embedded.com -// Copyright 2003 - 2012 -// -// Email: admin@ultra-embedded.com -// -// License: GPL -// If you would like a version with a more permissive license for use in -// closed source commercial applications please contact me for details. -//----------------------------------------------------------------------------- -// -// This file is part of FAT File IO Library. -// -// FAT File IO Library is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// FAT File IO Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FAT File IO Library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -#include +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// FAT16/32 File IO Library +// V2.6 +// Ultra-Embedded.com +// Copyright 2003 - 2012 +// +// Email: admin@ultra-embedded.com +// +// License: GPL +// If you would like a version with a more permissive license for use in +// closed source commercial applications please contact me for details. +//----------------------------------------------------------------------------- +// +// This file is part of FAT File IO Library. +// +// FAT File IO Library is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// FAT File IO Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with FAT File IO Library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- #include #include "fat_misc.h" diff --git a/sys/include/fat/fat.h b/sys/include/fat/fat.h index 8a26997..ba73fa7 100644 --- a/sys/include/fat/fat.h +++ b/sys/include/fat/fat.h @@ -1 +1,3 @@ -void init_fat(); + #define FAT_PRINTF(a) kprintf a + +int fat_init(); diff --git a/sys/init/main.c b/sys/init/main.c index b03d371..11a825b 100644 --- a/sys/init/main.c +++ b/sys/init/main.c @@ -178,8 +178,6 @@ /* kprintf("SDE Thread Start! [0x%X]\n", &sdeThread); */ /* execThread(&sdeThread, 0x2000,0x0); */ - while (1); - kprintf("Kernel Name: [%s], Boot How To [0x%X], Boot Dev: [0x%X]\n", _kernelname, _boothowto, _bootdev); kprintf("B_TYPE(0x%X), B_SLICE(0x%X), B_UNIT(0x%X), B_PARTITION(0x%X)\n", B_TYPE(_bootdev), B_SLICE(_bootdev), B_UNIT(_bootdev), B_PARTITION(_bootdev)); kprintf("_bootinfo.bi_version: 0x%X\n", _bootinfo.bi_version); @@ -187,7 +185,9 @@ kprintf("_bootinfo.bi_bios_dev: 0x%X\n", _bootinfo.bi_bios_dev); execThread(systemTask, 0x2000, 0x0); - execFile("sys:/bin/init", argv_init, envp_init, 0x0); /* OS Initializer */ + //execFile("sys:/bin/init", argv_init, envp_init, 0x0); /* OS Initializer */ + + execFile("fat:/shell", argv_init, envp_init, 0x0); irqEnable(0x0);