--- c/src/lib/libbsp/powerpc/ep1a/console/alloc360.c | 25 ++++---- c/src/lib/libbsp/powerpc/ep1a/console/m68360.h | 6 +- .../lib/libbsp/powerpc/ep1a/console/mc68360_scc.c | 54 ++++++++++------- c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.c | 24 ++++---- c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.h | 16 ++--- c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c | 70 +++++++++++++--------- c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h | 10 ++-- c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c | 45 ++++---------- 8 files changed, 134 insertions(+), 116 deletions(-)
diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/alloc360.c b/c/src/lib/libbsp/powerpc/ep1a/console/alloc360.c index e7a05be..edc13ff 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/console/alloc360.c +++ b/c/src/lib/libbsp/powerpc/ep1a/console/alloc360.c @@ -25,7 +25,8 @@ #define DEBUG_PRINT 1 -void M360SetupMemory( M68360_t ptr ){ +void M360SetupMemory( M68360_t ptr ) +{ volatile m360_t *m360; m360 = ptr->m360; @@ -34,19 +35,19 @@ void M360SetupMemory( M68360_t ptr ){ printk("m360->mcr:0x%08x Q1_360_SIM_MCR:0x%08x\n", (unsigned int)&(m360->mcr), ((unsigned int)m360+Q1_360_SIM_MCR)); #endif - ptr->bdregions[0].base = (char *)&m360->dpram1[0]; + ptr->bdregions[0].base = &m360->dpram1[0]; ptr->bdregions[0].size = sizeof m360->dpram1; ptr->bdregions[0].used = 0; - ptr->bdregions[1].base = (char *)&m360->dpram3[0]; + ptr->bdregions[1].base = &m360->dpram3[0]; ptr->bdregions[1].size = sizeof m360->dpram3; ptr->bdregions[1].used = 0; - ptr->bdregions[2].base = (char *)&m360->dpram0[0]; + ptr->bdregions[2].base = &m360->dpram0[0]; ptr->bdregions[2].size = sizeof m360->dpram0; ptr->bdregions[2].used = 0; - ptr->bdregions[3].base = (char *)&m360->dpram2[0]; + ptr->bdregions[3].base = &m360->dpram2[0]; ptr->bdregions[3].size = sizeof m360->dpram2; ptr->bdregions[3].used = 0; } @@ -59,17 +60,17 @@ void * M360AllocateBufferDescriptors (M68360_t ptr, int count) { unsigned int i; - ISR_Level level; - void *bdp = NULL; - unsigned int want = count * sizeof(m360BufferDescriptor_t); - int have; + rtems_interrupt_level level; + volatile unsigned char *bdp = NULL; + unsigned int want = count * sizeof(m360BufferDescriptor_t); + int have; /* * Running with interrupts disabled is usually considered bad * form, but this routine is probably being run as part of an * initialization sequence so the effect shouldn't be too severe. */ - _ISR_Disable (level); + rtems_interrupt_disable(level); for (i = 0 ; i < M360_NUM_DPRAM_REAGONS ; i++) { @@ -100,10 +101,10 @@ M360AllocateBufferDescriptors (M68360_t ptr, int count) break; } } - _ISR_Enable (level); + rtems_interrupt_enable(level); if (bdp == NULL){ printk("rtems_panic can't allocate %d buffer descriptor(s).\n"); rtems_panic ("Can't allocate %d buffer descriptor(s).\n", count); } - return bdp; + return (void *)bdp; } diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h b/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h index c4cd472..7c99a4d 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h +++ b/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h @@ -933,9 +933,9 @@ typedef struct m360_ { } m360_t; struct bdregions_t { - char *base; - unsigned int size; - unsigned int used; + volatile unsigned char *base; + unsigned int size; + unsigned int used; }; #define M68360_RX_BUF_SIZE 1 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 929bb96..641c74f 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c +++ b/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c @@ -1,6 +1,8 @@ /* This file contains the termios TTY driver for the * Motorola MC68360 SCC ports. - * + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -34,24 +36,32 @@ int EP1A_READ_LENGTH_GREATER_THAN_1 = 0; int mc68360_length_array[ MC68360_LENGTH_SIZE ]; int mc68360_length_count=0; -void mc68360_Show_length_array(void) { +#if 0 +/* + * This is a debug method which is not currently used. + */ +static void mc68360_Show_length_array(void) +{ int i; for (i=0; i<MC68360_LENGTH_SIZE; i++) printf(" %d", mc68360_length_array[i] ); printf("\n\n"); } #endif +#endif M68360_t M68360_chips = NULL; #define SYNC eieio -#define mc68360_scc_Is_422( _minor ) (Console_Port_Tbl[minor]->sDeviceName[7] == '4' ) +#define mc68360_scc_Is_422( _minor ) \ + (Console_Port_Tbl[minor]->sDeviceName[7] == '4' ) - -void mc68360_scc_nullFunc(void) {} - -uint8_t scc_read8( +#if 0 +/* + * This method is included for completeness but not currently used. + */ +static uint8_t scc_read8( const char *name, volatile uint8_t *address ) @@ -68,8 +78,9 @@ uint8_t scc_read8( return value; } +#endif -void scc_write8( +static void scc_write8( const char *name, volatile uint8_t *address, uint8_t value @@ -81,8 +92,7 @@ void scc_write8( *address = value; } - -uint16_t scc_read16( +static uint16_t scc_read16( const char *name, volatile uint16_t *address ) @@ -100,7 +110,7 @@ uint16_t scc_read16( return value; } -void scc_write16( +static void scc_write16( const char *name, volatile uint16_t *address, uint16_t value @@ -112,8 +122,7 @@ void scc_write16( *address = value; } - -uint32_t scc_read32( +static uint32_t scc_read32( const char *name, volatile uint32_t *address ) @@ -131,7 +140,7 @@ uint32_t scc_read32( return value; } -void scc_write32( +static void scc_write32( const char *name, volatile uint32_t *address, uint32_t value @@ -143,7 +152,12 @@ void scc_write32( *address = value; } -void mc68360_sccShow_Regs(int minor){ +#if 0 +/* + * This is a debug method which is not currently used. + */ +static void mc68360_sccShow_Regs(int minor) +{ M68360_serial_ports_t ptr; ptr = Console_Port_Tbl[minor]->pDeviceParams; @@ -151,6 +165,7 @@ void mc68360_sccShow_Regs(int minor){ printk( " 0x%04x\n", ptr->pSCCR->scce ); } +#endif #define TX_BUFFER_ADDRESS( _ptr ) \ ((char *)ptr->txBuf - (char *)ptr->chip->board_data->baseaddr) @@ -325,8 +340,7 @@ if (length > 1) * * Default state is 9600 baud, 8 bits, No parity, and 1 stop bit. */ - -int mc68360_scc_open( +static int mc68360_scc_open( int major, int minor, void * arg @@ -653,10 +667,10 @@ void mc68360_scc_initialize_interrupts(int minor) * Console Termios output entry point when using interrupt driven output. */ -int mc68360_scc_write_support_int( +ssize_t mc68360_scc_write_support_int( int minor, const char *buf, - int len + size_t len ) { rtems_interrupt_level Irql; @@ -953,7 +967,7 @@ int mc68360_scc_create_chip( PPMCQ1BoardData BoardData, uint8_t int_vector ) chip->board_data->slotNo, chip->board_data->funcNo, &mc68360_sccInterruptHandler, - chip + (uintptr_t) chip ); return RTEMS_SUCCESSFUL; diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.c b/c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.c index 89dd8b9..12a423b 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.c +++ b/c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.c @@ -1,6 +1,8 @@ /* - * This include file contains all console driver definations for the nc16550 - * + * This include file contains all console driver definitions for the ns16550. + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -9,10 +11,11 @@ * http://www.rtems.org/license/LICENSE. */ -#include <rtems.h> +#include <bsp.h> #include <libchip/serial.h> #include <libchip/ns16550.h> -#include <bsp.h> + +#include "ns16550cfg.h" typedef struct uart_reg { @@ -21,21 +24,22 @@ typedef struct uart_reg } uartReg; uint8_t Read_ns16550_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum + uintptr_t ulCtrlPort, + uint8_t ucRegNum ) { -volatile struct uart_reg *p = (volatile struct uart_reg *)ulCtrlPort; + volatile struct uart_reg *p = (volatile struct uart_reg *)ulCtrlPort; uint8_t ucData; + ucData = p[ucRegNum].reg; __asm__ volatile("sync"); return ucData; } void Write_ns16550_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum, - uint8_t ucData + uintptr_t ulCtrlPort, + uint8_t ucRegNum, + uint8_t ucData ) { volatile struct uart_reg *p = (volatile struct uart_reg *)ulCtrlPort; diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.h b/c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.h index 73bd2d0..45d5208 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.h +++ b/c/src/lib/libbsp/powerpc/ep1a/console/ns16550cfg.h @@ -1,6 +1,8 @@ /* - * This include file contains all console driver definations for the nc16550 - * + * This include file contains all console driver definitions for the ns16550. + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -21,14 +23,14 @@ extern "C" { */ uint8_t Read_ns16550_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum + uintptr_t ulCtrlPort, + uint8_t ucRegNum ); void Write_ns16550_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum, - uint8_t ucData + uintptr_t ulCtrlPort, + uint8_t ucRegNum, + uint8_t ucData ); extern const console_fns ns16550_fns_8245; diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c b/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c index 88e8819..122a4d0 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c +++ b/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c @@ -52,6 +52,7 @@ static unsigned char rsPMCQ1Initialized = FALSE; /* forward declarations */ +#if 0 /* local Qspan II serial eeprom table */ static unsigned char rsPMCQ1eeprom[] = { @@ -79,30 +80,33 @@ static unsigned char rsPMCQ1eeprom[] = 0xC0, /* Byte 21 - PCI_PMC */ 0x00 /* Byte 22 - PCI_BST */ }; +#endif -void MsDelay(void) +static void MsDelay(void) { printk("."); } -void write8( int addr, int data ){ +static void write8( int addr, int data ){ out_8((void *)addr, (unsigned char)data); } -void write16( int addr, int data ) { +static void write16( int addr, int data ) { out_be16((void *)addr, (short)data ); } -void write32( int addr, int data ) { +static void write32( int addr, int data ) { out_be32((unsigned int *)addr, data ); } -int read32( int addr){ +#if 0 +static int read32( int addr){ return in_be32((unsigned int *)addr); } +#endif -void rsPMCQ1_scc_nullFunc(void) {} +static void rsPMCQ1_scc_nullFunc(void) {} /******************************************************************************* * rsPMCQ1Int - handle a PMCQ1 interrupt @@ -113,7 +117,7 @@ void rsPMCQ1_scc_nullFunc(void) {} * RETURNS: NONE. */ -void rsPMCQ1Int( void *ptr ) +static void rsPMCQ1Int( void *ptr ) { unsigned long status; unsigned long status1; @@ -155,6 +159,7 @@ void rsPMCQ1Int( void *ptr ) *(volatile unsigned long *)(boardData->bridgeaddr + 0x600) = 0x00001000; /* read back the status register to ensure that the pci write has completed */ + (void) status1; /* avoid set but not used warning */ status1 = *(volatile unsigned long *)(boardData->bridgeaddr + 0x600); RTEMS_COMPILER_MEMORY_BARRIER(); @@ -175,8 +180,8 @@ unsigned int rsPMCQ1MaIntConnect ( unsigned long busNo, /* Pci Bus number of PMCQ1 */ unsigned long slotNo, /* Pci Slot number of PMCQ1 */ unsigned long funcNo, /* Pci Function number of PMCQ1 */ - FUNCION_PTR routine,/* interrupt routine */ - int arg /* argument to pass to interrupt routine */ + FUNCION_PTR routine,/* interrupt routine */ + uintptr_t arg /* argument to pass to interrupt routine */ ) { PPMCQ1BoardData boardData; @@ -207,6 +212,8 @@ unsigned int rsPMCQ1MaIntConnect ( return (status); } +#if 0 +/* This method is apparently unused. --joel 9 Oct 2014 */ /******************************************************************************* * * rsPMCQ1MaIntDisconnect - disconnect a MiniAce interrupt routine @@ -216,8 +223,7 @@ unsigned int rsPMCQ1MaIntConnect ( * * RETURNS: OK if PMCQ1 found, ERROR if not. */ - -unsigned int rsPMCQ1MaIntDisconnect( +static unsigned int rsPMCQ1MaIntDisconnect( unsigned long busNo, /* Pci Bus number of PMCQ1 */ unsigned long slotNo, /* Pci Slot number of PMCQ1 */ unsigned long funcNo /* Pci Function number of PMCQ1 */ @@ -239,6 +245,7 @@ unsigned int rsPMCQ1MaIntDisconnect( return (status); } +#endif /******************************************************************************* * @@ -249,13 +256,12 @@ unsigned int rsPMCQ1MaIntDisconnect( * * RETURNS: OK if PMCQ1 found, ERROR if not. */ - unsigned int rsPMCQ1QuiccIntConnect( unsigned long busNo, /* Pci Bus number of PMCQ1 */ unsigned long slotNo, /* Pci Slot number of PMCQ1 */ unsigned long funcNo, /* Pci Function number of PMCQ1 */ - FUNCION_PTR routine,/* interrupt routine */ - int arg /* argument to pass to interrupt routine */ + FUNCION_PTR routine,/* interrupt routine */ + uintptr_t arg /* argument to pass to interrupt routine */ ) { PPMCQ1BoardData boardData; @@ -275,6 +281,8 @@ unsigned int rsPMCQ1QuiccIntConnect( return (status); } +#if 0 +/* This method is apparently unused. --joel 9 Oct 2014 */ /******************************************************************************* * * rsPMCQ1QuiccIntDisconnect - disconnect a Quicc interrupt routine @@ -284,8 +292,7 @@ unsigned int rsPMCQ1QuiccIntConnect( * * RETURNS: OK if PMCQ1 found, ERROR if not. */ - -unsigned int rsPMCQ1QuiccIntDisconnect( +static unsigned int rsPMCQ1QuiccIntDisconnect( unsigned long busNo, /* Pci Bus number of PMCQ1 */ unsigned long slotNo, /* Pci Slot number of PMCQ1 */ unsigned long funcNo /* Pci Function number of PMCQ1 */ @@ -308,6 +315,8 @@ unsigned int rsPMCQ1QuiccIntDisconnect( return (status); } +#endif +/* This method is apparently unused. --joel 9 Oct 2014 */ /******************************************************************************* @@ -323,20 +332,22 @@ unsigned int rsPMCQ1Init(void) { int busNo; int slotNo; - unsigned int baseaddr = 0; - unsigned int bridgeaddr = 0; + uint32_t baseaddr = 0; + uint32_t bridgeaddr = 0; unsigned long pbti0_ctl; int i; unsigned char int_vector; int fun; - int temp; + uint32_t temp; PPMCQ1BoardData boardData; - rtems_irq_connect_data IrqData = {0, - rsPMCQ1Int, - rsPMCQ1_scc_nullFunc, - rsPMCQ1_scc_nullFunc, - rsPMCQ1_scc_nullFunc, - NULL}; + rtems_irq_connect_data IrqData = { + .name = 0, + .hdl = rsPMCQ1Int, + .handle = NULL, + .on = (rtems_irq_enable) rsPMCQ1_scc_nullFunc, + .off = (rtems_irq_disable) rsPMCQ1_scc_nullFunc, + .isOn = (rtems_irq_is_enabled) rsPMCQ1_scc_nullFunc, + }; if (rsPMCQ1Initialized) { @@ -480,6 +491,8 @@ unsigned int rsPMCQ1Init(void) return((i > 0) ? RTEMS_SUCCESSFUL : RTEMS_IO_ERROR); } +#if 0 +/* This method is apparently unused. --joel 9 Oct 2014 */ /******************************************************************************* * * rsPMCQ1Commission - initialize the serial EEPROM on the QSPAN @@ -489,8 +502,10 @@ unsigned int rsPMCQ1Init(void) * found with apparently uninitialised EEPROM's or PMCQ1's (to allow * EEPROM modifications to be performed). */ - -unsigned int rsPMCQ1Commission( unsigned long busNo, unsigned long slotNo ) +static unsigned int rsPMCQ1Commission( + unsigned long busNo, + unsigned long slotNo +) { unsigned int status = RTEMS_IO_ERROR; uint32_t bridgeaddr = 0; @@ -555,6 +570,7 @@ unsigned int rsPMCQ1Commission( unsigned long busNo, unsigned long slotNo ) } return(status); } +#endif uint32_t PMCQ1_Read_EPLD( uint32_t base, uint32_t reg ) { diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h b/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h index b743f02..a888ebb 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h +++ b/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h @@ -132,9 +132,9 @@ typedef struct _PMCQ1BoardData unsigned long baseaddr; unsigned long bridgeaddr; FUNCION_PTR quiccInt; - int quiccArg; + uintptr_t quiccArg; FUNCION_PTR maInt; - int maArg; + uintptr_t maArg; } PMCQ1BoardData, *PPMCQ1BoardData; extern PPMCQ1BoardData pmcq1BoardData; @@ -147,15 +147,17 @@ extern unsigned int rsPMCQ1QuiccIntConnect( unsigned long slotNo, unsigned long funcNo, FUNCION_PTR routine, - int arg + uintptr_t arg ); + unsigned int rsPMCQ1Init(void); + unsigned int rsPMCQ1MaIntConnect ( unsigned long busNo, /* Pci Bus number of PMCQ1 */ unsigned long slotNo, /* Pci Slot number of PMCQ1 */ unsigned long funcNo, /* Pci Function number of PMCQ1 */ FUNCION_PTR routine,/* interrupt routine */ - int arg /* argument to pass to interrupt routine */ + uintptr_t arg /* argument to pass to interrupt routine */ ); #endif /* __INCPMCQ1H */ diff --git a/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c b/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c index 0a5a765..a0e2636 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c @@ -3,7 +3,7 @@ */ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2014. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -51,37 +51,32 @@ uint8_t LightIdx = 0; extern int RAM_END; unsigned int BSP_mem_size = (unsigned int)&RAM_END; -void BSP_Increment_Light(void){ +static void BSP_Increment_Light(void) +{ uint8_t data; + data = *GENERAL_REGISTER1; data &= 0xf0; data |= LightIdx++; *GENERAL_REGISTER1 = data; } -void BSP_Fatal_Fault_Light(void) { +#if 0 +static void BSP_Fatal_Fault_Light(void) +{ uint8_t data; + data = *GENERAL_REGISTER1; data &= 0xf0; data |= 0x7; while(1) *GENERAL_REGISTER1 = data; } - -void write_to_Q2ram(int offset, unsigned int data ) -{ -printk("0x%x ==> %d\n", offset, data ); -#if 0 - unsigned int *ptr = 0x82000000; - ptr += offset; - *ptr = data; #endif -} /* * Vital Board data Start using DATA RESIDUAL */ - uint32_t VME_Slot1 = FALSE; /* @@ -160,27 +155,10 @@ void bsp_pretasking_hook(void) rsPMCQ1Init(); } -void zero_bss(void) -{ - memset(__SBSS_START__, 0, ((unsigned) __SBSS_END__) - ((unsigned)__SBSS_START__)); - memset(__SBSS2_START__, 0, ((unsigned) __SBSS2_END__) - ((unsigned)__SBSS2_START__)); - memset(__bss_start, 0, ((unsigned) __rtems_end) - ((unsigned)__bss_start)); -} - -char * save_boot_params(RESIDUAL* r3, void *r4, void* r5, char *additional_boot_options) -{ -#if 0 - residualCopy = *r3; - strncpy(loaderParam, additional_boot_options, MAX_LOADER_ADD_PARM); - loaderParam[MAX_LOADER_ADD_PARM - 1] ='\0'; - return loaderParam; -#endif - return 0; -} - unsigned int EUMBBAR; -unsigned int get_eumbbar(void) { +static unsigned int get_eumbbar(void) +{ register int a, e; __asm__ volatile( "lis %0,0xfec0; ori %0,%0,0x0000": "=r" (a) ); @@ -198,7 +176,7 @@ unsigned int get_eumbbar(void) { return e; } -void Read_ep1a_config_registers( ppc_cpu_id_t myCpu ) { +static void Read_ep1a_config_registers( ppc_cpu_id_t myCpu ) { unsigned char value; /* @@ -288,6 +266,7 @@ void bsp_start( void ) * latter... */ BSP_Increment_Light(); + (void) myCpuRevision; /* avoid set but not used warning */ myCpu = get_ppc_cpu_type(); myCpuRevision = get_ppc_cpu_revision(); -- 1.9.3 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel