From 1dab7883a960c53c254f760ae4af4024f2cf55c6 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 20 Aug 2008 17:29:19 +0000 Subject: 2008-08-20 Sebastian Huber * mpc55xx/fec/fec.c: Added copyright information. * mpc55xx/dspi/dspi.c, mpc55xx/edma/edma.c, mpc55xx/esci/esci.c: Fixed nexted extern declarations. Fixed integer conversion warnings. * shared/include/cpuIdent.c: Added missing initializers. --- c/src/lib/libcpu/powerpc/ChangeLog | 7 ++++++ c/src/lib/libcpu/powerpc/mpc55xx/dspi/dspi.c | 25 ++++++++-------------- c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c | 16 +++++++------- c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c | 14 ++++++------ c/src/lib/libcpu/powerpc/mpc55xx/fec/fec.c | 20 ++++++++--------- c/src/lib/libcpu/powerpc/mpc83xx/gtm/gtm.c | 8 +++---- c/src/lib/libcpu/powerpc/shared/include/cpuIdent.c | 13 ++++++++++- 7 files changed, 57 insertions(+), 46 deletions(-) (limited to 'c/src/lib/libcpu') diff --git a/c/src/lib/libcpu/powerpc/ChangeLog b/c/src/lib/libcpu/powerpc/ChangeLog index 38d10602c0..0c77b6c642 100644 --- a/c/src/lib/libcpu/powerpc/ChangeLog +++ b/c/src/lib/libcpu/powerpc/ChangeLog @@ -1,3 +1,10 @@ +2008-08-20 Sebastian Huber + + * mpc55xx/fec/fec.c: Added copyright information. + * mpc55xx/dspi/dspi.c, mpc55xx/edma/edma.c, mpc55xx/esci/esci.c: + Fixed nexted extern declarations. Fixed integer conversion warnings. + * shared/include/cpuIdent.c: Added missing initializers. + 2008-08-20 Ralf Corsépius * mpc8260/clock/clock.c, mpc8260/console-generic/console-generic.c: diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/dspi/dspi.c b/c/src/lib/libcpu/powerpc/mpc55xx/dspi/dspi.c index 2d78905d77..448b4bf020 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/dspi/dspi.c +++ b/c/src/lib/libcpu/powerpc/mpc55xx/dspi/dspi.c @@ -317,12 +317,13 @@ static rtems_status_code mpc55xx_dspi_send_addr( rtems_libi2c_bus_t *bus, uint32 return RTEMS_SUCCESSFUL; } +/* FIXME, TODO */ +extern uint32_t bsp_clock_speed; + static int mpc55xx_dspi_set_transfer_mode( rtems_libi2c_bus_t *bus, const rtems_libi2c_tfr_mode_t *mode) { mpc55xx_dspi_bus_entry *e = (mpc55xx_dspi_bus_entry *) bus; union DSPI_CTAR_tag ctar = MPC55XX_ZERO_FLAGS; - // FIXME, TODO - extern uint32_t bsp_clock_speed; uint32_t scaler = bsp_clock_speed / mode->baudrate; mpc55xx_dspi_baudrate_scaler_entry bse = mpc55xx_dspi_search_baudrate_scaler( scaler, 0, MPC55XX_DSPI_BAUDRATE_SCALER_TABLE_SIZE / 2, MPC55XX_DSPI_BAUDRATE_SCALER_TABLE_SIZE); @@ -337,11 +338,6 @@ static int mpc55xx_dspi_set_transfer_mode( rtems_libi2c_bus_t *bus, const rtems_ ctar.B.PBR = bse.pbr; ctar.B.BR = bse.br; - // ctar.B.PCSSCK = bse.pbr; - // ctar.B.CSSCK = bse.br; - // ctar.B.PASC = bse.pbr; - // ctar.B.ASC = bse.br; - ctar.B.PCSSCK = 0; ctar.B.CSSCK = 0; ctar.B.PASC = 0; @@ -425,8 +421,8 @@ static int mpc55xx_dspi_read_write( rtems_libi2c_bus_t *bus, unsigned char *in, } if (n > MPC55XX_DSPI_EDMA_MAGIC_SIZE) { - n_nc = mpc55xx_non_cache_aligned_size( in); - n_c = mpc55xx_cache_aligned_size( in, n); + n_nc = (int) mpc55xx_non_cache_aligned_size( in); + n_c = (int) mpc55xx_cache_aligned_size( in, (size_t) n); if (n_c > EDMA_TCD_BITER_LINKED_SIZE) { SYSLOG_WARNING( "Buffer size out of range, cannot use eDMA\n"); n_nc = n; @@ -462,8 +458,7 @@ static int mpc55xx_dspi_read_write( rtems_libi2c_bus_t *bus, unsigned char *in, /* Read */ if (r < n_nc && sr.B.RXCTR != 0) { pop_data.R = ppc_read_word( pop); - in [r] = pop_data.B.RXDATA; - // printk( "[%03u]: 0x%02x -> 0x%02x\n", r, out [r], in [r]); + in [r] = (unsigned char) pop_data.B.RXDATA; ++r; } } @@ -484,7 +479,6 @@ static int mpc55xx_dspi_read_write( rtems_libi2c_bus_t *bus, unsigned char *in, /* Read */ if (r < n_nc && sr.B.RXCTR != 0) { pop_data.R = ppc_read_word( pop); - // printk( "[%03u]: 0x%02x -> 0x%02x\n", r, out [r], in [r]); ++r; } } @@ -505,8 +499,7 @@ static int mpc55xx_dspi_read_write( rtems_libi2c_bus_t *bus, unsigned char *in, /* Read */ if (r < n_nc && sr.B.RXCTR != 0) { pop_data.R = ppc_read_word( pop); - in [r] = pop_data.B.RXDATA; - // printk( "[%03u]: 0x%02x -> 0x%02x\n", r, out [r], in [r]); + in [r] = (unsigned char) pop_data.B.RXDATA; ++r; } } @@ -521,8 +514,8 @@ static int mpc55xx_dspi_read_write( rtems_libi2c_bus_t *bus, unsigned char *in, struct tcd_t tcd_receive = MPC55XX_EDMA_TCD_DEFAULT; /* Cache operations */ - rtems_cache_flush_multiple_data_lines( out_c, n_c); - rtems_cache_invalidate_multiple_data_lines( in_c, n_c); + rtems_cache_flush_multiple_data_lines( out_c, (size_t) n_c); + rtems_cache_invalidate_multiple_data_lines( in_c, (size_t) n_c); /* Set transmit TCD */ if (out == NULL) { diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c b/c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c index c1a4e4a7b6..3b55ab029a 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c +++ b/c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c @@ -31,7 +31,7 @@ #include #define MPC55XX_EDMA_CHANNEL_NUMBER 64 -#define MPC55XX_EDMA_INVALID_CHANNEL -1 +#define MPC55XX_EDMA_INVALID_CHANNEL UINT8_MAX #define MPC55XX_EDMA_IS_CHANNEL_INVALID( i) ((i) < 0 || (i) >= MPC55XX_EDMA_CHANNEL_NUMBER) #define MPC55XX_EDMA_IRQ_PRIORITY MPC55XX_INTC_MIN_PRIORITY @@ -67,7 +67,7 @@ static void mpc55xx_edma_irq_handler( rtems_vector_number vector, void *data) SYSLOG_WARNING_SC( sc, "Transfer update semaphore release"); } -static void mpc55xx_edma_irq_update_error_table( uint8_t *link_table, uint8_t *error_table, uint8_t channel) +static void mpc55xx_edma_irq_update_error_table( uint8_t *link_table, uint8_t *error_table, int channel) { int i = 0; error_table [channel] = 1; @@ -82,8 +82,8 @@ static void mpc55xx_edma_irq_error_handler( rtems_vector_number vector, void *da { rtems_status_code sc = RTEMS_SUCCESSFUL; uint8_t channel_start = *((uint8_t *) data); - uint8_t channel_end = channel_start + 32; - uint8_t i = 0; + uint8_t channel_end = (uint8_t) (channel_start + 32); + int i = 0; uint32_t mask = 0x1; uint32_t error_register = 0; uint8_t channel_link_table [MPC55XX_EDMA_CHANNEL_NUMBER]; @@ -100,7 +100,7 @@ static void mpc55xx_edma_irq_error_handler( rtems_vector_number vector, void *da /* Fill channel link table */ for (i = 0; i < MPC55XX_EDMA_CHANNEL_NUMBER; ++i) { if (EDMA.TCD [i].BITERE_LINK && EDMA.TCD [i].CITER != EDMA.TCD [i].BITER) { - channel_link_table [i] = EDMA_TCD_BITER_LINK( i); + channel_link_table [i] = (uint8_t) EDMA_TCD_BITER_LINK( i); } else if (EDMA.TCD [i].MAJORE_LINK && EDMA.TCD [i].CITER == EDMA.TCD [i].BITER) { channel_link_table [i] = EDMA.TCD [i].MAJORLINKCH; } else { @@ -135,7 +135,7 @@ static void mpc55xx_edma_irq_error_handler( rtems_vector_number vector, void *da /* Clear the error interrupt requests */ for (i = 0; i < MPC55XX_EDMA_CHANNEL_NUMBER; ++i) { if (channel_error_table [i]) { - EDMA.CER.R = i; + EDMA.CER.R = (uint8_t) i; } } } @@ -146,9 +146,9 @@ rtems_status_code mpc55xx_edma_enable_hardware_requests( int channel, bool enabl return RTEMS_INVALID_NUMBER; } if (enable) { - EDMA.SERQR.R = channel; + EDMA.SERQR.R = (uint8_t) channel; } else { - EDMA.CERQR.R = channel; + EDMA.CERQR.R = (uint8_t) channel; } return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c b/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c index 3f1c228aa7..ff19e1f817 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c +++ b/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c @@ -257,6 +257,9 @@ static int mpc55xx_esci_termios_write( int minor, const char *out, int n) return 0; } +/* FIXME, TODO */ +extern uint32_t bsp_clock_speed; + /** * @brief Sets attributes of port @a minor according to termios attributes @a t. * @@ -337,9 +340,6 @@ static int mpc55xx_esci_termios_set_attributes( int minor, const struct termios default: br = 0; break; } if (br > 0) { - // FIXME, TODO - extern uint32_t bsp_clock_speed; - br = bsp_clock_speed / (16 * br); br = (br > 8191) ? 8191 : br; } else { @@ -452,7 +452,7 @@ rtems_device_driver console_initialize( rtems_device_major_number major, rtems_d rtems_status_code sc = RTEMS_SUCCESSFUL; int console_done = 0; int termios_do_init = 1; - int i = 0; + rtems_device_minor_number i = 0; mpc55xx_esci_driver_entry *e = NULL; for (i = 0; i < MPC55XX_ESCI_NUMBER; ++i) { @@ -488,7 +488,7 @@ rtems_device_driver console_initialize( rtems_device_major_number major, rtems_d CHECK_SC( sc, "Install IRQ handler"); } } - mpc55xx_esci_termios_set_attributes( minor, &mpc55xx_esci_termios_default); + mpc55xx_esci_termios_set_attributes( (int) i, &mpc55xx_esci_termios_default); } return RTEMS_SUCCESSFUL; @@ -613,7 +613,7 @@ rtems_device_driver console_control( rtems_device_major_number major, rtems_devi * * The correct value will be set by mpc55xx_esci_output_char_init(). */ -static unsigned mpc55xx_esci_output_char_minor = 0; +static int mpc55xx_esci_output_char_minor = 0; /** * @name BSP Character Output @@ -637,7 +637,7 @@ static void mpc55xx_esci_output_char_nop( char c) static void mpc55xx_esci_output_char_init( char c) { int console_found = 0; - unsigned i = 0; + int i = 0; for (i = 0; i < MPC55XX_ESCI_NUMBER; ++i) { if (mpc55xx_esci_driver_table [i].console) { console_found = 1; diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/fec/fec.c b/c/src/lib/libcpu/powerpc/mpc55xx/fec/fec.c index 8304560f38..7be177d861 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/fec/fec.c +++ b/c/src/lib/libcpu/powerpc/mpc55xx/fec/fec.c @@ -3,17 +3,17 @@ * * @ingroup mpc55xx * - * @brief Device driver for the Fast Ethernet Controller - * - * @par Copyright - * Copyright (c) 2008
- * Embedded Brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * rtems@embedded-brains.de
+ * @brief Empty file. + */ + +/* + * Copyright (c) 2008 + * Embedded Brains GmbH + * Obere Lagerstr. 30 + * D-82178 Puchheim + * Germany + * rtems@embedded-brains.de * - * @par License * The license and distribution terms for this file may be found in the file * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. */ diff --git a/c/src/lib/libcpu/powerpc/mpc83xx/gtm/gtm.c b/c/src/lib/libcpu/powerpc/mpc83xx/gtm/gtm.c index 3974c56941..47af348913 100644 --- a/c/src/lib/libcpu/powerpc/mpc83xx/gtm/gtm.c +++ b/c/src/lib/libcpu/powerpc/mpc83xx/gtm/gtm.c @@ -49,16 +49,16 @@ rtems_status_code mpc83xx_gtm_initialize( int timer, int clock) MPC83XX_GTM_VARIABLES( timer); - uint8_t mask = 0xf << (low * 4); - uint8_t flags = 0x3 << (low * 4); - uint16_t reg = 0; + unsigned mask = 0xfU << (low * 4); + unsigned flags = 0x3U << (low * 4); + uint8_t reg = 0; MPC83XX_GTM_CHECK_INDEX( timer); rtems_interrupt_disable( level); reg = mpc83xx.gtm [module].gtcfr [high].reg; - mpc83xx.gtm [module].gtcfr [high].reg = (reg & ~mask) | flags; + mpc83xx.gtm [module].gtcfr [high].reg = (uint8_t) ((reg & ~mask) | flags); mpc83xx.gtm [module].gt_tim_regs [high].gtmdr [low] = 0; diff --git a/c/src/lib/libcpu/powerpc/shared/include/cpuIdent.c b/c/src/lib/libcpu/powerpc/shared/include/cpuIdent.c index 3f02a710f2..7245b6b3b0 100644 --- a/c/src/lib/libcpu/powerpc/shared/include/cpuIdent.c +++ b/c/src/lib/libcpu/powerpc/shared/include/cpuIdent.c @@ -25,7 +25,18 @@ SPR_RO(PVR) ppc_cpu_id_t current_ppc_cpu = PPC_UNKNOWN; ppc_cpu_revision_t current_ppc_revision = 0xff; -ppc_feature_t current_ppc_features = {0}; +ppc_feature_t current_ppc_features = { + .has_altivec = 0, + .has_fpu = 0, + .has_hw_ptbl_lkup = 0, + .is_bookE = 0, + .has_16byte_clne = 0, + .is_60x = 0, + .has_8_bats = 0, + .has_epic = 0, + .has_shadowed_gprs = 0, + .has_ivpr_and_ivor = 0 +}; char *get_ppc_cpu_type_name(ppc_cpu_id_t cpu) { -- cgit v1.2.3