RTEMS  5.0.0
intercom.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
11  *
12  * embedded brains GmbH
13  * Obere Lagerstr. 30
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 LIBBSP_POWERPC_QORIQ_INTERCOM_H
24 #define LIBBSP_POWERPC_QORIQ_INTERCOM_H
25 
26 #include <rtems.h>
27 #include <rtems/chain.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32 
43 uint32_t qoriq_spin_lock(uint32_t *lock);
44 
45 void qoriq_spin_unlock(uint32_t *lock, uint32_t msr);
46 
47 #define INTERCOM_CORE_COUNT 2
48 
49 #define INTERCOM_SERVICE_COUNT 8
50 
51 typedef enum {
52  INTERCOM_TYPE_MPCI,
53  INTERCOM_TYPE_UART_0,
54  INTERCOM_TYPE_UART_1,
55  INTERCOM_TYPE_NETWORK,
56  INTERCOM_TYPE_CUSTOM_0,
57  INTERCOM_TYPE_CUSTOM_1,
58  INTERCOM_TYPE_CUSTOM_2,
59  INTERCOM_TYPE_CUSTOM_3,
60  INTERCOM_TYPE_CUSTOM_4
61 } intercom_type;
62 
63 typedef enum {
64  INTERCOM_SIZE_64 = 0,
65  INTERCOM_SIZE_512,
66  INTERCOM_SIZE_2K,
67  INTERCOM_SIZE_4K
68 } intercom_size;
69 
70 typedef struct intercom_packet {
71  union {
72  struct intercom_packet *next;
73  rtems_chain_node node;
74  } glue;
75  intercom_type type_index;
76  intercom_size size_index;
77  uint32_t flags;
78  size_t size;
79  uint32_t cache_line_alignment [2];
80  char data [];
82 
83 typedef void (*intercom_service)(intercom_packet *packet, void *arg);
84 
85 void qoriq_intercom_init(void);
86 
87 void qoriq_intercom_start(void);
88 
89 void qoriq_intercom_service_install(intercom_type type, intercom_service service, void *arg);
90 
91 void qoriq_intercom_service_remove(intercom_type type);
92 
93 intercom_packet *qoriq_intercom_allocate_packet(intercom_type type, intercom_size size);
94 
95 void qoriq_intercom_send_packets(int destination_core, intercom_packet *first, intercom_packet *last);
96 
97 static inline void qoriq_intercom_send_packet(int destination_core, intercom_packet *packet)
98 {
99  qoriq_intercom_send_packets(destination_core, packet, packet);
100 }
101 
102 void qoriq_intercom_broadcast_packets(intercom_packet *first, intercom_packet *last);
103 
104 static inline void qoriq_intercom_broadcast_packet(intercom_packet *packet)
105 {
106  qoriq_intercom_broadcast_packets(packet, packet);
107 }
108 
109 void qoriq_intercom_send(int destination_core, intercom_type type, intercom_size size, const void *buf, size_t n);
110 
111 void qoriq_intercom_free_packet(intercom_packet *packet);
112 
113 intercom_packet *qoriq_intercom_clone_packet(const intercom_packet *packet);
114 
115 #ifdef RTEMS_MULTIPROCESSING
116  extern rtems_mpci_table qoriq_intercom_mpci;
117 #endif
118 
121 #ifdef __cplusplus
122 }
123 #endif /* __cplusplus */
124 
125 #endif /* LIBBSP_POWERPC_QORIQ_INTERCOM_H */
Definition: chain.h:65
Definition: intercom.h:70
Definition: demand.c:51
Chain API.