Interface: moteiv.tos.lib.resource.Arbiter

interface Arbiter

Please refer to TEP 108 for more information about this interface and its intended use.

The Arbiter interface allows a component to query the current status of an arbiter. It must be provided by ALL arbiter implementations, and can be used for a variety of different purposes. Normally it will be used in conjunction with the Resource interface for performing run time checks on access rights to a particular shared resource.

Loosely based on the proposal from TEP 108 and TOS2 with some minor modifications, namely:
ArbiterInfo (TEP 108) and Arbiter are synonomous
requested() and idle() are part of the Arbiter interface instead of ResourceController.
userId in TEP 108 is called user in the Arbiter interface.

Author:
Cory Sharp, Moteiv Corporation <info@moteiv.com>
Kevin Klues (klueska@cs.wustl.edu)

Commands
command bool inUse() Check whether a resource is currently allocated.
command uint8_t user() Get the id of the client currently using a resource.

Events
event void idle() Event sent whenever a resource goes idle.
event void requested() This event is signalled whenever the user of this arbiter currently has control of the resource, and another user requests it.

Commands - Details

inUse

command bool inUse()

Check whether a resource is currently allocated.

Returns:
TRUE If the resource being arbitrated is currently allocated to any of its users
FALSE Otherwise.

user

command uint8_t user()

Get the id of the client currently using a resource.

Returns:
Id of the current owner of the resource
RESOURCE_NONE if no one currently owns the resource

Events - Details

idle

event void idle()

Event sent whenever a resource goes idle. That is to say, whenever no one currently owns the resource, and there are no more pending requests.

requested

event void requested()

This event is signalled whenever the user of this arbiter currently has control of the resource, and another user requests it. You may want to consider releasing a resource based on this event.