2 * FreeRTOS Kernel V10.4.4
\r
3 * Copyright (C) 2006-2015 Cadence Design Systems, Inc.
\r
4 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
6 * SPDX-License-Identifier: MIT
\r
8 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
9 * this software and associated documentation files (the "Software"), to deal in
\r
10 * the Software without restriction, including without limitation the rights to
\r
11 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
12 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
13 * subject to the following conditions:
\r
15 * The above copyright notice and this permission notice shall be included in all
\r
16 * copies or substantial portions of the Software.
\r
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
20 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
21 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
22 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
25 * https://www.FreeRTOS.org
\r
26 * https://github.com/FreeRTOS
\r
30 /******************************************************************************
\r
31 * Xtensa-specific API for RTOS ports.
\r
32 ******************************************************************************/
\r
34 #ifndef __XTENSA_API_H__
\r
35 #define __XTENSA_API_H__
\r
37 #include <xtensa/hal.h>
\r
39 #include "xtensa_context.h"
\r
42 /* Typedef for C-callable interrupt handler function */
\r
43 typedef void (* xt_handler)( void * );
\r
45 /* Typedef for C-callable exception handler function */
\r
46 typedef void (* xt_exc_handler)( XtExcFrame * );
\r
50 * -------------------------------------------------------------------------------
\r
51 * Call this function to set a handler for the specified exception. The handler
\r
52 * will be installed on the core that calls this function.
\r
54 * n - Exception number (type)
\r
55 * f - Handler function address, NULL to uninstall handler.
\r
57 * The handler will be passed a pointer to the exception frame, which is created
\r
58 * on the stack of the thread that caused the exception.
\r
60 * If the handler returns, the thread context will be restored and the faulting
\r
61 * instruction will be retried. Any values in the exception frame that are
\r
62 * modified by the handler will be restored as part of the context. For details
\r
63 * of the exception frame structure see xtensa_context.h.
\r
64 * -------------------------------------------------------------------------------
\r
66 extern xt_exc_handler xt_set_exception_handler( int n,
\r
71 * -------------------------------------------------------------------------------
\r
72 * Call this function to set a handler for the specified interrupt. The handler
\r
73 * will be installed on the core that calls this function.
\r
75 * n - Interrupt number.
\r
76 * f - Handler function address, NULL to uninstall handler.
\r
77 * arg - Argument to be passed to handler.
\r
78 * -------------------------------------------------------------------------------
\r
80 extern xt_handler xt_set_interrupt_handler( int n,
\r
86 * -------------------------------------------------------------------------------
\r
87 * Call this function to enable the specified interrupts on the core that runs
\r
90 * mask - Bit mask of interrupts to be enabled.
\r
91 * -------------------------------------------------------------------------------
\r
93 extern void xt_ints_on( unsigned int mask );
\r
97 * -------------------------------------------------------------------------------
\r
98 * Call this function to disable the specified interrupts on the core that runs
\r
101 * mask - Bit mask of interrupts to be disabled.
\r
102 * -------------------------------------------------------------------------------
\r
104 extern void xt_ints_off( unsigned int mask );
\r
108 * -------------------------------------------------------------------------------
\r
109 * Call this function to set the specified (s/w) interrupt.
\r
110 * -------------------------------------------------------------------------------
\r
112 static inline void xt_set_intset( unsigned int arg )
\r
114 xthal_set_intset( arg );
\r
119 * -------------------------------------------------------------------------------
\r
120 * Call this function to clear the specified (s/w or edge-triggered)
\r
122 * -------------------------------------------------------------------------------
\r
124 static inline void xt_set_intclear( unsigned int arg )
\r
126 xthal_set_intclear( arg );
\r
130 * -------------------------------------------------------------------------------
\r
131 * Call this function to get handler's argument for the specified interrupt.
\r
133 * n - Interrupt number.
\r
134 * -------------------------------------------------------------------------------
\r
136 extern void * xt_get_interrupt_handler_arg( int n );
\r
138 #endif /* __XTENSA_API_H__ */
\r