diff --git a/src/sys/deviceman/device.h b/src/sys/deviceman/device.h index 25ff524..6e982f1 100755 --- a/src/sys/deviceman/device.h +++ b/src/sys/deviceman/device.h @@ -1,86 +1,86 @@ -/* - "device.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 11, 2002 - - purpose: master header file for all things device related -*/ - -#ifndef _DEVICE_H -#define _DEVICE_H - -// maximum length of a device's name -#define MAX_DEVICE_NAMELEN (16) - -// maximum number of bus devices allowed -#define MAX_BUS_DEVICES (16) - -/* device types (for now, only bus devices allowed) */ -#define DEVICE_TYPE_UNKNOWN (0) -#define DEVICE_TYPE_BUS_ISA (1) -#define DEVICE_TYPE_BUS_PCI (2) - -/* device ISR or pseudo ISR */ -typedef int (* DEVICE_ISR)( void * p ); - -/* device IO routine */ -typedef int (* DEVICE_IO_RTN)( void * p ); - -/* device control routine */ -typedef int (* DEVICE_CTRL_RTN)( void * p ); - -/* ISA bus device structure */ -typedef struct tagDEVICE_ISA -{ - /* bus resources assigned to device */ - BUS_RESOURCES br; - - /* ISRs for device */ - DEVICE_ISR * apfn_isr[BI_MAX_IRQS]; - - /* device IO routine (kernel/driver use only) */ - DEVICE_IO_RTN pfn_io; - - /* device control routine (kernel/driver use only) */ - DEVICE_CTRL_RTN pfn_ctrl; -} -DEVICE_BUS_ISA; - -/* PCI bus device structure */ -/* TODO */ -typedef struct tagDEVICE_BUS_PCI -{ - int dummy; -} -DEVICE_PCI; - -/* bus device structure */ -typedef union tagDEVICE_BUS -{ - DEVICE_BUS_ISA isa; - DEVICE_BUS_PCI pci; -} -DEVICE_BUS; - -/* device structure */ -typedef struct tagDEVICE -{ - /* type of device */ - BYTEg type; - - /* pointer to actual device specific structure */ - void * p; -} -DEVICE; - -/* global kernel structure for device information */ -typedef struct tagDEVICES -{ - /* bus devices */ - DEVICE a_isa[MAX_BUS_DEVICES]; -} -DEVICES; - -#endif /* _DEVICE_H */ \ No newline at end of file +/* + "device.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 11, 2002 + + purpose: master header file for all things device related +*/ + +#ifndef _DEVICE_H +#define _DEVICE_H + +// maximum length of a device's name +#define MAX_DEVICE_NAMELEN (16) + +// maximum number of bus devices allowed +#define MAX_BUS_DEVICES (16) + +/* device types (for now, only bus devices allowed) */ +#define DEVICE_TYPE_UNKNOWN (0) +#define DEVICE_TYPE_BUS_ISA (1) +#define DEVICE_TYPE_BUS_PCI (2) + +/* device ISR or pseudo ISR */ +typedef int (* DEVICE_ISR)( void * p ); + +/* device IO routine */ +typedef int (* DEVICE_IO_RTN)( void * p ); + +/* device control routine */ +typedef int (* DEVICE_CTRL_RTN)( void * p ); + +/* ISA bus device structure */ +typedef struct tagDEVICE_ISA +{ + /* bus resources assigned to device */ + BUS_RESOURCES br; + + /* ISRs for device */ + DEVICE_ISR * apfn_isr[BI_MAX_IRQS]; + + /* device IO routine (kernel/driver use only) */ + DEVICE_IO_RTN pfn_io; + + /* device control routine (kernel/driver use only) */ + DEVICE_CTRL_RTN pfn_ctrl; +} +DEVICE_BUS_ISA; + +/* PCI bus device structure */ +/* TODO */ +typedef struct tagDEVICE_BUS_PCI +{ + int dummy; +} +DEVICE_PCI; + +/* bus device structure */ +typedef union tagDEVICE_BUS +{ + DEVICE_BUS_ISA isa; + DEVICE_BUS_PCI pci; +} +DEVICE_BUS; + +/* device structure */ +typedef struct tagDEVICE +{ + /* type of device */ + BYTEg type; + + /* pointer to actual device specific structure */ + void * p; +} +DEVICE; + +/* global kernel structure for device information */ +typedef struct tagDEVICES +{ + /* bus devices */ + DEVICE a_isa[MAX_BUS_DEVICES]; +} +DEVICES; + +#endif /* _DEVICE_H */ diff --git a/src/sys/drivers/Makefile b/src/sys/drivers/Makefile index 96bcc4f..fc27141 100755 --- a/src/sys/drivers/Makefile +++ b/src/sys/drivers/Makefile @@ -14,7 +14,7 @@ REMOVE = rm -fr # Objects -OBJS = video.o 8259.o keyboard.o +OBJS = video.o 8259.o keyboard.o fdc.o all: $(OBJS) diff --git a/src/sys/drivers/fdc.c b/src/sys/drivers/fdc.c new file mode 100755 index 0000000..dab9e30 --- /dev/null +++ b/src/sys/drivers/fdc.c @@ -0,0 +1,68 @@ +/************************************************************************************** + Copyright (c) 2002 + The UbixOS Project + + $Id$ +**************************************************************************************/ + +#include +#include +#include +#include +#include +#include + +static volatile BOOL done = FALSE; + +void initFloppy() { + setVector(floppyIsr, mVec+6, (dInt+dPresent+dDpl1)); + enableIrq(6); + } + +asm( + ".globl floppyIsr \n" + "floppyIsr: \n" + " pusha \n" + " pushw %ds \n" + " pushw %es \n" + " pushw %ss \n" + " pushw %ss \n" + " popw %ds \n" + " popw %es \n" + " call floppyIsrhndlr \n" + " popw %es \n" + " popw %ds \n" + " popa \n" + " iret \n" + ); + +void floppyIsrhndlr() { + done = TRUE; + outportByte(0x20,0x20); + } + +void sendByte(int byte) { + volatile int msr; + int tmo; + for (tmo=0;tmo<128;tmo++) { + msr = inportByte(fdcMsr); + if ((msr & 0xc0) == 0x80) { + outportByte(fdcData,byte); + return; + } + inportByte(0x80); + } + } + +int getByte() { + volatile int msr; + int tmo; + for (tmo=0;tmo<128;tmo++) { + msr = inportByte(fdcMsr); + if ((msr & 0xd0) == 0xd0) { + return inportByte(fdcData); + } + inportByte(0x80); + } + return(-1); + } \ No newline at end of file diff --git a/src/sys/include/drivers/fdc.h b/src/sys/include/drivers/fdc.h new file mode 100755 index 0000000..770a4a4 --- /dev/null +++ b/src/sys/include/drivers/fdc.h @@ -0,0 +1,21 @@ +/************************************************************************************** + Copyright (c) 2002 + The UbixOS Project + + $Id$ +**************************************************************************************/ + +#ifndef _FDC_H +#define _FDC_H + + +#define fdcMsr (0x3f4) +#define fdcData (0x3f5) + +void initFloppy(); +void floppyIsr(); +void floppyIsrhndlr(); +void sendByte(int byte); +int getByte(); + +#endif \ No newline at end of file diff --git a/src/sys/include/ubixos/schedule.h b/src/sys/include/ubixos/schedule.h index bad2660..601d5c6 100755 --- a/src/sys/include/ubixos/schedule.h +++ b/src/sys/include/ubixos/schedule.h @@ -8,8 +8,6 @@ #ifndef _SCHEDULE_H #define _SCHEDULE_H -#define LATCH (1193180/500) - #define numTasks 1024 #define RUNABLE 3 #define ACTIVE 2 diff --git a/src/sys/include/ubixos/types.h b/src/sys/include/ubixos/types.h new file mode 100755 index 0000000..c619c20 --- /dev/null +++ b/src/sys/include/ubixos/types.h @@ -0,0 +1,13 @@ +/************************************************************************************** + Copyright (c) 2002 + The UbixOS Project + + $Id$ +**************************************************************************************/ + +#ifndef _TYPES_H +#define _TYPES_H + +typedef enum { FALSE=0,TRUE=1 } BOOL; + +#endif \ No newline at end of file diff --git a/src/sys/init/main.c b/src/sys/init/main.c index ff984ce..72b93cd 100755 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,7 @@ initIdt(); //Initialize IDT initKeyboard(); //Initialize Keyboard initScheduler(); //Initialize Scheduler + initFloppy(); //Initialize Floppy Controller execThread(test,0xAFFF,"Test Thread"); execThread(test2,0xBFFF,"Test Thread2"); enableIrq(0); diff --git a/src/sys/kernel/schedule.c b/src/sys/kernel/schedule.c index 2c03f1b..cc3f7ca 100755 --- a/src/sys/kernel/schedule.c +++ b/src/sys/kernel/schedule.c @@ -29,9 +29,6 @@ } currentProc = -1; setVector(timerInt, mVec, (dInt + dPresent + dDpl3)); - outportByte(0x36,0x43); /* binary, mode 3, LSB/MSB, ch 0 */ - outportByte(LATCH & 0xff , 0x40); /* LSB */ - outportByte(LATCH >> 8 , 0x40); /* MSB */ } /* Finds A Free Task */ diff --git a/ubixos.kdevprj b/ubixos.kdevprj index d8022c7..4edfbd4 100755 --- a/ubixos.kdevprj +++ b/ubixos.kdevprj @@ -27,13 +27,12 @@ [General] AMChanged=false author=Christopher Olsen -configure_args= dir_where_make_will_be_called=./ email=Chris@DomainAtlantic.com kdevprj_version=1.3 lfv_open_groups=Others make_options=\s-j1 clean all install -makefiles=./Makefile.am,src/Makefile.am,src/sys/Makefile.am,src/sys/include/Makefile.am,src/lib/Makefile.am,src/lib/libc/Makefile.am,src/lib/libc/include/Makefile.am,src/bin/Makefile.am,src/bin/shell/Makefile.am,Makefile.am,src/sys/boot/Makefile.am,src/sys/init/Makefile.am,src/sys/include/ubixos/Makefile.am,src/sys/drivers/Makefile.am,src/sys/kernel/Makefile.am,src/sys/compile/Makefile.am,src/sys/include/version/Makefile.am,src/sys/include/drivers/Makefile.am,src/sys/vmm/Makefile.am,src/sys/include/vmm/Makefile.am,src/grayspace-misc/Makefile.am +makefiles=./Makefile.am,src/Makefile.am,src/sys/Makefile.am,src/sys/include/Makefile.am,src/lib/Makefile.am,src/lib/libc/Makefile.am,src/lib/libc/include/Makefile.am,src/bin/Makefile.am,src/bin/shell/Makefile.am,Makefile.am,src/sys/boot/Makefile.am,src/sys/init/Makefile.am,src/sys/include/ubixos/Makefile.am,src/sys/drivers/Makefile.am,src/sys/kernel/Makefile.am,src/sys/compile/Makefile.am,src/sys/include/version/Makefile.am,src/sys/include/drivers/Makefile.am,src/sys/vmm/Makefile.am,src/sys/include/vmm/Makefile.am modifyMakefiles=true project_name=UbixOS project_type=normal_empty @@ -71,7 +70,7 @@ [src/Makefile.am] files= -sub_dirs=sys,lib,bin,grayspace-misc +sub_dirs=sys,lib,bin, type=normal [src/bin/Makefile.am] @@ -82,17 +81,6 @@ sub_dirs= type=normal -[src/grayspace-misc/Makefile.am] -files=src/grayspace-misc/gsdefines.h -sub_dirs= -type=normal - -[src/grayspace-misc/gsdefines.h] -dist=true -install=false -install_location= -type=HEADER - [src/lib/Makefile.am] sub_dirs=libc, type=normal @@ -177,10 +165,16 @@ type=DATA [src/sys/drivers/Makefile.am] -files=src/sys/drivers/Makefile,src/sys/drivers/video.c,src/sys/drivers/8259.c,src/sys/drivers/keyboard.c +files=src/sys/drivers/Makefile,src/sys/drivers/video.c,src/sys/drivers/8259.c,src/sys/drivers/keyboard.c,src/sys/drivers/fdc.c sub_dirs= type=static_library +[src/sys/drivers/fdc.c] +dist=true +install=false +install_location= +type=SOURCE + [src/sys/drivers/keyboard.c] dist=true install=false @@ -205,10 +199,16 @@ type=HEADER [src/sys/include/drivers/Makefile.am] -files=src/sys/include/drivers/video.h,src/sys/include/drivers/8259.h,src/sys/include/drivers/keyboard.h +files=src/sys/include/drivers/video.h,src/sys/include/drivers/8259.h,src/sys/include/drivers/keyboard.h,src/sys/include/drivers/fdc.h sub_dirs= type=static_library +[src/sys/include/drivers/fdc.h] +dist=true +install=false +install_location= +type=HEADER + [src/sys/include/drivers/keyboard.h] dist=true install=false @@ -228,7 +228,7 @@ type=HEADER [src/sys/include/ubixos/Makefile.am] -files=src/sys/include/ubixos/gdt.h,src/sys/include/ubixos/io.h,src/sys/include/ubixos/idt.h,src/sys/include/ubixos/exec.h,src/sys/include/ubixos/schedule.h +files=src/sys/include/ubixos/gdt.h,src/sys/include/ubixos/io.h,src/sys/include/ubixos/idt.h,src/sys/include/ubixos/exec.h,src/sys/include/ubixos/schedule.h,src/sys/include/ubixos/types.h sub_dirs= type=normal @@ -262,6 +262,12 @@ install_location= type=HEADER +[src/sys/include/ubixos/types.h] +dist=true +install=false +install_location= +type=HEADER + [src/sys/include/version/Makefile.am] files=src/sys/include/version/version.h sub_dirs=