MulticoreBSP for C  Version 2.0.4
mcbsp-default-hooks.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015
3  *
4  * File created by A. N. Yzelman, 2015.
5  *
6  * This file is part of MulticoreBSP in C --
7  * a port of the original Java-based MulticoreBSP.
8  *
9  * MulticoreBSP for C is distributed as part of the original
10  * MulticoreBSP and is free software: you can redistribute
11  * it and/or modify it under the terms of the GNU Lesser
12  * General Public License as published by the Free Software
13  * Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  * MulticoreBSP is distributed in the hope that it will be
16  * useful, but WITHOUT ANY WARRANTY; without even the
17  * implied warranty of MERCHANTABILITY or FITNESS FOR A
18  * PARTICULAR PURPOSE. See the GNU Lesser General Public
19  * License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General
22  * Public License along with MulticoreBSP. If not, see
23  * <http://www.gnu.org/licenses/>.
24  */
25 
26 
27 #ifndef _H_BSP_HOOKS
28 #define _H_BSP_HOOKS
29 
30 #undef MCBSP_WITH_ACCELERATOR
31 
32 #include "mcbsp.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
52 static inline void mcbsp_accelerator_implied_init(
53  struct mcbsp_init_data * const init,
54  const bsp_pid_t P
55 ) {
56  (void)init;
57  (void)P;
58 }
59 
75 static inline void mcbsp_accelerator_full_init(
76  struct mcbsp_init_data * const init,
77  const int argc,
78  char * const * const argv
79 ) {
80  (void)init;
81  (void)argc;
82  (void)argv;
83 }
84 
96 #ifdef __cplusplus
97  return static_cast< bsp_pid_t >( -1 );
98 #else
99  return ((bsp_pid_t)-1);
100 #endif
101 }
102 
112 static inline size_t mcbsp_nocc_cache_line_size( void ) {
113  return 0;
114 }
115 
129 static inline void mcbsp_nocc_purge_all( void ) {
130 #ifdef __arm__
131  __asm __volatile("dsb" : : : "memory")
132 #endif
133 }
134 
151 static inline void mcbsp_nocc_flush_cacheline( const void * const address ) {
152  (void)address;
153 }
154 
177 static inline void mcbsp_nocc_invalidate(
178  const void * const address,
179  const size_t length
180 ) {
181  (void)address;
182  (void)length;
183 }
184 
197 static inline void mcbsp_nocc_wait_for_flush( void ) {}
198 
206 static inline void mcbsp_nocc_invalidate_cacheline( const void * const address ) {
207  (void)address;
208 }
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif
215 
static void mcbsp_nocc_invalidate(const void *const address, const size_t length)
Invalidate a specific cache line.
Definition: mcbsp-default-hooks.h:177
static void mcbsp_nocc_purge_all(void)
Purges the local cache.
Definition: mcbsp-default-hooks.h:129
static void mcbsp_nocc_wait_for_flush(void)
Waits for any outstanding flushes to complete.
Definition: mcbsp-default-hooks.h:197
static void mcbsp_nocc_invalidate_cacheline(const void *const address)
As mcbsp_nocc_invalidate, but invalidates a single cache line only.
Definition: mcbsp-default-hooks.h:206
static void mcbsp_nocc_flush_cacheline(const void *const address)
Flushes a specific cache line.
Definition: mcbsp-default-hooks.h:151
static void mcbsp_accelerator_implied_init(struct mcbsp_init_data *const init, const bsp_pid_t P)
Accelerator-specific initialisation.
Definition: mcbsp-default-hooks.h:52
static bsp_pid_t mcbsp_accelerator_offline_nprocs(void)
Returns the maximum number of processes supported by the accelerator.
Definition: mcbsp-default-hooks.h:95
static void mcbsp_accelerator_full_init(struct mcbsp_init_data *const init, const int argc, char *const *const argv)
Accelerator-specific initialisation.
Definition: mcbsp-default-hooks.h:75
void MCBSP_FUNCTION_PREFIX() init(void(*spmd)(void), int argc, char **argv)
unsigned int bsp_pid_t
Data type used for thread IDs.
Definition: bsp.h:252
static size_t mcbsp_nocc_cache_line_size(void)
Returns the cache line size in bytes, as active on the accelerator.
Definition: mcbsp-default-hooks.h:112
Initialisation struct.
Definition: mcbsp.h:198