/* * linux/arch/m68k/atari/debug.c * * Atari debugging and serial console stuff * * Assembled of parts of former atari/config.c 97-12-18 by Roman Hodek * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details.
*/
/* Can be set somewhere, if a SCC master reset has already be done and should
* not be repeated; used by kgdb */ int atari_SCC_reset_done;
EXPORT_SYMBOL(atari_SCC_reset_done);
staticinlinevoid ata_mfp_out(char c)
{ while (!(st_mfp.trn_stat & 0x80)) /* wait for tx buf empty */
barrier();
st_mfp.usart_dta = c;
}
staticvoid atari_mfp_console_write(struct console *co, constchar *str, unsignedint count)
{ while (count--) { if (*str == '\n')
ata_mfp_out('\r');
ata_mfp_out(*str++);
}
}
staticinlinevoid ata_scc_out(char c)
{ do {
MFPDELAY();
} while (!(atari_scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
MFPDELAY();
atari_scc.cha_b_data = c;
}
staticvoid atari_scc_console_write(struct console *co, constchar *str, unsignedint count)
{ while (count--) { if (*str == '\n')
ata_scc_out('\r');
ata_scc_out(*str++);
}
}
staticinlinevoid ata_midi_out(char c)
{ while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */
barrier();
acia.mid_data = c;
}
staticvoid atari_midi_console_write(struct console *co, constchar *str, unsignedint count)
{ while (count--) { if (*str == '\n')
ata_midi_out('\r');
ata_midi_out(*str++);
}
}
staticint ata_par_out(char c)
{ unsignedchar tmp; /* This a some-seconds timeout in case no printer is connected */ unsignedlong i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ;
while ((st_mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */
; if (!i) return 0;
sound_ym.rd_data_reg_sel = 15; /* select port B */
sound_ym.wd_data = c; /* put char onto port */
sound_ym.rd_data_reg_sel = 14; /* select port A */
tmp = sound_ym.rd_data_reg_sel;
sound_ym.wd_data = tmp & ~0x20; /* set strobe L */
MFPDELAY(); /* wait a bit */
sound_ym.wd_data = tmp | 0x20; /* set strobe H */ return 1;
}
while (count--) { if (*str == '\n') { if (!ata_par_out('\r')) {
printer_present = 0; return;
}
} if (!ata_par_out(*str++)) {
printer_present = 0; return;
}
}
}
#if 0 int atari_mfp_console_wait_key(struct console *co)
{ while (!(st_mfp.rcv_stat & 0x80)) /* wait for rx buf filled */
barrier(); return st_mfp.usart_dta;
}
int atari_scc_console_wait_key(struct console *co)
{ do {
MFPDELAY();
} while (!(atari_scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */
MFPDELAY(); return atari_scc.cha_b_data;
}
int atari_midi_console_wait_key(struct console *co)
{ while (!(acia.mid_ctrl & ACIA_RDRF)) /* wait for rx buf filled */
barrier(); return acia.mid_data;
} #endif
/* * The following two functions do a quick'n'dirty initialization of the MFP or * SCC serial ports. They're used by the debugging interface, kgdb, and the * serial console code.
*/ staticvoid __init atari_init_mfp_port(int cflag)
{ /* * timer values for 1200...115200 bps; > 38400 select 110, 134, or 150 * bps, resp., and work only correct if there's a RSVE or RSSPEED
*/ staticint baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 }; int baud = cflag & CBAUD; int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0; int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00;
if (cflag & CBAUDEX)
baud += B38400; if (baud < B1200 || baud > B38400+2)
baud = B9600; /* use default 9600bps for non-implemented rates */
baud -= B1200; /* baud_table[] starts at 1200bps */
/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
* delay of ~ 60us. */ #define LONG_DELAY() \ do { \ int i; \ for (i = 100; i > 0; --i) \
MFPDELAY(); \
} while (0)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.