diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-01-23 11:19:22 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-01-23 11:19:22 +0100 |
commit | a762dc2a49fad0e7797806fefd34d144b6d998b2 (patch) | |
tree | 3f21a6ba6320a3a89581a3d1e2be5162bb8a904f /c/src/lib/libbsp/powerpc/mpc55xxevb/include | |
parent | Google C++ Testing Framework 1.6.0. (diff) | |
download | rtems-a762dc2a49fad0e7797806fefd34d144b6d998b2.tar.bz2 |
Support for MPC5643L.
Rework of the start sequence to reduce the amount assembler code and to
support configuration tables which may be provided by the application.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/mpc55xxevb/include')
4 files changed, 281 insertions, 11 deletions
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-esci.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-esci.h new file mode 100644 index 0000000000..1e51ecde7e --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-esci.h @@ -0,0 +1,57 @@ +/** + * @file + * + * @brief Console ESCI API. + */ + +/* + * Copyright (c) 2011 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * 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. + */ + +#ifndef LIBBSP_POWERPC_MPC55XXEVB_CONSOLE_ESCI_H +#define LIBBSP_POWERPC_MPC55XXEVB_CONSOLE_ESCI_H + +#include "console-generic.h" + +#undef CR0 +#undef CR1 +#undef CR2 +#undef CR3 + +#include <mpc55xx/regs.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef MPC55XX_HAS_ESCI + +extern const console_generic_callbacks mpc55xx_esci_callbacks; + +typedef struct { + volatile struct ESCI_tag *regs; + struct rtems_termios_tty *tty; + int transmit_nest_level; + bool transmit_in_progress; + rtems_vector_number irq; +} mpc55xx_esci_context; + +extern mpc55xx_esci_context mpc55xx_esci_devices []; + +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LIBBSP_POWERPC_MPC55XXEVB_CONSOLE_ESCI_H */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-generic.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-generic.h new file mode 100644 index 0000000000..630f9da873 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-generic.h @@ -0,0 +1,81 @@ +/** + * @file + * + * @brief Generic console driver API. + */ + +/* + * Copyright (c) 2011 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * 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. + */ + +#ifndef LIBBSP_SHARED_CONSOLE_GENERIC_H +#define LIBBSP_SHARED_CONSOLE_GENERIC_H + +#include <rtems/libio.h> +#include <rtems/termiostypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct { + rtems_termios_callbacks termios_callbacks; + int (*poll_read)(int minor); + void (*poll_write)(int minor, char c); +} console_generic_callbacks; + +typedef struct { + void *context; + const console_generic_callbacks *callbacks; + const char *device_path; +} console_generic_info; + +extern const console_generic_info console_generic_info_table []; + +extern const size_t console_generic_info_count; + +extern const rtems_device_minor_number console_generic_minor; + +#define CONSOLE_GENERIC_INFO_TABLE \ + const console_generic_info console_generic_info_table [] + +#define CONSOLE_GENERIC_INFO(context, callbacks, device_path) \ + { context, callbacks, device_path } + +#define CONSOLE_GENERIC_INFO_COUNT \ + const size_t console_generic_info_count = \ + sizeof(console_generic_info_table) / sizeof(console_generic_info_table [0]) + +#define CONSOLE_GENERIC_MINOR(minor) \ + const rtems_device_minor_number console_generic_minor = (minor) + +static inline void *console_generic_get_context(int minor) +{ + return console_generic_info_table [minor].context; +} + +static inline struct rtems_termios_tty *console_generic_get_tty_at_open( + void *arg +) +{ + const rtems_libio_open_close_args_t *oc = + (const rtems_libio_open_close_args_t *) arg; + + return (struct rtems_termios_tty *) oc->iop->data1; +} + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LIBBSP_SHARED_CONSOLE_GENERIC_H */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-linflex.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-linflex.h new file mode 100644 index 0000000000..791bb8c983 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/console-linflex.h @@ -0,0 +1,64 @@ +/** + * @file + * + * @brief Console LINFlexD API. + */ + +/* + * Copyright (c) 2011 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * 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. + */ + +#ifndef LIBBSP_POWERPC_MPC55XXEVB_CONSOLE_LINFLEX_H +#define LIBBSP_POWERPC_MPC55XXEVB_CONSOLE_LINFLEX_H + +#include "console-generic.h" + +#undef CR0 +#undef CR1 +#undef CR2 +#undef CR3 + +#include <mpc55xx/regs.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef MPC55XX_HAS_LINFLEX + +extern const console_generic_callbacks mpc55xx_linflex_callbacks; + +typedef struct { + volatile LINFLEX_tag *regs; + struct rtems_termios_tty *tty; + rtems_vector_number irq_rxi; + rtems_vector_number irq_txi; + rtems_vector_number irq_err; + volatile SIU_PCR_tag *tx_pcr_register; + uint8_t tx_pa_value:2; + volatile SIU_PCR_tag *rx_pcr_register; + volatile SIUL_PSMI_8B_tag *rx_psmi_register; + uint8_t rx_padsel_value:4; + int transmit_nest_level; + bool transmit_in_progress; +} mpc55xx_linflex_context; + +extern mpc55xx_linflex_context mpc55xx_linflex_devices []; + +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LIBBSP_POWERPC_MPC55XXEVB_CONSOLE_LINFLEX_H */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h index 181e519921..93d212f807 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h @@ -3,7 +3,7 @@ * * @ingroup mpc55xx * - * @brief MPC55XX low-level configuration. + * @brief Low-level configuration. */ /* @@ -27,6 +27,10 @@ #include <stddef.h> +#include <libcpu/powerpc-utility.h> + +#include <bsp/start.h> + #include <mpc55xx/regs.h> #include <mpc55xx/regs-mmu.h> @@ -38,25 +42,89 @@ typedef struct { uint16_t index; uint16_t count; union SIU_PCR_tag pcr; -} mpc55xx_siu_pcr_config_entry; +} mpc55xx_siu_pcr_config; + +extern const mpc55xx_siu_pcr_config mpc55xx_start_config_siu_pcr []; + +extern const size_t mpc55xx_start_config_siu_pcr_count []; + +extern const struct MMU_tag mpc55xx_start_config_mmu_early []; + +extern const size_t mpc55xx_start_config_mmu_early_count []; + +extern const struct MMU_tag mpc55xx_start_config_mmu []; + +extern const size_t mpc55xx_start_config_mmu_count []; + +#ifdef MPC55XX_HAS_FMPLL + typedef struct { + union FMPLL_SYNCR_tag syncr_tmp; + union FMPLL_SYNCR_tag syncr_final; + } mpc55xx_clock_config; +#endif + +#ifdef MPC55XX_HAS_FMPLL_ENHANCED + typedef struct { + union FMPLL_ESYNCR2_tag esyncr2_tmp; + union FMPLL_ESYNCR2_tag esyncr2_final; + union FMPLL_ESYNCR1_tag esyncr1_final; + } mpc55xx_clock_config; +#endif + +#ifdef MPC55XX_HAS_MODE_CONTROL + typedef struct { + struct { + PLLD_CR_32B_tag cr; + PLLD_MR_32B_tag mr; + } fmpll [2]; + CGM_OC_EN_32B_tag oc_en; + CGM_OCDS_SC_32B_tag ocds_sc; + CGM_SC_DC0_3_32B_tag sc_dc0_3; + CGM_AUXCLK_tag auxclk [5]; + } mpc55xx_clock_config; +#endif + +extern const mpc55xx_clock_config mpc55xx_start_config_clock []; + +#ifdef MPC55XX_HAS_EBI + extern const struct EBI_CS_tag mpc55xx_start_config_ebi_cs []; + + extern const size_t mpc55xx_start_config_ebi_cs_count []; + + extern const struct EBI_CAL_CS_tag mpc55xx_start_config_ebi_cal_cs []; + + extern const size_t mpc55xx_start_config_ebi_cal_cs_count []; +#endif + +void mpc55xx_start_early(void); + +void mpc55xx_start_flash(void); -extern const mpc55xx_siu_pcr_config_entry mpc55xx_siu_pcr_config []; +void mpc55xx_start_cache(void); -extern const size_t mpc55xx_siu_pcr_config_count []; +void mpc55xx_start_clock(void); -extern const struct MMU_tag mpc55xx_mmu_config []; +void mpc55xx_start_watchdog(void); -extern const size_t mpc55xx_mmu_config_count []; +void mpc55xx_start_mmu_apply_config(const struct MMU_tag *config, size_t count); -extern const struct EBI_CS_tag mpc55xx_ebi_cs_config []; +uint32_t mpc55xx_get_system_clock(void); -extern const size_t mpc55xx_ebi_cs_config_count []; +LINKER_SYMBOL(bsp_ram_start) +LINKER_SYMBOL(bsp_ram_end) +LINKER_SYMBOL(bsp_ram_size) -extern const struct EBI_CAL_CS_tag mpc55xx_ebi_cal_cs_config []; +LINKER_SYMBOL(bsp_ram_1_start) +LINKER_SYMBOL(bsp_ram_1_end) +LINKER_SYMBOL(bsp_ram_1_size) -extern const size_t mpc55xx_ebi_cal_cs_config_count []; +LINKER_SYMBOL(bsp_rom_start) +LINKER_SYMBOL(bsp_rom_end) +LINKER_SYMBOL(bsp_rom_size) -void mpc55xx_early_init(void); +#ifdef MPC55XX_BOOTFLAGS + extern uint32_t mpc55xx_bootflag_0 []; +#endif #ifdef __cplusplus } |