SH libcpu and libbsp: Fix warnings

This commit is contained in:
Joel Sherrill
2014-10-15 14:20:14 -05:00
parent 694debefe9
commit 0626dba48a
15 changed files with 350 additions and 332 deletions

View File

@@ -1,8 +1,10 @@
/*
* This include file contains all board IO definitions.
*
* generic sh1
*
* This include file contains all board IO definitions.
*/
/*
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
*
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
@@ -68,8 +70,9 @@ extern void *CPU_Interrupt_stack_high;
console_read, console_write, console_control }
/*
* NOTE: Use the standard Clock driver entry
* BSP methods that cross file boundaries.
*/
void bsp_hw_init(void);
#ifdef __cplusplus
}

View File

@@ -1,8 +1,10 @@
/*
* This include file contains all board IO definitions.
*
* generic sh2
*
* This include file contains all board IO definitions.
*/
/*
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
*
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
@@ -45,12 +47,11 @@ extern "C" {
#include <bspopts.h>
#include <bsp/default-initial-extension.h>
#if 0
#include <rtems/devnull.h>
#define BSP_CONSOLE_DEVNAME "/dev/null"
#define BSP_CONSOLE_DRIVER_TABLE_ENTRY DEVNULL_DRIVER_TABLE_ENTRY
#else
#include <termios.h> /* for tcflag_t */
#include <sh/sci.h>
#if 1
/* FIXME:
* These definitions will be no longer necessary if the old
* implementation of SCI driver will be droped
@@ -66,17 +67,18 @@ extern "C" {
/*
* Defined in the linker script 'linkcmds'
*/
extern void *CPU_Interrupt_stack_low;
extern void *CPU_Interrupt_stack_high;
/*
* Device Driver Table Entries
*/
/*
* NOTE: Use the standard Clock driver entry
* BSP methods that cross file boundaries.
*/
void bsp_hw_init(void);
extern int _sci_get_brparms(
tcflag_t cflag,
unsigned char *smr,
unsigned char *brr
);
#ifdef __cplusplus
}

View File

@@ -1,6 +1,8 @@
/*
* SMFD board hardware initialization.
*
*/
/*
* Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
* Author: Victor V. Vengerov <vvv@oktet.ru>
* Alexandra Kossovsky <sasha@oktet.ru>
@@ -25,15 +27,8 @@
*
* This function should not access the memory! It should be compiled
* with -fomit-frame-pointer to avoid stack access.
*
* PARAMETERS:
* none
*
* RETURNS:
* none
*/
void
early_hw_init(void)
void early_hw_init(void)
{
/* Explicitly turn off the MMU */
write32(0, SH7750_MMUCR);
@@ -269,8 +264,7 @@ early_hw_init(void)
*/
void bsp_cache_on(void)
{
switch (boot_mode)
{
switch (boot_mode) {
case SH4_BOOT_MODE_FLASH:
write32(SH7750_CCR_ICI | SH7750_CCR_ICE |
SH7750_CCR_OCI | SH7750_CCR_CB | SH7750_CCR_OCE,

View File

@@ -1,8 +1,10 @@
/*
* This include file contains all board IO definitions.
*
* generic sh4 BSP
*
* This include file contains all board IO definitions.
*/
/*
* Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
* Author: Victor V. Vengerov <vvv@oktet.ru>
*
@@ -47,6 +49,7 @@ extern "C" {
#include <rtems/console.h>
#include <bspopts.h>
#include <bsp/default-initial-extension.h>
#include <termios.h> /* for tcflag_t */
#include "rtems/score/sh7750_regs.h"
@@ -79,8 +82,16 @@ extern uint32_t boot_mode;
console_read, console_write, console_control }
/*
* NOTE: Use the standard Clock driver entry
* BSP methods that cross file boundaries.
*/
void bsp_hw_init(void);
void early_hw_init(void);
void bsp_cache_on(void);
extern int _sci_get_brparms(
tcflag_t cflag,
unsigned char *smr,
unsigned char *brr
);
#ifdef __cplusplus
}

View File

@@ -1,7 +1,9 @@
/*
* This is a dummy bsp_hw_init routine.
*
* COPYRIGHT (c) 1989-2008.
*/
/*
* COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -9,6 +11,8 @@
* http://www.rtems.org/license/LICENSE.
*/
#include <bsp.h>
void bsp_hw_init( void )
{
}

View File

@@ -1,9 +1,6 @@
/**
* @file
* @brief Stub printk() support
*
* This file contains a stub for the required printk() support.
* It is NOT functional!!!
*/
/*
@@ -27,7 +24,7 @@ void console_outbyte_polled(
char ch
);
void BSP_output_char_f(char c)
static void BSP_output_char_f(char c)
{
console_outbyte_polled( 0, c );
}

View File

@@ -20,20 +20,13 @@
#include <bsp/syscall.h>
int errno;
extern int __trap34(int, int, void*, int );
/*
* console_initialize_hardware
*
* This routine initializes the console hardware.
*
*/
void console_initialize_hardware(void)
{
return;
}
/*
@@ -41,14 +34,12 @@ void console_initialize_hardware(void)
*
* This routine transmits a character using polling.
*/
void console_outbyte_polled(
int port,
char ch
)
{
__trap34 (SYS_write, 1, &ch, 1);
return;
}
/*
@@ -56,7 +47,6 @@ void console_outbyte_polled(
*
* This routine polls for a character.
*/
int console_inbyte_nonblocking(
int port
)
@@ -65,9 +55,3 @@ int console_inbyte_nonblocking(
return __trap34 (SYS_read, 0, &c, 1);
}
/* XXX wrong place for this */
int _sys_exit (int n)
{
return __trap34 (SYS_exit, n, 0, 0);
}

View File

@@ -1,8 +1,10 @@
/*
* This include file contains all board IO definitions.
*
* SH-gdb simulator BSP
*
* This include file contains all board IO definitions.
*/
/*
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
*
* COPYRIGHT (c) 2001, Ralf Corsepius, Ulm, Germany
@@ -22,6 +24,8 @@
#ifndef _BSP_H
#define _BSP_H
#ifndef ASM
#ifdef __cplusplus
extern "C" {
#endif
@@ -46,12 +50,19 @@ Thread clock_driver_sim_idle_body(uintptr_t);
/*
* Defined in the linker script 'linkcmds'
*/
extern void *CPU_Interrupt_stack_low;
extern void *CPU_Interrupt_stack_high;
/*
* BSP methods that cross file boundaries.
*/
int __trap34(int, int, void*, int );
int _sys_exit (int n);
void bsp_hw_init(void);
#ifdef __cplusplus
}
#endif
#endif /* !ASM */
#endif

View File

@@ -18,6 +18,7 @@
*/
#include <rtems/asm.h>
#include <bsp.h>
BEGIN_CODE
PUBLIC(start)

View File

@@ -0,0 +1,21 @@
/*
* This file contains the simulator specific exit trap.
*/
/*
* COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <bsp.h>
extern int __trap34(int, int, void*, int );
int _sys_exit (int n)
{
return __trap34 (SYS_exit, n, 0, 0);
}

View File

@@ -35,6 +35,7 @@
#include <rtems/score/isr.h>
#include <rtems/score/threaddispatch.h>
#include <rtems/score/sh.h>
#include <rtems/score/ispsh7032.h>
#include <rtems/score/ispsh7032.h>
#include <rtems/score/iosh7032.h>

View File

@@ -8,7 +8,9 @@
* This approach is similar to installing a sym-link from one device to
* another device. If rtems once will support sym-links for devices files,
* this implementation could be dropped.
*
*/
/*
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
*
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
@@ -148,7 +150,7 @@ static int _sci_set_cflags(
* local functions operate SCI ports 0 and 1
* called from polling routines or ISRs
*/
bool wrtSCI0(unsigned char ch)
static bool wrtSCI0(unsigned char ch)
{
uint8_t temp;
bool result = false;
@@ -164,7 +166,7 @@ bool wrtSCI0(unsigned char ch)
return result;
} /* wrtSCI0 */
bool wrtSCI1(unsigned char ch)
static bool wrtSCI1(unsigned char ch)
{
uint8_t temp;
bool result = false;
@@ -181,7 +183,7 @@ bool wrtSCI1(unsigned char ch)
} /* wrtSCI1 */
/* polled output steers byte to selected port */
void sh_sci_outbyte_polled(
static void sh_sci_outbyte_polled(
rtems_device_minor_number minor,
char ch )
{
@@ -194,14 +196,14 @@ void sh_sci_outbyte_polled(
/*
* Initial version calls polled output driver and blocks
*/
void outbyte(
static void outbyte(
rtems_device_minor_number minor,
char ch)
{
sh_sci_outbyte_polled(minor, (unsigned char)ch);
} /* outbyte */
bool rdSCI0(unsigned char *ch)
static bool rdSCI0(unsigned char *ch)
{
uint8_t temp;
bool result = false;
@@ -225,7 +227,7 @@ bool rdSCI0(unsigned char *ch)
return result;
} /* rdSCI0 */
bool rdSCI1(unsigned char *ch)
static bool rdSCI1(unsigned char *ch)
{
uint8_t temp;
bool result = false;
@@ -249,9 +251,8 @@ bool rdSCI1(unsigned char *ch)
return result;
} /* rdSCI1 */
/* initial version pulls byte from selected port */
char sh_sci_inbyte_polled( rtems_device_minor_number minor )
static char sh_sci_inbyte_polled( rtems_device_minor_number minor )
{
uint8_t ch = 0;
@@ -263,7 +264,7 @@ char sh_sci_inbyte_polled( rtems_device_minor_number minor )
} /* sh_sci_inbyte_polled */
/* Initial version calls polled input driver */
char inbyte( rtems_device_minor_number minor )
static char inbyte( rtems_device_minor_number minor )
{
char ch;
@@ -271,7 +272,6 @@ char inbyte( rtems_device_minor_number minor )
return ch;
} /* inbyte */
/* sh_sci_initialize
*
* This routine initializes (registers) the sh_sci IO drivers.
@@ -283,9 +283,7 @@ char inbyte( rtems_device_minor_number minor )
* Return values: RTEMS_SUCCESSFUL
* if all sci[...] register, else calls
* rtems_fatal_error_occurred(status)
*
*/
rtems_device_driver sh_sci_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
@@ -295,7 +293,6 @@ rtems_device_driver sh_sci_initialize(
rtems_device_minor_number i;
rtems_driver_name_t driver;
/*
* register all possible devices.
* the initialization of the hardware is done by sci_open
@@ -303,19 +300,17 @@ rtems_device_driver sh_sci_initialize(
* One of devices could be previously registered by console
* initialization therefore we check it everytime
*/
for ( i = 0 ; i < SCI_MINOR_DEVICES ; i++ )
{
for ( i = 0 ; i < SCI_MINOR_DEVICES ; i++ ) {
status = rtems_io_lookup_name(
sci_device[i].name,
&driver);
if ( status != RTEMS_SUCCESSFUL )
{
if ( status != RTEMS_SUCCESSFUL ) {
/* OK. We assume it is not registered yet. */
status = rtems_io_register_name(
sci_device[i].name,
major,
sci_device[i].minor );
sci_device[i].minor
);
if (status != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred(status);
}
@@ -326,12 +321,10 @@ rtems_device_driver sh_sci_initialize(
return RTEMS_SUCCESSFUL;
}
/*
* Open entry point
* Sets up port and pins for selected sci.
*/
rtems_device_driver sh_sci_open(
rtems_device_major_number major,
rtems_device_minor_number minor,
@@ -343,14 +336,12 @@ rtems_device_driver sh_sci_open(
unsigned a;
/* check for valid minor number */
if (( minor > ( SCI_MINOR_DEVICES -1 )) || ( minor < 0 ))
{
if (( minor > ( SCI_MINOR_DEVICES -1 )) || ( minor < 0 )) {
return RTEMS_INVALID_NUMBER;
}
/* device already opened */
if ( sci_device[minor].opened > 0 )
{
if ( sci_device[minor].opened > 0 ) {
sci_device[minor].opened++;
return RTEMS_SUCCESSFUL;
}
@@ -409,7 +400,6 @@ rtems_device_driver sh_sci_open(
/*
* Close entry point
*/
rtems_device_driver sh_sci_close(
rtems_device_major_number major,
rtems_device_minor_number minor,
@@ -428,7 +418,6 @@ rtems_device_driver sh_sci_close(
/*
* read bytes from the serial port. We only have stdin.
*/
rtems_device_driver sh_sci_read(
rtems_device_major_number major,
rtems_device_minor_number minor,
@@ -460,7 +449,6 @@ rtems_device_driver sh_sci_read(
/*
* write bytes to the serial port. Stdout and stderr are the same.
*/
rtems_device_driver sh_sci_write(
rtems_device_major_number major,
rtems_device_minor_number minor,
@@ -491,7 +479,6 @@ rtems_device_driver sh_sci_write(
/*
* IO Control entry point
*/
rtems_device_driver sh_sci_control(
rtems_device_major_number major,
rtems_device_minor_number minor,

View File

@@ -1,6 +1,8 @@
/*
* Termios console serial driver.
*
*/
/*
* Based on SCI driver by Ralf Corsepius and John M. Mills
*
* Author: Radzislaw Galler <rgaller@et.put.poznan.pl>
@@ -124,7 +126,7 @@ int sh_sci_set_attributes(
*
* The same routine for all interrupt sources of the same type.
*/
rtems_isr sh_sci_rx_isr(rtems_vector_number vector)
static rtems_isr sh_sci_rx_isr(rtems_vector_number vector)
{
int minor;
@@ -151,7 +153,7 @@ rtems_isr sh_sci_rx_isr(rtems_vector_number vector)
*
* The same routine for all interrupt sources of the same type.
*/
rtems_isr sh_sci_tx_isr(rtems_vector_number vector)
static rtems_isr sh_sci_tx_isr(rtems_vector_number vector)
{
int minor;

View File

@@ -77,7 +77,7 @@ sh4uart_init(sh4uart *uart, void *tty, int chn, int int_driven)
* RETURNS:
* peripheral module clock in Hz.
*/
uint32_t
static uint32_t
sh4uart_get_Pph(void)
{
uint16_t frqcr = *(volatile uint16_t*)SH7750_FRQCR;
@@ -418,7 +418,7 @@ sh4uart_set_attributes(sh4uart *uart, const struct termios *t)
* RETURNS:
* nothing
*/
void
static void
sh4uart_handle_error(sh4uart *uart)
{
if (uart->chn == SH4_SCI) {
@@ -451,7 +451,6 @@ int
sh4uart_poll_read(sh4uart *uart)
{
int chn = uart->chn;
int error_occured = 0;
int parity_error = 0;
int break_occured = 0;
int ch;
@@ -464,7 +463,6 @@ sh4uart_poll_read(sh4uart *uart)
if (chn == SH4_SCI) {
if ((SCSSR1 & (SH7750_SCSSR1_PER | SH7750_SCSSR1_FER |
SH7750_SCSSR1_ORER)) != 0) {
error_occured = 1;
if (SCSSR1 & (SH7750_SCSSR1_PER | SH7750_SCSSR1_FER))
parity_error = 1;
sh4uart_handle_error(uart);
@@ -475,7 +473,6 @@ sh4uart_poll_read(sh4uart *uart)
if ((SCSSR2 & (SH7750_SCSSR2_ER | SH7750_SCSSR2_DR |
SH7750_SCSSR2_BRK)) != 0 ||
(SCLSR2 & SH7750_SCLSR2_ORER) != 0) {
error_occured = 1;
if (SCSSR2 & (SH7750_SCSSR1_PER | SH7750_SCSSR1_FER))
parity_error = 1;
if (SCSSR2 & SH7750_SCSSR2_BRK)

View File

@@ -1,6 +1,8 @@
/*
* Support for SuperH Simulator in GDB
*
*/
/*
* COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
@@ -22,10 +24,11 @@
register unsigned long *stack_ptr __asm__ ("r15");
void __ISR_Handler(uint32_t vector);
/*
* This routine provides the RTEMS interrupt management.
*/
void __ISR_Handler( uint32_t vector)
{
ISR_Level level;