File indexing completed on 2025-05-11 08:24:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifdef HAVE_CONFIG_H
0018 #include "config.h"
0019 #endif
0020
0021 #include <rtems/score/cpuimpl.h>
0022 #include <rtems/score/isr.h>
0023 #include <rtems/score/bfin.h>
0024 #include <rtems/bfin/bfin.h>
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 extern void _ISR15_Handler(void);
0039 extern void _CPU_Emulation_handler(void);
0040 extern void _CPU_Reset_handler(void);
0041 extern void _CPU_NMI_handler(void);
0042 extern void _CPU_Exception_handler(void);
0043 extern void _CPU_Unhandled_Interrupt_handler(void);
0044
0045 void _CPU_Initialize(void)
0046 {
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 CPU_ISR_raw_handler ignored;
0059
0060 #if 0
0061
0062 int i;
0063 _CPU_ISR_install_raw_handler(0, _CPU_Emulation_handler, &ignored);
0064 _CPU_ISR_install_raw_handler(1, _CPU_Reset_handler, &ignored);
0065 _CPU_ISR_install_raw_handler(2, _CPU_NMI_handler, &ignored);
0066 _CPU_ISR_install_raw_handler(3, _CPU_Exception_handler, &ignored);
0067 for (i = 5; i < 15; i++)
0068 _CPU_ISR_install_raw_handler(i, _CPU_Unhandled_Interrupt_handler, &ignored);
0069 #endif
0070
0071
0072 _CPU_ISR_install_raw_handler( 15, _ISR15_Handler, &ignored );
0073
0074 __asm__ __volatile__ ("syscfg = %0" : : "d" (0x00000004));
0075 }
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 uint32_t _CPU_ISR_Get_level( void )
0086 {
0087
0088
0089
0090
0091 register uint32_t _tmpimask;
0092
0093
0094
0095 _tmpimask = *((uint32_t*)IMASK);
0096
0097 return (_tmpimask & 0xffe0) ? 0 : 1;
0098 }
0099
0100 void _CPU_ISR_install_raw_handler(
0101 uint32_t vector,
0102 CPU_ISR_raw_handler new_handler,
0103 CPU_ISR_raw_handler *old_handler
0104 )
0105 {
0106 CPU_ISR_raw_handler *interrupt_table;
0107
0108
0109
0110
0111
0112
0113
0114 interrupt_table = (void*)0xFFE02000;
0115
0116 *old_handler = interrupt_table[ vector ];
0117 interrupt_table[ vector ] = new_handler;
0118
0119 }
0120
0121 void _CPU_ISR_install_vector(
0122 uint32_t vector,
0123 CPU_ISR_handler new_handler,
0124 CPU_ISR_handler *old_handler
0125 )
0126 {
0127 CPU_ISR_raw_handler ignored;
0128
0129 *old_handler = _ISR_Vector_table[ vector ];
0130
0131
0132
0133
0134
0135
0136 _ISR_Vector_table[ vector ] = new_handler;
0137
0138 _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
0139 }
0140
0141 void *_CPU_Thread_Idle_body(uintptr_t ignored)
0142 {
0143 while (1) {
0144 __asm__ __volatile__("ssync; idle; ssync");
0145 }
0146 }
0147
0148
0149
0150
0151 void _CPU_Context_Initialize(
0152 Context_Control *the_context,
0153 uint32_t *stack_base,
0154 uint32_t size,
0155 uint32_t new_level,
0156 void *entry_point,
0157 bool is_fp,
0158 void *tls_area
0159 )
0160 {
0161 uint32_t stack_high;
0162 stack_high = ((uint32_t)(stack_base) + size);
0163
0164
0165 the_context->register_sp = stack_high - 12;
0166 the_context->register_rets = (uint32_t) entry_point;
0167 the_context->imask = new_level ? 0 : 0xffff;
0168 }