arch/m68k/atari/debug.c

Source file repositories/reference/linux-study-clean/arch/m68k/atari/debug.c

File Facts

System
Linux kernel
Corpus path
arch/m68k/atari/debug.c
Extension
.c
Size
9073 bytes
Lines
330
Domain
Architecture Layer
Bucket
arch/m68k
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

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.
 */
static void __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
	 */
	static int 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 */

	st_mfp.trn_stat &= ~0x01;	/* disable TX */
	st_mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
	st_mfp.tim_ct_cd &= 0x70;	/* stop timer D */
	st_mfp.tim_dt_d = baud_table[baud];
	st_mfp.tim_ct_cd |= 0x01;	/* start timer D, 1:4 */
	st_mfp.trn_stat |= 0x01;	/* enable TX */
}

#define SCC_WRITE(reg, val)				\
	do {						\
		atari_scc.cha_b_ctrl = (reg);		\
		MFPDELAY();				\
		atari_scc.cha_b_ctrl = (val);		\
		MFPDELAY();				\
	} while (0)

/* 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)

static void __init atari_init_scc_port(int cflag)
{
	static int clksrc_table[9] =
		/* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */
		{ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };

Annotation

Implementation Notes