Removed use of data port for z8530.

Move some code around.
This commit is contained in:
Joel Sherrill
1998-07-18 18:35:34 +00:00
parent 3652929e61
commit c14a619709
4 changed files with 108 additions and 180 deletions

View File

@@ -243,49 +243,6 @@ Z85C30_STATIC int z85c30_close(
return(RTEMS_SUCCESSFUL); return(RTEMS_SUCCESSFUL);
} }
/*
* z85c30_write_polled
*
* This routine transmits a character using polling.
*/
Z85C30_STATIC void z85c30_write_polled(
int minor,
char cChar
)
{
volatile unsigned8 z85c30_status;
unsigned32 ulCtrlPort;
getRegister_f getReg;
setData_f setData;
ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
getReg = Console_Port_Tbl[minor].getRegister;
setData = Console_Port_Tbl[minor].setData;
/*
* Wait for the Transmit buffer to indicate that it is empty.
*/
z85c30_status = (*getReg)( ulCtrlPort, SCC_WR0_SEL_RD0 );
while (!Z85C30_Status_Is_TX_buffer_empty(z85c30_status)) {
/*
* Yield while we wait
*/
if (_System_state_Is_up(_System_state_Get())) {
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
}
z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0);
}
/*
* Write the character.
*/
(*setData)(Console_Port_Tbl[minor].ulDataPort, cChar);
}
/* /*
* Console Device Driver Entry Points * Console Device Driver Entry Points
*/ */
@@ -580,20 +537,14 @@ Z85C30_STATIC void z85c30_process(
) )
{ {
unsigned32 ulCtrlPort; unsigned32 ulCtrlPort;
unsigned32 ulDataPort;
volatile unsigned8 z85c30_status; volatile unsigned8 z85c30_status;
char cChar; char cChar;
setRegister_f setReg; setRegister_f setReg;
getRegister_f getReg; getRegister_f getReg;
getData_f getData;
setData_f setData;
ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
ulDataPort = Console_Port_Tbl[minor].ulDataPort;
setReg = Console_Port_Tbl[minor].setRegister; setReg = Console_Port_Tbl[minor].setRegister;
getReg = Console_Port_Tbl[minor].getRegister; getReg = Console_Port_Tbl[minor].getRegister;
getData = Console_Port_Tbl[minor].getData;
setData = Console_Port_Tbl[minor].setData;
/* /*
* Deal with any received characters * Deal with any received characters
@@ -609,7 +560,7 @@ Z85C30_STATIC void z85c30_process(
* Return the character read. * Return the character read.
*/ */
cChar = (*getData)(ulDataPort); cChar = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD8);
rtems_termios_enqueue_raw_characters( rtems_termios_enqueue_raw_characters(
Console_Port_Data[minor].termios_data, Console_Port_Data[minor].termios_data,
@@ -658,7 +609,7 @@ Z85C30_STATIC void z85c30_process(
/* /*
* transmit character * transmit character
*/ */
(*setData)(ulDataPort, cChar); (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR8, cChar);
/* /*
* Interrupt once FIFO has room * Interrupt once FIFO has room
@@ -883,10 +834,8 @@ Z85C30_STATIC int z85c30_inbyte_nonblocking_polled(
volatile unsigned8 z85c30_status; volatile unsigned8 z85c30_status;
unsigned32 ulCtrlPort; unsigned32 ulCtrlPort;
getRegister_f getReg; getRegister_f getReg;
getData_f getData;
ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
getData = Console_Port_Tbl[minor].getData;
getReg = Console_Port_Tbl[minor].getRegister; getReg = Console_Port_Tbl[minor].getRegister;
/* /*
@@ -900,7 +849,8 @@ Z85C30_STATIC int z85c30_inbyte_nonblocking_polled(
/* /*
* Return the character read. * Return the character read.
*/ */
return (*getData)(Console_Port_Tbl[minor].ulDataPort);
return (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD8);
} }
/* /*
@@ -930,3 +880,47 @@ Z85C30_STATIC int z85c30_write_support_polled(
*/ */
return nwrite; return nwrite;
} }
/*
* z85c30_write_polled
*
* This routine transmits a character using polling.
*/
Z85C30_STATIC void z85c30_write_polled(
int minor,
char cChar
)
{
volatile unsigned8 z85c30_status;
unsigned32 ulCtrlPort;
getRegister_f getReg;
setRegister_f setReg;
ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
getReg = Console_Port_Tbl[minor].getRegister;
setReg = Console_Port_Tbl[minor].setRegister;
/*
* Wait for the Transmit buffer to indicate that it is empty.
*/
z85c30_status = (*getReg)( ulCtrlPort, SCC_WR0_SEL_RD0 );
while (!Z85C30_Status_Is_TX_buffer_empty(z85c30_status)) {
/*
* Yield while we wait
*/
if (_System_state_Is_up(_System_state_Get())) {
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
}
z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0);
}
/*
* Write the character.
*/
(*setReg)( ulCtrlPort, SCC_WR0_SEL_WR8, cChar );
}

View File

@@ -71,33 +71,3 @@ void _Z85C30_NAME(z85c30_set_register)(
*port = ucData; *port = ucData;
rtems_interrupt_disable(level); rtems_interrupt_disable(level);
} }
/*
* Z85C30 Get Data Routine
*/
unsigned8 _Z85C30_NAME(z85c30_get_data)(
unsigned32 ulDataPort
)
{
_Z85C30_TYPE *port;
port = (_Z85C30_TYPE *)ulDataPort;
return *port;
}
/*
* Z85C30 Set Data Routine
*/
void _Z85C30_NAME(z85c30_set_data)(
unsigned32 ulDataPort,
unsigned8 ucData
)
{
_Z85C30_TYPE *port;
port = (_Z85C30_TYPE *)ulDataPort;
*port = ucData;
}

View File

@@ -243,49 +243,6 @@ Z85C30_STATIC int z85c30_close(
return(RTEMS_SUCCESSFUL); return(RTEMS_SUCCESSFUL);
} }
/*
* z85c30_write_polled
*
* This routine transmits a character using polling.
*/
Z85C30_STATIC void z85c30_write_polled(
int minor,
char cChar
)
{
volatile unsigned8 z85c30_status;
unsigned32 ulCtrlPort;
getRegister_f getReg;
setData_f setData;
ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
getReg = Console_Port_Tbl[minor].getRegister;
setData = Console_Port_Tbl[minor].setData;
/*
* Wait for the Transmit buffer to indicate that it is empty.
*/
z85c30_status = (*getReg)( ulCtrlPort, SCC_WR0_SEL_RD0 );
while (!Z85C30_Status_Is_TX_buffer_empty(z85c30_status)) {
/*
* Yield while we wait
*/
if (_System_state_Is_up(_System_state_Get())) {
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
}
z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0);
}
/*
* Write the character.
*/
(*setData)(Console_Port_Tbl[minor].ulDataPort, cChar);
}
/* /*
* Console Device Driver Entry Points * Console Device Driver Entry Points
*/ */
@@ -580,20 +537,14 @@ Z85C30_STATIC void z85c30_process(
) )
{ {
unsigned32 ulCtrlPort; unsigned32 ulCtrlPort;
unsigned32 ulDataPort;
volatile unsigned8 z85c30_status; volatile unsigned8 z85c30_status;
char cChar; char cChar;
setRegister_f setReg; setRegister_f setReg;
getRegister_f getReg; getRegister_f getReg;
getData_f getData;
setData_f setData;
ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
ulDataPort = Console_Port_Tbl[minor].ulDataPort;
setReg = Console_Port_Tbl[minor].setRegister; setReg = Console_Port_Tbl[minor].setRegister;
getReg = Console_Port_Tbl[minor].getRegister; getReg = Console_Port_Tbl[minor].getRegister;
getData = Console_Port_Tbl[minor].getData;
setData = Console_Port_Tbl[minor].setData;
/* /*
* Deal with any received characters * Deal with any received characters
@@ -609,7 +560,7 @@ Z85C30_STATIC void z85c30_process(
* Return the character read. * Return the character read.
*/ */
cChar = (*getData)(ulDataPort); cChar = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD8);
rtems_termios_enqueue_raw_characters( rtems_termios_enqueue_raw_characters(
Console_Port_Data[minor].termios_data, Console_Port_Data[minor].termios_data,
@@ -658,7 +609,7 @@ Z85C30_STATIC void z85c30_process(
/* /*
* transmit character * transmit character
*/ */
(*setData)(ulDataPort, cChar); (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR8, cChar);
/* /*
* Interrupt once FIFO has room * Interrupt once FIFO has room
@@ -883,10 +834,8 @@ Z85C30_STATIC int z85c30_inbyte_nonblocking_polled(
volatile unsigned8 z85c30_status; volatile unsigned8 z85c30_status;
unsigned32 ulCtrlPort; unsigned32 ulCtrlPort;
getRegister_f getReg; getRegister_f getReg;
getData_f getData;
ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
getData = Console_Port_Tbl[minor].getData;
getReg = Console_Port_Tbl[minor].getRegister; getReg = Console_Port_Tbl[minor].getRegister;
/* /*
@@ -900,7 +849,8 @@ Z85C30_STATIC int z85c30_inbyte_nonblocking_polled(
/* /*
* Return the character read. * Return the character read.
*/ */
return (*getData)(Console_Port_Tbl[minor].ulDataPort);
return (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD8);
} }
/* /*
@@ -930,3 +880,47 @@ Z85C30_STATIC int z85c30_write_support_polled(
*/ */
return nwrite; return nwrite;
} }
/*
* z85c30_write_polled
*
* This routine transmits a character using polling.
*/
Z85C30_STATIC void z85c30_write_polled(
int minor,
char cChar
)
{
volatile unsigned8 z85c30_status;
unsigned32 ulCtrlPort;
getRegister_f getReg;
setRegister_f setReg;
ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
getReg = Console_Port_Tbl[minor].getRegister;
setReg = Console_Port_Tbl[minor].setRegister;
/*
* Wait for the Transmit buffer to indicate that it is empty.
*/
z85c30_status = (*getReg)( ulCtrlPort, SCC_WR0_SEL_RD0 );
while (!Z85C30_Status_Is_TX_buffer_empty(z85c30_status)) {
/*
* Yield while we wait
*/
if (_System_state_Is_up(_System_state_Get())) {
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
}
z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0);
}
/*
* Write the character.
*/
(*setReg)( ulCtrlPort, SCC_WR0_SEL_WR8, cChar );
}

View File

@@ -71,33 +71,3 @@ void _Z85C30_NAME(z85c30_set_register)(
*port = ucData; *port = ucData;
rtems_interrupt_disable(level); rtems_interrupt_disable(level);
} }
/*
* Z85C30 Get Data Routine
*/
unsigned8 _Z85C30_NAME(z85c30_get_data)(
unsigned32 ulDataPort
)
{
_Z85C30_TYPE *port;
port = (_Z85C30_TYPE *)ulDataPort;
return *port;
}
/*
* Z85C30 Set Data Routine
*/
void _Z85C30_NAME(z85c30_set_data)(
unsigned32 ulDataPort,
unsigned8 ucData
)
{
_Z85C30_TYPE *port;
port = (_Z85C30_TYPE *)ulDataPort;
*port = ucData;
}