On Sep 4, 2014, at 3:47 PM, Rob Eaglestone <email@example.com> wrote: > I find it easier to hack code than work on the bare metal. Fine. So I'm writing C for the first time in years. > > Now, I love C, but I'm worried about the Raspberry Pi's ability to sleep for microseconds. Sure, the BCM2835 library has a sleepMicroseconds function, and yes, there is always usleep( usec ). However, the ninepin project mentions that even telling the RPi to sleep for ZERO microseconds results in an 80 usec delay. > > That seems unacceptable if I want to emulate the 1541. > > So, shall I just hack ninepin's kernel code? Or is there another way to get C to sleep reliably (with great accuracy) on the Raspberry Pi? > What’s your kernel? Linux? Usually the way it works for short sleeps is a calibrated delay loop (with interrupts disabled if you really have to). So you’ll have to write a kernel extension. Heck, the project you mention did exactly that: "The disk interface support works with the Commodore 64 IEC serial bus. It is a combination of a user space program and kernel module which implements the protocol on the Raspberry Pi using GPIO. The signaling is implemented in a Linux Kernel Module in order to use interrupts. There are only 2 places where interrupts are disabled during processing. I had to use looping for delays since there was no way to do microsecond delays in the kernel.” https://github.com/FozzTexx/ninepin -Nate Message was sent through the cbm-hackers mailing listReceived on 2014-09-05 00:00:02
Archive generated by hypermail 2.2.0.