Query related with Book Linux Device Drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I [being a chemical enginner and new to Kernel world ]
am having probelm in understanding a sample code
[skull] available with Book Linux device driver By
Alessandro Rubini. Could anyone guide me about this ?

mb(); [ What mb do ?. Is documentation present for
these functions ]

I got the programming aspect for this but did not get
the logic of it.

if ((oldval^newval) == 0xff) {  /* we re-read our
change: it's ram */
    printk(KERN_INFO "%lx: RAM\n", add);
    continue;
}

if ((oldval^newval) != 0) {  /* random bits changed:
it's empty */
    printk(KERN_INFO "%lx: empty\n", add);
    continue;
}

Please explain these lines and what is the
significance of Expansion ROM.	 

if ( (oldval == 0x55) && (readb (base + add + 1) ==
0xaa)) {
    int size = 512 * readb (base + add + 2);
    printk(KERN_INFO "%lx: Expansion ROM, %i bytes\n",
                  add, size);
    add += (size & ~2048) - 2048; /* skip it */
    continue;
}

printk(KERN_INFO "%lx: ", add);
for (i=0; i<5; i++) {
    unsigned long radd = add + 57*(i+1);  /* a
"random" value */
    unsigned char val = readb (base + radd);
    if (val && val != 0xFF && val != ((unsigned long)
radd&0xFF))
	break;
}    
printk("%s\n", i==5 ? "empty" : "ROM");

Thanks & Regards
Dinesh

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux