From: Jon E. <el...@pi...> - 2003-05-27 04:36:08
|
Paul wrote: >Hi John > >I'd caution against using x86 assembler in the code - There has been talk >elsewhere of running EMC on a non Intel platform. Stick with standard C and >leave the assembler code where it belongs (in the arch headers). > > Yes, I agree in principle with this. But, unfortunately, there is ALREADY x86 assembly code in some parts of the R/T side of EMC! The module asm/io.h is called for in a number of places related to flipping bits in the parallel port. I have used it VERY extensively, as it is the way to get fast I/O transfers using the IEEE-1284 functions of the PC's parallel port. It would be nice if there was no need to do this, but how do you access a raw I/O port on x86 hardware without it? C has absolutely no function for handling I/O ports directly. Anything that is memory mapped can be done pretty easily in very generic C code, but I/O ports are another matter entirely. Also, note that even the user-mode side of EMC probably uses these, and also uses a system call to authorize access to a range of I/O space addresses. All of this is awfully platform specific! Now, maybe in the course of the hardware abstraction changes, these details can also be abstracted, but they sure are not at the moment. And, it will be quite obvious on cursory inspection that the include file asm/io.h is VERY architecture-specific, in that you are basically using a macro to construct in-line assembly language. Jon |