source: rtems/cpukit/score/cpu/arm/include/rtems/score/armv4.h @ d8369225

Last change on this file since d8369225 was e47a3b7, checked in by Joel Sherrill <joel@…>, on 02/16/22 at 22:54:29

score/cpu/arm: Change license to BSD-2

Updates #3053.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
5 *
6 *  embedded brains GmbH
7 *  Dornierstr. 4
8 *  82178 Puchheim
9 *  Germany
10 *  <rtems@embedded-brains.de>
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in the
19 *    documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef RTEMS_SCORE_ARMV4_H
35#define RTEMS_SCORE_ARMV4_H
36
37#include <rtems/score/cpu.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif /* __cplusplus */
42
43#ifdef ARM_MULTILIB_ARCH_V4
44
45void bsp_interrupt_dispatch( void );
46
47void _ARMV4_Exception_interrupt( void );
48
49typedef void ARMV4_Exception_abort_handler( CPU_Exception_frame *frame );
50
51void _ARMV4_Exception_data_abort_set_handler(
52  ARMV4_Exception_abort_handler handler
53);
54
55void _ARMV4_Exception_data_abort( void );
56
57void _ARMV4_Exception_prefetch_abort_set_handler(
58  ARMV4_Exception_abort_handler handler
59);
60
61void _ARMV4_Exception_prefetch_abort( void );
62
63void _ARMV4_Exception_undef_default( void );
64
65void _ARMV4_Exception_swi_default( void );
66
67void _ARMV4_Exception_data_abort_default( void );
68
69void _ARMV4_Exception_pref_abort_default( void );
70
71void _ARMV4_Exception_reserved_default( void );
72
73void _ARMV4_Exception_irq_default( void );
74
75void _ARMV4_Exception_fiq_default( void );
76
77static inline uint32_t _ARMV4_Status_irq_enable( void )
78{
79  uint32_t arm_switch_reg;
80  uint32_t psr;
81
82  RTEMS_COMPILER_MEMORY_BARRIER();
83
84  __asm__ volatile (
85    ARM_SWITCH_TO_ARM
86    "mrs %[psr], cpsr\n"
87    "bic %[arm_switch_reg], %[psr], #0x80\n"
88    "msr cpsr, %[arm_switch_reg]\n"
89    ARM_SWITCH_BACK
90    : [arm_switch_reg] "=&r" (arm_switch_reg), [psr] "=&r" (psr)
91  );
92
93  return psr;
94}
95
96static inline void _ARMV4_Status_restore( uint32_t psr )
97{
98  ARM_SWITCH_REGISTERS;
99
100  __asm__ volatile (
101    ARM_SWITCH_TO_ARM
102    "msr cpsr, %[psr]\n"
103    ARM_SWITCH_BACK
104    : ARM_SWITCH_OUTPUT
105    : [psr] "r" (psr)
106  );
107
108  RTEMS_COMPILER_MEMORY_BARRIER();
109}
110
111#endif /* ARM_MULTILIB_ARCH_V4 */
112
113#ifdef __cplusplus
114}
115#endif /* __cplusplus */
116
117#endif /* RTEMS_SCORE_ARMV4_H */
Note: See TracBrowser for help on using the repository browser.