summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c')
-rw-r--r--c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c146
1 files changed, 59 insertions, 87 deletions
diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c b/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c
index ad9b5700fe..b2dab2ba17 100644
--- a/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c
+++ b/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c
@@ -167,25 +167,15 @@ mc68360_sccBRGC(int baud, int m360_clock_rate)
}
-/**************************************************************************
- * Function: sccInterruptHandler *
- **************************************************************************
- * Description: *
- * *
- * This is the interrupt service routine for the console UART. It *
- * handles both receive and transmit interrupts. The bulk of the *
- * work is done by termios. *
- * *
- * Inputs: *
- * *
- * chip - structure of chip specific information *
- * *
- * Output: *
- * *
- * none *
- * *
- **************************************************************************/
-void mc68360_sccInterruptHandler( M68360_t chip )
+/*
+ * sccInterruptHandler
+ *
+ * This is the interrupt service routine for the console UART. It
+ * handles both receive and transmit interrupts. The bulk of the
+ * work is done by termios.
+ *
+ */
+static void mc68360_sccInterruptHandler( M68360_t chip )
{
volatile m360_t *m360;
int port;
@@ -280,21 +270,17 @@ static int mc68360_scc_open(
)
{
M68360_serial_ports_t ptr;
- volatile m360_t *m360;
uint32_t data;
#ifdef DEBUG_360
printk("mc68360_scc_open %d\n", minor);
#endif
-
- ptr = Console_Port_Tbl[minor]->pDeviceParams;
- m360 = ptr->chip->m360;
+ ptr = Console_Port_Tbl[minor]->pDeviceParams;
/*
* Enable the receiver and the transmitter.
*/
-
SYNC();
data = scc_read32( "pSCCR->gsmr_l", &ptr->pSCCR->gsmr_l);
scc_write32( "pSCCR->gsmr_l", &ptr->pSCCR->gsmr_l,
@@ -311,7 +297,7 @@ static int mc68360_scc_open(
return RTEMS_SUCCESSFUL;
}
-uint32_t mc68360_scc_calculate_pbdat( M68360_t chip )
+static uint32_t mc68360_scc_calculate_pbdat( M68360_t chip )
{
uint32_t i;
uint32_t pbdat_data;
@@ -336,8 +322,7 @@ uint32_t mc68360_scc_calculate_pbdat( M68360_t chip )
* This routine initializes the console's receive and transmit
* ring buffers and loads the appropriate vectors to handle the interrupts.
*/
-
-void mc68360_scc_initialize_interrupts(int minor)
+static void mc68360_scc_initialize_interrupts(int minor)
{
M68360_serial_ports_t ptr;
volatile m360_t *m360;
@@ -599,8 +584,7 @@ void mc68360_scc_initialize_interrupts(int minor)
*
* Console Termios output entry point when using interrupt driven output.
*/
-
-ssize_t mc68360_scc_write_support_int(
+static ssize_t mc68360_scc_write_support_int(
int minor,
const char *buf,
size_t len
@@ -657,8 +641,7 @@ ssize_t mc68360_scc_write_support_int(
*
* This routine polls out the requested character.
*/
-
-void mc68360_scc_write_polled(
+static void mc68360_scc_write_polled(
int minor,
char cChar
)
@@ -674,63 +657,57 @@ void mc68360_scc_write_polled(
* This function sets the DUART channel to reflect the requested termios
* port settings.
*/
-
-int mc68360_scc_set_attributes(
+static int mc68360_scc_set_attributes(
int minor,
const struct termios *t
)
{
- int baud;
- volatile m360_t *m360;
- M68360_serial_ports_t ptr;
- uint16_t value;
+ int baud;
+ M68360_serial_ports_t ptr;
+ uint16_t value;
#ifdef DEBUG_360
printk("mc68360_scc_set_attributes\n");
#endif
- ptr = Console_Port_Tbl[minor]->pDeviceParams;
- m360 = ptr->chip->m360;
-
- switch (t->c_cflag & CBAUD)
- {
- case B50: baud = 50; break;
- case B75: baud = 75; break;
- case B110: baud = 110; break;
- case B134: baud = 134; break;
- case B150: baud = 150; break;
- case B200: baud = 200; break;
- case B300: baud = 300; break;
- case B600: baud = 600; break;
- case B1200: baud = 1200; break;
- case B1800: baud = 1800; break;
- case B2400: baud = 2400; break;
- case B4800: baud = 4800; break;
- case B9600: baud = 9600; break;
- case B19200: baud = 19200; break;
- case B38400: baud = 38400; break;
- case B57600: baud = 57600; break;
- case B115200: baud = 115200; break;
- case B230400: baud = 230400; break;
- case B460800: baud = 460800; break;
- default: baud = -1; break;
- }
-
- if (baud > 0)
- {
- scc_write32(
- "pBRGC",
- ptr->pBRGC,
- mc68360_sccBRGC(baud, ptr->chip->m360_clock_rate)
- );
- }
+ ptr = Console_Port_Tbl[minor]->pDeviceParams;
+
+ switch (t->c_cflag & CBAUD) {
+ case B50: baud = 50; break;
+ case B75: baud = 75; break;
+ case B110: baud = 110; break;
+ case B134: baud = 134; break;
+ case B150: baud = 150; break;
+ case B200: baud = 200; break;
+ case B300: baud = 300; break;
+ case B600: baud = 600; break;
+ case B1200: baud = 1200; break;
+ case B1800: baud = 1800; break;
+ case B2400: baud = 2400; break;
+ case B4800: baud = 4800; break;
+ case B9600: baud = 9600; break;
+ case B19200: baud = 19200; break;
+ case B38400: baud = 38400; break;
+ case B57600: baud = 57600; break;
+ case B115200: baud = 115200; break;
+ case B230400: baud = 230400; break;
+ case B460800: baud = 460800; break;
+ default: baud = -1; break;
+ }
+
+ if (baud > 0) {
+ scc_write32(
+ "pBRGC",
+ ptr->pBRGC,
+ mc68360_sccBRGC(baud, ptr->chip->m360_clock_rate)
+ );
+ }
/* Initial value of PSMR should be 0 */
value = M360_PSMR_UM_NORMAL;
/* set the number of data bits, 8 is most common */
- if (t->c_cflag & CSIZE) /* was it specified? */
- {
+ if (t->c_cflag & CSIZE) { /* was it specified? */
switch (t->c_cflag & CSIZE) {
case CS5: value |= M360_PSMR_CL5; break;
case CS6: value |= M360_PSMR_CL6; break;
@@ -750,8 +727,7 @@ printk("mc68360_scc_set_attributes\n");
/* Set Parity M360_PSMR_PEN bit should be clear on no parity so
* do nothing in that case
*/
- if (t->c_cflag & PARENB) /* enable parity detection? */
- {
+ if (t->c_cflag & PARENB) { /* enable parity detection? */
value |= M360_PSMR_PEN;
if (t->c_cflag & PARODD){
value |= M360_PSMR_RPM_ODD; /* select odd parity */
@@ -774,14 +750,13 @@ printk("mc68360_scc_set_attributes\n");
*
* This function shuts down the requested port.
*/
-
-int mc68360_scc_close(
+static int mc68360_scc_close(
int major,
int minor,
void *arg
)
{
- return(RTEMS_SUCCESSFUL);
+ return RTEMS_SUCCESSFUL;
}
/*
@@ -789,12 +764,11 @@ int mc68360_scc_close(
*
* Console Termios polling input entry point.
*/
-
-int mc68360_scc_inbyte_nonblocking_polled(
+static int mc68360_scc_inbyte_nonblocking_polled(
int minor
)
{
- return -1;
+ return -1;
}
/*
@@ -803,8 +777,7 @@ int mc68360_scc_inbyte_nonblocking_polled(
* Console Termios output entry point when using polled output.
*
*/
-
-ssize_t mc68360_scc_write_support_polled(
+static ssize_t mc68360_scc_write_support_polled(
int minor,
const char *buf,
size_t len
@@ -820,8 +793,7 @@ ssize_t mc68360_scc_write_support_polled(
*
* This function initializes the DUART to a quiecsent state.
*/
-
-void mc68360_scc_init(int minor)
+static void mc68360_scc_init(int minor)
{
#ifdef DEBUG_360
printk("mc68360_scc_init\n");
@@ -899,7 +871,7 @@ int mc68360_scc_create_chip( PPMCQ1BoardData BoardData, uint8_t int_vector )
chip->board_data->busNo,
chip->board_data->slotNo,
chip->board_data->funcNo,
- &mc68360_sccInterruptHandler,
+ (FUNCTION_PTR) &mc68360_sccInterruptHandler,
(uintptr_t) chip
);