J
James Harris
I'm wanting to write in C some code in which it is necessary to address a device as I/O
space rather than as part of memory. I would like the code to be as standard - and hence
as portable - as possible. It's intended to be later ported to other hardware.
Options?
1) Set up some inline assembler in a header file. I believe I'd need to use the asm
keyword but that this isn't ansi C. Is that correct?
2) Write a separate routine in assembler (to do the actual in and out) and link it with
the C code.
3) Use the appropriate C calls - perhaps they already exist....?
I've seen asm overridden with __asm__ but how does that work? It may stop the compiler
complaining but doesn't it result in the same thing in the end?
Help much appreciated. I have checked the FAQ but searches on "asm" and "assem" returned
nothing.
space rather than as part of memory. I would like the code to be as standard - and hence
as portable - as possible. It's intended to be later ported to other hardware.
Options?
1) Set up some inline assembler in a header file. I believe I'd need to use the asm
keyword but that this isn't ansi C. Is that correct?
2) Write a separate routine in assembler (to do the actual in and out) and link it with
the C code.
3) Use the appropriate C calls - perhaps they already exist....?
I've seen asm overridden with __asm__ but how does that work? It may stop the compiler
complaining but doesn't it result in the same thing in the end?
Help much appreciated. I have checked the FAQ but searches on "asm" and "assem" returned
nothing.