[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/printf PrintfC.nc, 1.4,
1.5 PrintfP.nc, 1.4, 1.5 printf.h, 1.4, 1.5
Kevin Klues
klueska at users.sourceforge.net
Thu Apr 19 17:55:35 PDT 2007
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/printf
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30142
Modified Files:
PrintfC.nc PrintfP.nc printf.h
Log Message:
Update to comply with tep 3 standards as well as better documantation
Index: PrintfC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/printf/PrintfC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PrintfC.nc 12 Dec 2006 18:23:31 -0000 1.4
--- PrintfC.nc 20 Apr 2007 00:55:32 -0000 1.5
***************
*** 22,25 ****
--- 22,37 ----
/**
+ * This is the PrintfC component. It provides the printf service for printing
+ * data over the serial interface using the standard c-style printf command.
+ * It must be started via the SplitControl interface it provides. Data
+ * printed using printf are buffered and only sent over the serial line after
+ * making a call to PrintfFlush.flush(). This buffer has a maximum size of
+ * 250 bytes at present. After calling start on this component, printf
+ * statements can be made anywhere throughout your code, so long as you include
+ * the "printf.h" header file in every file you wish to use it. Standard
+ * practice is to start the printf service in the main application, and set up
+ * a timer to periodically flush the printf buffer (500ms should do). In future
+ * versions, user defined buffer sizes as well as well as automatic flushing at
+ * user defined intervals will be supported.
*
* @author Kevin Klues (klueska at cs.wustl.edu)
Index: PrintfP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/printf/PrintfP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PrintfP.nc 12 Dec 2006 18:23:31 -0000 1.4
--- PrintfP.nc 20 Apr 2007 00:55:32 -0000 1.5
***************
*** 8,14 ****
* two paragraphs and the author appear in all copies of this software.
*
! * IN NO EVENT SHALL WASHINGTON UNIVERSITY IN ST. LOUIS BE LIABLE TO ANY PARTY
! * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
! * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
--- 8,14 ----
* two paragraphs and the author appear in all copies of this software.
*
! * IN NO EVENT SHALL WASHINGTON UNIVERSITY IN ST. LOUIS BE LIABLE TO ANY PARTY
! * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
! * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
***************
*** 16,20 ****
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
--- 16,20 ----
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
***************
*** 22,29 ****
/**
*
* @author Kevin Klues (klueska at cs.wustl.edu)
* @version $Revision$
! * @date $Date$
*/
--- 22,46 ----
/**
+ * This is the PrintfP component. It provides the printf service for printing
+ * data over the serial interface using the standard c-style printf command.
+ * It must be started via the SplitControl interface it provides. Data
+ * printed using printf are buffered and only sent over the serial line after
+ * making a call to PrintfFlush.flush(). This buffer has a maximum size of
+ * 250 bytes at present. After calling start on this component, printf
+ * statements can be made anywhere throughout your code, so long as you include
+ * the "printf.h" header file in every file you wish to use it. Standard
+ * practice is to start the printf service in the main application, and set up
+ * a timer to periodically flush the printf buffer (500ms should do). In future
+ * versions, user defined buffer sizes as well as well as automatic flushing at
+ * user defined intervals will be supported.
+ *
+ * The printf service is currently only available for msp430 based motes
+ * (i.e. telos, eyes) and atmega128 based motes (i.e. mica2, micaz). On the
+ * atmega platforms, avr-libc version 1.4 or above mus tbe used.
+ *
*
* @author Kevin Klues (klueska at cs.wustl.edu)
* @version $Revision$
! * @date $Date$
*/
***************
*** 63,76 ****
task void retrySend() {
! if(call AMSend.send(AM_BROADCAST_ADDR, &printfMsg, sizeof(PrintfMsg)) != SUCCESS)
post retrySend();
}
void sendNext() {
! PrintfMsg* m = (PrintfMsg*)call Packet.getPayload(&printfMsg, NULL);
! length_to_send = (bytes_left_to_flush < sizeof(PrintfMsg)) ? bytes_left_to_flush : sizeof(PrintfMsg);
memset(m->buffer, 0, sizeof(printfMsg));
memcpy(m->buffer, (uint8_t*)next_byte, length_to_send);
! if(call AMSend.send(AM_BROADCAST_ADDR, &printfMsg, sizeof(PrintfMsg)) != SUCCESS)
post retrySend();
else {
--- 80,93 ----
task void retrySend() {
! if(call AMSend.send(AM_BROADCAST_ADDR, &printfMsg, sizeof(printf_msg)) != SUCCESS)
post retrySend();
}
void sendNext() {
! printf_msg* m = (printf_msg*)call Packet.getPayload(&printfMsg, NULL);
! length_to_send = (bytes_left_to_flush < sizeof(printf_msg)) ? bytes_left_to_flush : sizeof(printf_msg);
memset(m->buffer, 0, sizeof(printfMsg));
memcpy(m->buffer, (uint8_t*)next_byte, length_to_send);
! if(call AMSend.send(AM_BROADCAST_ADDR, &printfMsg, sizeof(printf_msg)) != SUCCESS)
post retrySend();
else {
Index: printf.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/printf/printf.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** printf.h 12 Dec 2006 18:23:31 -0000 1.4
--- printf.h 20 Apr 2007 00:55:32 -0000 1.5
***************
*** 8,14 ****
* two paragraphs and the author appear in all copies of this software.
*
! * IN NO EVENT SHALL WASHINGTON UNIVERSITY IN ST. LOUIS BE LIABLE TO ANY PARTY
! * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
! * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
--- 8,14 ----
* two paragraphs and the author appear in all copies of this software.
*
! * IN NO EVENT SHALL WASHINGTON UNIVERSITY IN ST. LOUIS BE LIABLE TO ANY PARTY
! * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
! * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
***************
*** 16,20 ****
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
--- 16,20 ----
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
***************
*** 36,42 ****
#define PRINTF_BUFFER_SIZE 250
! typedef nx_struct PrintfMsg {
nx_uint8_t buffer[TOSH_DATA_LENGTH];
! } PrintfMsg;
enum {
--- 36,42 ----
#define PRINTF_BUFFER_SIZE 250
! typedef nx_struct printf_msg {
nx_uint8_t buffer[TOSH_DATA_LENGTH];
! } printf_msg;
enum {
More information about the Tinyos-2-commits
mailing list