flat assembler
Message board for the users of flat assembler.
Index
> Windows > EC I/O synchronisation |
Author |
|
r22 09 Sep 2009, 16:24
alphonso, perhaps you should post the code your using. Does winring0 put a cli sti around the code you execute through it, it could be something as simple as that.
|
|||
09 Sep 2009, 16:24 |
|
Alphonso 10 Sep 2009, 04:04
Well my code is a bit messy at the moment, I've tried to clean up the 'read EC byte routine' to post but WinRing0 does the dirty work. We just need to pass the port number and either the data byte or storage location depending whether we're writing or reading. AFAIK there is no encapsulated CLI/STI.
Code: ;------------------------------------------- proc GetEcByte inc [FailECB] ;Fail Flag for reading EC Byte @@: invoke ReadIoPortByteEx,66h,PByte ;Read EC CMD/Status Register cmp eax,0 je Fail ;WinRing0.dll call failed mov al,byte[PByte] and al,7bh ;Mask input bits cmp al,0 ;Nothing pending je @f cmp al,8 ;Seems something writes a command to the EC and never finishes off ;if we don't ignore this first time we never get any EC data. ;Once we're talking all seems to go as expected !?! jne Fail ;Some other flag set so we just give up talking to the EC this time round @@: invoke WriteIoPortByteEx,66h,80h ;Send 'Read Byte' command (0x80) to EC CMD/Status port 0x66 via WingRing0.dll cmp eax,0 je Fail ;WinRing0.dll call failed @@: invoke ReadIoPortByteEx,66h,PByte ;Read EC CMD/Status port 0x66 to PByte cmp eax,0 je Fail mov al,byte[PByte] and al,1 shl 1 ;Check if Bit 1 Input Buffer Full (IBF = 0) ie EC has read command jnz @b invoke WriteIoPortByteEx,62h,[OffSet] ;Set Byte position Offset that we wish to read cmp eax,0 je Fail @@: invoke ReadIoPortByteEx,66h,PByte cmp eax,0 je Fail mov al,byte[PByte] cmp al,1 shl 1 ;Check if Bit 1 Input Buffer Full (IBF = 0) ie EC has read command ;Maybe we can skip this and just check for data jnz @b @@: invoke ReadIoPortByteEx,66h,PByte cmp eax,0 je Fail mov al,byte[PByte] cmp al,1 shl 0 ;Check if Bit 0 Output Buffer Full (OBF = 1) ie EC has sent data byte jne @b invoke ReadIoPortByteEx,62h,ECByte ;Read the data byte and save in ECByte cmp eax,0 je Fail mov [FailECB],0 ;Clear the fail flag, ie we were successful Fail: ret endp ;------------------------------------------- I think it's strange that when I go to read the EC cmd/status register for the first time bit 3 (CMD) is set which I think means something sent a command to the EC but never finished off. I'm wondering if I need to use the ACPI GlobalLock to get the synchronisation while accessing the EC. I did think about writing my own driver but quickly decided my ability and patience wasn't up to it so wimped out. Besides WinRing0 seems to offer what I need plus it's certified too. |
|||
10 Sep 2009, 04:04 |
|
r22 10 Sep 2009, 16:03
You should really try the code in your own driver. There are a lot of Win 32 driver examples just plug your code into one of the sources compile and run the scmanager util. If it doesn't cause the event to be fired you know it's winring0's fault.
|
|||
10 Sep 2009, 16:03 |
|
Alphonso 11 Sep 2009, 04:32
Yeah, I guess I should but with drivers heading towards having to be certified it takes away some of the enthusiasm. There are still some other tests that I will probably do before though. Thanks for the input.
|
|||
11 Sep 2009, 04:32 |
|
phpdevpad 29 Jan 2013, 21:02
How can you include winring0 into fasm?
|
|||
29 Jan 2013, 21:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.