RTEMS 6.1-rc6
Loading...
Searching...
No Matches
intercom.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (c) 2011 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 LIBBSP_POWERPC_QORIQ_INTERCOM_H
37#define LIBBSP_POWERPC_QORIQ_INTERCOM_H
38
39#include <rtems.h>
40#include <rtems/chain.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif /* __cplusplus */
45
56uint32_t qoriq_spin_lock(uint32_t *lock);
57
58void qoriq_spin_unlock(uint32_t *lock, uint32_t msr);
59
60#define INTERCOM_CORE_COUNT 2
61
62#define INTERCOM_SERVICE_COUNT 8
63
64typedef enum {
65 INTERCOM_TYPE_MPCI,
66 INTERCOM_TYPE_UART_0,
67 INTERCOM_TYPE_UART_1,
68 INTERCOM_TYPE_NETWORK,
69 INTERCOM_TYPE_CUSTOM_0,
70 INTERCOM_TYPE_CUSTOM_1,
71 INTERCOM_TYPE_CUSTOM_2,
72 INTERCOM_TYPE_CUSTOM_3,
73 INTERCOM_TYPE_CUSTOM_4
74} intercom_type;
75
76typedef enum {
77 INTERCOM_SIZE_64 = 0,
78 INTERCOM_SIZE_512,
79 INTERCOM_SIZE_2K,
80 INTERCOM_SIZE_4K
81} intercom_size;
82
83typedef struct intercom_packet {
84 union {
85 struct intercom_packet *next;
87 } glue;
88 intercom_type type_index;
89 intercom_size size_index;
90 uint32_t flags;
91 size_t size;
92 uint32_t cache_line_alignment [2];
93 char data [];
95
96typedef void (*intercom_service)(intercom_packet *packet, void *arg);
97
98void qoriq_intercom_init(void);
99
100void qoriq_intercom_start(void);
101
102void qoriq_intercom_service_install(intercom_type type, intercom_service service, void *arg);
103
104void qoriq_intercom_service_remove(intercom_type type);
105
106intercom_packet *qoriq_intercom_allocate_packet(intercom_type type, intercom_size size);
107
108void qoriq_intercom_send_packets(int destination_core, intercom_packet *first, intercom_packet *last);
109
110static inline void qoriq_intercom_send_packet(int destination_core, intercom_packet *packet)
111{
112 qoriq_intercom_send_packets(destination_core, packet, packet);
113}
114
115void qoriq_intercom_broadcast_packets(intercom_packet *first, intercom_packet *last);
116
117static inline void qoriq_intercom_broadcast_packet(intercom_packet *packet)
118{
119 qoriq_intercom_broadcast_packets(packet, packet);
120}
121
122void qoriq_intercom_send(int destination_core, intercom_type type, intercom_size size, const void *buf, size_t n);
123
124void qoriq_intercom_free_packet(intercom_packet *packet);
125
126intercom_packet *qoriq_intercom_clone_packet(const intercom_packet *packet);
127
128#ifdef RTEMS_MULTIPROCESSING
129 extern rtems_mpci_table qoriq_intercom_mpci;
130#endif
131
134#ifdef __cplusplus
135}
136#endif /* __cplusplus */
137
138#endif /* LIBBSP_POWERPC_QORIQ_INTERCOM_H */
This header file provides the Chains API.
This header file defines the RTEMS Classic API.
This structure represents a chain node.
Definition: chain.h:78
Definition: intercom.h:83