X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <002a01c644cd$45e6b5d0$36aebc3e@AMILO> From: "Martin Jarman (Cabledoc)" To: "DJ Delorie" Subject: Can you help? Date: Sat, 11 Mar 2006 05:31:13 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Reply-To: djgpp AT delorie DOT com Hello DJ Delorie I have been working on a real-time control system for a couple of months and have now hit a serious problem which you may be able to help with. Pleeeease, I'm desperate!! Really, I would just like to know if using DJGPP will get me out of this pickle... I am using FreeDOS in conjunction with a multifunction PCI card (digital I/O, ADC, DAC & onboard timer). It is **essential** that my control code runs without any significant interruptions - and preferably none at all. (The odd few microseconds may be OK, especially if they are deterministic). Sparing the details, my code or psuedo code is: GetLargeArraytoOutputToPCIcard(); // Using TCP/IP disable(); //disable interrupts //Read the external clock on the PCI card : nPreviousTime = inp(timerPortAddress); while (bMoreLargeArrayItemsToOutput) //Accurately synchronise to the next millisecond: KeepGettingTheTimeUntilItEquals_nPreviousTime_PlusOneMilliSecond(); //Every call to the external clock above is 'Logged' to //allow analysis of the performance of this code outp(PortA,NextValueInOutputArray); // Do other inp() & outp() here (must total < 1 millisec) } enable(); //enable interrupts The good news is that the above code works very deterministically. The dreadful news is that I overlooked the memory limitations of DOS and cannot allocate sufficient memory for the arrays (several Megabytes are needed). I've tried using files on RAM disks, but the moment these are read, the accurate timing I need is lost. I presume this to be partly because of the switch into / out of Protected Mode, and perhaps also because interrupts may be occuring whilst in PM. So here's my question(s). If I were to use DJGPP, can I run the all the code between disable() and enable() in PM? (I think this is another way of asking if inp() in outp() can be used in PM without needing to return to RM, isn't it?) Secondly, the above code only works well when surrounded by the disable() and enable() functions. I noted from some of your documentation you have similar functions in PM. Is it acceptable to run the loop for long periods with interrupts disabled in PM (and be confident that won't be interrupted)? Lastly, and if the answer to both of the above isn't "Yes", if I have to keep switching from PM to RM and back, can I keep interrupts disabled all the time, including thoughout the transitions between the two modes? Well it's now 5:20 AM - time for bed I think! If you can offer any advice, this would be greatly appreciated. Regards Martin Jarman mjarman AT cabledoc DOT co DOT uk