source: rtems/bsps/powerpc/mpc55xxevb/start/bspstart.c @ ff081aee

Last change on this file since ff081aee was ff081aee, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 6, 2018 at 3:58:02 PM

score: Rename interrupt stack symbols

Rename

  • _Configuration_Interrupt_stack_area_begin in _ISR_Stack_area_begin,
  • _Configuration_Interrupt_stack_area_end in _ISR_Stack_area_end, and
  • _Configuration_Interrupt_stack_size in _ISR_Stack_size.

Move definitions to <rtems/score/isr.h>. The new names are considerable
shorter and in the right namespace.

Update #3459.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup mpc55xx
5 *
6 * @brief BSP startup code.
7 */
8
9/*
10 * Copyright (c) 2008-2013 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#include <mpc55xx/mpc55xx.h>
24#include <mpc55xx/regs.h>
25#include <mpc55xx/edma.h>
26#include <mpc55xx/emios.h>
27
28#include <string.h>
29
30#include <rtems.h>
31#include <rtems/config.h>
32#include <rtems/counter.h>
33
34#include <libcpu/powerpc-utility.h>
35#include <bsp/vectors.h>
36
37#include <bsp.h>
38#include <bsp/bootcard.h>
39#include <bsp/irq.h>
40#include <bsp/irq-generic.h>
41#include <bsp/linker-symbols.h>
42#include <bsp/start.h>
43#include <bsp/mpc55xx-config.h>
44
45/* Symbols defined in linker command file */
46LINKER_SYMBOL(mpc55xx_exc_vector_base);
47
48unsigned int bsp_clock_speed = 0;
49
50uint32_t bsp_clicks_per_usec = 0;
51
52static void null_pointer_protection(void)
53{
54#ifdef MPC55XX_NULL_POINTER_PROTECTION
55        struct MMU_tag mmu = { .MAS0 = { .B = { .TLBSEL = 1, .ESEL = 1 } } };
56
57        PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS0, mmu.MAS0.R);
58        __asm__ volatile ("tlbre");
59        mmu.MAS1.R = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1);
60        mmu.MAS1.B.VALID = 0;
61        PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1, mmu.MAS1.R);
62        __asm__ volatile ("tlbwe");
63#endif
64}
65
66uint32_t _CPU_Counter_frequency(void)
67{
68        return bsp_clock_speed;
69}
70
71void bsp_start(void)
72{
73        null_pointer_protection();
74
75        /*
76         * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
77         * function store the result in global variables so that it can be used
78         * latter...
79         */
80        get_ppc_cpu_type();
81        get_ppc_cpu_revision();
82
83        /*
84         * determine clock speed
85         */
86        bsp_clock_speed = mpc55xx_get_system_clock() / MPC55XX_SYSTEM_CLOCK_DIVIDER;
87
88        /* Time reference value */
89        bsp_clicks_per_usec = bsp_clock_speed / 1000000;
90
91        ppc_exc_initialize_with_vector_base(
92                (uintptr_t) _ISR_Stack_area_begin,
93                mpc55xx_exc_vector_base
94        );
95        bsp_interrupt_initialize();
96
97        #if MPC55XX_CHIP_FAMILY != 566
98                mpc55xx_edma_init();
99        #endif
100
101        #ifdef MPC55XX_EMIOS_PRESCALER
102                mpc55xx_emios_initialize(MPC55XX_EMIOS_PRESCALER);
103        #endif
104}
Note: See TracBrowser for help on using the repository browser.