n Wed, Sep 30, 2009 at 3:26 AM, Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxxxxxxxxx> wrote: > Le Wed, 30 Sep 2009 16:47:33 +1300, > Michal Ludvig <mludvig@xxxxxxxxxxxx> a écrit : > >> I've got two questions: >> 1) Can I speed it up somehow? >> 2) Apparently it's quite a lot of time between calling outb() and its >> return. Can the kernel do something else in the meantime, like >> scheduling another process or handling interrupts, or is it blocked >> waiting for the outb() return? I'm on a uniprocessor x86 system. > > You can read the implementation of outb() for x86 > in /home/thomas/local/linuxdev/arch/x86/include/asm/io_32.h. Unless you > use outb_p() (which introduces a pause after the write), outb() is only > a static inline function that does the "outb" CPU instruction. No more, > no less. > > If you want to be 100%, for testing purposes, you can hand-code the > outb() using an asm("") statement. But I don't think it'll make any > difference. > > You can also make an accurate measurement of the instruction duration > using the TSC, to get the number of cycles spent during the execution > of the instruction. > > Finally, my hardware knowledge is a bit limited, but I'm not sure that > a 8 Mhz bus necessarly means that you can do 8 millions outb() per > second through this bus. One outb() probably requires several (if not > many) clock ticks. look at the timing diagram, and u can see that one outb() usually have to spread across many cycles, (1cycle being the smallest clock tick) - this is to enable data on the bus to be reliably received before the turning off the signal. anyway, so many other delays can come in, so just the timing diagram estimation is likely to be far from accurate. > > Sincerly, > > Thomas > -- > Thomas Petazzoni, Free Electrons > Kernel, drivers and embedded Linux development, > consulting, training and support. > http://free-electrons.com > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > Please read the FAQ at http://kernelnewbies.org/FAQ > > -- Regards, Peter Teoh -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ