]> begriffs open source - freertos/blob - portable/ThirdParty/GCC/Xtensa_ESP32/include/xtensa_api.h
[AUTO][RELEASE]: Bump file header version to "10.4.4"
[freertos] / portable / ThirdParty / GCC / Xtensa_ESP32 / include / xtensa_api.h
1 /*\r
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
5  *\r
6  * SPDX-License-Identifier: MIT\r
7  *\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
14  *\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
17  *\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
24  *\r
25  * https://www.FreeRTOS.org\r
26  * https://github.com/FreeRTOS\r
27  *\r
28  */\r
29 \r
30 /******************************************************************************\r
31 *  Xtensa-specific API for RTOS ports.\r
32 ******************************************************************************/\r
33 \r
34 #ifndef __XTENSA_API_H__\r
35 #define __XTENSA_API_H__\r
36 \r
37 #include <xtensa/hal.h>\r
38 \r
39 #include "xtensa_context.h"\r
40 \r
41 \r
42 /* Typedef for C-callable interrupt handler function */\r
43 typedef void (* xt_handler)( void * );\r
44 \r
45 /* Typedef for C-callable exception handler function */\r
46 typedef void (* xt_exc_handler)( XtExcFrame * );\r
47 \r
48 \r
49 /*\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
53  *\r
54  *  n        - Exception number (type)\r
55  *  f        - Handler function address, NULL to uninstall handler.\r
56  *\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
59  *\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
65  */\r
66 extern xt_exc_handler xt_set_exception_handler( int n,\r
67                                                 xt_exc_handler f );\r
68 \r
69 \r
70 /*\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
74  *\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
79  */\r
80 extern xt_handler xt_set_interrupt_handler( int n,\r
81                                             xt_handler f,\r
82                                             void * arg );\r
83 \r
84 \r
85 /*\r
86  * -------------------------------------------------------------------------------\r
87  * Call this function to enable the specified interrupts on the core that runs\r
88  * this code.\r
89  *\r
90  *  mask     - Bit mask of interrupts to be enabled.\r
91  * -------------------------------------------------------------------------------\r
92  */\r
93 extern void xt_ints_on( unsigned int mask );\r
94 \r
95 \r
96 /*\r
97  * -------------------------------------------------------------------------------\r
98  * Call this function to disable the specified interrupts on the core that runs\r
99  * this code.\r
100  *\r
101  *  mask     - Bit mask of interrupts to be disabled.\r
102  * -------------------------------------------------------------------------------\r
103  */\r
104 extern void xt_ints_off( unsigned int mask );\r
105 \r
106 \r
107 /*\r
108  * -------------------------------------------------------------------------------\r
109  * Call this function to set the specified (s/w) interrupt.\r
110  * -------------------------------------------------------------------------------\r
111  */\r
112 static inline void xt_set_intset( unsigned int arg )\r
113 {\r
114     xthal_set_intset( arg );\r
115 }\r
116 \r
117 \r
118 /*\r
119  * -------------------------------------------------------------------------------\r
120  * Call this function to clear the specified (s/w or edge-triggered)\r
121  * interrupt.\r
122  * -------------------------------------------------------------------------------\r
123  */\r
124 static inline void xt_set_intclear( unsigned int arg )\r
125 {\r
126     xthal_set_intclear( arg );\r
127 }\r
128 \r
129 /*\r
130  * -------------------------------------------------------------------------------\r
131  * Call this function to get handler's argument for the specified interrupt.\r
132  *\r
133  *  n        - Interrupt number.\r
134  * -------------------------------------------------------------------------------\r
135  */\r
136 extern void * xt_get_interrupt_handler_arg( int n );\r
137 \r
138 #endif /* __XTENSA_API_H__ */\r