Re: Serial Driver mod

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Michael--J (MichaelJ_at_discussions.microsoft.com)
Date: 08/22/04


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.
> >
>
>
>



Relevant Pages

  • [PATCH 1/1] hv: Added new hv_utils driver with shutdown as first functionality - NO OUTLOOK
    ... Addition of new driver for Hyper-V called hv_utils. ... * VmbusChannelSendPacket- Send the specified buffer on the given channel ... struct vmbus_channel *channel; ...
    (Linux-Kernel)
  • Re: Real World Significant Sources of (what we usually call) Latency
    ... CPU is twice as fast, you can reduce your buffer size to half." ... the buffer adjustment for the driver or DAW program would go down to zero. ... nothing that can distract it from processing audio. ...
    (rec.audio.pro)
  • Re: Difference between synchronous and asynchronous operation/calls (NDISPROT)
    ... The main problem with synchronous operation/calls seems to be the lack of buffers for the driver to store data into. ... Each "read call" supplies the driver with a buffer and optionally a completion routine so that the driver can inform the application when the requested operation is/was done. ... However it seems the current windows/driver design does some copies as well? ...
    (microsoft.public.development.device.drivers)
  • Re: Degradation of TCP connection
    ... Gigabit ethernet. ... D card's data buffer can only hold about 64K samples worth of data ... link you posted is for an older version of VxWorks that used a BSD- ... but a bug in the ethernet driver. ...
    (comp.os.vxworks)
  • Re: PCI bus-master and large contiguous memory buffers
    ... As soon as device reaches the end of the buffer ... Sure, I am developing both PCI adapter and device driver, so, it is ... not afford reinitializing DMA on my device after every transfer. ... x86 CPU memory management structures I never tried to dig into Windows ...
    (microsoft.public.development.device.drivers)