Generate all APIs.
This CL expands the generator to create all the .rsh files, not just
the core_math one. To do so, processing of types (simple, struct, enums)
and constants was added. .spec files corresponding to each .rsh file was
created. Documentation was added.
This CL also generates HTML documentation files. This generation will soon
be upgraded.
To make the code easier to expand, I've done fairly extensive refactoring.
In a subsequent CL, the APIs will be regrouped in different header files to
simplify learning the APIs. In an other, the documentation generation will
be futher improved and incorporated in the actual online help.
Also removes rs_path & related functions.
Change-Id: I2c88554c9c6a8625233772b89e055fc6c4ad5da5
diff --git a/api/rs_atomic.spec b/api/rs_atomic.spec
new file mode 100644
index 0000000..8add583
--- /dev/null
+++ b/api/rs_atomic.spec
@@ -0,0 +1,229 @@
+#
+# Copyright (C) 2015 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.
+#
+
+header:
+summary: Atomic routines
+description:
+ To update values shared between multiple threads, use the functions below.
+ They ensure that the values are atomically updated, i.e. that the memory
+ reads, the updates, and the memory writes are all done in the right order.
+
+ These functions are slower than just doing the non-atomic variants, so use
+ them only when synchronization is needed.
+
+ Note that in RenderScript, your code is likely to be running in separate
+ threads even though you did not explicitely create them. The RenderScript
+ runtime will very often split the execution of one kernel across multiple
+ threads. Updating globals should be done with atomic functions. If possible,
+ modify your algorithm to avoid them altogether.
+end:
+
+function: rsAtomicAdd
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Amount to add"
+summary: Thread-safe addition
+description:
+ Atomicly adds a value to the value at addr, i.e. <code>*addr += value</code>.
+test: none
+end:
+
+function: rsAtomicAdd
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
+
+function: rsAtomicAnd
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Value to and with"
+summary: Thread-safe bitwise and
+description:
+ Atomicly performs a bitwise and of two values, storing the result back at addr,
+ i.e. <code>*addr &= value</code>
+test: none
+end:
+
+function: rsAtomicAnd
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
+
+function: rsAtomicCas
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "The address to compare and replace if the compare passes."
+arg: int32_t compareValue, "The value to test *addr against."
+arg: int32_t newValue, "The value to write if the test passes."
+summary: Thread-safe compare and set
+description:
+ If the value at addr matches compareValue then the newValue is written at addr,
+ i.e. <code>if (*addr == compareValue) { *addr = newValue; }</code>
+
+ You can check that the value was written by checking that the value returned
+ by rsAtomicCas is compareValue.
+test: none
+end:
+
+function: rsAtomicCas
+version: 14
+ret: uint32_t
+arg: volatile uint32_t* addr
+arg: uint32_t compareValue
+arg: uint32_t newValue
+test: none
+end:
+
+function: rsAtomicDec
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to decrement"
+summary: Thread-safe decrement
+description:
+ Atomicly subtracts one from the value at addr. Equal to <code>@rsAtomicSub(addr, 1)</code>
+test: none
+end:
+
+function: rsAtomicDec
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+test: none
+end:
+
+function: rsAtomicInc
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to increment"
+summary: Thread-safe increment
+description:
+ Atomicly adds one to the value at addr. Equal to <code>@rsAtomicAdd(addr, 1)</code>
+test: none
+end:
+
+function: rsAtomicInc
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+test: none
+end:
+
+function: rsAtomicMax
+version: 14
+ret: uint32_t, "Old value"
+arg: volatile uint32_t* addr, "Address of the value to modify"
+arg: uint32_t value, "Comparison value"
+summary: Thread-safe maximum
+description:
+ Atomicly sets the value at addr to the maximum of addr and value, i.e.
+ <code>*addr = max(*addr, value)</code>
+test: none
+end:
+
+function: rsAtomicMax
+version: 14
+ret: int32_t
+arg: volatile int32_t* addr
+arg: int32_t value
+test: none
+end:
+
+function: rsAtomicMin
+version: 14
+ret: uint32_t, "Old value"
+arg: volatile uint32_t* addr, "Address of the value to modify"
+arg: uint32_t value, "Comparison value"
+summary: Thread-safe minimum
+description:
+ Atomicly sets the value at addr to the minimum of addr and value, i.e.
+ <code>*addr = min(*addr, value)</code>
+test: none
+end:
+
+function: rsAtomicMin
+version: 14
+ret: int32_t
+arg: volatile int32_t* addr
+arg: int32_t value
+test: none
+end:
+
+function: rsAtomicOr
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Value to or with"
+summary: Thread-safe bitwise or
+description:
+ Atomicly perform a bitwise or two values, storing the result at addr,
+ i.e. <code>*addr |= value</code>
+test: none
+end:
+
+function: rsAtomicOr
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
+
+function: rsAtomicSub
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Amount to subtract"
+summary: Thread-safe subtraction
+description:
+ Atomicly subtracts a value from the value at addr, i.e. <code>*addr -= value</code>
+test: none
+end:
+
+function: rsAtomicSub
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
+
+function: rsAtomicXor
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Value to xor with"
+summary: Thread-safe bitwise exclusive or
+description:
+ Atomicly performs a bitwise xor of two values, storing the result at addr,
+ i.e. <code>*addr ^= value</code>
+test: none
+end:
+
+function: rsAtomicXor
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end: