[comp.os.minix] MINIX/ST MDI and KBD Blues

hcj@lzaz.ATT.COM (HC Johnson) (11/30/88)

I have been working on both  MIDI and RS232 drivers for minix.
I have encountered the following.
1. There is something I can do in the keyboard that locks up the system.
   This seems related to fumbling around alt,ctrl,and shift.
2. Most attempts to read in MIDI interrupts lock up the system.
3. I think 1. and 2. are related.
4. Minix handles the MFP differently from TOS. TOS uses manual interrupt
   acknowledgement ( the S bit). Minix goes for automatic acknowledgment.
5. The KBD handler seems to work because it tries to poll out all the 
   characters being sent to it after the first interrupt.
   while(KBD->ac_cs & IRQ) {
       code = KBD->ac_da;
      ... lots of processing
  }
6. The same for MIDI fails unless I add a delay in the loop.

How about it.  Anyone else try this stuff.  Am I the only one going
crazy trying this.

PS. work in progress in Lincroft:
  MIDI
  RS232
  Ptrace(...)
  ADB port.


Howard C. Johnson
ATT Bell Labs
...lzaz!hcj

agray@zaphod.axion.bt.co.uk (Andy Gray) (12/02/88)

From article <284@lzaz.ATT.COM>, by hcj@lzaz.ATT.COM (HC Johnson):
> 2. Most attempts to read in MIDI interrupts lock up the system.

Hmm I have noticed that in the vanilla distribution there is a bit of puzzling
code. (I will be checking this through later, but here I am just stating an
observation)

In stmain.c (aciaint)

	if (MDI->ac_cs & A_IRQ)
		mdiiint();

	...

mdiint(t)	{fake_int("mdiint",t);}

	...

fake_int(s, t) char *s; {
  printf("Fake interrupt handler for %s. trap = %02x\n", s, t);

	Studying async reveals

	move.w	d0,(sp)		! push trap type as argument
	jsr	(a0)		! call service routine
	tst.w	(sp)+		! pop trap type

	This is a bit opportunist isn't it? Are we sure that we are getting
the trap type as our argument 't' and not some miscellaneous stored 'pc'
value. I am not highly experienced in analyzing 68k assembler yet, and my data
book is not handy, but the stack state seems to be

	trap type
	address of 'tst.w (sp)+'
	address of code following 'mdiint()' in 'aciaint'

	then we call 'fake_int' pushing a pointer to a static string (OK) and
't' by value. Is the value of 't' 

	1.	the address of the 'tst.w (sp)+' instruction
	2.	the trap type

	If anyone has any answers to this can they post (or E_Mail me) as I am
somewhat puzzled by this, and I am also writing service routines in this area.

	Andy Gray

----------------------------------------------------------------------------
E-Mail (UUCP)   AGray@axion.bt.co.uk ...!ukc!axion!AGray
Organisation	UNIX Operating System Support and Development Group
		British Telecom Research Laboratories (RT3134)
Snail Mail	BTRL, Rm G23 B68, Martlesham Heath, IPSWICH IP5 7RE, UK
Telephone	+44 473 646647
Quote		"Hey - somebody's crept in here and committed a neatness!"
----------------------------------------------------------------------------