Hardware Libraries  20.1
Stratix 10 SoC Hardware Manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
alt_interrupt.h
1 /******************************************************************************
2 *
3 * Copyright 2013,2017 Altera Corporation. All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software without
17 * specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 ******************************************************************************/
32 
33 
34 /*
35  * $Id: //acds/main/embedded/ip/hps/armv8/hwlib/include/alt_interrupt.h#1 $
36  */
37 
42 #ifndef __ALT_INT_H__
43 #define __ALT_INT_H__
44 
45 #ifdef __ALT_INT_NS_H__
46 #error Secure and Non-Secure interrupt API cannot be used together.
47 #endif
48 
49 #include "hwlib.h"
50 #include "alt_int_device.h"
51 
52 #ifdef __cplusplus
53 extern "C"
54 {
55 #endif /* __cplusplus */
56 
71 typedef uint32_t alt_int_cpu_target_t;
72 
76 typedef enum ALT_INT_TRIGGER_e
77 {
78  ALT_INT_TRIGGER_EDGE,
79  ALT_INT_TRIGGER_LEVEL,
80 
86 
95 
102 
111 {
117 
123 
130 
140 typedef void (*alt_int_callback_t)(uint32_t icciar, void * context);
141 
181 #define ALT_INT_PROVISION_INT_COUNT (256)
182 
204 ALT_STATUS_CODE alt_int_global_init(void);
205 
213 ALT_STATUS_CODE alt_int_global_uninit(void);
214 
226 ALT_STATUS_CODE alt_int_global_enable(void);
227 
239 ALT_STATUS_CODE alt_int_global_disable(void);
240 
269 ALT_STATUS_CODE alt_int_dist_enable(ALT_INT_INTERRUPT_t int_id);
270 
286 ALT_STATUS_CODE alt_int_dist_disable(ALT_INT_INTERRUPT_t int_id);
287 
304 ALT_STATUS_CODE alt_int_dist_is_enabled(ALT_INT_INTERRUPT_t int_id);
305 
306 
325 ALT_STATUS_CODE alt_int_dist_pending_set(ALT_INT_INTERRUPT_t int_id);
326 
344 ALT_STATUS_CODE alt_int_dist_pending_clear(ALT_INT_INTERRUPT_t int_id);
345 
363 ALT_STATUS_CODE alt_int_dist_is_pending(ALT_INT_INTERRUPT_t int_id);
364 
382 ALT_STATUS_CODE alt_int_dist_is_active(ALT_INT_INTERRUPT_t int_id);
383 
384 
405 ALT_STATUS_CODE alt_int_dist_priority_get(ALT_INT_INTERRUPT_t int_id,
406  uint32_t * priority);
407 
428 ALT_STATUS_CODE alt_int_dist_priority_set(ALT_INT_INTERRUPT_t int_id,
429  uint32_t priority);
430 
431 
450 ALT_STATUS_CODE alt_int_dist_target_get(ALT_INT_INTERRUPT_t int_id,
451  alt_int_cpu_target_t * target);
452 
469 ALT_STATUS_CODE alt_int_dist_target_set(ALT_INT_INTERRUPT_t int_id,
470  alt_int_cpu_target_t target);
471 
472 
492 ALT_STATUS_CODE alt_int_dist_trigger_get(ALT_INT_INTERRUPT_t int_id,
493  ALT_INT_TRIGGER_t * trigger_type);
494 
515 ALT_STATUS_CODE alt_int_dist_trigger_set(ALT_INT_INTERRUPT_t int_id,
516  ALT_INT_TRIGGER_t trigger_type);
517 
573 ALT_STATUS_CODE alt_int_sgi_trigger(ALT_INT_INTERRUPT_t int_id,
574  ALT_INT_SGI_TARGET_t target_filter,
575  alt_int_cpu_target_t target_list,
576  bool secure_only);
577 
599 ALT_STATUS_CODE alt_int_cpu_init(void);
600 
605 ALT_STATUS_CODE alt_int_cpu_uninit(void);
606 
612 ALT_STATUS_CODE alt_int_cpu_enable(void);
613 
619 ALT_STATUS_CODE alt_int_cpu_enable_irq(void);
620 
626 ALT_STATUS_CODE alt_int_cpu_enable_fiq(void);
627 
631 void alt_int_cpu_disable(void);
632 
636 void alt_int_cpu_disable_irq(void);
637 
641  void alt_int_cpu_disable_fiq(void);
642 
643 
652 uint32_t alt_int_cpu_priority_mask_get(void);
653 
668 ALT_STATUS_CODE alt_int_cpu_priority_mask_set(uint32_t priority_mask);
669 
677 uint32_t alt_int_cpu_binary_point_get(void);
678 
695 ALT_STATUS_CODE alt_int_cpu_binary_point_set(uint32_t binary_point);
696 
732 ALT_STATUS_CODE alt_int_isr_register(ALT_INT_INTERRUPT_t int_id,
733  alt_int_callback_t callback,
734  void * context);
735 
750 ALT_STATUS_CODE alt_int_isr_unregister(ALT_INT_INTERRUPT_t int_id);
751 
769 uint32_t alt_int_util_cpu_count(void);
770 
776 uint32_t alt_int_util_int_count(void);
777 
778 
785 uint32_t alt_int_util_get_current_cpu(void);
786 
787 
793 alt_int_cpu_target_t alt_int_util_cpu_current(void);
794 
803 void set_vector_table(void *vector_table);
804 
810  #ifdef __arm__ /* 32 bit */
811 
815  void alt_int_fixup_irq_stack(uint32_t stack);
819  void alt_int_fixup_fiq_stack(uint32_t stack);
823  void alt_int_fixup_abt_stack(uint32_t stack);
827  void alt_int_fixup_und_stack(uint32_t stack);
831  void alt_int_set_vector(uint32_t vector);
832  #endif
833 
834 
835  #ifdef EXECUTION_LEVEL3
836 
851 ALT_STATUS_CODE alt_int_global_enable_ns(void);
852 
863 ALT_STATUS_CODE alt_int_global_disable_ns(void);
864 
876 ALT_STATUS_CODE alt_int_global_enable_all(void);
877 
889 ALT_STATUS_CODE alt_int_global_disable_all(void);
890 
901 ALT_STATUS_CODE alt_int_dist_secure_enable(ALT_INT_INTERRUPT_t int_id);
902 
913 ALT_STATUS_CODE alt_int_dist_secure_disable(ALT_INT_INTERRUPT_t int_id);
914 
926 ALT_STATUS_CODE alt_int_dist_is_secure(ALT_INT_INTERRUPT_t int_id);
927 
936 ALT_STATUS_CODE alt_int_cpu_enable_ns(void);
937 
946 ALT_STATUS_CODE alt_int_cpu_disable_ns(void);
947 
956 ALT_STATUS_CODE alt_int_cpu_enable_all(void);
957 
965 ALT_STATUS_CODE alt_int_cpu_disable_all(void);
966 
967 
1017 ALT_STATUS_CODE alt_int_cpu_config_get(bool* use_secure_binary_point,
1018  bool* use_FIQ_for_secure_interrupts,
1019  bool* allow_secure_ack_all_interrupts);
1020 
1078 ALT_STATUS_CODE alt_int_cpu_config_set(bool use_secure_binary_point,
1079  bool use_FIQ_for_secure_interrupts,
1080  bool allow_secure_ack_all_interrupts);
1081 
1089 uint32_t alt_int_cpu_binary_point_get_ns(void);
1090 
1104 ALT_STATUS_CODE alt_int_cpu_binary_point_set_ns(uint32_t binary_point);
1105 
1106 /*
1107  * Set the stack for el0 (userspace)
1108  * Can be called from EL1, EL2, or EL3
1109  */
1110 void alt_int_set_stack_el0(uint64_t stack_ptr);
1111 
1112 /*
1113  * Set the stack for el1 (kernel space)
1114  * Must be called from EL2/3
1115  */
1116 void alt_int_set_stack_el1(uint64_t stack_ptr);
1117 
1118 /*
1119  * Set the stack for el2 (hypervisor)
1120  * Must be called from EL3
1121  */
1122 void alt_int_set_stack_el2(uint64_t stack_ptr);
1123 
1124 /*
1125  * Sets the vector table for el1 64 bit. Must be called
1126  * from EL1/2/3. For example of the format for this vector
1127  * table, see alt_interrupt_vector in alt_interrupt64.S
1128  */
1129 void alt_int_set_vector_el1(uint64_t vector);
1130 
1131 /*
1132  * Sets the vector table for el2. Must be called from EL2/3.
1133  * For example of the format for this vector
1134  * table, see alt_interrupt_vector in alt_interrupt64.S
1135  */
1136 extern void alt_int_set_vector_el2(uint64_t vector);
1137 /*
1138  * Sets the vector table for el3. Must be called from EL3
1139  * For example of the format for this vector
1140  * table, see alt_interrupt_vector in alt_interrupt64.S
1141  */
1142 extern void alt_int_set_vector_el3(uint64_t vector);
1143 
1147 #endif
1148 
1153 #ifdef __cplusplus
1154 }
1155 #endif
1156 
1157 #endif /* __ALT_INT_H__ */