Skip to content

Commit

Permalink
Always enable interrupt-driven MFP RS-232
Browse files Browse the repository at this point in the history
Polled mode was an artifact of early EmuTOS versions.
  • Loading branch information
vinriviere committed Mar 14, 2021
1 parent a4a7acd commit f18beec
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 41 deletions.
11 changes: 4 additions & 7 deletions bios/ikbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,10 @@ void push_ascii_ikbdiorec(UBYTE ascii)
LONG bconstat2(void)
{
#if CONF_SERIAL_CONSOLE_POLLING_MODE
/*
* Note: If device 1 is the MFP, whether or not the MFP is actually
* polled or is interrupt-driven depends on
* CONF_MFP_RS232_USE_INTERRUPT.
*/
/* Poll the serial port */
return bconstat(1);
#else
/* Check the IKBD IOREC */
if (ikbdiorec.head == ikbdiorec.tail) {
return 0; /* iorec empty */
} else {
Expand All @@ -254,11 +251,11 @@ LONG bconin2(void)
{
ULONG value;
#if CONF_SERIAL_CONSOLE_POLLING_MODE
/* See note above about whether or not the MFP is actually polled
in the bconin(1) call. */
/* Poll the serial port */
UBYTE ascii = (UBYTE)bconin(1);
value = ikbdiorec_from_ascii(ascii);
#else
/* Check the IKBD IOREC */
WORD old_sr;

while (!bconstat2()) {
Expand Down
17 changes: 1 addition & 16 deletions bios/serport.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,13 @@ LONG bconstat1(void)
return coldfire_rs232_can_read() ? -1 : 0;
# endif
#elif CONF_WITH_MFP_RS232
# if CONF_MFP_RS232_USE_INTERRUPT
/* Character available in the serial input buffer? */
if (iorec1.in.head == iorec1.in.tail) {
return 0; /* iorec empty */
}
else {
return -1; /* not empty => input available */
}
# else
/* FIXME: We ought to use Iorec() for this... */
if (MFP_BASE->rsr & 0x80)
return -1;
else
return 0;
# endif
#else
return 0;
#endif
Expand All @@ -159,7 +151,6 @@ LONG bconin1(void)
#if CONF_WITH_COLDFIRE_RS232
return coldfire_rs232_read_byte();
#elif CONF_WITH_MFP_RS232
# if CONF_MFP_RS232_USE_INTERRUPT
/* Return character... */
WORD old_sr;
LONG value;
Expand All @@ -176,10 +167,6 @@ LONG bconin1(void)
/* restore interrupts */
set_sr(old_sr);
return value;
# else
/* FIXME: We ought to use Iorec() for this... */
return MFP_BASE->udr;
# endif
#else
/* The above loop will never return */
return 0;
Expand Down Expand Up @@ -247,7 +234,6 @@ static const struct mfp_rs232_table mfp_rs232_init[] = {
{ /* 50 */ 2, 96 },
};

#if CONF_MFP_RS232_USE_INTERRUPT
void mfp_rs232_rx_interrupt_handler(void)
{
WORD tail;
Expand Down Expand Up @@ -275,7 +261,6 @@ void mfp_rs232_rx_interrupt_handler(void)
/* restore interrupts */
set_sr(old_sr);
}
#endif /* CONF_MFP_RS232_INTERRUPT_MODE */

#endif /* CONF_WITH_MFP_RS232 */

Expand Down Expand Up @@ -803,7 +788,7 @@ void init_serport(void)
(*rsconfptr)(B9600, 0, 0x88, 1, 1, 0);
#endif

#if CONF_MFP_RS232_USE_INTERRUPT
#if CONF_WITH_MFP_RS232
/* Set up a handler for MFP vector 12, the receive buffer full interrupt */
mfpint(MFP_RBF, (LONG) mfp_rs232_rx_interrupt);
#endif
Expand Down
2 changes: 1 addition & 1 deletion bios/serport.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void scc_init(void);
LONG bconoutB(WORD,WORD);
#endif

#if CONF_MFP_RS232_USE_INTERRUPT
#if CONF_WITH_MFP_RS232
void mfp_rs232_rx_interrupt_handler(void);
#endif

Expand Down
2 changes: 1 addition & 1 deletion bios/vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ timerc_end:
// our caller with RTE.
rte

#if CONF_MFP_RS232_USE_INTERRUPT
#if CONF_WITH_MFP_RS232
.globl _mfp_rs232_rx_interrupt
_mfp_rs232_rx_interrupt:
#ifdef __mcoldfire__
Expand Down
2 changes: 1 addition & 1 deletion bios/vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ extern WORD trap_save_area[];
extern void (*vector_5ms)(void); /* 200 Hz system timer */
#endif

#if CONF_MFP_RS232_USE_INTERRUPT
#if CONF_WITH_MFP_RS232
void mfp_rs232_rx_interrupt(void);
#endif

Expand Down
15 changes: 0 additions & 15 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -826,15 +826,6 @@
# define CONF_WITH_MFP_RS232 1
#endif

/*
* Set CONF_MFP_RS232_USE_INTERRUPT to 1 to enable the use of
* the MFP receive interrupt for MFP serial input. Use polling
* if not enabled.
*/
#ifndef CONF_MFP_RS232_USE_INTERRUPT
# define CONF_MFP_RS232_USE_INTERRUPT 0
#endif

/*
* Set CONF_WITH_TT_MFP to 1 to enable TT MFP support
*/
Expand Down Expand Up @@ -1872,12 +1863,6 @@
# endif
#endif

#if !CONF_WITH_MFP_RS232
# if CONF_MFP_RS232_USE_INTERRUPT
# error CONF_MFP_RS232_USE_INTERRUPT requires CONF_WITH_MFP_RS232.
# endif
#endif

#if !CONF_WITH_ATARI_VIDEO
# if CONF_WITH_STE_SHIFTER
# error CONF_WITH_STE_SHIFTER requires CONF_WITH_ATARI_VIDEO.
Expand Down

0 comments on commit f18beec

Please sign in to comment.