source: rtems/cpukit/score/cpu/moxie/cpu.c @ 8b65b574

Last change on this file since 8b65b574 was 8b65b574, checked in by Sebastian Huber <sebastian.huber@…>, on 07/28/21 at 12:41:32

score: Canonicalize _CPU_Fatal_halt()

Move _CPU_Fatal_halt() declaration to <rtems/score/cpuimpl.h> and make sure it
is a proper declaration of a function which does not return. Fix the type of
the error code. If necessary, add the implementation to cpu.c. Implementing
_CPU_Fatal_halt() as a function makes it possible to wrap this function for
example to fully test _Terminate().

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Moxie CPU Dependent Source
3 *
4 *  COPYRIGHT (c) 2011 Anthony Green
5 *
6 *  Based on example code and other ports with this copyright:
7 *
8 *  COPYRIGHT (c) 1989-1999, 2010.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#ifdef HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <rtems/score/cpuimpl.h>
21#include <rtems/score/isr.h>
22#include <rtems/bspIo.h>
23
24/*  _CPU_Initialize
25 *
26 *  This routine performs processor dependent initialization.
27 *
28 *  INPUT PARAMETERS: NONE
29 */
30void _CPU_Initialize(void)
31{
32  /*
33   *  If there is not an easy way to initialize the FP context
34   *  during Context_Initialize, then it is usually easier to
35   *  save an "uninitialized" FP context here and copy it to
36   *  the task's during Context_Initialize.
37   */
38
39  /* FP context initialization support goes here */
40}
41
42void _CPU_Fatal_halt( uint32_t source, CPU_Uint32ptr error )
43{
44  ISR_Level level;
45
46  _CPU_ISR_Disable( level );
47  (void) level;
48
49  while ( true ) {
50    /* Do nothing */
51  }
52}
53
54/*
55 *  _CPU_ISR_Get_level
56 *
57 *  This routine returns the current interrupt level.
58 */
59uint32_t   _CPU_ISR_Get_level( void )
60{
61  return 0;
62}
63
64void _CPU_ISR_install_vector(
65  uint32_t         vector,
66  CPU_ISR_handler  new_handler,
67  CPU_ISR_handler *old_handler
68)
69{
70  *old_handler = _ISR_Vector_table[ vector ];
71  _ISR_Vector_table[ vector ] = new_handler;
72}
73
74/*
75 *  _CPU_Thread_Idle_body
76 *
77 *  NOTES:
78 *
79 *  1. This is the same as the regular CPU independent algorithm.
80 *
81 *  2. If you implement this using a "halt", "idle", or "shutdown"
82 *     instruction, then don't forget to put it in an infinite loop.
83 *
84 *  3. Be warned. Some processors with onboard DMA have been known
85 *     to stop the DMA if the CPU were put in IDLE mode.  This might
86 *     also be a problem with other on-chip peripherals.  So use this
87 *     hook with caution.
88 */
89#if 0
90void *_CPU_Thread_Idle_body( uintptr_t ignored )
91{
92
93  for( ; ; )
94    IDLE_Monitor();
95        /*asm(" sleep   \n"); */
96    /* insert your "halt" instruction here */ ;
97}
98#endif
Note: See TracBrowser for help on using the repository browser.