Device Drivers & STREAMS

Device Drivers & STREAMS

Post by Steffen Ja » Sat, 11 May 1996 04:00:00



Hi,

I'm looking for papers/sources describing the programming of device
drivers & STREAMS, because I got a little bit trouble with it ....

Two of my problems:

I wrote a /dev/zero-like STREAMS based device driver. If an application
writes to the device, all work fine. But if an application tries to read
from the device, the read() call blocks. Internally no entry function of
the device is called!? - The papers I have red, describing only devices
like line printers, only with a write side, without a read side.

A specific SunOS problem with loadable modules. I can load a modules
dynamically in the system, but if I try to load a second one, I get the
message No Such Device Or Address!? - With a posting to a Sun specific
NewsGroup I got no answers.

My System: SunOS 4.1.3 on Sun4c.

I got already the following papers:

  Adams: Writing UNIX Device Drivers in C.
  UNIX SVR4: Programmers Guide: STREAMS
  SunOS AnswerBook

Thx for hints,

Steffen.

 
 
 

1. STREAMS Device Driver problem

Hi everybody,

I hope this is the right place for posting this query :)

This is regarding the STREAMS implementation on DEC OSF/1 3.0 on
DEC 2100 server.

I'm presently trying to write a hardware STREAMS device driver.
I'm able to successfully configure my Streams device driver into the
kernel statically.
My probe, attach, configure interfaces are being invoked properly.

But my wput() interface is somehow not getting invoked.
Could you tell me where to look for the bug !!

My device driver source code has the following Streams related
initializations :

    static  struct  module_info  minfo  =    {
      0,  PCIDSNAME,  PCIDSMINPSZ,  PCIDSMAXPSZ,  PCIDSHIWAT,  PCIDSLOWAT
    };

    static  struct  qinit  rinit  =  {
      pcidsrput,  NULL,  pcids_open,  pcids_close,  NULL,  &minfo, NULL
    };

    static  struct  qinit  winit  =  {
      pcidswput,  NULL,  NULL,  NULL,  NULL,  &minfo, NULL
    };

    struct  streamtab  pcids_info  =  { &rinit, &winit, NULL, NULL };

My pcids_configure interface successfully managed to add the
pcids driver using the strmod_add() kernel utility.

Even my xxxopen and xxxxclose interface are being invoked properly.
But my write() to this device (before closing !!) returns 0xFFFFFFFF (-1).
That is to say that my pcidswput() interface never manages to print the
message
"I'm inside pcidswput...." in the console.

My pcidswput() interface looks like this :

    static int pcidswput  (q,  mp)
        queue_t  *q;
        mblk_t   *mp;
    {

      printf ("I'm inside pcidswput....\n") ;
      switch  (DB_TYPE(mp))  {
        case  M_FLUSH:
          if  (*mp->b_rptr  &  FLUSHW)
            flushq(q,  0);
          putnext(q,  mp);
          break;
        default:
          putq(q,  mp);
          break;
      }
      return  0;
    }

What could be the problem ?

Thanks in anticipation.
Please make it convenient to send me a reply by email.

Regards,
Abhay Ranade

CDAC, India.

2. HD or RAM error message

3. Help needed on STREAMS device drivers..

4. Self-extracting programs

5. Streams device driver - open and close routines

6. Transceiver BNC/TPO

7. STREAMS device driver for Solaris x86

8. Question: processes

9. 2 APIs for a STREAMS device driver in Solaris

10. STREAMS based tty device driver source code

11. Streams Device Drivers

12. STREAMS device driver example

13. Are STREAMS device drivers mmap'able ?