From c91fb0847cce91b329c93946d65a2dd45943aebc Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Thu, 16 Sep 2010 19:35:25 -0600 Subject: [PATCH] New Write and WriteNow interfaces. --- tos/interfaces/Write.nc | 39 +++++++++++++++++++++++++++++++++++ tos/interfaces/WriteNow.nc | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 tos/interfaces/Write.nc create mode 100644 tos/interfaces/WriteNow.nc 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); +} -- 2.39.2