Jason Sams | c4cdf45 | 2010-07-07 11:55:51 -0700 | [diff] [blame] | 1 | #ifndef __RS_MATH_RSH__ |
| 2 | #define __RS_MATH_RSH__ |
| 3 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 4 | /** |
| 5 | * Copy reference to the specified object. |
| 6 | * |
| 7 | * @param dst |
| 8 | * @param src |
| 9 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 10 | extern void __attribute__((overloadable)) |
| 11 | rsSetObject(rs_element *dst, rs_element src); |
| 12 | extern void __attribute__((overloadable)) |
| 13 | rsSetObject(rs_type *dst, rs_type src); |
| 14 | extern void __attribute__((overloadable)) |
| 15 | rsSetObject(rs_allocation *dst, rs_allocation src); |
| 16 | extern void __attribute__((overloadable)) |
| 17 | rsSetObject(rs_sampler *dst, rs_sampler src); |
| 18 | extern void __attribute__((overloadable)) |
| 19 | rsSetObject(rs_script *dst, rs_script src); |
| 20 | extern void __attribute__((overloadable)) |
| 21 | rsSetObject(rs_mesh *dst, rs_mesh src); |
| 22 | extern void __attribute__((overloadable)) |
| 23 | rsSetObject(rs_program_fragment *dst, rs_program_fragment src); |
| 24 | extern void __attribute__((overloadable)) |
| 25 | rsSetObject(rs_program_vertex *dst, rs_program_vertex src); |
| 26 | extern void __attribute__((overloadable)) |
| 27 | rsSetObject(rs_program_raster *dst, rs_program_raster src); |
| 28 | extern void __attribute__((overloadable)) |
| 29 | rsSetObject(rs_program_store *dst, rs_program_store src); |
| 30 | extern void __attribute__((overloadable)) |
| 31 | rsSetObject(rs_font *dst, rs_font src); |
| 32 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 33 | /** |
| 34 | * Sets the object to NULL. |
| 35 | * |
| 36 | * @return bool |
| 37 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 38 | extern void __attribute__((overloadable)) |
| 39 | rsClearObject(rs_element *dst); |
| 40 | extern void __attribute__((overloadable)) |
| 41 | rsClearObject(rs_type *dst); |
| 42 | extern void __attribute__((overloadable)) |
| 43 | rsClearObject(rs_allocation *dst); |
| 44 | extern void __attribute__((overloadable)) |
| 45 | rsClearObject(rs_sampler *dst); |
| 46 | extern void __attribute__((overloadable)) |
| 47 | rsClearObject(rs_script *dst); |
| 48 | extern void __attribute__((overloadable)) |
| 49 | rsClearObject(rs_mesh *dst); |
| 50 | extern void __attribute__((overloadable)) |
| 51 | rsClearObject(rs_program_fragment *dst); |
| 52 | extern void __attribute__((overloadable)) |
| 53 | rsClearObject(rs_program_vertex *dst); |
| 54 | extern void __attribute__((overloadable)) |
| 55 | rsClearObject(rs_program_raster *dst); |
| 56 | extern void __attribute__((overloadable)) |
| 57 | rsClearObject(rs_program_store *dst); |
| 58 | extern void __attribute__((overloadable)) |
| 59 | rsClearObject(rs_font *dst); |
| 60 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 61 | /** |
| 62 | * Tests if the object is valid. Returns true if the object is valid, false if |
| 63 | * it is NULL. |
| 64 | * |
| 65 | * @return bool |
| 66 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 67 | extern bool __attribute__((overloadable)) |
| 68 | rsIsObject(rs_element); |
| 69 | extern bool __attribute__((overloadable)) |
| 70 | rsIsObject(rs_type); |
| 71 | extern bool __attribute__((overloadable)) |
| 72 | rsIsObject(rs_allocation); |
| 73 | extern bool __attribute__((overloadable)) |
| 74 | rsIsObject(rs_sampler); |
| 75 | extern bool __attribute__((overloadable)) |
| 76 | rsIsObject(rs_script); |
| 77 | extern bool __attribute__((overloadable)) |
| 78 | rsIsObject(rs_mesh); |
| 79 | extern bool __attribute__((overloadable)) |
| 80 | rsIsObject(rs_program_fragment); |
| 81 | extern bool __attribute__((overloadable)) |
| 82 | rsIsObject(rs_program_vertex); |
| 83 | extern bool __attribute__((overloadable)) |
| 84 | rsIsObject(rs_program_raster); |
| 85 | extern bool __attribute__((overloadable)) |
| 86 | rsIsObject(rs_program_store); |
| 87 | extern bool __attribute__((overloadable)) |
| 88 | rsIsObject(rs_font); |
| 89 | |
| 90 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 91 | /** |
| 92 | * Returns the Allocation for a given pointer. The pointer should point within |
| 93 | * a valid allocation. The results are undefined if the pointer is not from a |
| 94 | * valid allocation. |
| 95 | */ |
Jason Sams | ef5867a | 2010-07-28 11:17:53 -0700 | [diff] [blame] | 96 | extern rs_allocation __attribute__((overloadable)) |
| 97 | rsGetAllocation(const void *); |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 98 | |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 99 | /** |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 100 | * Query the dimension of an allocation. |
| 101 | * |
| 102 | * @return uint32_t The X dimension of the allocation. |
| 103 | */ |
Jason Sams | ef5867a | 2010-07-28 11:17:53 -0700 | [diff] [blame] | 104 | extern uint32_t __attribute__((overloadable)) |
| 105 | rsAllocationGetDimX(rs_allocation); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 106 | |
| 107 | /** |
| 108 | * Query the dimension of an allocation. |
| 109 | * |
| 110 | * @return uint32_t The Y dimension of the allocation. |
| 111 | */ |
Jason Sams | ef5867a | 2010-07-28 11:17:53 -0700 | [diff] [blame] | 112 | extern uint32_t __attribute__((overloadable)) |
| 113 | rsAllocationGetDimY(rs_allocation); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 114 | |
| 115 | /** |
| 116 | * Query the dimension of an allocation. |
| 117 | * |
| 118 | * @return uint32_t The Z dimension of the allocation. |
| 119 | */ |
Jason Sams | ef5867a | 2010-07-28 11:17:53 -0700 | [diff] [blame] | 120 | extern uint32_t __attribute__((overloadable)) |
| 121 | rsAllocationGetDimZ(rs_allocation); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 122 | |
| 123 | /** |
| 124 | * Query an allocation for the presence of more than one LOD. |
| 125 | * |
| 126 | * @return uint32_t Returns 1 if more than one LOD is present, 0 otherwise. |
| 127 | */ |
Jason Sams | ef5867a | 2010-07-28 11:17:53 -0700 | [diff] [blame] | 128 | extern uint32_t __attribute__((overloadable)) |
| 129 | rsAllocationGetDimLOD(rs_allocation); |
Jason Sams | 09aeb8a | 2011-01-28 15:49:07 -0800 | [diff] [blame] | 130 | |
| 131 | /** |
| 132 | * Query an allocation for the presence of more than one face. |
| 133 | * |
| 134 | * @return uint32_t Returns 1 if more than one face is present, 0 otherwise. |
| 135 | */ |
Jason Sams | ef5867a | 2010-07-28 11:17:53 -0700 | [diff] [blame] | 136 | extern uint32_t __attribute__((overloadable)) |
| 137 | rsAllocationGetDimFaces(rs_allocation); |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 138 | |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 139 | /** |
| 140 | * Copy part of an allocation from another allocation. |
| 141 | * |
| 142 | * @param dstAlloc Allocation to copy data into. |
| 143 | * @param dstOff The offset of the first element to be copied in |
| 144 | * the destination allocation. |
| 145 | * @param dstMip Mip level in the destination allocation. |
| 146 | * @param count The number of elements to be copied. |
| 147 | * @param srcAlloc The source data allocation. |
| 148 | * @param srcOff The offset of the first element in data to be |
| 149 | * copied in the source allocation. |
| 150 | * @param srcMip Mip level in the source allocation. |
| 151 | */ |
| 152 | extern void __attribute__((overloadable)) |
| 153 | rsAllocationCopy1DRange(rs_allocation dstAlloc, |
| 154 | uint32_t dstOff, uint32_t dstMip, |
| 155 | uint32_t count, |
| 156 | rs_allocation srcAlloc, |
| 157 | uint32_t srcOff, uint32_t srcMip); |
| 158 | |
| 159 | /** |
| 160 | * Copy a rectangular region into the allocation from another |
| 161 | * allocation. |
| 162 | * |
| 163 | * @param dstAlloc allocation to copy data into. |
| 164 | * @param dstXoff X offset of the region to update in the |
| 165 | * destination allocation. |
| 166 | * @param dstYoff Y offset of the region to update in the |
| 167 | * destination allocation. |
| 168 | * @param dstMip Mip level in the destination allocation. |
| 169 | * @param dstFace Cubemap face of the destination allocation, |
| 170 | * ignored for allocations that aren't cubemaps. |
| 171 | * @param width Width of the incoming region to update. |
| 172 | * @param height Height of the incoming region to update. |
| 173 | * @param srcAlloc The source data allocation. |
| 174 | * @param srcXoff X offset in data of the source allocation. |
| 175 | * @param srcYoff Y offset in data of the source allocation. |
| 176 | * @param srcMip Mip level in the source allocation. |
| 177 | * @param srcFace Cubemap face of the source allocation, |
| 178 | * ignored for allocations that aren't cubemaps. |
| 179 | */ |
| 180 | extern void __attribute__((overloadable)) |
| 181 | rsAllocationCopy2DRange(rs_allocation dstAlloc, |
| 182 | uint32_t dstXoff, uint32_t dstYoff, |
| 183 | uint32_t dstMip, |
| 184 | rs_allocation_cubemap_face dstFace, |
| 185 | uint32_t width, uint32_t height, |
| 186 | rs_allocation srcAlloc, |
| 187 | uint32_t srcXoff, uint32_t srcYoff, |
| 188 | uint32_t srcMip, |
| 189 | rs_allocation_cubemap_face srcFace); |
| 190 | |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 191 | // Extract a single element from an allocation. |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 192 | extern const void * __attribute__((overloadable)) |
| 193 | rsGetElementAt(rs_allocation, uint32_t x); |
| 194 | extern const void * __attribute__((overloadable)) |
| 195 | rsGetElementAt(rs_allocation, uint32_t x, uint32_t y); |
| 196 | extern const void * __attribute__((overloadable)) |
| 197 | rsGetElementAt(rs_allocation, uint32_t x, uint32_t y, uint32_t z); |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 198 | |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 199 | // Return a random value between 0 (or min_value) and max_malue. |
| 200 | extern int __attribute__((overloadable)) |
| 201 | rsRand(int max_value); |
| 202 | extern int __attribute__((overloadable)) |
| 203 | rsRand(int min_value, int max_value); |
| 204 | extern float __attribute__((overloadable)) |
| 205 | rsRand(float max_value); |
| 206 | extern float __attribute__((overloadable)) |
| 207 | rsRand(float min_value, float max_value); |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 208 | |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 209 | // return the fractional part of a float |
| 210 | // min(v - ((int)floor(v)), 0x1.fffffep-1f); |
| 211 | extern float __attribute__((overloadable)) |
| 212 | rsFrac(float); |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 213 | |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 214 | // Send a message back to the client. Will not block and returns true |
| 215 | // if the message was sendable and false if the fifo was full. |
| 216 | // A message ID is required. Data payload is optional. |
| 217 | extern bool __attribute__((overloadable)) |
| 218 | rsSendToClient(int cmdID); |
| 219 | extern bool __attribute__((overloadable)) |
| 220 | rsSendToClient(int cmdID, const void *data, uint len); |
| 221 | |
| 222 | // Send a message back to the client, blocking until the message is queued. |
| 223 | // A message ID is required. Data payload is optional. |
| 224 | extern void __attribute__((overloadable)) |
| 225 | rsSendToClientBlocking(int cmdID); |
| 226 | extern void __attribute__((overloadable)) |
| 227 | rsSendToClientBlocking(int cmdID, const void *data, uint len); |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 228 | |
Jason Sams | dd663fa | 2010-08-11 13:26:28 -0700 | [diff] [blame] | 229 | |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 230 | // Script to Script |
Jason Sams | dd663fa | 2010-08-11 13:26:28 -0700 | [diff] [blame] | 231 | enum rs_for_each_strategy { |
| 232 | RS_FOR_EACH_STRATEGY_SERIAL, |
| 233 | RS_FOR_EACH_STRATEGY_DONT_CARE, |
| 234 | RS_FOR_EACH_STRATEGY_DST_LINEAR, |
| 235 | RS_FOR_EACH_STRATEGY_TILE_SMALL, |
| 236 | RS_FOR_EACH_STRATEGY_TILE_MEDIUM, |
| 237 | RS_FOR_EACH_STRATEGY_TILE_LARGE |
| 238 | }; |
| 239 | |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 240 | typedef struct rs_script_call { |
Jason Sams | dd663fa | 2010-08-11 13:26:28 -0700 | [diff] [blame] | 241 | enum rs_for_each_strategy strategy; |
Jason Sams | 479e292 | 2010-07-09 15:34:32 -0700 | [diff] [blame] | 242 | uint32_t xStart; |
| 243 | uint32_t xEnd; |
| 244 | uint32_t yStart; |
| 245 | uint32_t yEnd; |
| 246 | uint32_t zStart; |
| 247 | uint32_t zEnd; |
| 248 | uint32_t arrayStart; |
| 249 | uint32_t arrayEnd; |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 250 | } rs_script_call_t; |
Jason Sams | 479e292 | 2010-07-09 15:34:32 -0700 | [diff] [blame] | 251 | |
Jason Sams | c500e74 | 2011-07-25 12:58:37 -0700 | [diff] [blame^] | 252 | #if 1//(RS_VERSION >= 14) |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 253 | extern void __attribute__((overloadable)) |
Jason Sams | c500e74 | 2011-07-25 12:58:37 -0700 | [diff] [blame^] | 254 | rsForEach(rs_script script, rs_allocation input, rs_allocation output); |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 255 | |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 256 | extern void __attribute__((overloadable)) |
Jason Sams | c500e74 | 2011-07-25 12:58:37 -0700 | [diff] [blame^] | 257 | rsForEach(rs_script script, rs_allocation input, rs_allocation output, |
| 258 | const void * usrData, size_t usrDataLen); |
| 259 | |
| 260 | extern void __attribute__((overloadable)) |
| 261 | rsForEach(rs_script script, rs_allocation input, rs_allocation output, |
| 262 | const void * usrData, size_t usrDataLen, const rs_script_call_t *); |
| 263 | #else |
| 264 | extern void __attribute__((overloadable)) |
Jason Sams | 7349547 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 265 | rsForEach(rs_script script, rs_allocation input, |
| 266 | rs_allocation output, const void * usrData, |
| 267 | const rs_script_call_t *); |
Jason Sams | c500e74 | 2011-07-25 12:58:37 -0700 | [diff] [blame^] | 268 | #endif |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 269 | |
Jason Sams | c500e74 | 2011-07-25 12:58:37 -0700 | [diff] [blame^] | 270 | // Move me once dependant changes are in. |
| 271 | extern void __attribute__((overloadable)) |
| 272 | rsForEach(rs_script script, rs_allocation input, |
| 273 | rs_allocation output, const void * usrData); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 274 | |
| 275 | |
| 276 | /** |
| 277 | * Atomic add one to the value at addr. |
| 278 | * Equal to rsAtomicAdd(addr, 1) |
| 279 | * |
| 280 | * @param addr Address of value to increment |
| 281 | * |
| 282 | * @return old value |
| 283 | */ |
| 284 | extern int32_t __attribute__((overloadable)) |
| 285 | rsAtomicInc(volatile int32_t* addr); |
| 286 | /** |
| 287 | * Atomic add one to the value at addr. |
| 288 | * Equal to rsAtomicAdd(addr, 1) |
| 289 | * |
| 290 | * @param addr Address of value to increment |
| 291 | * |
| 292 | * @return old value |
| 293 | */ |
| 294 | extern uint32_t __attribute__((overloadable)) |
| 295 | rsAtomicInc(volatile uint32_t* addr); |
| 296 | |
| 297 | /** |
| 298 | * Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1) |
| 299 | * |
| 300 | * @param addr Address of value to decrement |
| 301 | * |
| 302 | * @return old value |
| 303 | */ |
| 304 | extern int32_t __attribute__((overloadable)) |
| 305 | rsAtomicDec(volatile int32_t* addr); |
| 306 | /** |
| 307 | * Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1) |
| 308 | * |
| 309 | * @param addr Address of value to decrement |
| 310 | * |
| 311 | * @return old value |
| 312 | */ |
| 313 | extern uint32_t __attribute__((overloadable)) |
| 314 | rsAtomicDec(volatile uint32_t* addr); |
| 315 | |
| 316 | /** |
| 317 | * Atomic add a value to the value at addr. addr[0] += value |
| 318 | * |
| 319 | * @param addr Address of value to modify |
| 320 | * @param value Amount to add to the value at addr |
| 321 | * |
| 322 | * @return old value |
| 323 | */ |
| 324 | extern int32_t __attribute__((overloadable)) |
| 325 | rsAtomicAdd(volatile int32_t* addr, int32_t value); |
| 326 | /** |
| 327 | * Atomic add a value to the value at addr. addr[0] += value |
| 328 | * |
| 329 | * @param addr Address of value to modify |
| 330 | * @param value Amount to add to the value at addr |
| 331 | * |
| 332 | * @return old value |
| 333 | */ |
| 334 | extern uint32_t __attribute__((overloadable)) |
| 335 | rsAtomicAdd(volatile uint32_t* addr, uint32_t value); |
| 336 | |
| 337 | /** |
| 338 | * Atomic Subtract a value from the value at addr. addr[0] -= value |
| 339 | * |
| 340 | * @param addr Address of value to modify |
| 341 | * @param value Amount to subtract from the value at addr |
| 342 | * |
| 343 | * @return old value |
| 344 | */ |
| 345 | extern int32_t __attribute__((overloadable)) |
| 346 | rsAtomicSub(volatile int32_t* addr, int32_t value); |
| 347 | /** |
| 348 | * Atomic Subtract a value from the value at addr. addr[0] -= value |
| 349 | * |
| 350 | * @param addr Address of value to modify |
| 351 | * @param value Amount to subtract from the value at addr |
| 352 | * |
| 353 | * @return old value |
| 354 | */ |
| 355 | extern uint32_t __attribute__((overloadable)) |
| 356 | rsAtomicSub(volatile uint32_t* addr, uint32_t value); |
| 357 | |
| 358 | /** |
| 359 | * Atomic Bitwise and a value from the value at addr. addr[0] &= value |
| 360 | * |
| 361 | * @param addr Address of value to modify |
| 362 | * @param value Amount to and with the value at addr |
| 363 | * |
| 364 | * @return old value |
| 365 | */ |
| 366 | extern int32_t __attribute__((overloadable)) |
| 367 | rsAtomicAnd(volatile int32_t* addr, int32_t value); |
| 368 | /** |
| 369 | * Atomic Bitwise and a value from the value at addr. addr[0] &= value |
| 370 | * |
| 371 | * @param addr Address of value to modify |
| 372 | * @param value Amount to and with the value at addr |
| 373 | * |
| 374 | * @return old value |
| 375 | */ |
| 376 | extern uint32_t __attribute__((overloadable)) |
| 377 | rsAtomicAnd(volatile uint32_t* addr, uint32_t value); |
| 378 | |
| 379 | /** |
| 380 | * Atomic Bitwise or a value from the value at addr. addr[0] |= value |
| 381 | * |
| 382 | * @param addr Address of value to modify |
| 383 | * @param value Amount to or with the value at addr |
| 384 | * |
| 385 | * @return old value |
| 386 | */ |
| 387 | extern int32_t __attribute__((overloadable)) |
| 388 | rsAtomicOr(volatile int32_t* addr, int32_t value); |
| 389 | /** |
| 390 | * Atomic Bitwise or a value from the value at addr. addr[0] |= value |
| 391 | * |
| 392 | * @param addr Address of value to modify |
| 393 | * @param value Amount to or with the value at addr |
| 394 | * |
| 395 | * @return old value |
| 396 | */ |
| 397 | extern uint32_t __attribute__((overloadable)) |
| 398 | rsAtomicOr(volatile uint32_t* addr, uint32_t value); |
| 399 | |
| 400 | /** |
| 401 | * Atomic Bitwise xor a value from the value at addr. addr[0] ^= value |
| 402 | * |
| 403 | * @param addr Address of value to modify |
| 404 | * @param value Amount to xor with the value at addr |
| 405 | * |
| 406 | * @return old value |
| 407 | */ |
| 408 | extern uint32_t __attribute__((overloadable)) |
| 409 | rsAtomicXor(volatile uint32_t* addr, uint32_t value); |
| 410 | /** |
| 411 | * Atomic Bitwise xor a value from the value at addr. addr[0] ^= value |
| 412 | * |
| 413 | * @param addr Address of value to modify |
| 414 | * @param value Amount to xor with the value at addr |
| 415 | * |
| 416 | * @return old value |
| 417 | */ |
| 418 | extern int32_t __attribute__((overloadable)) |
| 419 | rsAtomicXor(volatile int32_t* addr, int32_t value); |
| 420 | |
| 421 | /** |
| 422 | * Atomic Set the value at addr to the min of addr and value |
| 423 | * addr[0] = rsMin(addr[0], value) |
| 424 | * |
| 425 | * @param addr Address of value to modify |
| 426 | * @param value comparison value |
| 427 | * |
| 428 | * @return old value |
| 429 | */ |
| 430 | extern uint32_t __attribute__((overloadable)) |
| 431 | rsAtomicMin(volatile uint32_t* addr, uint32_t value); |
| 432 | /** |
| 433 | * Atomic Set the value at addr to the min of addr and value |
| 434 | * addr[0] = rsMin(addr[0], value) |
| 435 | * |
| 436 | * @param addr Address of value to modify |
| 437 | * @param value comparison value |
| 438 | * |
| 439 | * @return old value |
| 440 | */ |
| 441 | extern int32_t __attribute__((overloadable)) |
| 442 | rsAtomicMin(volatile int32_t* addr, int32_t value); |
| 443 | |
| 444 | /** |
| 445 | * Atomic Set the value at addr to the max of addr and value |
| 446 | * addr[0] = rsMax(addr[0], value) |
| 447 | * |
| 448 | * @param addr Address of value to modify |
| 449 | * @param value comparison value |
| 450 | * |
| 451 | * @return old value |
| 452 | */ |
| 453 | extern uint32_t __attribute__((overloadable)) |
| 454 | rsAtomicMax(volatile uint32_t* addr, uint32_t value); |
| 455 | /** |
| 456 | * Atomic Set the value at addr to the max of addr and value |
| 457 | * addr[0] = rsMin(addr[0], value) |
| 458 | * |
| 459 | * @param addr Address of value to modify |
| 460 | * @param value comparison value |
| 461 | * |
| 462 | * @return old value |
| 463 | */ |
| 464 | extern int32_t __attribute__((overloadable)) |
| 465 | rsAtomicMax(volatile int32_t* addr, int32_t value); |
| 466 | |
| 467 | /** |
| 468 | * Compare-and-set operation with a full memory barrier. |
| 469 | * |
| 470 | * If the value at addr matches compareValue then newValue is written. |
| 471 | * |
| 472 | * @param addr The address to compare and replace if the compare passes. |
| 473 | * @param compareValue The value to test addr[0] against. |
| 474 | * @param newValue The value to write if the test passes. |
| 475 | * |
| 476 | * @return old value |
| 477 | */ |
| 478 | extern int32_t __attribute__((overloadable)) |
| 479 | rsAtomicCas(volatile int32_t* addr, int32_t compareValue, int32_t newValue); |
| 480 | |
| 481 | /** |
| 482 | * Compare-and-set operation with a full memory barrier. |
| 483 | * |
| 484 | * If the value at addr matches compareValue then newValue is written. |
| 485 | * |
| 486 | * @param addr The address to compare and replace if the compare passes. |
| 487 | * @param compareValue The value to test addr[0] against. |
| 488 | * @param newValue The value to write if the test passes. |
| 489 | * |
| 490 | * @return old value |
| 491 | */ |
| 492 | extern uint32_t __attribute__((overloadable)) |
| 493 | rsAtomicCas(volatile uint32_t* addr, int32_t compareValue, int32_t newValue); |
| 494 | |
| 495 | |
Jason Sams | c4cdf45 | 2010-07-07 11:55:51 -0700 | [diff] [blame] | 496 | #endif |