|
60 | 60 | *
|
61 | 61 | * @param box_name[in] The name of the source box as decalred in
|
62 | 62 | * `UVISOR_BOX_CONFIG`.
|
| 63 | + * @param shared[in] Whether the gateway can be shared with other boxes or |
| 64 | + * not. Two values are available: UVISOR_RGW_SHARED, |
| 65 | + * UVISOR_RGW_EXCLUSIVE. |
63 | 66 | * @param addr[in] The address for the data access.
|
64 | 67 | * @param operation[in] The operation to perform at the address for the read. It
|
65 | 68 | * is chosen among the `UVISOR_RGW_OP_*` macros.
|
66 |
| - * @param shared[in] True if the gateway can be performed by any box. In this |
67 |
| - * case, the box_name field does not guarantee exclusivity. |
68 | 69 | * @param mask[in] The mask to apply for the read operation.
|
69 | 70 | * @returns The value read from address using the operation and mask provided
|
70 | 71 | * (or their respective defaults if they have not been provided).
|
71 | 72 | */
|
72 |
| -#define uvisor_read(box_name, addr, op, shared, msk) \ |
| 73 | +#define uvisor_read(box_name, shared, addr, op, msk) \ |
73 | 74 | ({ \
|
74 | 75 | /* Instanstiate the gateway. This gets resolved at link-time. */ \
|
75 | 76 | __attribute__((aligned(4))) static TRegisterGateway const register_gateway = { \
|
|
106 | 107 | *
|
107 | 108 | * @param box_name[in] The name of the source box as decalred in
|
108 | 109 | * `UVISOR_BOX_CONFIG`.
|
| 110 | + * @param shared[in] Whether the gateway can be shared with other boxes or |
| 111 | + * not. Two values are available: UVISOR_RGW_SHARED, |
| 112 | + * UVISOR_RGW_EXCLUSIVE. |
109 | 113 | * @param addr[in] The address for the data access.
|
110 | 114 | * @param val[in] The value to write at address.
|
111 | 115 | * @param operation[in] The operation to perform at the address for the read. It
|
112 | 116 | * is chosen among the `UVISOR_RGW_OP_*` macros.
|
113 |
| - * @param shared[in] True if the gateway can be performed by any box. In this |
114 |
| - * case, the box_name field does not guarantee exclusivity. |
115 | 117 | * @param mask[in] The mask to apply for the write operation.
|
116 | 118 | */
|
117 |
| -#define uvisor_write(box_name, addr, val, op, shared, msk) \ |
| 119 | +#define uvisor_write(box_name, shared, addr, val, op, msk) \ |
118 | 120 | { \
|
119 | 121 | /* Instanstiate the gateway. This gets resolved at link-time. */ \
|
120 | 122 | __attribute__((aligned(4))) static TRegisterGateway const register_gateway = { \
|
|
143 | 145 | /** Get the selected bits at the target address.
|
144 | 146 | * @param box_name[in] Box name as defined by the uVisor box configuration
|
145 | 147 | * macro `UVISOR_BOX_CONFIG`
|
| 148 | + * @param shared[in] Whether the gateway can be shared with other boxes or |
| 149 | + * not. Two values are available: UVISOR_RGW_SHARED, |
| 150 | + * UVISOR_RGW_EXCLUSIVE. |
146 | 151 | * @param address[in] Target address
|
147 | 152 | * @param mask[in] Bits to select out of the target address
|
148 | 153 | * @returns The value `*address & mask`.
|
149 | 154 | */
|
150 |
| -#define UVISOR_BITS_GET(box_name, address, mask) \ |
| 155 | +#define UVISOR_BITS_GET(box_name, shared, address, mask) \ |
151 | 156 | /* Register gateway implementation:
|
152 | 157 | * *address & mask */ \
|
153 |
| - uvisor_read(box_name, address, UVISOR_RGW_OP_READ_AND, false, mask) |
| 158 | + uvisor_read(box_name, shared, address, UVISOR_RGW_OP_READ_AND, mask) |
154 | 159 |
|
155 | 160 | /** Check the selected bits at the target address.
|
156 | 161 | * @param box_name[in] Box name as defined by the uVisor box configuration
|
157 | 162 | * macro `UVISOR_BOX_CONFIG`
|
| 163 | + * @param shared[in] Whether the gateway can be shared with other boxes or |
| 164 | + * not. Two values are available: UVISOR_RGW_SHARED, |
| 165 | + * UVISOR_RGW_EXCLUSIVE. |
158 | 166 | * @param address[in] Address at which to check the bits
|
159 | 167 | * @param mask[in] Bits to select out of the target address
|
160 |
| - * @returns The value `(bool) (*address & mask) == mask)`. |
| 168 | + * @returns The value `((*address & mask) == mask)`. |
161 | 169 | */
|
162 |
| -#define UVISOR_BITS_CHECK(box_name, address, mask) \ |
163 |
| - ((bool) (UVISOR_BITS_GET(box_name, address, mask) == mask)) |
| 170 | +#define UVISOR_BITS_CHECK(box_name, shared, address, mask) \ |
| 171 | + ((UVISOR_BITS_GET(box_name, shared, address, mask)) == (mask)) |
164 | 172 |
|
165 | 173 | /** Set the selected bits to 1 at the target address.
|
166 | 174 | *
|
167 | 175 | * Equivalent to: `*address |= mask`.
|
168 | 176 | * @param box_name[in] Box name as defined by the uVisor box configuration
|
169 | 177 | * macro `UVISOR_BOX_CONFIG`
|
| 178 | + * @param shared[in] Whether the gateway can be shared with other boxes or |
| 179 | + * not. Two values are available: UVISOR_RGW_SHARED, |
| 180 | + * UVISOR_RGW_EXCLUSIVE. |
170 | 181 | * @param address[in] Target address
|
171 | 182 | * @param mask[in] Bits to select out of the target address
|
172 | 183 | */
|
173 |
| -#define UVISOR_BITS_SET(box_name, address, mask) \ |
| 184 | +#define UVISOR_BITS_SET(box_name, shared, address, mask) \ |
174 | 185 | /* Register gateway implementation:
|
175 | 186 | * *address |= (mask & mask) */ \
|
176 |
| - uvisor_write(box_name, address, mask, UVISOR_RGW_OP_WRITE_OR, false, mask) |
| 187 | + uvisor_write(box_name, shared, address, mask, UVISOR_RGW_OP_WRITE_OR, mask) |
177 | 188 |
|
178 | 189 | /** Clear the selected bits at the target address.
|
179 | 190 | *
|
180 | 191 | * Equivalent to: `*address &= ~mask`.
|
181 | 192 | * @param box_name[in] Box name as defined by the uVisor box configuration
|
182 | 193 | * macro `UVISOR_BOX_CONFIG`
|
| 194 | + * @param shared[in] Whether the gateway can be shared with other boxes or |
| 195 | + * not. Two values are available: UVISOR_RGW_SHARED, |
| 196 | + * UVISOR_RGW_EXCLUSIVE. |
183 | 197 | * @param address[in] Target address
|
184 | 198 | * @param mask[in] Bits to select out of the target address
|
185 | 199 | */
|
186 |
| -#define UVISOR_BITS_CLEAR(box_name, address, mask) \ |
| 200 | +#define UVISOR_BITS_CLEAR(box_name, shared, address, mask) \ |
187 | 201 | /* Register gateway implementation:
|
188 | 202 | * *address &= (0x00000000 | ~mask) */ \
|
189 |
| - uvisor_write(box_name, address, 0x00000000, UVISOR_RGW_OP_WRITE_AND, false, mask) |
| 203 | + uvisor_write(box_name, shared, address, 0x00000000, UVISOR_RGW_OP_WRITE_AND, mask) |
190 | 204 |
|
191 | 205 | /** Set the selected bits at the target address to the given value.
|
192 | 206 | *
|
193 | 207 | * Equivalent to: `*address = (*address & ~mask) | (value & mask)`.
|
194 | 208 | * @param box_name[in] Box name as defined by the uVisor box configuration
|
195 | 209 | * macro `UVISOR_BOX_CONFIG`
|
| 210 | + * @param shared[in] Whether the gateway can be shared with other boxes or |
| 211 | + * not. Two values are available: UVISOR_RGW_SHARED, |
| 212 | + * UVISOR_RGW_EXCLUSIVE. |
196 | 213 | * @param address[in] Target address
|
197 | 214 | * @param mask[in] Bits to select out of the target address
|
198 | 215 | * @param value[in] Value to write at the address location. Note: The value
|
199 | 216 | * must be already shifted to the correct bit position
|
200 | 217 | */
|
201 |
| -#define UVISOR_BITS_SET_VALUE(box_name, address, mask, value) \ |
| 218 | +#define UVISOR_BITS_SET_VALUE(box_name, shared, address, mask, value) \ |
202 | 219 | /* Register gateway implementation:
|
203 | 220 | * *address = (*address & ~mask) | (value & mask) */ \
|
204 |
| - uvisor_write(box_name, address, value, UVISOR_RGW_OP_WRITE_REPLACE, false, mask) |
| 221 | + uvisor_write(box_name, shared, address, value, UVISOR_RGW_OP_WRITE_REPLACE, mask) |
205 | 222 |
|
206 | 223 | /** Toggle the selected bits at the target address.
|
207 | 224 | *
|
208 | 225 | * Equivalent to: `*address ^= mask`.
|
209 | 226 | * @param box_name[in] Box name as defined by the uVisor box configuration
|
210 | 227 | * macro `UVISOR_BOX_CONFIG`
|
| 228 | + * @param shared[in] Whether the gateway can be shared with other boxes or |
| 229 | + * not. Two values are available: UVISOR_RGW_SHARED, |
| 230 | + * UVISOR_RGW_EXCLUSIVE. |
211 | 231 | * @param address[in] Target address
|
212 | 232 | * @param mask[in] Bits to select out of the target address
|
213 | 233 | */
|
214 |
| -#define UVISOR_BITS_TOGGLE(box_name, address, mask) \ |
| 234 | +#define UVISOR_BITS_TOGGLE(box_name, shared, address, mask) \ |
215 | 235 | /* Register gateway implementation:
|
216 | 236 | * *address ^= (0xFFFFFFFF & mask) */ \
|
217 |
| - uvisor_write(box_name, address, 0xFFFFFFFF, UVISOR_RGW_OP_WRITE_XOR, false, mask) |
| 237 | + uvisor_write(box_name, shared, address, 0xFFFFFFFF, UVISOR_RGW_OP_WRITE_XOR, mask) |
218 | 238 |
|
219 | 239 | #endif /* __UVISOR_API_REGISTER_GATEWAY_H__ */
|
0 commit comments