Added initial part of iniitialization.

This commit is contained in:
Joel Sherrill
1998-06-22 11:49:38 +00:00
parent ab2dbd7e94
commit 7deeb16840
4 changed files with 72 additions and 16 deletions

View File

@@ -84,6 +84,7 @@ static boolean mc68681_probe(int minor)
static void mc68681_init(int minor) static void mc68681_init(int minor)
{ {
/* XXX */ /* XXX */
unsigned32 pMC68681_port;
unsigned32 pMC68681; unsigned32 pMC68681;
unsigned8 ucTrash; unsigned8 ucTrash;
unsigned8 ucDataByte; unsigned8 ucDataByte;
@@ -102,11 +103,32 @@ ulBaudDivisor = ucDataByte = ucTrash = 0;
pmc68681Context->ucModemCtrl = SP_MODEM_IRQ; pmc68681Context->ucModemCtrl = SP_MODEM_IRQ;
#endif #endif
pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort1;
setReg = Console_Port_Tbl[minor].setRegister; pMC68681 = Console_Port_Tbl[minor].ulCtrlPort2;
getReg = Console_Port_Tbl[minor].getRegister; setReg = Console_Port_Tbl[minor].setRegister;
getReg = Console_Port_Tbl[minor].getRegister;
/*
* Reset Receiver
*/
(*setReg)( pMC68681, MC68681_COMMAND, MC68681_MODE_REG_RESET_RX );
(*setReg)( pMC68681, MC68681_COMMAND, MC68681_MODE_REG_RESET_RX );
/*
* Reset Transmitter
*/
(*setReg)( pMC68681, MC68681_COMMAND, MC68681_MODE_REG_RESET_TX );
(*setReg)( pMC68681, MC68681_COMMAND, MC68681_MODE_REG_RESET_TX );
(*setReg)( pMC68681, MC68681_MODE_REG_1A, 0x00 );
(*setReg)( pMC68681, MC68681_MODE_REG_2A, 0x02 );
#if 0 #if 0
/* FOM NS16550 */
/* Clear the divisor latch, clear all interrupt enables, /* Clear the divisor latch, clear all interrupt enables,
* and reset and * and reset and
* disable the FIFO's. * disable the FIFO's.
@@ -208,7 +230,7 @@ static void mc68681_write_polled(
* wait for transmitter holding register to be empty * wait for transmitter holding register to be empty
*/ */
iTimeout = 1000; iTimeout = 1000;
ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS_REG); ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS);
while ((ucLineStatus & MC68681_TX_READY) == 0) { while ((ucLineStatus & MC68681_TX_READY) == 0) {
/* /*
@@ -218,7 +240,7 @@ static void mc68681_write_polled(
if(_System_state_Is_up(_System_state_Get())) { if(_System_state_Is_up(_System_state_Get())) {
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
} }
ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS_REG); ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS);
if(!--iTimeout) { if(!--iTimeout) {
break; break;
} }
@@ -644,7 +666,7 @@ static int mc68681_inbyte_nonblocking_polled(
getReg = Console_Port_Tbl[minor].getRegister; getReg = Console_Port_Tbl[minor].getRegister;
getData = Console_Port_Tbl[minor].getData; getData = Console_Port_Tbl[minor].getData;
ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS_REG); ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS);
if(ucLineStatus & MC68681_RX_READY) { if(ucLineStatus & MC68681_RX_READY) {
cChar = (*getData)(pMC68681); cChar = (*getData)(pMC68681);
return (int)cChar; return (int)cChar;

View File

@@ -20,10 +20,16 @@ extern "C" {
/* /*
* These are just used in the interface between this driver and * These are just used in the interface between this driver and
* the read/write register routines. * the read/write register routines when accessing the first
* control port.
*/ */
#define MC68681_STATUS_REG 0xFF #define MC68681_STATUS 1
#define MC68681_RX_BUFFER 2
#define MC68681_CLOCK_SELECT 1
#define MC68681_COMMAND 2
#define MC68681_TX_BUFFER 3
/* /*
* Driver function table * Driver function table

View File

@@ -84,6 +84,7 @@ static boolean mc68681_probe(int minor)
static void mc68681_init(int minor) static void mc68681_init(int minor)
{ {
/* XXX */ /* XXX */
unsigned32 pMC68681_port;
unsigned32 pMC68681; unsigned32 pMC68681;
unsigned8 ucTrash; unsigned8 ucTrash;
unsigned8 ucDataByte; unsigned8 ucDataByte;
@@ -102,11 +103,32 @@ ulBaudDivisor = ucDataByte = ucTrash = 0;
pmc68681Context->ucModemCtrl = SP_MODEM_IRQ; pmc68681Context->ucModemCtrl = SP_MODEM_IRQ;
#endif #endif
pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort1;
setReg = Console_Port_Tbl[minor].setRegister; pMC68681 = Console_Port_Tbl[minor].ulCtrlPort2;
getReg = Console_Port_Tbl[minor].getRegister; setReg = Console_Port_Tbl[minor].setRegister;
getReg = Console_Port_Tbl[minor].getRegister;
/*
* Reset Receiver
*/
(*setReg)( pMC68681, MC68681_COMMAND, MC68681_MODE_REG_RESET_RX );
(*setReg)( pMC68681, MC68681_COMMAND, MC68681_MODE_REG_RESET_RX );
/*
* Reset Transmitter
*/
(*setReg)( pMC68681, MC68681_COMMAND, MC68681_MODE_REG_RESET_TX );
(*setReg)( pMC68681, MC68681_COMMAND, MC68681_MODE_REG_RESET_TX );
(*setReg)( pMC68681, MC68681_MODE_REG_1A, 0x00 );
(*setReg)( pMC68681, MC68681_MODE_REG_2A, 0x02 );
#if 0 #if 0
/* FOM NS16550 */
/* Clear the divisor latch, clear all interrupt enables, /* Clear the divisor latch, clear all interrupt enables,
* and reset and * and reset and
* disable the FIFO's. * disable the FIFO's.
@@ -208,7 +230,7 @@ static void mc68681_write_polled(
* wait for transmitter holding register to be empty * wait for transmitter holding register to be empty
*/ */
iTimeout = 1000; iTimeout = 1000;
ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS_REG); ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS);
while ((ucLineStatus & MC68681_TX_READY) == 0) { while ((ucLineStatus & MC68681_TX_READY) == 0) {
/* /*
@@ -218,7 +240,7 @@ static void mc68681_write_polled(
if(_System_state_Is_up(_System_state_Get())) { if(_System_state_Is_up(_System_state_Get())) {
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
} }
ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS_REG); ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS);
if(!--iTimeout) { if(!--iTimeout) {
break; break;
} }
@@ -644,7 +666,7 @@ static int mc68681_inbyte_nonblocking_polled(
getReg = Console_Port_Tbl[minor].getRegister; getReg = Console_Port_Tbl[minor].getRegister;
getData = Console_Port_Tbl[minor].getData; getData = Console_Port_Tbl[minor].getData;
ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS_REG); ucLineStatus = (*getReg)(pMC68681, MC68681_STATUS);
if(ucLineStatus & MC68681_RX_READY) { if(ucLineStatus & MC68681_RX_READY) {
cChar = (*getData)(pMC68681); cChar = (*getData)(pMC68681);
return (int)cChar; return (int)cChar;

View File

@@ -20,10 +20,16 @@ extern "C" {
/* /*
* These are just used in the interface between this driver and * These are just used in the interface between this driver and
* the read/write register routines. * the read/write register routines when accessing the first
* control port.
*/ */
#define MC68681_STATUS_REG 0xFF #define MC68681_STATUS 1
#define MC68681_RX_BUFFER 2
#define MC68681_CLOCK_SELECT 1
#define MC68681_COMMAND 2
#define MC68681_TX_BUFFER 3
/* /*
* Driver function table * Driver function table