lso@softpro.stgt.sub.org (Lars Soltau) (05/02/91)
I think enough time has passed since I posted my request for information about performing I/O with microchannel adapters from a device driver. First, I want to thank all of you who mailed me a reply. Without your help I would have had to abandon my project. The most important mail I received was from Michael Massa (massa@eniac.seas.upenn.edu), who mailed me the following two pieces of code and an explanation. ------------------------------------------------------------------------------- Sample code to set a POS register: #include <sys/adspace.h> #include <sys/iocc.h> #include <sys/ioacc.h> int bus_val; /* Set POS 2 to the correct value */ pos2 = ???; bus_val = IOCC_ATT(IOCC_BID, 0); pptr = bus_val + IO_IOCC + POSREG(2, slot_number); BUSIO_PUTC(pptr, pos2); /* Load the contents into POS2 */ IOCC_DET(bus_val); Sample code for writing to a Micro Channel device #define BUS_ID (0x82000030) /* bus id to gain access to MCA bus */ /* this usually comes from the ODM PdAt entry */ unsigned char *p; ulong bus_val; bus_val = BUSIO_ATT(BUS_ID, 0); p = (unsigned char *) (bus_val + 0x9876); /* 0x9876 is the reg addr */ BUSIO_PUTC(p, 0x12); BUSIO_DET(bus_val); Basically what is happening is that you are attaching the bus I/O address space to your own virtual address space - the BUSIO_ATT macro calls the io_att() kernel call. ------------------------------------------------------------------------------- -- Lars Soltau lso@softpro.stgt.sub.org #include <stddiscl.h>