source: rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_bspsupp.h @ 94e1931c

4.104.114.95
Last change on this file since 94e1931c was 94e1931c, checked in by Till Straumann <strauman@…>, on 12/08/07 at 23:43:24

2007-12-08 Till Straumann <strauman@…>

  • new-exceptions/bspsupport/, new-exceptions/bspsupport/ppc_exc.S, new-exceptions/bspsupport/ppc_exc_test.c, new-exceptions/bspsupport/vectors.h, new-exceptions/bspsupport/vectors_init.c, new-exceptions/bspsupport/irq.c, new-exceptions/bspsupport/ppc_exc_bspsupp.h, new-exceptions/bspsupport/ppc_exc_hdl.c, new-exceptions/bspsupport/ppc_exc_asm_macros.h, new-exceptions/bspsupport/nested_irq_test.c: New files. Added 'middleware' code for helping BSPs implement exception and interrupt handling and implementing the 'new' RTEMS IRQ API (which I personally dislike).
  • Property mode set to 100644
File size: 4.0 KB
Line 
1/* PowerPC exception handling middleware; consult README for more
2 * information.
3 *
4 * Author: Till Straumann <strauman@slac.stanford.edu>, 2007
5 *
6 *  The license and distribution terms for this file may be
7 *  found in found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#ifndef PPC_EXC_SHARED_H
14#define PPC_EXC_SHARED_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/********* C-Exception Handlers *********************/
21
22/* API to be used by middleware,                    */
23/* BSP and application code (if necessary           */
24
25/****************************************************/
26
27typedef int (*ppc_exc_handler_t)(BSP_Exception_frame *f, int vector);
28
29/*
30 * Bits in MSR that are enabled during execution of exception handlers / ISRs
31 * (on classic PPC these are DR/IR/RI [default], on bookE-style CPUs they should
32 * be set to 0 during initialization)
33 *
34 * By default, the setting of these bits that is in effect when exception
35 * handling is initialized is used.
36 */
37extern uint32_t ppc_exc_msr_bits;
38
39/*
40 * Set of MSR bits required to disable all
41 * asynchronous exceptions (depends on CPU type;
42 * must be set during initialization).
43 * Interrupt are disabled by writing the
44 * one's complement of this mask to msr:
45 *  msr &= ~ppc_exc_msr_irq_mask;
46 */
47extern uint32_t ppc_exc_msr_irq_mask;
48
49/*
50 * Hook C exception handlers.
51 *  - handlers for asynchronous exceptions run on the ISR stack
52 *    with thread-dispatching disabled.
53 *  - handlers for synchronous exceptions run on the task stack
54 *    with thread-dispatching enabled.
55 *
56 * If a particular slot is NULL then the traditional 'globalExcHdl' is used.
57 *
58 * ppc_exc_set_handler() registers a handler (returning 0 on success,
59 * -1 if the vector argument is too big).
60 *
61 * It is legal to set a NULL handler. This leads to the globalExcHdl
62 * being called if an exception for 'vector' occurs.
63 */
64int
65ppc_exc_set_handler(unsigned vector, ppc_exc_handler_t hdl);
66
67/* ppc_exc_get_handler() retrieves the currently active handler.
68 */
69ppc_exc_handler_t
70ppc_exc_get_handler(unsigned vector);
71
72/********* Low-level Exception Handlers *************/
73
74/* This API is used by middleware code              */
75
76/****************************************************/
77
78typedef uint32_t ppc_exc_min_prolog_t[4];
79
80/* Templates are ppc_raw_except_func BUT they must be exactly 16 bytes */
81typedef rtems_raw_except_func ppc_exc_min_prolog_template_t;
82
83/*
84 * Expand a prolog template into 'buf' using vector 'vec'
85 */
86void
87ppc_exc_min_prolog_expand(ppc_exc_min_prolog_t buf, ppc_exc_min_prolog_template_t templ, uint16_t vec);
88
89extern unsigned ppc_exc_min_prolog_size[];
90/* Symbols are defined by the linker; declare as an array so
91 * that gcc doesn't attempt to emit a relocation looking for
92 * it in the SDA section
93 */
94extern unsigned ppc_exc_tgpr_clr_prolog_size[];
95
96/* Templates for ppc_exc_min_prolog_expand() which fills-in the vector information */
97extern void ppc_exc_min_prolog_async_tmpl_std();
98extern void ppc_exc_min_prolog_sync_tmpl_std();
99extern void ppc_exc_min_prolog_async_tmpl_p405_crit();
100extern void ppc_exc_min_prolog_sync_tmpl_p405_crit();
101extern void ppc_exc_min_prolog_async_tmpl_bookE_crit();
102extern void ppc_exc_min_prolog_sync_tmpl_bookE_crit();
103extern void ppc_exc_min_prolog_sync_tmpl_e500_mchk();
104extern void ppc_exc_min_prolog_async_tmpl_e500_mchk();
105
106/* Special prologue for handling register shadowing on 603-style CPUs */
107extern void ppc_exc_tgpr_clr_prolog();
108/* Classic prologue which determines the vector dynamically from
109 * the offset address. This must only be used for classic, synchronous
110 * exceptions with a vector offset aligned on a 256-byte boundary.
111 */
112extern void ppc_exc_min_prolog_auto();
113
114
115/* CPU support may store the address of a function here
116 * that can be used by the default exception handler to
117 * obtain fault-address info which is helpful. Unfortunately,
118 * the SPR holding this information is not uniform
119 * across PPC families so we need assistance from
120 * CPU support
121 */
122extern uint32_t (*ppc_exc_get_DAR)();
123
124#ifdef __cplusplus
125};
126#endif
127
128#endif
Note: See TracBrowser for help on using the repository browser.