[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RTS/CTS and fast modems.



AH! A cure!

SERIALFX.PRG goes in the auto folder before MiNT. Then execute the 
following from mint.cnf (after compiling, and so forth, of course :) :

#include <tos.h>
#include <stdio.h>
#include <stdlib.h>

struct	serfix
	{
	int   lockfg;         /*  RTS/CTS locked flag (bit 1 = locked) */
        int   cdecl (*setlock)(int);    /*  Routine  to  set lock status */
        };

typedef struct
	{
		long	cookie;
		long	value;
	} COOKIE;

int	get_cookie(long target,long *value)
{
	long oldssp;
	COOKIE *cookie_ptr;
	
	if(Super((void *)1L)==0L)
		oldssp=Super(0L);
	else	oldssp=0L;
	
	cookie_ptr=*(COOKIE **)0x5a0;
	
	if(oldssp)
		Super((void *)oldssp);
	
	if(cookie_ptr)
		{
		do
			{
			if(cookie_ptr->cookie==target)
				{
				if(value)
					*value=cookie_ptr->value;
				return 1;
				}
			} while((cookie_ptr++)->cookie);
		}
	return 0;
}


int	main(int argc, char **argv)
{
	long addr;
	int	state;
	
	if(argc!=2)
		{
		printf("Usage: %s <1>|<0>\n",argv[0]);
		exit(1);
		}
	state=atoi(argv[1]);
	if(get_cookie('MDSa',&addr))
		{
		struct serfix *foo=(struct serfix *)addr;
		puts("Got cookie.");
		printf("Lockstate was: %d\n",foo->lockfg);
		foo->setlock(state);
		printf("Lockstate is: %d\n",foo->lockfg);
		}
	Rsconf(0,2,-1,-1,-1,-1);
	return 0;
}

My mint.cnf entry looks like this:

exec c:\rtscts.ttp 1

Which permanently locks the serial port into RTS/CTS handshaking, 
courtesy of SERIALFX. This should work on all TOS versions where SERIALFX 
works.

Dancer

--
----------------------------------------------------------------------------
|   /----\   |GAT -d++()(--)>!d H s++: g+ p1+ !au a-? w+++(--)
|  /  //  \  |v---(-)*(++) c+++@>$ U?++++$>B++++$>S++++$ P+(-) L- 3-
| |  //  //| |E--- N++(+++) K W---() M(+) V--@ -po+(--@)(++@) Y+ t(+++@)
| | //  // | |!5 !j R+++()>$ G+ tv(-) b+++ !D B(-) e u++(*)
|  \/  // /  |h++(-)(---)>*$ f+(?) r--@(+++@) n----(--) y+++(++@)>*>**
|   \----/   | dancer@ozspace.brisnet.org.au http://thelbane.brisnet.org.au/
----------------------------------------------------------------------------