Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:53

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSBSPsPowerPCGen83XX
0007  *
0008  * @brief Global BSP definitions.
0009  */
0010 
0011 /*
0012  * RTEMS generic MPC83xx BSP
0013  *
0014  * This file contains board specific definitions.
0015  */
0016 
0017 /*
0018  * Copyright (c) 2007 embedded brains GmbH & Co. KG
0019  *
0020  * Redistribution and use in source and binary forms, with or without
0021  * modification, are permitted provided that the following conditions
0022  * are met:
0023  * 1. Redistributions of source code must retain the above copyright
0024  *    notice, this list of conditions and the following disclaimer.
0025  * 2. Redistributions in binary form must reproduce the above copyright
0026  *    notice, this list of conditions and the following disclaimer in the
0027  *    documentation and/or other materials provided with the distribution.
0028  *
0029  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0030  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0031  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0032  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0033  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0034  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0035  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0036  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0037  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0038  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0039  * POSSIBILITY OF SUCH DAMAGE.
0040  */
0041 
0042 #ifndef LIBBSP_POWERPC_GEN83XX_BSP_H
0043 #define LIBBSP_POWERPC_GEN83XX_BSP_H
0044 
0045 /**
0046  * @defgroup RTEMSBSPsPowerPCGen83XX NXP MPC83XX
0047  *
0048  * @ingroup RTEMSBSPsPowerPC
0049  *
0050  * @brief NXP MPC83XX Board Support Package.
0051  *
0052  * @{
0053  */
0054 
0055 #define BSP_FEATURE_IRQ_EXTENSION
0056 
0057 #include <bspopts.h>
0058 
0059 #include <libcpu/powerpc-utility.h>
0060 
0061 #include <bsp/hwreg_vals.h>
0062 
0063 /*
0064  * Some symbols defined in the linker command file.
0065  */
0066 
0067 LINKER_SYMBOL(bsp_ram_start);
0068 LINKER_SYMBOL(bsp_ram_end);
0069 LINKER_SYMBOL(bsp_ram_size);
0070 
0071 LINKER_SYMBOL(bsp_rom_start);
0072 LINKER_SYMBOL(bsp_rom_end);
0073 LINKER_SYMBOL(bsp_rom_size);
0074 
0075 LINKER_SYMBOL(bsp_section_text_start);
0076 LINKER_SYMBOL(bsp_section_text_end);
0077 LINKER_SYMBOL(bsp_section_text_size);
0078 
0079 LINKER_SYMBOL(bsp_section_data_start);
0080 LINKER_SYMBOL(bsp_section_data_end);
0081 LINKER_SYMBOL(bsp_section_data_size);
0082 
0083 LINKER_SYMBOL(bsp_section_bss_start);
0084 LINKER_SYMBOL(bsp_section_bss_end);
0085 LINKER_SYMBOL(bsp_section_bss_size);
0086 
0087 LINKER_SYMBOL(bsp_work_area_start);
0088 
0089 LINKER_SYMBOL(IMMRBAR);
0090 
0091 #ifndef ASM
0092 
0093 #include <rtems.h>
0094 #include <bsp/vectors.h>
0095 #include <bsp/irq.h>
0096 #include <bsp/default-initial-extension.h>
0097 
0098 #ifdef __cplusplus
0099 extern "C" {
0100 #endif
0101 
0102 /*
0103  * indicate, that BSP has no IDE driver
0104  */
0105 #undef RTEMS_BSP_HAS_IDE_DRIVER
0106 
0107 /* misc macros */
0108 #define BSP_ARRAY_CNT(arr) (sizeof(arr)/sizeof(arr[0]))
0109 
0110 void *bsp_idle_thread( uintptr_t ignored );
0111 #define BSP_IDLE_TASK_BODY bsp_idle_thread
0112 
0113 /* functions */
0114 rtems_status_code bsp_register_i2c(void);
0115 rtems_status_code bsp_register_spi(void);
0116 
0117 /*
0118  * Network driver configuration
0119  */
0120 struct rtems_bsdnet_ifconfig;
0121 extern int BSP_tsec_attach(struct rtems_bsdnet_ifconfig *config,int attaching);
0122 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_tsec_attach
0123 
0124 #ifdef MPC83XX_BOARD_MPC8313ERDB
0125   #define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec2"
0126   #define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec1"
0127 #else
0128   #define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec1"
0129   #define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec2"
0130 #endif
0131 
0132 #if defined(MPC83XX_BOARD_MPC8349EAMDS)
0133 /*
0134  * i2c EEPROM device name
0135  */
0136 #define RTEMS_BSP_I2C_EEPROM_DEVICE_NAME "eeprom"
0137 #define RTEMS_BSP_I2C_EEPROM_DEVICE_PATH "/dev/i2c1.eeprom"
0138 
0139 /*
0140  * SPI Flash device name
0141  */
0142 #define RTEMS_BSP_SPI_FLASH_DEVICE_NAME "flash"
0143 #define RTEMS_BSP_SPI_FLASH_DEVICE_PATH "/dev/spi.flash"
0144 #endif /* defined(MPC83XX_BOARD_MPC8349EAMDS) */
0145 
0146 #if defined(MPC83XX_BOARD_HSC_CM01)
0147 /*
0148  * i2c EEPROM device name
0149  */
0150 #define RTEMS_BSP_I2C_EEPROM_DEVICE_NAME "eeprom"
0151 #define RTEMS_BSP_I2C_EEPROM_DEVICE_PATH "/dev/i2c1.eeprom"
0152 
0153 /*
0154  * SPI FRAM device name
0155  */
0156 #define RTEMS_BSP_SPI_FRAM_DEVICE_NAME "fram"
0157 #define RTEMS_BSP_SPI_FRAM_DEVICE_PATH "/dev/spi.fram"
0158 #endif /* defined(MPC83XX_BOARD_HSC_CM01) */
0159 
0160 extern unsigned int BSP_bus_frequency;
0161 
0162 extern uint32_t bsp_clicks_per_usec;
0163 
0164 /*
0165  *  Convert decrementer value to tenths of microseconds (used by shared timer
0166  *  driver).
0167  */
0168 #define BSP_Convert_decrementer( _value ) \
0169   ((int) (((_value) * 10) / bsp_clicks_per_usec))
0170 
0171 void mpc83xx_zero_4( void *dest, size_t n);
0172 
0173 void cpu_init( void);
0174 
0175 void bsp_restart(void *addr);
0176 
0177 #if defined(HAS_UBOOT)
0178   /* Routine to obtain U-Boot environment variables */
0179   const char *bsp_uboot_getenv(
0180     const char *name
0181   );
0182 #endif
0183 
0184 #ifdef __cplusplus
0185 }
0186 #endif
0187 
0188 #endif /* ASM */
0189 
0190 /** @} */
0191 
0192 #endif /* GEN83xx */