source: rtems/bsps/powerpc/qoriq/include/tm27.h @ a660e9dc

Last change on this file since a660e9dc was a660e9dc, checked in by Sebastian Huber <sebastian.huber@…>, on 09/08/22 at 08:37:05

Do not use RTEMS_INLINE_ROUTINE

Directly use "static inline" which is available in C99 and later. This brings
the RTEMS implementation closer to standard C.

Close #3935.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSBSPsPowerPCQorIQ
7 *
8 * @brief Support file for Timer Test 27.
9 */
10
11/*
12 * Copyright (c) 2010-2015 embedded brains GmbH.  All rights reserved.
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
45#include <libcpu/powerpc-utility.h>
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(void (*handler)(rtems_vector_number))
57{
58  rtems_status_code sc;
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
62  sc = rtems_interrupt_handler_install(
63    low,
64    "tm17 low",
65    RTEMS_INTERRUPT_UNIQUE,
66    (rtems_interrupt_handler) 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
74  sc = rtems_interrupt_handler_install(
75    high,
76    "tm17 high",
77    RTEMS_INTERRUPT_UNIQUE,
78    (rtems_interrupt_handler) 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 */
Note: See TracBrowser for help on using the repository browser.