diff --git a/src/sys/deviceman/bus.h b/src/sys/deviceman/bus.h deleted file mode 100755 index aa04f12..0000000 --- a/src/sys/deviceman/bus.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - "bus.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 11, 2002 - - purpose: master header file for all things BUS related -*/ - -#ifndef _BUS_H -#define _BUS_H - -/* Intel 32-bit architecture */ -#if TCPU_IA32 - -/* DMA channels */ -#define MIN_DMA_CHANNEL (0) -#define MAX_DMA_CHANNEL (7) -#define NUM_DMA_CHANNELS (MAX_DMA_CHANNEL - MIN_DMA_CHANNEL - 1) - -/* IRQs */ -#define MIN_IRQ (0) -#define MAX_IRQ (15) -#define NUM_IRQS (MAX_IRQ - MIN_IRQ - 1) - -/* Port IO Range */ -#define MIN_PORTIO_ADDR (0) -#define MAX_PORTIO_ADDR (65535) -#define MAXBITS_PORTIO_ADDR (16) - -/* NOTE: 'BI_' denotes roughly something related to BUS info */ - -/* for building/use-with device-info/bus-resource-info structures */ -#define BI_NUMBITS_IRQS (4) -#define BI_NUMBITS_DMA_CHANNELS (3) -#define BI_IRQ_BIT (0) -#define BI_DMA_CHANNEL_BIT (BI_IRQ_BIT + BI_NUMBITS_IRQS) - -#define BI_IRQ_MASK\ - MAKEMASK_GS( BI_NUMBITS_IRQS, BI_IRQ_BIT ) -#define BI_DMA_CHANNEL_MASK\ - MAKEMASK_GS( BI_NUMBITS_DMA_CHANNELS, BI_DMA_CHANNEL_BIT ) - -#define BI_NUMBITS_PORTIO_BASEADDR (16) -#define BI_NUMBITS_PORTIO_OVERADDR (16) -#define BI_PORTIO_BASEADDR_BIT (0) -#define BI_PORTIO_OVERADDR_BIT ( BI_PORTIO_BASEADDR_BIT\ - + BI_NUMBITS_PORTIO_BASEADDR ) -#define BI_PORTIO_BASEADDR_MASK\ - MAKEMASK_GS( BI_NUMBITS_PORTIO_BASEADDR, BI_PORTIO_BASEADDR_BIT ) -#define BI_PORTIO_OVERADDR_MASK\ - MAKEMASK_GS( BI_NUMBITS_PORTIO_OVERADDR, BI_PORTIO_OVERADDR_BIT ) - -/* maximum number of DMAs and IRQs a device can use - NOTE: *must* be same */ -#define BI_MAX_DMAANDIRQS (2) -#define BI_MAX_DMAS (BI_MAX_DMAANDIRQS) -#define BI_MAX_IRQS (BI_MAX_DMAANDIRQS) - -/* maximum number of Port IO ranges a device can use */ -#define BI_MAX_PORTIO_RANGES (4) - -/* structure for storing a device's bus resources */ -typedef struct tagBUS_RESOURCES -{ - /* DMA and IRQ info */ - BYTEg a_dmairq[BI_MAX_DMAANDIRQS]; - - /* - bits [0,1] number of IRQs used - bits [2,3] number of DMA channels used - bits [4,7] number of port IO ranges used - */ - BYTEg resource_counts; - - /* Port IO Ranges */ - DWORDg a_portiorange[BI_MAX_PORTIO_RANGES]; -} -BUS_RESOURCES; - -/* NOTE: 'BUS_RES' denotes interface functions/macros on - the 'BUS_RESOURCES' structure */ - -#if (BI_IRQ_BIT == 0) - /* get IRQ 'idx' from resource description 'br' */ - #define BUS_RES_GETIRQ( br, idx ) ((br).a_dmairq[(idx)]&BI_IRQ_MASK) - - /* set IRQ 'idx' in resource description 'br' to 'irq' */ - #define BUS_RES_SETIRQ( br, idx, irq )\ - (br).a_dmairq[(idx)] &= BI_IRQ_MASK;\ - (br).a_dmairq[(idx)] |= (irq) -#else - /* get IRQ 'idx' from resource description 'br' */ - #define BUS_RES_GETIRQ( br, idx )\ - GETBITVAL_GS( (br).a_dmairq[(idx)], BI_IRQ_MASK, BI_IRQ_BIT ) - - /* set IRQ 'idx' in resource description 'br' to 'irq' */ - #define BUS_RES_SETIRQ( br, idx, irq )\ - SETBITVAL_FAST_GS( (br).a_dmairq[(idx)],\ - BI_IRQ_MASK,\ - BI_IRQ_BIT,\ - (irq) ) -#endif - -/* get DMA 'idx' from resource description 'br' */ -#define BUS_RES_GETDMA( br, idx )\ - GETBITVAL_GS( (br).a_dmairq[(idx)], BI_DMA_MASK, BI_DMA_BIT ) - -/* set DMA 'idx' in resource description 'br' to 'dma' */ -#define BUS_RES_SETDMA( br, idx, dma )\ - SETBITVAL_FAST_GS( (br).a_dmairq[(idx)],\ - BI_DMA_MASK,\ - BI_DMA_BIT,\ - (dma) ) - -#if (BI_PORTIO_BASEADDR_BIT == 0) && (BI_PORTIO_OVERADDR_BIT == BI_NUMBITS_PORTIO_BASEADDR ) - /* get port IO base address 'idx' from resource description 'br' */ - #define BUS_RES_GETPORTIOBASE( br, idx )\ - ((br).a_portiorange[(idx)]&BI_PORTIO_BASEADDR_MASK) - - /* get port IO 'over' address 'idx' from resource description 'br' */ - #define BUS_RES_GETPORTIOOVER( br, idx )\ - ((br).a_portiorange[(idx)]>>BI_PORTIO_OVERADDR_BIT) - - /* get port IO range 'idx' from resource description 'br' - into 'baseaddr_o' and 'overaddr_o' */ - #define BUS_RES_GETPORTIORANGE( br, idx, baseaddr_o, overaddr_o )\ - (baseaddr_o)\ - = ((br).a_portiorange[(idx)] & BI_PORTIO_BASEADDR_MASK);\ - (overaddr_o)\ - = ((br).a_portiorange[(idx)] >> BI_PORTIO_OVERADDR_BIT) - - /* set port IO range 'idx' in resource description 'br' - to 'baseaddr' and 'overaddr' */ - #define BUS_RES_SETPORTIORANGE( br, idx, baseaddr, overaddr )\ - ((br).a_portiorange[(idx)]\ - = ((overaddr)<>2) -/* set number of IRQs used/assign-to device */ -#define BUS_RES_SETIRQSUSED( br, irqsused )\ - (br).resource_counts &= ~0x0C;\ - (br).resource_counts |= ((irqsused)<<2) - -/* get number of DMAs used/assign-to device */ -#define BUS_RES_GETDMASUSED( br )\ - ((br).resource_counts & 3) -/* set number of DMAs used/assign-to device */ -#define BUS_RES_SETDMASUSED( br, dmasused )\ - (br).resource_counts &= ~3;\ - (br).resource_counts |= (dmasused) - -/* get number of port IO ranges used/assign-to device */ -#define BUS_RES_GETPORTIORANGESUSED( br )\ - (((br).resource_counts)>>4) -/* get number of port IO ranges used/assign-to device */ -#define BUS_RES_SETPORTIORANGESUSED( br, rangesused )\ - (br).resource_counts &= 0x0F;\ - (br).resource_counts |= ((rangesused)<<4) - -#else /* #if TCPU_IA32 */ - -#error unknown target CPU!!! - -#endif /* #if TCPU_??? */ - -#endif /* _BUS_H */ \ No newline at end of file diff --git a/src/sys/deviceman/bus_resources_portio.c b/src/sys/deviceman/bus_resources_portio.c index d77534e..73b7c9c 100755 --- a/src/sys/deviceman/bus_resources_portio.c +++ b/src/sys/deviceman/bus_resources_portio.c @@ -10,8 +10,9 @@ $Id$ */ -#include "gsdefines.h" -#include "misc_bit_array.h" +#include "../../grayspace-misc/gsdefines.h" +#include "../../sys/include/misc/misc_bit_array.h" +#include "../../sys/include/deviceman/bus_resources.h" /* checks a range of port addresses returns: diff --git a/src/sys/deviceman/device.h b/src/sys/deviceman/device.h deleted file mode 100755 index 6e982f1..0000000 --- a/src/sys/deviceman/device.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - "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/include/deviceman/bus_resources.h b/src/sys/include/deviceman/bus_resources.h index 181dd5d..f2f2124 100755 --- a/src/sys/include/deviceman/bus_resources.h +++ b/src/sys/include/deviceman/bus_resources.h @@ -214,4 +214,6 @@ #endif /* #if TCPU_??? */ +#include "bus_resources_portio.h" + #endif /* _BUS_RESOURCES_H */ \ No newline at end of file diff --git a/src/sys/misc/kernel_string_pool.c b/src/sys/misc/kernel_string_pool.c index 79c732a..d703e90 100755 --- a/src/sys/misc/kernel_string_pool.c +++ b/src/sys/misc/kernel_string_pool.c @@ -19,8 +19,8 @@ $Id$ */ -#include "gsdefines.h" -#include "kernel_string_pool.h" +#include "../../grayspace-misc/gsdefines.h" +#include "../../sys/include/misc/kernel_string_pool.h" // returns pointer to character *after* substring read static char * ReadSubString( char * p_dst, const BYTEg * p_substr ) diff --git a/src/sys/misc/kernel_string_pool.h b/src/sys/misc/kernel_string_pool.h deleted file mode 100755 index f3e7a26..0000000 --- a/src/sys/misc/kernel_string_pool.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - "kernel_string_pool.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 11, 2002 - - purpose: to provide a mechanism for maintaining a pool of strings - for use by the kernel without unnecessary waste of memory - - NOTEs: - - for now only ASCII is supported - - done quickly, pretty hacky - - TODO: - - expand to support unicode - - use huffman encoding instead -*/ - -#ifndef _KERNEL_STRING_POOL_H -#define _KERNEL_STRING_POOL_H - -/* memory FORMAT of a 'KRNSTR': (quick and dirty for now) - - an 'ID' is used to indicate a string within the pool - ---------------------------------------------------- - - 'ID' - [DWORD]: - - 'num-words' - bits [0,7] - - number of 'KRNWORD's in the string is 'num-words' + 1 - - bits [8,32] BYTE offset inside pool where the 'KRNSTR' - (kernel string) is stored - - 'KRNSTR's (kernel strings) are specified as an array of continuous BYTEs - ------------------------------------------------------------------------ - - 'KRNSTR': - - [KRNWORD] x 'num-words' (given by ID) - - 'KRNWORD': - - [BYTE] 'key1' - - - if key1 == [0,254]: - - key1 is the index of the 'sub-string' in the pool - - - otherwise key1 is an escape sequence and implies: - - [BYTE] 'key2' - - [BYTE] 'key3' - - the index of the 'sub-string' in the pool is key2*256 + key3 + 255 - - - NOTE: the reason for using two extra 8-bit keys instead of a 16-bit - value is in case we port to platform with data alignment exceptions - and this stuff is left dormant and never changed - - - NOTE: a 'space' (0x20) is implied between each 'KRNWORD', therefore - it is not currently possible to break encode string AB into substrings - A & B if AB does not contain any spaces - - - a 'sub-string' is found by using the the index of the - 'sub-string' in the pool to get an offset into an array - of continuous BYTEs via lookup - - 'sub-string's are specified as an array of continuous BYTEs - ----------------------------------------------------------- - - - a 'sub-string' is as follows: - - - [BYTE] 'numchars' [0,255] -> [1,256] - - [BYTE] x 'numchars' (the chars themselves) - - - WARNING: empty 'sub-string's are not allowed - -*/ - -/* WARNING: it is *assumed* any 'ID' given to a kernel - string pool function will be valid!! */ - -/* structure for kernel string pool */ -typedef struct tagKSTR_POOL -{ - /* pointer to where the kernel strings are stored */ - const BYTEg * p_krnstrs; - - /* pointer to where the sub strings are stored */ - const BYTEg * p_substrs; - - /* lookup table for substring offsets */ - const unsigned int * p_substr_off; -} -KSTR_POOL; - -/* the reason for this structure format is so that a tool - can be written which can generate a 'KSTR_POOL' from a configuration - file and place it into a 'C' source and header file pair as static data */ - -// gets the substring indicated by 'id' from the pool 'p_ksp' into 'p_dst' -// - returns pointer to 'p_dst' -char * KSTR_POOL_GetString( KSTR_POOL * p_ksp, char * p_dst, DWORDg id ); - -#endif /* _KERNEL_STRING_POOL_H */ \ No newline at end of file diff --git a/src/sys/misc/misc_bit_array.c b/src/sys/misc/misc_bit_array.c index 9271d12..07611e8 100755 --- a/src/sys/misc/misc_bit_array.c +++ b/src/sys/misc/misc_bit_array.c @@ -10,15 +10,14 @@ $Id$ */ -#include "gsdefines.h" -#include "misc_bit_array.h" -#include "bus_resources_portio.h" +#include "../../grayspace-misc/gsdefines.h" +#include "../../sys/include/misc/misc_bit_array.h" int BIT_ARRAY_IsRangeEmpty( BIT_ARRAY_RANGE_PARAMS * p_rp ) { p_rp->p_curdw = p_rp->p_firstdw; - if( !(p_rp->premask & *(p_rp->p_curdw) ) + if( !(p_rp->premask & *(p_rp->p_curdw)) ) { if( p_rp->premask ) {