stp@ethz.UUCP (Stephan Paschedag) (05/04/90)
Hi folks ! I'm trying to access a peripheral device from C-language. The problem I have is that if the 8-bit data written to the port is 0x00, the compiler generates a 'clr.b' instruction, which is (who knows why) a read-modify-write operation, i.e. the CPU first reads the address, then clears it. But I'm not allowed to read this port during a write operation (I have to do several writes to that port without any read inbetween !!). Has Microware ever thought about that problem ? I think many people writing device drivers in C-language will have similar problems. Is there a way to solve the problem without using inline code ? ============================================================================== OS/2 & PS/2 : half an operating system for half a computer Stephan Paschedag paschedag@strati.ethz.ch or stp@ethz.UUCP MPL AG, Zelgweg 12, CH-5405 Baden-Daettwil ..!mcvax!cernvax!chx400!ethz!stp ______________________________________________________________________________
ww0n+@andrew.cmu.edu (Walter Lloyd Wimer III) (05/05/90)
Excerpts from netnews.comp.os.os9: 3-May-90 C-problem Stephan Paschedag@ethz.U (1006) > Hi folks ! > I'm trying to access a peripheral device from C-language. The problem I > have > is that if the 8-bit data written to the port is 0x00, the compiler > generates > a 'clr.b' instruction, which is (who knows why) a read-modify-write > operation, > i.e. the CPU first reads the address, then clears it. But I'm not > allowed to > read this port during a write operation (I have to do several writes to > that > port without any read inbetween !!). > Has Microware ever thought about that problem ? I think many people > writing > device drivers in C-language will have similar problems. > Is there a way to solve the problem without using inline code ? > ==================================================================== > ========== > OS/2 & PS/2 : half an operating system for half a computer > Stephan Paschedag paschedag@strati.ethz.ch or stp@ethz.UUCP > MPL AG, Zelgweg 12, CH-5405 Baden-Daettwil > ..!mcvax!cernvax!chx400!ethz!stp > ___________________________________________________________________ > ___________ I don't have OS-9/68000 and I've never had enough time to play around extensively with my Microware OS-9/6809 C compiler, so I'm not well versed with the exact problem. Please forgive me if my ideas don't pan out. From your message, I get the impression that you're doing something like: device_register = 0; in C which is being translated into CLR (which, as you said, is a read-modify-write instruction (implemented in the processor as an XOR operation, I suspect)). Have you tried simply initializing a dummy variable to zero and using it as the assignment?: char zero = 0; . . . device_register = zero; This might fool the compiler and should produce "reasonable" code. Good luck, Walt Wimer