diff options
| author | Jason Sams <rjsams@android.com> | 2011-08-08 16:52:30 -0700 |
|---|---|---|
| committer | Stephen Hines <srhines@google.com> | 2011-08-09 11:34:33 -0700 |
| commit | 044e2ee36ffe6520570a7f0207d75a8fce8b8e91 (patch) | |
| tree | 4fb7bd572f5947c5ec92ac3c6d797fa9d7d17d70 /scriptc/rs_atomic.rsh | |
| parent | 319680d6280bd8eb1eeecb6dfb8074dc42aaeec7 (diff) | |
| download | android_frameworks_rs-044e2ee36ffe6520570a7f0207d75a8fce8b8e91.tar.gz android_frameworks_rs-044e2ee36ffe6520570a7f0207d75a8fce8b8e91.tar.bz2 android_frameworks_rs-044e2ee36ffe6520570a7f0207d75a8fce8b8e91.zip | |
Start refactoring RS headerfiles for docs.
Change-Id: Ieb7797601f94beec2835e1d936dc2dd0c38cb48c
Diffstat (limited to 'scriptc/rs_atomic.rsh')
| -rw-r--r-- | scriptc/rs_atomic.rsh | 248 |
1 files changed, 248 insertions, 0 deletions
diff --git a/scriptc/rs_atomic.rsh b/scriptc/rs_atomic.rsh new file mode 100644 index 00000000..95513ad6 --- /dev/null +++ b/scriptc/rs_atomic.rsh @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** @file rs_atomic.rsh + * \brief Atomic routines + * + * + */ + +#ifndef __RS_ATOMIC_RSH__ +#define __RS_ATOMIC_RSH__ + + +/** + * Atomic add one to the value at addr. + * Equal to rsAtomicAdd(addr, 1) + * + * @param addr Address of value to increment + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicInc(volatile int32_t* addr); +/** + * Atomic add one to the value at addr. + * Equal to rsAtomicAdd(addr, 1) + * + * @param addr Address of value to increment + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicInc(volatile uint32_t* addr); + +/** + * Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1) + * + * @param addr Address of value to decrement + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicDec(volatile int32_t* addr); +/** + * Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1) + * + * @param addr Address of value to decrement + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicDec(volatile uint32_t* addr); + +/** + * Atomic add a value to the value at addr. addr[0] += value + * + * @param addr Address of value to modify + * @param value Amount to add to the value at addr + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicAdd(volatile int32_t* addr, int32_t value); +/** + * Atomic add a value to the value at addr. addr[0] += value + * + * @param addr Address of value to modify + * @param value Amount to add to the value at addr + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicAdd(volatile uint32_t* addr, uint32_t value); + +/** + * Atomic Subtract a value from the value at addr. addr[0] -= value + * + * @param addr Address of value to modify + * @param value Amount to subtract from the value at addr + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicSub(volatile int32_t* addr, int32_t value); +/** + * Atomic Subtract a value from the value at addr. addr[0] -= value + * + * @param addr Address of value to modify + * @param value Amount to subtract from the value at addr + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicSub(volatile uint32_t* addr, uint32_t value); + +/** + * Atomic Bitwise and a value from the value at addr. addr[0] &= value + * + * @param addr Address of value to modify + * @param value Amount to and with the value at addr + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicAnd(volatile int32_t* addr, int32_t value); +/** + * Atomic Bitwise and a value from the value at addr. addr[0] &= value + * + * @param addr Address of value to modify + * @param value Amount to and with the value at addr + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicAnd(volatile uint32_t* addr, uint32_t value); + +/** + * Atomic Bitwise or a value from the value at addr. addr[0] |= value + * + * @param addr Address of value to modify + * @param value Amount to or with the value at addr + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicOr(volatile int32_t* addr, int32_t value); +/** + * Atomic Bitwise or a value from the value at addr. addr[0] |= value + * + * @param addr Address of value to modify + * @param value Amount to or with the value at addr + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicOr(volatile uint32_t* addr, uint32_t value); + +/** + * Atomic Bitwise xor a value from the value at addr. addr[0] ^= value + * + * @param addr Address of value to modify + * @param value Amount to xor with the value at addr + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicXor(volatile uint32_t* addr, uint32_t value); +/** + * Atomic Bitwise xor a value from the value at addr. addr[0] ^= value + * + * @param addr Address of value to modify + * @param value Amount to xor with the value at addr + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicXor(volatile int32_t* addr, int32_t value); + +/** + * Atomic Set the value at addr to the min of addr and value + * addr[0] = rsMin(addr[0], value) + * + * @param addr Address of value to modify + * @param value comparison value + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicMin(volatile uint32_t* addr, uint32_t value); +/** + * Atomic Set the value at addr to the min of addr and value + * addr[0] = rsMin(addr[0], value) + * + * @param addr Address of value to modify + * @param value comparison value + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicMin(volatile int32_t* addr, int32_t value); + +/** + * Atomic Set the value at addr to the max of addr and value + * addr[0] = rsMax(addr[0], value) + * + * @param addr Address of value to modify + * @param value comparison value + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicMax(volatile uint32_t* addr, uint32_t value); +/** + * Atomic Set the value at addr to the max of addr and value + * addr[0] = rsMin(addr[0], value) + * + * @param addr Address of value to modify + * @param value comparison value + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicMax(volatile int32_t* addr, int32_t value); + +/** + * Compare-and-set operation with a full memory barrier. + * + * If the value at addr matches compareValue then newValue is written. + * + * @param addr The address to compare and replace if the compare passes. + * @param compareValue The value to test addr[0] against. + * @param newValue The value to write if the test passes. + * + * @return old value + */ +extern int32_t __attribute__((overloadable)) + rsAtomicCas(volatile int32_t* addr, int32_t compareValue, int32_t newValue); + +/** + * Compare-and-set operation with a full memory barrier. + * + * If the value at addr matches compareValue then newValue is written. + * + * @param addr The address to compare and replace if the compare passes. + * @param compareValue The value to test addr[0] against. + * @param newValue The value to write if the test passes. + * + * @return old value + */ +extern uint32_t __attribute__((overloadable)) + rsAtomicCas(volatile uint32_t* addr, int32_t compareValue, int32_t newValue); + + +#endif + |
