From: R. Steve McKown Date: Fri, 17 Sep 2010 01:35:25 +0000 (-0600) Subject: New Write and WriteNow interfaces. X-Git-Tag: release/2.1.1-4.4~6 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=e3f7b8d07ac0c977757bff197d4489105121efc6 New Write and WriteNow interfaces. --- diff --git a/tos/interfaces/Write.nc b/tos/interfaces/Write.nc new file mode 100644 index 00000000..d46948ef --- /dev/null +++ b/tos/interfaces/Write.nc @@ -0,0 +1,39 @@ +/* Copyright (c) 2006-2010 by Sporian Microsystems, Inc. + * All Rights Reserved. + * + * This document is the proprietary and confidential property of Sporian + * Microsystems, Inc. All use, distribution, reproduction or re-distribution + * is disallowed without the prior express written consent of Sporian + * Microsystems, Inc. + */ + +/** + * The Write interface is intended for split-phase low-rate or + * high-latency writing of small values. The type of the value is + * given as a template argument. Because this interface is + * split-phase, these values may be backed by hardware, or a + * long-running computation. This interface is the output analog + * of the standard Read interface. + * + * @param val_t the type of the object that will be written + * + * @author R. Steve McKown + */ + + +interface Write { + /** + * Initiate a write of the provided value. + * + * @param val The value to write. + * @return SUCCESS if writeDone() will later be signalled, + * EBUSY if a write is already in progress, or FAIL for other errors. + */ + command error_t write(val_t val); + + /** + * Signalled upon completion of the write operation initiated by the previous + * write() command. + */ + event void writeDone(error_t error); +} diff --git a/tos/interfaces/WriteNow.nc b/tos/interfaces/WriteNow.nc new file mode 100644 index 00000000..caaadffc --- /dev/null +++ b/tos/interfaces/WriteNow.nc @@ -0,0 +1,42 @@ +/* Copyright (c) 2006-2010 by Sporian Microsystems, Inc. + * All Rights Reserved. + * + * This document is the proprietary and confidential property of Sporian + * Microsystems, Inc. All use, distribution, reproduction or re-distribution + * is disallowed without the prior express written consent of Sporian + * Microsystems, Inc. + */ + +/** + * The Write interface is intended for split-phase low-rate or + * high-latency writing of small values. The type of the value is + * given as a template argument. Because this interface is + * split-phase, these values may be backed by hardware, or a + * long-running computation. This interface is the output analog + * of the standard Read interface. + * + * This interface is equivalent to the Write interface, except that its + * operations are defined async. + * + * @param val_t the type of the object that will be written + * + * @author R. Steve McKown + */ + + +interface WriteNow { + /** + * Initiate a write of the provided value. + * + * @param val The value to write. + * @return SUCCESS if writeDone() will later be signalled, + * EBUSY if a write is already in progress, or FAIL for other errors. + */ + async command error_t write(val_t val); + + /** + * Signalled upon completion of the write operation initiated by the previous + * write() command. + */ + async event void writeDone(error_t error); +}