diff --git a/drivers/audio/a5536/driver.lds b/drivers/audio/a5536/driver.lds new file mode 100644 index 0000000000..8bb43eefae --- /dev/null +++ b/drivers/audio/a5536/driver.lds @@ -0,0 +1,56 @@ + + +OUTPUT_FORMAT(pei-i386) + +ENTRY("_drvEntry") + +SECTIONS +{ + . = SIZEOF_HEADERS; + . = ALIGN(__section_alignment__); + + .text __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) : + + { + *(.text) *(.rdata) + } + + .data ALIGN(__section_alignment__) : + { + *(.data) + } + + .bss ALIGN(__section_alignment__): + { + *(.bss) + *(COMMON) + } + + /DISCARD/ : + { + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + *(.edata) + } + + .idata ALIGN(__section_alignment__): + { + SORT(*)(.idata$2) + SORT(*)(.idata$3) + /* These zeroes mark the end of the import list. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + } + + .reloc ALIGN(__section_alignment__) : + { + *(.reloc) + } + +} + diff --git a/drivers/audio/a5536/geode.c b/drivers/audio/a5536/geode.c index d577676d9f..ff145cc77b 100644 --- a/drivers/audio/a5536/geode.c +++ b/drivers/audio/a5536/geode.c @@ -2,20 +2,13 @@ #define FORCED_PIO -#include "types.h" - +#include #include "pci.h" -#include "syscall.h" +#include #include "geode.h" -#define DEBUG - -#ifdef DEBUG - #define DBG(format,...) dbgprintf(format,##__VA_ARGS__) -#else - #define DBG(format,...) -#endif +#define DBG(format,...) dbgprintf(format,##__VA_ARGS__) #define BM0_IRQ 0x04 #define BM1_IRQ 0x08 @@ -470,7 +463,7 @@ Bool FindPciDevice() }; -u32_t __stdcall drvEntry(int action) +u32_t drvEntry(int action, char *cmdline) { u32_t retval; @@ -479,17 +472,15 @@ u32_t __stdcall drvEntry(int action) if(action != 1) return 0; -#ifdef DEBUG if(!dbg_open("/rd/1/drivers/geode.log")) { printf("Can't open /rd/1/drivers/geode.log\nExit\n"); return 0; } -#endif if( FindPciDevice() == FALSE) { - DBG("Device not found\n"); + dbgprintf("Device not found\n"); return 0; }; @@ -516,7 +507,7 @@ u32_t __stdcall drvEntry(int action) #define DEV_SET_MASTERVOL 6 #define DEV_GET_MASTERVOL 7 #define DEV_GET_INFO 8 - +#define DEV_GET_POS 9 int __stdcall srv_sound(ioctl_t *io) { @@ -551,6 +542,14 @@ int __stdcall srv_sound(ioctl_t *io) } break; + case DEV_GET_POS: + if(io->out_size==4) + { + *outp = ctrl_read_32(0x60)>>2; + return 0; + } + break; + default: return ERR_PARAM; }; diff --git a/drivers/audio/a5536/makefile b/drivers/audio/a5536/makefile index dd601dc94f..668f381264 100644 --- a/drivers/audio/a5536/makefile +++ b/drivers/audio/a5536/makefile @@ -2,14 +2,23 @@ CC = gcc FASM = e:/fasm/fasm.exe CFLAGS = -c -O2 -fomit-frame-pointer -fno-builtin-printf -LDRHD = -shared -T ld.x -s --file-alignment 32 +LDFLAGS = -nostdlib -shared -s -Map usb.map --image-base 0\ + --file-alignment 512 --section-alignment 4096 -INCLUDES = -I ../../include +DEFINES = -D__KERNEL__ -DCONFIG_X86_32 -HFILES:= ../../include/types.h \ - ../../include/syscall.h \ - ../../include/pci.h \ - geode.h +DRV_TOPDIR = $(CURDIR)/../.. + +DRV_INCLUDES = $(DRV_TOPDIR)/include + +INCLUDES = -I$(DRV_INCLUDES) \ + -I$(DRV_INCLUDES)/linux + +LIBPATH = $(DRV_TOPDIR)/ddk + +LIBS:= -lddk -lcore + +HFILES:= geode.h SRC_DEP:= GEODE_SRC:= amd_geode.h @@ -20,11 +29,11 @@ GEODE:= geode.dll all: $(GEODE) $(GEODE): geode.obj $(SRC_DEP) $(HFILES) Makefile - wlink name $(GEODE) SYS nt_dll lib libdrv op offset=0 op nod op maxe=25 op el op STUB=stub.exe op START=_drvEntry @$(NAME).lk + ld $(LDFLAGS) -L$(LIBPATH) -T driver.lds -o $@ geode.obj $(LIBS) kpack.exe geode.dll geode.drv geode.obj : geode.c $(SRC_DEP) $(HFILES) Makefile - $(CC) $(INCLUDES) $(CFLAGS) -o geode.obj geode.c + $(CC) $(DEFINES) $(INCLUDES) $(CFLAGS) -o geode.obj geode.c diff --git a/drivers/audio/a5536/pci.h b/drivers/audio/a5536/pci.h index 90a2efedc4..169deffd65 100644 --- a/drivers/audio/a5536/pci.h +++ b/drivers/audio/a5536/pci.h @@ -1,4 +1,8 @@ +typedef int Bool; + +#define TRUE 1 +#define FALSE 0 #pragma pack(push, 1) typedef struct