RTEMS 6.1-rc1
tm27.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2010, 2015 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef _RTEMS_TMTEST27
37 #error "This is an RTEMS internal file you must not include directly."
38#endif /* _RTEMS_TMTEST27 */
39
40#ifndef TMTESTS_TM27_H
41#define TMTESTS_TM27_H
42
43#include <assert.h>
44
46
47#include <bsp/irq.h>
48#include <bsp/qoriq.h>
49
50#define MUST_WAIT_FOR_INTERRUPT 1
51
52#define IPI_INDEX_LOW 1
53
54#define IPI_INDEX_HIGH 2
55
56static inline void Install_tm27_vector( rtems_interrupt_handler handler )
57{
59 rtems_vector_number low = QORIQ_IRQ_IPI_0 + IPI_INDEX_LOW;
60 rtems_vector_number high = QORIQ_IRQ_IPI_0 + IPI_INDEX_HIGH;
61
63 low,
64 "tm17 low",
66 handler,
67 NULL
68 );
69 assert(sc == RTEMS_SUCCESSFUL);
70
71 sc = qoriq_pic_set_priority(low, 1, NULL);
72 assert(sc == RTEMS_SUCCESSFUL);
73
75 high,
76 "tm17 high",
78 handler,
79 NULL
80 );
81 assert(sc == RTEMS_SUCCESSFUL);
82
83 sc = qoriq_pic_set_priority(high, 2, NULL);
84 assert(sc == RTEMS_SUCCESSFUL);
85}
86
87static inline void qoriq_tm27_cause(uint32_t ipi_index)
88{
89 uint32_t self = ppc_processor_id();
90
91 qoriq.pic.per_cpu[self].ipidr[ipi_index].reg = UINT32_C(1) << self;
92}
93
94static inline void Cause_tm27_intr(void)
95{
96 qoriq_tm27_cause(IPI_INDEX_LOW);
97}
98
99static inline void Clear_tm27_intr(void)
100{
101 /* Nothing to do */
102}
103
104static inline inline void Lower_tm27_intr(void)
105{
106 qoriq_tm27_cause(IPI_INDEX_HIGH);
107}
108
109#endif /* TMTESTS_TM27_H */
This header file provides the interfaces of the Assert Handler.
rtems_status_code rtems_interrupt_handler_install(rtems_vector_number vector, const char *info, rtems_option options, rtems_interrupt_handler routine, void *arg)
Installs the interrupt handler routine and argument at the interrupt vector.
Definition: irq-handler-install.c:85
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
#define RTEMS_INTERRUPT_UNIQUE
This interrupt handler install option ensures that the interrupt handler is unique.
Definition: intr.h:907
void(* rtems_interrupt_handler)(void *)
Interrupt handler routines shall have this type.
Definition: intr.h:965
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
@ RTEMS_SUCCESSFUL
This status code indicates successful completion of a requested operation.
Definition: status.h:90
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
General purpose assembler macros, linker command file support and some inline functions for direct re...
QorIQ Configuration, Control and Status Registers.