This message is from the T13 list server.


Hi,
        Reposting it the message as i did in reply to wrong message.

    Why isn't the DRQ is not being set to 1 ? 
  If there is some error in the below code please do mention how to
 correct it . The functions printf,inb,outb are working.

 Any other corrections to be made to just read the 1st or 2nd byte ?

 Here is code.

 static inline void insw(unsigned short port, unsigned char *addr,
                         unsigned long count)
 {
         __asm__ __volatile__("rep; ins" "w":"=D"(addr),
                              "=c"(count):"d"(port), "0"(addr),
 "1"(count));}

 void hd_init(void)
 {
         unsigned char *p, c[512], *e;
         e = c;
         while ((inb(0x1f7) & 0x80) == 0x80) ;
         printf("HERE 1\n");
         outb(0x1f2, 0x04);
         outb(0x1f3, 0x07);
         outb(0x1f4, 0xa7);
         outb(0x1f5, 0x00);
         outb(0x1f6, 0xa3);
         outb(0x1f7, 0x20);

         printf("%x", inb(0x1f7));
         /* Prints 0x50 . So the below loops forever.
          */
         while ((inb(0x1f7) & 0x80) == 0x80
                || (inb(0x1f7) & 0x08) != 0x08) ;
         /* Doesn't break out of this loop. Something wrong here. 
          * But as per the hardware spec this is what is expected.
          * Corrections to be made in this loop.
          */
         printf("HERE 2\n");
         insw(0x1f0, e, 256);

         printf("%x %x #####\n", c[0], e[0]);
 }

-- 

Reply via email to