geode: DEV_GET_POS call done right

git-svn-id: svn://kolibrios.org@1695 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2010-11-10 05:17:31 +00:00
parent ebad3e1b67
commit 137b1fee08
3 changed files with 9 additions and 25 deletions

View File

@ -48,6 +48,7 @@ typedef struct
int CurrentPowerState;
addr_t buffer;
addr_t buffer_dma;
addr_t prd_dma;
addr_t irq_line;
@ -245,6 +246,7 @@ Bool init_device()
addr_t buffer = geode.buffer;
addr_t dma = GetPgAddr(geode.buffer);
geode.buffer_dma = dma;
geode.prd_dma = (((addr_t)prd_tab) & 4095) + GetPgAddr((void*)prd_tab);
@ -478,6 +480,8 @@ u32_t drvEntry(int action, char *cmdline)
return 0;
}
printf("AMD Geode CS5536 audio driver\n");
if( FindPciDevice() == FALSE)
{
dbgprintf("Device not found\n");
@ -545,7 +549,10 @@ int __stdcall srv_sound(ioctl_t *io)
case DEV_GET_POS:
if(io->out_size==4)
{
*outp = ctrl_read_32(0x60)>>2;
u32_t dma;
dma = ctrl_read_32(0x60);
dma-= geode.buffer_dma;
*outp = (dma & 16383)>>2;
return 0;
}
break;

View File

@ -1,23 +0,0 @@
IMP
_KernelAlloc core.KernelAlloc,
_KernelFree core.KernelFree,
_CommitPages core.CommitPages,
_MapIoMem core.MapIoMem,
_GetPgAddr core.GetPgAddr,
_CreateRingBuffer core.CreateRingBuffer,
_PciApi core.PciApi,
_PciRead8 core.PciRead8,
_PciRead16 core.PciRead16,
_PciRead32 core.PciRead32,
_PciWrite8 core.PciWrite8,
_PciWrite16 core.PciWrite16,
_PciWrite32 core.PciWrite32,
_RegService core.RegService,
_AttachIntHandler core.AttachIntHandler,
_SysMsgBoardStr core.SysMsgBoardStr,
_Delay core.Delay
FIL geode.obj,
vsprintf.obj,
icompute.obj

View File

@ -2,7 +2,7 @@
CC = gcc
FASM = e:/fasm/fasm.exe
CFLAGS = -c -O2 -fomit-frame-pointer -fno-builtin-printf
LDFLAGS = -nostdlib -shared -s -Map usb.map --image-base 0\
LDFLAGS = -nostdlib -shared -s -Map geode.map --image-base 0\
--file-alignment 512 --section-alignment 4096
DEFINES = -D__KERNEL__ -DCONFIG_X86_32