* switched subsystem. For example, a communications bus that can handle IO
* for multiple clients simultaneously, but is powered down when not in use.
*
- * p_dfltOwnerId = uniqueCount() use by the resource. see SharedArbiterC
- *
* @author R. Steve McKown <rsmckown@gmail.com>
*/
-generic module SharedArbiterP(uint8_t p_dfltOwnerId) {
+generic module SharedArbiterP() {
provides {
interface Init;
interface Resource[uint8_t id];
async command error_t ResourceDefaultOwner.release()
{
- atomic {
- if (m_requesting > 0) {
- call State.forceState(S_GRANTED);
- post grantedTask();
- return SUCCESS;
- } else
- return FAIL;
- }
+ if (call State.requestState(S_GRANTED) == SUCCESS) {
+ post grantedTask();
+ return SUCCESS;
+ } else
+ return FAIL;
}
async command bool ArbiterInfo.inUse()