Re: Serial Driver mod
From: Michael--J (MichaelJ_at_discussions.microsoft.com)
Date: 08/22/04
- Next message: Frederic Sakr: "Drawing on PDA problem"
- Previous message: Jeff Rosenfeld: "Re: newbie: USB cable"
- In reply to: David Liao \(MS\): "Re: Serial Driver mod"
- Next in thread: Michael--J: "Re: Serial Driver mod"
- Reply: Michael--J: "Re: Serial Driver mod"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 22 Aug 2004 16:53:01 -0700
I see what you are saying.
But if i were to use that static buffer to hold my signature, how would
insert it in the API buffer associated with the API call to ReadFile() which
is called from my C# application?
Correct me if im wrong but this driver seems to be closely tied in with the
CE kernel, and i am not very familiar with programming in that environment.
"David Liao (MS)" wrote:
> RoomLeft may smaller than 6. You have to take this account.
> You can use static buffer to recode your extra data when error occor.
> Sent out data in static buffer first if there is any data and RoomLeft is
> not zero and decrement RoomLeft after writing one byte to the buffer.
>
> David Liao.
>
> "Michael--J" <MichaelJ@discussions.microsoft.com> wrote in message
> news:306DA021-1DDB-4D79-B89E-9616F1F20F6F@microsoft.com...
> > Hello,
> >
> > Im trying to modify the serial driver that comes with Platform Builder 4.2
> > so that an app i wrote in C# can detect ALL parity errors (it can't detect
> > all without modification because data is coming in so fast, the app misses
> > parity events raised by the driver).
> >
> > The main files that i'm looking at are ser16550.c and mdd.c. In
> > ser16550.c,
> > i modified the Receive Char Interrupt handler - SL_RxIntr, such that if a
> > parity error was detected it would add a 6-byte signature in front of the
> > associated byte. The signature i used was 0xF0-0x02-0x07-0xE4-0x19-0xF5
> > which
> > was a randomly created by me. My C# app which will run on my x86 device
> > basically searches for this signature and if it finds one, it knows that
> > the
> > byte following the signature had a parity error.
> >
> > This kinda worked, but occasionally, the data gets corrupted by the
> > driver.
> > I dont know exactly how the driver corrupts it but i have a sinking
> > feeling
> > it has something to do with my mod. At times i notice that a portion of
> > the
> > signature replaces bytes in the stream thus corrupting it.
> >
> > Since i am adding an extra 6 bytes into the stream everytime the driver
> > detects a parity error, the underlying buffer that the driver uses to
> > write
> > incoming bytes needs to be dynamically adjusted to account for this. I
> > just
> > dont know how to do it. To explain, this is normally what happens when the
> > driver has available bytes to be read:
> >
> > - it calls the SL_RxIntr to handle the received bytes, specifying the
> > amount
> > of room it has left in its write buffer using the variable RoomLeft.
> > - SL_RxIntr loops RoomLeft times with each loop reading a byte from the
> > receive register.
> >
> > SL_RxIntr(RoomLeft){
> > while(RoomLeft){
> > ReadLSR();
> > if(data available)
> > read the register;
> > else
> > break;
> >
> > write the byte to writeBuffer;
> > RoomLeft--;
> > }
> > }
> >
> > This is just a short version of it. I modified this to:
> >
> > SL_RxIntr(RoomLeft){
> > while(RoomLeft){
> >
> > if(parity error){
> > insert signature into writeBuffer;
> > RoomLeft = RoomLeft - 6;
> >
> > ReadLSR();
> > // Read the associated byte which has a parity error
> > if(data available){
> > read the register;
> > write the byte to writeBuffer;
> > break; // I break here so that i dont subtract RoomLeft to
> > a
> > neg value.
> > }
> > else
> > break;
> > }
> >
> > ReadLSR();
> > // Read the associated byte
> > if(data available)
> > read the register;
> > else
> > break;
> >
> > write the byte to writeBuffer;
> > RoomLeft--;
> > }
> > }
> >
> > I would appreciate it if you could supply some useful advice. And if
> > anyone
> > knows, how could i get in touch with the authors of the serial driver or
> > someone who is extremely proficient in these sorts of drivers. Thanks a
> > lot.
> >
> > Michael--J.
> >
>
>
>
- Next message: Frederic Sakr: "Drawing on PDA problem"
- Previous message: Jeff Rosenfeld: "Re: newbie: USB cable"
- In reply to: David Liao \(MS\): "Re: Serial Driver mod"
- Next in thread: Michael--J: "Re: Serial Driver mod"
- Reply: Michael--J: "Re: Serial Driver mod"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|