RTEMS  5.1
tm27.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2010-2015 embedded brains GmbH. All rights reserved.
11  *
12  * embedded brains GmbH
13  * Dornierstr. 4
14  * 82178 Puchheim
15  * Germany
16  * <rtems@embedded-brains.de>
17  *
18  * The license and distribution terms for this file may be
19  * found in the file LICENSE in this distribution or at
20  * http://www.rtems.org/license/LICENSE.
21  */
22 
23 #ifndef _RTEMS_TMTEST27
24  #error "This is an RTEMS internal file you must not include directly."
25 #endif /* _RTEMS_TMTEST27 */
26 
27 #ifndef TMTESTS_TM27_H
28 #define TMTESTS_TM27_H
29 
30 #include <assert.h>
31 
32 #include <libcpu/powerpc-utility.h>
33 
34 #include <bsp/irq.h>
35 #include <bsp/qoriq.h>
36 
37 #define MUST_WAIT_FOR_INTERRUPT 1
38 
39 #define IPI_INDEX_LOW 1
40 
41 #define IPI_INDEX_HIGH 2
42 
43 RTEMS_INLINE_ROUTINE void Install_tm27_vector(void (*handler)(rtems_vector_number))
44 {
46  rtems_vector_number low = QORIQ_IRQ_IPI_0 + IPI_INDEX_LOW;
47  rtems_vector_number high = QORIQ_IRQ_IPI_0 + IPI_INDEX_HIGH;
48 
50  low,
51  "tm17 low",
53  (rtems_interrupt_handler) handler,
54  NULL
55  );
56  assert(sc == RTEMS_SUCCESSFUL);
57 
58  sc = qoriq_pic_set_priority(low, 1, NULL);
59  assert(sc == RTEMS_SUCCESSFUL);
60 
62  high,
63  "tm17 high",
65  (rtems_interrupt_handler) handler,
66  NULL
67  );
68  assert(sc == RTEMS_SUCCESSFUL);
69 
70  sc = qoriq_pic_set_priority(high, 2, NULL);
71  assert(sc == RTEMS_SUCCESSFUL);
72 }
73 
74 RTEMS_INLINE_ROUTINE void qoriq_tm27_cause(uint32_t ipi_index)
75 {
76  uint32_t self = ppc_processor_id();
77 
78  qoriq.pic.per_cpu[self].ipidr[ipi_index].reg = UINT32_C(1) << self;
79 }
80 
81 RTEMS_INLINE_ROUTINE void Cause_tm27_intr(void)
82 {
83  qoriq_tm27_cause(IPI_INDEX_LOW);
84 }
85 
86 RTEMS_INLINE_ROUTINE void Clear_tm27_intr(void)
87 {
88  /* Nothing to do */
89 }
90 
91 RTEMS_INLINE_ROUTINE inline void Lower_tm27_intr(void)
92 {
93  qoriq_tm27_cause(IPI_INDEX_HIGH);
94 }
95 
96 #endif /* TMTESTS_TM27_H */
Definition: status.h:47
rtems_status_code rtems_interrupt_handler_install(rtems_vector_number vector, const char *info, rtems_option options, rtems_interrupt_handler handler, void *arg)
Installs the interrupt handler routine handler for the interrupt vector with number vector.
Definition: irq.c:127
ISR_Vector_number rtems_vector_number
Control block type used to manage the vectors.
Definition: intr.h:47
Information for the Assert Handler.
General purpose assembler macros, linker command file support and some inline functions for direct re...
rtems_status_code
Classic API Status.
Definition: status.h:43
#define RTEMS_INTERRUPT_UNIQUE
Makes the interrupt handler unique. Prevents other handler from using the same interrupt vector.
Definition: irq-extension.h:44
void(* rtems_interrupt_handler)(void *)
Interrupt handler routine type.
Definition: irq-extension.h:79
QorIQ Configuration, Control and Status Registers.
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77