Ejemplo n.º 1
0
int atari_keyb_init(void)
{
	int error;

	if (atari_keyb_done)
		return 0;

	kb_state.state = KEYBOARD;
	kb_state.len = 0;

	error = request_irq(IRQ_MFP_ACIA, atari_keyboard_interrupt,
			    IRQ_TYPE_SLOW, "keyboard,mouse,MIDI",
			    atari_keyboard_interrupt);
	if (error)
		return error;

	atari_turnoff_irq(IRQ_MFP_ACIA);
	do {
		/* reset IKBD ACIA */
		acia.key_ctrl = ACIA_RESET |
				((atari_switches & ATARI_SWITCH_IKBD) ?
				 ACIA_RHTID : 0);
		(void)acia.key_ctrl;
		(void)acia.key_data;

		/* reset MIDI ACIA */
		acia.mid_ctrl = ACIA_RESET |
				((atari_switches & ATARI_SWITCH_MIDI) ?
				 ACIA_RHTID : 0);
		(void)acia.mid_ctrl;
		(void)acia.mid_data;

		/* divide 500kHz by 64 gives 7812.5 baud */
		/* 8 data no parity 1 start 1 stop bit */
		/* receive interrupt enabled */
		/* RTS low (except if switch selected), transmit interrupt disabled */
		acia.key_ctrl = (ACIA_DIV64|ACIA_D8N1S|ACIA_RIE) |
				((atari_switches & ATARI_SWITCH_IKBD) ?
				 ACIA_RHTID : ACIA_RLTID);

		acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S |
				((atari_switches & ATARI_SWITCH_MIDI) ?
				 ACIA_RHTID : 0);

	/* make sure the interrupt line is up */
	} while ((st_mfp.par_dt_reg & 0x10) == 0);

	/* enable ACIA Interrupts */
	st_mfp.active_edge &= ~0x10;
	atari_turnon_irq(IRQ_MFP_ACIA);

	ikbd_self_test = 1;
	ikbd_reset();
	/* wait for a period of inactivity (here: 0.25s), then assume the IKBD's
	 * self-test is finished */
	self_test_last_rcv = jiffies;
	while (time_before(jiffies, self_test_last_rcv + HZ/4))
		barrier();
	/* if not incremented: no 0xf1 received */
	if (ikbd_self_test == 1)
		printk(KERN_ERR "WARNING: keyboard self test failed!\n");
	ikbd_self_test = 0;

	ikbd_mouse_disable();
	ikbd_joystick_disable();

#ifdef FIXED_ATARI_JOYSTICK
	atari_joystick_init();
#endif

	// flag init done
	atari_keyb_done = 1;
	return 0;
}
Ejemplo n.º 2
0
__initfunc(int atari_keyb_init(void))
{
    /* setup key map */
    memcpy(key_maps[0], ataplain_map, sizeof(plain_map));
    memcpy(key_maps[1], atashift_map, sizeof(plain_map));
    memcpy(key_maps[4], atactrl_map, sizeof(plain_map));
    memcpy(key_maps[5], atashift_ctrl_map, sizeof(plain_map));
    memcpy(key_maps[8], ataalt_map, sizeof(plain_map));
    /* Atari doesn't have an altgr_map, so we can reuse its memory for
       atashift_alt_map */
    memcpy(key_maps[2], atashift_alt_map, sizeof(plain_map));
    key_maps[9]  = key_maps[2];
    key_maps[2]  = 0; /* ataaltgr_map */
    memcpy(key_maps[12], atactrl_alt_map, sizeof(plain_map));
    key_maps[13] = atashift_ctrl_alt_map;
    keymap_count = 8;

    /* say that we don't have an AltGr key */
    keyboard_type = KB_84;

    kb_state.state = KEYBOARD;
    kb_state.len = 0;

    request_irq(IRQ_MFP_ACIA, keyboard_interrupt, IRQ_TYPE_SLOW,
                "keyboard/mouse/MIDI", keyboard_interrupt);

    atari_turnoff_irq(IRQ_MFP_ACIA);
    do {
	/* reset IKBD ACIA */
	acia.key_ctrl = ACIA_RESET |
			(atari_switches & ATARI_SWITCH_IKBD) ? ACIA_RHTID : 0;
	(void)acia.key_ctrl;
	(void)acia.key_data;

	/* reset MIDI ACIA */
	acia.mid_ctrl = ACIA_RESET |
			(atari_switches & ATARI_SWITCH_MIDI) ? ACIA_RHTID : 0;
	(void)acia.mid_ctrl;
	(void)acia.mid_data;

	/* divide 500kHz by 64 gives 7812.5 baud */
	/* 8 data no parity 1 start 1 stop bit */
	/* receive interrupt enabled */
	/* RTS low (except if switch selected), transmit interrupt disabled */
	acia.key_ctrl = (ACIA_DIV64|ACIA_D8N1S|ACIA_RIE) |
			((atari_switches & ATARI_SWITCH_IKBD) ?
			 ACIA_RHTID : ACIA_RLTID);
	   
	acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S |
			(atari_switches & ATARI_SWITCH_MIDI) ? ACIA_RHTID : 0;
    }
    /* make sure the interrupt line is up */
    while ((mfp.par_dt_reg & 0x10) == 0);

    /* enable ACIA Interrupts */ 
    mfp.active_edge &= ~0x10;
    atari_turnon_irq(IRQ_MFP_ACIA);

    ikbd_self_test = 1;
    ikbd_reset();
    /* wait for a period of inactivity (here: 0.25s), then assume the IKBD's
     * self-test is finished */
    self_test_last_rcv = jiffies;
    while (time_before(jiffies, self_test_last_rcv + HZ/4))
	barrier();
    /* if not incremented: no 0xf1 received */
    if (ikbd_self_test == 1)
	printk( KERN_ERR "WARNING: keyboard self test failed!\n" );
    ikbd_self_test = 0;
    
    ikbd_mouse_disable();
    ikbd_joystick_disable();

    atari_joystick_init();
  
    return 0;
}
Ejemplo n.º 3
0
int atari_keyb_init(void)
{
	int error;

	if (atari_keyb_done)
		return 0;

	kb_state.state = KEYBOARD;
	kb_state.len = 0;

	error = request_irq(IRQ_MFP_ACIA, atari_keyboard_interrupt,
			    IRQ_TYPE_SLOW, "keyboard,mouse,MIDI",
			    atari_keyboard_interrupt);
	if (error)
		return error;

	atari_turnoff_irq(IRQ_MFP_ACIA);
	do {
		
		acia.key_ctrl = ACIA_RESET |
				((atari_switches & ATARI_SWITCH_IKBD) ?
				 ACIA_RHTID : 0);
		(void)acia.key_ctrl;
		(void)acia.key_data;

		
		acia.mid_ctrl = ACIA_RESET |
				((atari_switches & ATARI_SWITCH_MIDI) ?
				 ACIA_RHTID : 0);
		(void)acia.mid_ctrl;
		(void)acia.mid_data;

		
		
		
		
		acia.key_ctrl = (ACIA_DIV64|ACIA_D8N1S|ACIA_RIE) |
				((atari_switches & ATARI_SWITCH_IKBD) ?
				 ACIA_RHTID : ACIA_RLTID);

		acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S |
				((atari_switches & ATARI_SWITCH_MIDI) ?
				 ACIA_RHTID : 0);

	
	} while ((st_mfp.par_dt_reg & 0x10) == 0);

	
	st_mfp.active_edge &= ~0x10;
	atari_turnon_irq(IRQ_MFP_ACIA);

	ikbd_self_test = 1;
	ikbd_reset();
	self_test_last_rcv = jiffies;
	while (time_before(jiffies, self_test_last_rcv + HZ/4))
		barrier();
	
	if (ikbd_self_test == 1)
		printk(KERN_ERR "WARNING: keyboard self test failed!\n");
	ikbd_self_test = 0;

	ikbd_mouse_disable();
	ikbd_joystick_disable();

#ifdef FIXED_ATARI_JOYSTICK
	atari_joystick_init();
#endif

	
	atari_keyb_done = 1;
	return 0;
}