/*******************************************************************/ /* */ /* Advanced Communication Board Developer Toolkit */ /* (c)Copyright 1993-1995, Sealevel Systems Incorporated */ /* */ /*******************************************************************/ /* Please read the program abstract for details on this */ /* program. */ /* POLL1.C */ /*******************************************************************/ #include #include #include #include "acb.h" /*build with ACB.OBJ */ #include "Z8530.h" /*******************************************************************/ /* Things to make the program "compiler friendly"! */ /*******************************************************************/ #ifndef _BORLAND #define IN _inp #define OUT _outp #define FAR __far #else #define IN inportb #define OUT outportb #define FAR far #endif /*******************************************************************/ /* Functions Prototypes */ /*******************************************************************/ int main(void); /*******************************************************************/ #define PORT 0x238 /*base address of 238 hex */ #define ESC 27 /*keyboard character to terminate program */ /*******************************************************************/ /* Z85x30 Init Values */ /*******************************************************************/ #define PRAM_COUNT 54 unsigned char init[PRAM_COUNT]= { WR0,NULL_CODE, /* MODES */ WR4, X16_CLOCK | STOP_BIT_1 | PARITY_DISABLE, WR1, WAIT_DMA_DISABLE | INT_DISABLE, WR2, 0x00, /* not used in polled mode */ WR3, RX_8_BITS, WR5, TX_8_BITS, WR6, 0x00, /* not used-SDLC Address field */ WR7, 0x00, /* not used-SDLC Flag */ WR9, MI_DISABLE, WR10, 0x00, /* not used in asynchronous */ WR11, TX_CLK_BRG | RX_CLK_BRG | TRXC_OUT_BRG, WR12, 0x1e, /*time constant-low byte 4800 Baud*/ WR13, 0x00, /*time constant-high byte */ WR14, BRG_SOURCE_PCLK | DPLL_NULL, WR14, BRG_SOURCE_PCLK | DPLL_NULL, WR14, BRG_SOURCE_PCLK | DPLL_NULL, WR14, BRG_ENABLE | BRG_SOURCE_PCLK | DPLL_NULL, /* ENABLES */ WR3, RX_8_BITS | RX_ENABLE, WR5, TX_8_BITS | TX_ENABLE, WR0, RESET_TX_CRC, WR0, ERROR_RESET, WR1, WAIT_DMA_DISABLE | INT_DISABLE, WR15, NO_EXT_STAT_INT, /*INTERRUPT*/ WR0, RESET_EXT_STATUS_INT, WR0, RESET_EXT_STATUS_INT, WR1, WAIT_DMA_DISABLE | INT_DISABLE, WR9, MI_DISABLE }; /*******************************************************************/ /* end of init table, adjust variable PRAM_COUNT after modifying */ /*******************************************************************/ /*******************************************************************/ /* Start of main program */ /*******************************************************************/ int main(void) { unsigned char c = 0; void FAR *p; /*******************************************************************/ /* Verify Address of SCC (85x30) */ /*******************************************************************/ SCCout(PORT, WR2, 0x55); /*write to WR2*/ if (SCCin(PORT, RR2) != 0x55) /*read back RR2*/ { printf("\nError: Device not found at address %x HEX.\n",PORT); return(1); /*return code 1 for ERROR*/ } else { printf("\nDevice verified at address %x HEX.\n",PORT); } /*******************************************************************/ /* Initialize ACB card */ /*******************************************************************/ SCCout(PORT, WR9, FORCE_HW_RESET); /*channel reset A and B */ p = &init[0]; SCCInitEx(PORT, p, PRAM_COUNT); /* Initialize ACB */ /*******************************************************************/ /* Terminal */ /*******************************************************************/ printf("\n"); do { if(_bios_keybrd(_KEYBRD_READY)) /*SW INT 16 hex function 1*/ { c = (unsigned char)(_bios_keybrd(_KEYBRD_READ)); if (c != ESC) { OUT(PORT, c); /* write character to data port */ SCCout(PORT, WR0, RESET_TX_UR_EOM); /*reset TX underrun */ } } /* end if */ if (SCCin(PORT, RR0) & RX_CHAR_AVAIL) /*RX char available? */ { printf("%c",IN(PORT)); } /* end if */ } while (c != ESC); /* end do while*/ return(0); } /*******************************************************************/ /* End of File */ /*******************************************************************/