source: trunk/hal/generic/hal_remote.h @ 81

Last change on this file since 81 was 72, checked in by max@…, 8 years ago

start defining some remote functions, and use uint8_t instead of
char

File size: 9.5 KB
RevLine 
[1]1/*
2 * hal_remote.h - Generic Remote Access API definition.
[17]3 *
[1]4 * Authors   Mohamed Karaoui  (2015)
5 *           Alain Greiner    (2016)
6 *
7 * Copyright (c)  UPMC Sorbonne Universites
[17]8 *
[1]9 * This file is part of ALMOS-MKH.
10 *
11 * ALMOS-MKH is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2.0 of the License.
14 *
15 * ALMOS-MKH is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#ifndef  _HAL_REMOTE_H_
26#define  _HAL_REMOTE_H_
27
28#include <hal_types.h>
29
30//////////////////////////////////////////////////////////////////////////////////////////
[17]31//          Generic Remote Access API (implementation in hal_remote.c)
[1]32//
33// Kernel accesses to local memory bank and peripherals can use normal C pointers.
34// kernel accesses to remote memory banks or peripherals must use the following
35// dedicated functions, because implementation depends on architectures.
36/////////////////////////////////////////////////////////////////////////////////////////
37
38/*****************************************************************************************
39 * This function writes a single byte in a remote cluster.
40 *****************************************************************************************
41 * @ xp      : extended pointer to remote cluster
42 * @ data    : value to be written
43 ****************************************************************************************/
44void hal_remote_sb( xptr_t xp,
[69]45                    uint8_t  data );
[1]46
47/*****************************************************************************************
48 * This function writes an aligned 32 bits word in a remote cluster.
49 *****************************************************************************************
50 * @ xp      : extended pointer to remote cluster
51 * @ data    : value to be written
52 ****************************************************************************************/
53void hal_remote_sw( xptr_t   xp,
54                    uint32_t data );
55
56/*****************************************************************************************
57 * This function writes an aligned 64 bits word in a remote cluster.
58 *****************************************************************************************
59 * @ xp      : extended pointer to remote cluster
60 * @ data    : value to be written
61 ****************************************************************************************/
62void hal_remote_swd( xptr_t   xp,
63                     uint64_t data );
64
65/*****************************************************************************************
66 * This function writes a pointer (32 or 64 bits) in a remote cluster.
67 *****************************************************************************************
68 * @ xp      : extended pointer to remote cluster
69 * @ pt      : value to be written
70 ****************************************************************************************/
71void hal_remote_spt( xptr_t   xp,
72                     void   * pt );
73
74/*****************************************************************************************
75 * This function reads a single byte in a remote cluster.
76 *****************************************************************************************
77 * @ xp      : extended pointer to remote data
[17]78 * @ return read value
[1]79 ****************************************************************************************/
[72]80uint8_t hal_remote_lb( xptr_t  xp );
[1]81
82/*****************************************************************************************
83 * This function reads an aligned 32 bits word in a remote cluster.
84 *****************************************************************************************
85 * @ xp      : extended pointer to remote data
86 * @ return read value
87 ****************************************************************************************/
88uint32_t hal_remote_lw( xptr_t  xp );
89
90/*****************************************************************************************
91 * This function reads an aligned 64 bits word in a remote cluster.
92 *****************************************************************************************
93 * @ xp      : extended pointer to remote data
94 * @ return read value
95 ****************************************************************************************/
96uint64_t hal_remote_lwd( xptr_t  xp );
97
98/*****************************************************************************************
99 * This function reads a pointer (can be 32 or 64 bits) in a remote cluster.
100 *****************************************************************************************
101 * @ xp      : extended pointer to remote data
102 * @ return read value
103 ****************************************************************************************/
104void * hal_remote_lpt( xptr_t  xp );
105
106/*****************************************************************************************
107 * This function reads an uncachable 32 bits word in a remote cluster.
108 *****************************************************************************************
109 * @ xp      : extended pointer to remote data
110 * @ return read value
111 ****************************************************************************************/
112uint32_t hal_remote_lw_unc( xptr_t  xp );
113
114/*****************************************************************************************
[8]115 * This non blocking function makes an atomic Compare-And-Swap in a remote cluster.
[1]116 *****************************************************************************************
117 * @ xp      : extended pointer to remote data
118 * @ old     : expected value
119 * @ new     : new value to be written
[17]120 * @ return true if success / return false if failure
[1]121 ****************************************************************************************/
122bool_t hal_remote_atomic_cas( xptr_t   xp,
123                              uint32_t old,
124                              uint32_t new );
125
126/*****************************************************************************************
127 * This blocking function adds atomically an increment to the current value of
128 * a 32 bits integer in a remote cluster. Returns only after success.
129 *****************************************************************************************
130 * @ xp      : extended pointer to remote data
131 * @ incr    : increment value.
132 * @ return old value (before increment) of the remote integer
133 ****************************************************************************************/
[17]134uint32_t hal_remote_atomic_add( xptr_t    xp,
[1]135                                uint32_t  incr );
136
137/*****************************************************************************************
138 * This function makes an atomic "and" between a local mask value and
139 * a 32 bits integer in a remote cluster. Returns only after success.
140 *****************************************************************************************
141 * @ xp      : extended pointer to remote data
142 * @ mask    : local mask value.
143 * @ return old value (before increment) of the remote integer
144 ****************************************************************************************/
[17]145uint32_t hal_remote_atomic_and( xptr_t    xp,
[1]146                                uint32_t  mask );
147
148/*****************************************************************************************
149 * This function makes an atomic "or" between a local mask value and
150 * a 32 bits integer in a remote cluster. Returns only after success.
151 *****************************************************************************************
152 * @ xp      : extended pointer to remote data
153 * @ mask    : local mask value.
154 * @ return old value (before increment) of the remote integer
155 ****************************************************************************************/
[17]156uint32_t hal_remote_atomic_or( xptr_t    xp,
[1]157                               uint32_t  mask );
158
159/*****************************************************************************************
160 * This non blocking function tries to make an atomic increment to the current
161 * value of a 32 bits integer in a remote cluster.
162 *****************************************************************************************
163 * @ xp      : extended pointer to remote data
164 * @ incr    : increment value.
165 * @ old     : local buffer address for the read value (before increment)
[17]166 * @ return 0 if atomic / return non-zero if failure
[1]167 ****************************************************************************************/
168error_t hal_remote_atomic_try_add( xptr_t     xp,
169                                   uint32_t   incr,
170                                   uint32_t * old );
171
172/*****************************************************************************************
173 * This function makes a memcpy from a source remote buffer in kernel space to another
174 * destination remote buffer in kernel space.
175 *****************************************************************************************
176 * @ dst     : extended pointer to destination buffer
177 * @ src     : extended pointer to source buffer
178 * @ size    : number of bytes to move
179 ****************************************************************************************/
180void hal_remote_memcpy( xptr_t   dst,
[17]181                        xptr_t   src,
[1]182                        uint32_t size );
183
184#endif  /* _HAL_REMOTE_H_ */
Note: See TracBrowser for help on using the repository browser.