[comp.sys.transputer] Inmos C: Help needed!

K312240@AEARN.BITNET (Klaus Kusche) (03/06/90)

Dear Mailing List / Dear Inmos Gurus:
(this goes to both, just to see who responds faster!)

I urgently need help with Inmos C:

We are a licensed user of Inmos Parallel C (D711D) under DOS on a
B004-compatible PC transputer board.

We have an application which requires direct access to PC hardware
ports. However, we must run this using Inmos' "iserver", not the
"afserver", and I also don't want to use any kind of afserver/iserver
emulator or converter.

I know that this is supported by the iserver, because the D705B toolset
libraries, which use exactly the same iserver, contain such functions:
"dos.port.read" and "dos.port.write". However, these Occam functions
have no C equivalents (there are some other nice things included in
Occam, but forgotten in C. "pollkey" is the most important example.).

To my ultimate surprise, as a last resort I tried to compile the
original source of our application (written by somebody else for
3L C and afserver) unmodified *** and it worked perfectly ***.

A closer look showed that they did host port input and output by calling
some undocumented C functions _put_int, _get_int etc., obviously
communicating to the afserver on an item-per-item basis. These functions
are obviously still present in the Inmos C run time lib, but they are
undocumented (any explanations???). Moreover, the protocol generated
using these functions is definitely *not* valid for the iserver, it *is*
a valid afserver sequence (does this indicate that Inmos C still
uses the afserver protocol for all its I/O operations, and has simply
placed an afserver/iserver converter between the host and the C
program??? Cheap trick!).

However, I want to do things in an orderly way, using only well-
documented features, and making sure that my code also works with
future releases of Inmos C:
* Can someone provide C code for performing host port I/O from
  within Inmos C programs? (Inmos approved code even more welcome).
* Does anybody know if these functions are present, but just not
  documented?
* If I have to write such code, what should the names and parameters
  of these functions be to ensure Inmos compatibility?
* How can I access the server channels from within C code (they must be
  global, because they are not parameters to all the I/O functions)?
  Do these channels adhere to the iserver or to the afserver protocol?
  Are there any rules to obey (do I have to access a semaphore to
  ensure exclusive, undisturbed access)? Are there any predefined
  types and functions helping me to access these channels?

Anybody who can help or explain these mysteries, please do so!

Many thanks in advance!

************************************************************************
* Klaus Kusche                                                         *
* Research Institute for Symbolic Computation                          *
* Johannes Kepler University           Tel: +43 7236 3231 67           *
* A-4040 Linz                          Telex: (Austria) 22323 uni li a *
* Austria (Europe)                     Fax: +43 7236 3231 30           *
*                                                                      *
* Bitnet:           K312240@AEARN                                      *
* Arpa/CS/Internet: K312240%AEARN.BITNET@CUNYVM.CUNY.EDU               *
* UUCP:             mcvax!aearn.bitnet!K312240                         *
* Janet:            k312240@earn.aearn or k312240%aearn@earn-relay     *
************************************************************************