Re: Anybody in Australia willing to sub-hire me? (was: How best to implement HashCons in user-level code within CL?)
- From: George Neuner <gneuner2@xxxxxxxxxxx>
- Date: Tue, 06 Oct 2009 01:19:42 -0400
On Sun, 04 Oct 2009 15:00:06 -0700, seeWebInstead@xxxxxxxxxxxxxxxx
(Robert Maas, http://tinyurl.com/uh3t) wrote:
From: George Neuner <gneun...@xxxxxxxxxxx>
if you happen to get ahold of a Mac emulator and feel like giving
it a royal try, I won't complain, and it it turns out to be a big
waste of your time I won't snicker "I told you so", I'll thank you
for trying.
Well I actually did try to set up SoftMac ... it was terribly unstable
and wouldn't let me access my serial ports. There is an open source
emulator called Basilisk - JITs 68K to x86 and is supposed to be
pretty good - but the pre-built binaries don't seem run on Linux on
VMWare and I haven't been able to build it natively for Windows yet.
However, I can still read documentation. Given your limitations using
Forth or the simple C compiler I don't know if or how much this will
help ... but here goes:
The functions of interest are:
pascal OSErr OpenDriver (ConstStr255Param name,
short *drvrRefNum);
pascal OSErr CloseDriver (short refNum);
pascal OSErr Control (short refNum,
short csCode,
const void *csParamPtr);
pascal OSErr Status (short refNum,
short csCode,
void *csParamPtr);
"pascal" calling convention means caller-pops the stack.
"OSErr" return type is an integer.
"short" is a 16-bit integer type
The trap #s for these calls are:
Open A000
Close A001
Control A004
Status A005
The driver names and associated refnums are:
".AIn" -6 // modem port in
".AOut" -7 // modem port out
".BIn" -8 // printer port in
".BOut" -9 // printer port out
AFAICT, you should not need to Open() or Close() the drivers ... once
they are opened in the terminal program, hopefully you can simply call
Control() on them specifying the proper reference numbers.
Enabling handshaking requires constructing a parameter block:
struct
{
BYTE fXOn; // XON/XOFF output flow control enabled flag
BYTE fCTS; // CTS hardware handshake enabled flag
char xOn; // XON character
char xOff; // XOFF character
BYTE errs; // error mask for input errs that cause abort
BYTE evts; // mask for status changes that cause events
BYTE fInX; // XON/XOFF input flow control flag
BYTE fDTR; // DTR input flow control enable flag
// (for csCode=14 only)
} hskParamBlk;
enum // error masks
{
parityErr = 16; // parity error
hwOverrunErr = 32; // hardware overrun error
framingErr = 64; // framing error
} errs;
enum // event masks
{
ctsEvent = 32; // change in CTS signal
breakEvent = 128; // change in break signal
} evts;
err = Control( <refnum>, 14, ¶mblk )
// enables hardware handshaking with parameters
err = Control( <refnum>, 10, ¶mblk )
// enables software handshaking with parameters
Note that software flow control will work regardless of, and in
addition to, hardware handshaking. Setting non-zero values in the
"flag" members enable the particular function.
*** There doesn't seem to be any way to read back these settings so
you won't be able to see what the terminal program already set. You'll
have to experiment to see what error and event values work and don't
kill the terminal program.
Setting bit rate:
Parameter is a WORD value: 9600, 19200, 56700, etc.
WORD rate = 56700;
err = Control( <refnum>, 13, &rate )
actual_rate = rate;
And finally reading status:
struct
{
char cumErrs; // cumulative errors
char xOffSent; // XOFF sent as input flow control
char rdPend; // read pending flag
char wrPend; // write pending flag
char ctsHold; // CTS flow control hold flag
char xOffHold; // XOFF flow control hold flag
} statParamBlk;
err = Status( <refnum>, 0, ¶mblk );
AFAICT, the argument "csCode" is unused by the serial drivers. The
lower level driver API doesn't use it, but I can't say for certain
because I can't find any good example code. I'm guessing that it
doesn't matter what value is passed for "csCode".
Errors you might encounter:
noErr 0 No error
controlErr -17 Driver does not respond to this control request
statusErr -18 Driver does not respond to this status request
readErr -19 Driver does not respond to read requests
writErr -20 Driver does not respond to write requests
badUnitErr -21 Driver reference number does not match unit table
unitEmptyErr -22 Driver reference number specifies a nil handle
in unit table
openErr -23 Requested read/write permission does not match
driver's open permission
closErr -24 Driver unable to complete close request
dRemovErr -25 Attempt to remove an open driver
dInstErr -26 Driver resource not found
abortErr -27 Request aborted by KillIO
notOpenErr -28 Driver not open
ioErr -36 Data does not match in read-verify mode
portInUse -97 Port is in use
portNotCf -98 Port is not configured
What I've outlined here is the high level management API. There is
also a lower level driver API which can also be used once the drivers
are opened, but it requires more work filling in parameter blocks. If
nothing here works, we can explore that API later.
... have the modem save its configuration so it powers up
configured properly.
Useless, because the FAX software always configures the modem for
its use when going online, then when the FAX software is switched
off it restores FACTORY settings instead of whatever I had in the
modem before starting up the FAX software.
Are you sure it goes to "factory" settings? Or just to "default"
settings. "Default" settings are what I was getting at.
Most modems have non-volatile RAM that holds configuration settings
while the modem is off. You set up the modem the way you want it and
then save the configuration to a default "profile". Then when the
modem powers on or is reset, it comes up already in your custom
configuration. Some modems let you store several custom profiles.
Your terminal software sends the init string when it first picks up
the modem.
Do you mean "goes off-hook"?
Yes.
Actually the *only* Hayes command it sends is the
ATDT... command. In fact VersaTerm doesn't even know whether the
modem is online or offline. I can right now, while *online* to the
shell account, pull down the menu to dial another number, and it'll
simply transmit the ATDT... command
Yes, but all the modem commands start with "AT". Usually terminal
software has in its saved options something called an "init" string.
You edit this string to set up the modem for the connection.
It may be a global setting or in with the dialing options because it
can also be a per connection setting - e.g., I want 9600,7,2,E,^Q^S
for this connection and 28800,8,1,N,RTS/CTS for that connection.
Also the Phone menu has a 'Hangup' item, but it doesn't work, maybe
because several years ago I changed the hayes-interrupt character
from + to something else so now VersaTerm and the modem disagree as
to what that should be. But if I manually type +++ with pause
before and after then the modem will go out of transparent mode
into DC Hayes command mode and then I can type ATH to hang up.
That's normal. When the modem is online you have to get its attention
before you can converse with it. '+++' is the usual attention string.
AFAIK the DC Hayes command set doesn't provide any way to read out
*all* the current non-factory settings so that they can be saved
somewhere and later restored.
Yes it does ... AFAIK
&W<n> : Stores current settings to user profile
&Y<n> : Reads (display) user profile
Z<n> : Resets modem and sets user profile
&F<n> : Resets modem and sets factory profile
where 'n' is optional and specifies a numbered setting profile if the
modem supports more than one. Some modems have multiple factory
setups too ... e.g., for PC or Mac.
However, your particular modem may not implement all of these
commands. Do you have the documentation for your modem? If not, tell
me what model it is and I'll try to find the complete command list for
it.
George
.
- References:
- Re: Anybody in Australia willing to sub-hire me? (was: How best to implement HashCons in user-level code within CL?)
- From: Robert Maas, http://tinyurl.com/uh3t
- Re: Anybody in Australia willing to sub-hire me? (was: How best to implement HashCons in user-level code within CL?)
- Prev by Date: Re: Anybody in Australia willing to sub-hire me? (was: How best to implement HashCons in user-level code within CL?)
- Next by Date: Re: loading csv-files: too much memory-consumption
- Previous by thread: Re: Anybody in Australia willing to sub-hire me? (was: How best to implement HashCons in user-level code within CL?)
- Next by thread: Re: Anybody in Australia willing to sub-hire me? (was: How best to implement HashCons in user-level code within CL?)
- Index(es):
Relevant Pages
|