Intel® Quark™ Microcontroller Software Interface 1.4.0 Intel® Quark™ Microcontroller BSP

- Main Page
- Modules
- Data Structures
- Files

- File List

qm_ss_interrupt.c
1 /*
2 * {% copyright %}
3 */
4
5 #include "qm_ss_interrupt.h"
6 #include "qm_soc_regs.h"
7 #include "qm_sensor_regs.h"
8
9 /* SCSS base addr for Sensor Subsystem interrupt routing, for linear IRQ
10 * mapping */
11 #define INTERRUPT_ROUTER_SS_INT_MASK_BASE \
12 (&QM_INTERRUPT_ROUTER->ss_adc_0_error_int_mask)
13
14 #if (UNIT_TEST)
15 qm_ss_isr_t __ivt_vect_table[QM_SS_INT_VECTOR_NUM];
16 #else
17 extern qm_ss_isr_t __ivt_vect_table[];
18 #endif
19
20 void qm_ss_irq_disable(void)
21 {
22 __builtin_arc_clri();
23 }
24
25 void qm_ss_irq_enable(void)
26 {
27 __builtin_arc_seti(0);
28 }
29
30 void qm_ss_irq_mask(uint32_t irq)
31 {
32 __builtin_arc_sr(irq, QM_SS_AUX_IRQ_SELECT);
33 __builtin_arc_sr(QM_SS_INT_DISABLE, QM_SS_AUX_IRQ_ENABLE);
34 }
35
36 void qm_ss_irq_unmask(uint32_t irq)
37 {
38 __builtin_arc_sr(irq, QM_SS_AUX_IRQ_SELECT);
39 __builtin_arc_sr(QM_SS_INT_ENABLE, QM_SS_AUX_IRQ_ENABLE);
40 }
41
42 void qm_ss_int_vector_request(uint32_t vector, qm_ss_isr_t isr)
43 {
44 /* Invalidate the I-cache line which contains the irq vector. This
45 * will bypass I-Cach and set vector with the good isr. */
46 __builtin_arc_sr((uint32_t)&__ivt_vect_table[0] + (vector * 4),
47 QM_SS_AUX_IC_IVIL);
48 /* All SR accesses to the IC_IVIL register must be followed by three
49 * NOP instructions, see chapter 3.3.59 in the datasheet
50 * "ARC_V2_ProgrammersReference.pdf" */
51 __builtin_arc_nop();
52 __builtin_arc_nop();
53 __builtin_arc_nop();
54 __ivt_vect_table[vector] = isr;
55 }
56
57 void qm_ss_irq_request(uint32_t irq, qm_ss_isr_t isr)
58 {
59 uint32_t vector = irq + (QM_SS_EXCEPTION_NUM + QM_SS_INT_TIMER_NUM);
60
61 /* Guarding the IRQ set-up */
62 qm_ss_irq_mask(vector);
63
64 qm_ss_int_vector_request(vector, isr);
65
66 qm_ss_irq_unmask(vector);
67 }
qm_ss_isr_t
void(* qm_ss_isr_t)(struct interrupt_frame *frame)
Interrupt service routine type.
Definition: qm_ss_interrupt.h:21
qm_ss_irq_enable
void qm_ss_irq_enable(void)
Enable interrupt delivery for the Sensor Subsystem.
Definition: qm_ss_interrupt.c:25
qm_ss_irq_disable
void qm_ss_irq_disable(void)
Disable interrupt delivery for the Sensor Subsystem.
Definition: qm_ss_interrupt.c:20
qm_ss_irq_request
void qm_ss_irq_request(uint32_t irq, qm_ss_isr_t isr)
Request a given IRQ and register ISR to interrupt vector.
Definition: qm_ss_interrupt.c:57
qm_ss_irq_mask
void qm_ss_irq_mask(uint32_t irq)
Mask a given interrupt line.
Definition: qm_ss_interrupt.c:30
qm_ss_irq_unmask
void qm_ss_irq_unmask(uint32_t irq)
Unmask a given interrupt line.
Definition: qm_ss_interrupt.c:36
qm_ss_int_vector_request
void qm_ss_int_vector_request(uint32_t vector, qm_ss_isr_t isr)
Register an Interrupt Service Routine to a given interrupt vector.
Definition: qm_ss_interrupt.c:42