From 286c372d2cc7d9f466aef16c2bccb5de4689f577 Mon Sep 17 00:00:00 2001 From: skarg Date: Fri, 14 May 2010 12:14:09 +0000 Subject: [PATCH] Updated ToDo list. Added more info to MS/TP capture utility readme file. Changed silence timer in BDK to compile smaller. --- bacnet-stack/demo/mstpcap/mstpcap.txt | 29 ++++++++++++++++ bacnet-stack/doc/README.todo | 12 ++++--- bacnet-stack/ports/bdk-atxx4-mstp/rs485.c | 6 ++-- bacnet-stack/ports/bdk-atxx4-mstp/rs485.h | 2 +- bacnet-stack/ports/bdk-atxx4-mstp/timer.c | 40 +++++++++++++++++++++++ bacnet-stack/ports/bdk-atxx4-mstp/timer.h | 11 ++++++- 6 files changed, 90 insertions(+), 10 deletions(-) diff --git a/bacnet-stack/demo/mstpcap/mstpcap.txt b/bacnet-stack/demo/mstpcap/mstpcap.txt index b9c76457..5001a1df 100644 --- a/bacnet-stack/demo/mstpcap/mstpcap.txt +++ b/bacnet-stack/demo/mstpcap/mstpcap.txt @@ -7,6 +7,13 @@ code in it, and will contain up to 65535 packets. A new file will be created at each 65535 packet interval. The tool can be stopped by using Control-C. +Wireshark is a protocol anaylzyer that can be downloaded from +wireshark.org. Wireshark can open and view the files that +are created from mstpcap. Wireshark can also open a named +pipe, and msptcap can send the capture data to the named pipe +for realtime viewing, while saving the capture data to a file. +See Named Pipe Usage below. + Here is a sample of the tool running (use CTRL-C to quit). D:\code\bacnet-stack\bin>mstpcap COM3 38400 Adjusted interface name to \\.\COM3 @@ -17,6 +24,8 @@ MAC MaxMstr Tokens Retries Treply Tusage Trpfm Tder Tpostpd 0 0 525 0 32 0 0 0 0 1 127 525 0 16 79 0 0 0 +Statistics +---------- The BACnet MS/TP capture tool also includes statistics which are listed for any MAC addresses found passing a token, or any MAC address replying to a DER message. @@ -53,3 +62,23 @@ required to be less than 250ms. Note that the mstpcap tool may not have that good of resolution on Windows, so timing under 50ms may not be accurate. +Name Pipe Usage +--------------- +1. Launch the mstpcap with all command line options, include the named +pipe. On Linux, the named pipe can be any file. On Windows the named +pipe must be located in a specific directory \\.\pipe\wireshark + +D:\code\bacnet-stack\bin>mstpcap COM3 38400 \\.\pipe\wireshark + +2. Run Wireshark. Select "Capture" -> "Options" -> "Interface". Copy the +pipe name from the command console (i.e. Mark) and paste it into the +Interface box. Select "Start" to begin the live capture. Note that +the capture cannot be restarted from Wireshark, but must be restarted from +the command line each time you want to capture. + +Non-Standard Baud Rates +----------------------- +If your serial adapter supports non-standard baud rates by using +aliasing, you can pass the aliased buad rate as the baud rate +parameter. 76800 is a non-standard baud rate, and is not enumerated +on Windows Computers. diff --git a/bacnet-stack/doc/README.todo b/bacnet-stack/doc/README.todo index 0a7d76ad..1382e340 100644 --- a/bacnet-stack/doc/README.todo +++ b/bacnet-stack/doc/README.todo @@ -2,14 +2,14 @@ To Do List - BACnet Stack at SourceForge Here are some things to do: A. Finish demo/epics/main.c - EPICS demo. Use object property lists. -B. Finish demo/object/lo.c - Lighting Output object demo -C. Finish bvlc.c and use it instead of or in compliment to bip.c -D. Complete client demo for ReadPropertyMultiple from rpm.c +B. Update demo/object/lo.c - Lighting Output object demo - match addendum +C. Add storage hooks to bvlc.c +D. --- done. E. Add HTTP demo like bacnet4linux F. Add SubscribeCOVProperty support in server demo. G. Add hooks to increment Database_Revision property -H. --- done. -I. --- done. +H. Enumerate negative integers for unique error codes +I. Change core encode/decode to pass length for safe handling J. Change bip.c to not use extra buffer (shift data) K. Add Visual Studio 2005 makefiles or projects for demos. L. Add Code::Blocks projects for demos. @@ -33,3 +33,5 @@ V. Change OBJECT_ID to only be 32 bits, and add macro handlers. W. Add #ifdef for all MAX_ defines so they can be overridden. X. Change WhoIs demo to list all I-Am's received such that duplicate IDs with different MAC addresses can be detected. +Y. Add tsm_alloc to allocate memory and invoke ID for sending. +Z. Make alternate TSM that handles segmentation. diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/rs485.c b/bacnet-stack/ports/bdk-atxx4-mstp/rs485.c index fcfbc85e..f5e1e638 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/rs485.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/rs485.c @@ -52,9 +52,9 @@ static FIFO_BUFFER Receive_Buffer; static struct etimer Silence_Timer; bool rs485_silence_time_elapsed( - uint32_t milliseconds) + uint16_t milliseconds) { - return timer_elapsed_milliseconds(&Silence_Timer, milliseconds); + return timer_elapsed_milliseconds_short(&Silence_Timer, milliseconds); } void rs485_silence_time_reset( @@ -96,7 +96,7 @@ void rs485_turnaround_delay( /* wait a minimum 40 bit times since reception */ /* at least 1 ms for errors: rounding, clock tick */ turnaround_time = 1 + ((Tturnaround * 1000UL) / Baud_Rate); - while (!timer_elapsed_milliseconds(&Silence_Timer, turnaround_time)) { + while (!timer_elapsed_milliseconds_short(&Silence_Timer, turnaround_time)) { /* do nothing - wait for timer to increment */ }; } diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/rs485.h b/bacnet-stack/ports/bdk-atxx4-mstp/rs485.h index 7d3146af..6dfa393e 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/rs485.h +++ b/bacnet-stack/ports/bdk-atxx4-mstp/rs485.h @@ -63,7 +63,7 @@ extern "C" { void rs485_silence_time_reset( void); bool rs485_silence_time_elapsed( - uint32_t milliseconds); + uint16_t milliseconds); #ifdef __cplusplus } diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/timer.c b/bacnet-stack/ports/bdk-atxx4-mstp/timer.c index 3671ec09..75c6146d 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/timer.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/timer.c @@ -121,6 +121,46 @@ bool timer_elapsed_minutes( return timer_elapsed_milliseconds(t, milliseconds); } +/************************************************************************* +* Description: Tests to see if time has elapsed +* Returns: true if time has elapsed +* Notes: none +*************************************************************************/ +bool timer_elapsed_milliseconds_short( + struct etimer *t, + uint16_t value) +{ + uint32_t milliseconds; + + milliseconds = value; + + return (timer_elapsed_time(t) >= milliseconds); +} + +/************************************************************************* +* Description: Tests to see if time has elapsed +* Returns: true if time has elapsed +* Notes: none +*************************************************************************/ +bool timer_elapsed_seconds_short( + struct etimer *t, + uint16_t value) +{ + return timer_elapsed_seconds(t, value); +} + +/************************************************************************* +* Description: Tests to see if time has elapsed +* Returns: true if time has elapsed +* Notes: none +*************************************************************************/ +bool timer_elapsed_minutes_short( + struct etimer *t, + uint16_t value) +{ + return timer_elapsed_minutes_short(t, value); +} + /************************************************************************* * Description: Starts an interval timer * Returns: nothing diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/timer.h b/bacnet-stack/ports/bdk-atxx4-mstp/timer.h index 5a6dd810..fb9bf0e0 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/timer.h +++ b/bacnet-stack/ports/bdk-atxx4-mstp/timer.h @@ -69,7 +69,16 @@ extern "C" { uint32_t value); bool timer_elapsed_minutes( struct etimer *t, - uint32_t seconds); + uint32_t value); + bool timer_elapsed_milliseconds_short( + struct etimer *t, + uint16_t value); + bool timer_elapsed_seconds_short( + struct etimer *t, + uint16_t value); + bool timer_elapsed_minutes_short( + struct etimer *t, + uint16_t value); /* interval timer */ void timer_interval_start(